@ -1020,6 +1020,7 @@ static void exithelp(void)
# endif
" \n MULTI-STRATEGY: \n "
" --new \t \t \t \t \t \t ; begin new strategy \n "
" --skip \t \t \t \t \t \t ; do not use this strategy \n "
" --filter-l3=ipv4|ipv6 \t \t \t \t ; L3 protocol filter. multiple comma separated values allowed. \n "
" --filter-tcp=[~]port1[-port2]|* \t \t ; TCP port filter. ~ means negation. setting tcp and not setting udp filter denies udp. comma separated list allowed. \n "
" --filter-udp=[~]port1[-port2]|* \t \t ; UDP port filter. ~ means negation. setting udp and not setting tcp filter denies tcp. comma separated list allowed. \n "
@ -1042,6 +1043,7 @@ static void exithelp(void)
" --hostspell \t \t \t \t \t ; exact spelling of \" Host \" header. must be 4 chars. default is \" host \" \n "
" --hostnospace \t \t \t \t \t ; remove space after Host: and add it to User-Agent: to preserve packet size \n "
" --domcase \t \t \t \t \t ; mix domain case : Host: TeSt.cOm \n "
" --methodeol \t \t \t \t \t ; add ' \\ n' before method and remove space from Host: \n "
" --dpi-desync=[<mode0>,]<mode>[,<mode2>] \t ; try to desync dpi state. modes : \n "
" \t \t \t \t \t \t ; synack syndata fake fakeknown rst rstack hopbyhop destopt ipfrag1 \n "
" \t \t \t \t \t \t ; multisplit multidisorder fakedsplit fakeddisorder ipfrag2 udplen tamper \n "
@ -1139,7 +1141,7 @@ int main(int argc, char **argv)
# endif
int result , v ;
int option_index = 0 ;
bool daemon = false ;
bool daemon = false , bSkip = false ;
char pidfile [ 256 ] ;
# ifdef __CYGWIN__
char windivert_filter [ 8192 ] , wf_pf_tcp_src [ 256 ] , wf_pf_tcp_dst [ 256 ] , wf_pf_udp_src [ 256 ] , wf_pf_udp_dst [ 256 ] , wf_save_file [ 256 ] ;
@ -1227,70 +1229,72 @@ int main(int argc, char **argv)
{ " hostspell " , required_argument , 0 , 0 } , // optidx=11
{ " hostnospace " , no_argument , 0 , 0 } , // optidx=12
{ " domcase " , no_argument , 0 , 0 } , // optidx=13
{ " dpi-desync " , required_argument , 0 , 0 } , // optidx=14
{ " methodeol " , no_argument , 0 , 0 } , // optidx=14
{ " dpi-desync " , required_argument , 0 , 0 } , // optidx=15
# ifdef __linux__
{ " dpi-desync-fwmark " , required_argument , 0 , 0 } , // optidx=15
{ " dpi-desync-fwmark " , required_argument , 0 , 0 } , // optidx=16
# elif defined(SO_USER_COOKIE)
{ " dpi-desync-sockarg " , required_argument , 0 , 0 } , // optidx=15
{ " dpi-desync-sockarg " , required_argument , 0 , 0 } , // optidx=16
# else
{ " disabled_argument_4 " , no_argument , 0 , 0 } , // optidx=15
{ " disabled_argument_4 " , no_argument , 0 , 0 } , // optidx=16
# endif
{ " dpi-desync-ttl " , required_argument , 0 , 0 } , // optidx=16
{ " dpi-desync-ttl6 " , required_argument , 0 , 0 } , // optidx=17
{ " dpi-desync-autottl " , optional_argument , 0 , 0 } , // optidx=18
{ " dpi-desync-autottl6 " , optional_argument , 0 , 0 } , // optidx=19
{ " dpi-desync-fooling " , required_argument , 0 , 0 } , // optidx=20
{ " dpi-desync-repeats " , required_argument , 0 , 0 } , // optidx=21
{ " dpi-desync-skip-nosni " , optional_argument , 0 , 0 } , // optidx=22
{ " dpi-desync-split-pos " , required_argument , 0 , 0 } , // optidx=23
{ " dpi-desync-split-http-req " , required_argument , 0 , 0 } , // optidx=24
{ " dpi-desync-split-tls " , required_argument , 0 , 0 } , // optidx=25
{ " dpi-desync-split-seqovl " , required_argument , 0 , 0 } , // optidx=26
{ " dpi-desync-split-seqovl-pattern " , required_argument , 0 , 0 } , // optidx=27
{ " dpi-desync-ipfrag-pos-tcp " , required_argument , 0 , 0 } , // optidx=28
{ " dpi-desync-ipfrag-pos-udp " , required_argument , 0 , 0 } , // optidx=29
{ " dpi-desync-badseq-increment " , required_argument , 0 , 0 } , // optidx=30
{ " dpi-desync-badack-increment " , required_argument , 0 , 0 } , // optidx=31
{ " dpi-desync-any-protocol " , optional_argument , 0 , 0 } , // optidx=32
{ " dpi-desync-fake-http " , required_argument , 0 , 0 } , // optidx=33
{ " dpi-desync-fake-tls " , required_argument , 0 , 0 } , // optidx=34
{ " dpi-desync-fake-unknown " , required_argument , 0 , 0 } , // optidx=35
{ " dpi-desync-fake-syndata " , required_argument , 0 , 0 } , // optidx=36
{ " dpi-desync-fake-quic " , required_argument , 0 , 0 } , // optidx=37
{ " dpi-desync-fake-wireguard " , required_argument , 0 , 0 } , // optidx=38
{ " dpi-desync-fake-dht " , required_argument , 0 , 0 } , // optidx=39
{ " dpi-desync-fake-unknown-udp " , required_argument , 0 , 0 } , // optidx=40
{ " dpi-desync-udplen-increment " , required_argument , 0 , 0 } , // optidx=41
{ " dpi-desync-udplen-pattern " , required_argument , 0 , 0 } , // optidx=42
{ " dpi-desync-cutoff " , required_argument , 0 , 0 } , // optidx=43
{ " dpi-desync-start " , required_argument , 0 , 0 } , // optidx=43
{ " hostlist " , required_argument , 0 , 0 } , // optidx=44
{ " hostlist-exclude " , required_argument , 0 , 0 } , // optidx=45
{ " hostlist-auto " , required_argument , 0 , 0 } , // optidx=46
{ " hostlist-auto-fail-threshold " , required_argument , 0 , 0 } , // optidx=48
{ " hostlist-auto-fail-time " , required_argument , 0 , 0 } , // optidx=49
{ " hostlist-auto-retrans-threshold " , required_argument , 0 , 0 } , // optidx=50
{ " hostlist-auto-debug " , required_argument , 0 , 0 } , // optidx=51
{ " new " , no_argument , 0 , 0 } , // optidx=52
{ " filter-l3 " , required_argument , 0 , 0 } , // optidx=53
{ " filter-tcp " , required_argument , 0 , 0 } , // optidx=54
{ " filter-udp " , required_argument , 0 , 0 } , // optidx=55
{ " filter-l7 " , required_argument , 0 , 0 } , // optidx=56
{ " ipset " , required_argument , 0 , 0 } , // optidx=57
{ " ipset-exclude " , required_argument , 0 , 0 } , // optidx=58
{ " dpi-desync-ttl " , required_argument , 0 , 0 } , // optidx=17
{ " dpi-desync-ttl6 " , required_argument , 0 , 0 } , // optidx=18
{ " dpi-desync-autottl " , optional_argument , 0 , 0 } , // optidx=19
{ " dpi-desync-autottl6 " , optional_argument , 0 , 0 } , // optidx=20
{ " dpi-desync-fooling " , required_argument , 0 , 0 } , // optidx=21
{ " dpi-desync-repeats " , required_argument , 0 , 0 } , // optidx=22
{ " dpi-desync-skip-nosni " , optional_argument , 0 , 0 } , // optidx=23
{ " dpi-desync-split-pos " , required_argument , 0 , 0 } , // optidx=24
{ " dpi-desync-split-http-req " , required_argument , 0 , 0 } , // optidx=25
{ " dpi-desync-split-tls " , required_argument , 0 , 0 } , // optidx=26
{ " dpi-desync-split-seqovl " , required_argument , 0 , 0 } , // optidx=27
{ " dpi-desync-split-seqovl-pattern " , required_argument , 0 , 0 } , // optidx=28
{ " dpi-desync-ipfrag-pos-tcp " , required_argument , 0 , 0 } , // optidx=29
{ " dpi-desync-ipfrag-pos-udp " , required_argument , 0 , 0 } , // optidx=30
{ " dpi-desync-badseq-increment " , required_argument , 0 , 0 } , // optidx=31
{ " dpi-desync-badack-increment " , required_argument , 0 , 0 } , // optidx=32
{ " dpi-desync-any-protocol " , optional_argument , 0 , 0 } , // optidx=33
{ " dpi-desync-fake-http " , required_argument , 0 , 0 } , // optidx=34
{ " dpi-desync-fake-tls " , required_argument , 0 , 0 } , // optidx=35
{ " dpi-desync-fake-unknown " , required_argument , 0 , 0 } , // optidx=36
{ " dpi-desync-fake-syndata " , required_argument , 0 , 0 } , // optidx=37
{ " dpi-desync-fake-quic " , required_argument , 0 , 0 } , // optidx=38
{ " dpi-desync-fake-wireguard " , required_argument , 0 , 0 } , // optidx=39
{ " dpi-desync-fake-dht " , required_argument , 0 , 0 } , // optidx=40
{ " dpi-desync-fake-unknown-udp " , required_argument , 0 , 0 } , // optidx=41
{ " dpi-desync-udplen-increment " , required_argument , 0 , 0 } , // optidx=42
{ " dpi-desync-udplen-pattern " , required_argument , 0 , 0 } , // optidx=43
{ " dpi-desync-cutoff " , required_argument , 0 , 0 } , // optidx=44
{ " dpi-desync-start " , required_argument , 0 , 0 } , // optidx=45
{ " hostlist " , required_argument , 0 , 0 } , // optidx=46
{ " hostlist-exclude " , required_argument , 0 , 0 } , // optidx=47
{ " hostlist-auto " , required_argument , 0 , 0 } , // optidx=48
{ " hostlist-auto-fail-threshold " , required_argument , 0 , 0 } , // optidx=49
{ " hostlist-auto-fail-time " , required_argument , 0 , 0 } , // optidx=50
{ " hostlist-auto-retrans-threshold " , required_argument , 0 , 0 } , // optidx=51
{ " hostlist-auto-debug " , required_argument , 0 , 0 } , // optidx=52
{ " new " , no_argument , 0 , 0 } , // optidx=53
{ " skip " , no_argument , 0 , 0 } , // optidx=54
{ " filter-l3 " , required_argument , 0 , 0 } , // optidx=55
{ " filter-tcp " , required_argument , 0 , 0 } , // optidx=56
{ " filter-udp " , required_argument , 0 , 0 } , // optidx=57
{ " filter-l7 " , required_argument , 0 , 0 } , // optidx=58
{ " ipset " , required_argument , 0 , 0 } , // optidx=59
{ " ipset-exclude " , required_argument , 0 , 0 } , // optidx=60
# ifdef __linux__
{ " bind-fix4 " , no_argument , 0 , 0 } , // optidx=59
{ " bind-fix6 " , no_argument , 0 , 0 } , // optidx=60
{ " bind-fix4 " , no_argument , 0 , 0 } , // optidx=61
{ " bind-fix6 " , no_argument , 0 , 0 } , // optidx=62
# elif defined(__CYGWIN__)
{ " wf-iface " , required_argument , 0 , 0 } , // optidx=59
{ " wf-l3 " , required_argument , 0 , 0 } , // optidx=60
{ " wf-tcp " , required_argument , 0 , 0 } , // optidx=61
{ " wf-udp " , required_argument , 0 , 0 } , // optidx=62
{ " wf-raw " , required_argument , 0 , 0 } , // optidx=63
{ " wf-save " , required_argument , 0 , 0 } , // optidx=64
{ " ssid-filter " , required_argument , 0 , 0 } , // optidx=65
{ " nlm-filter " , required_argument , 0 , 0 } , // optidx=66
{ " nlm-list " , optional_argument , 0 , 0 } , // optidx=67
{ " wf-iface " , required_argument , 0 , 0 } , // optidx=61
{ " wf-l3 " , required_argument , 0 , 0 } , // optidx=62
{ " wf-tcp " , required_argument , 0 , 0 } , // optidx=63
{ " wf-udp " , required_argument , 0 , 0 } , // optidx=64
{ " wf-raw " , required_argument , 0 , 0 } , // optidx=65
{ " wf-save " , required_argument , 0 , 0 } , // optidx=66
{ " ssid-filter " , required_argument , 0 , 0 } , // optidx=67
{ " nlm-filter " , required_argument , 0 , 0 } , // optidx=68
{ " nlm-list " , optional_argument , 0 , 0 } , // optidx=69
# endif
{ NULL , 0 , NULL , 0 }
} ;
@ -1422,12 +1426,25 @@ int main(int argc, char **argv)
memcpy ( dp - > hostspell , optarg , 4 ) ;
break ;
case 12 : /* hostnospace */
if ( dp - > methodeol )
{
DLOG_ERR ( " --hostnospace and --methodeol are incompatible \n " ) ;
exit_clean ( 1 ) ;
}
dp - > hostnospace = true ;
break ;
case 13 : /* domcase */
dp - > domcase = true ;
break ;
case 14 : /* dpi-desync */
case 14 : /* methodeol */
if ( dp - > hostnospace )
{
DLOG_ERR ( " --hostnospace and --methodeol are incompatible \n " ) ;
exit_clean ( 1 ) ;
}
dp - > methodeol = true ;
break ;
case 15 : /* dpi-desync */
{
char * mode = optarg , * mode2 , * mode3 ;
mode2 = mode ? strchr ( mode , ' , ' ) : NULL ;
@ -1473,7 +1490,7 @@ int main(int argc, char **argv)
}
break ;
# ifndef __CYGWIN__
case 15 : /* dpi-desync-fwmark/dpi-desync-sockarg */
case 16 : /* dpi-desync-fwmark/dpi-desync-sockarg */
# if defined(__linux__) || defined(SO_USER_COOKIE)
params . desync_fwmark = 0 ;
if ( sscanf ( optarg , " 0x%X " , & params . desync_fwmark ) < = 0 ) sscanf ( optarg , " %u " , & params . desync_fwmark ) ;
@ -1488,27 +1505,27 @@ int main(int argc, char **argv)
# endif
break ;
# endif
case 16 : /* dpi-desync-ttl */
case 17 : /* dpi-desync-ttl */
dp - > desync_ttl = ( uint8_t ) atoi ( optarg ) ;
break ;
case 17 : /* dpi-desync-ttl6 */
case 18 : /* dpi-desync-ttl6 */
dp - > desync_ttl6 = ( uint8_t ) atoi ( optarg ) ;
break ;
case 18 : /* dpi-desync-autottl */
case 19 : /* dpi-desync-autottl */
if ( ! parse_autottl ( optarg , & dp - > desync_autottl ) )
{
DLOG_ERR ( " dpi-desync-autottl value error \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 19 : /* dpi-desync-autottl6 */
case 20 : /* dpi-desync-autottl6 */
if ( ! parse_autottl ( optarg , & dp - > desync_autottl6 ) )
{
DLOG_ERR ( " dpi-desync-autottl6 value error \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 20 : /* dpi-desync-fooling */
case 21 : /* dpi-desync-fooling */
{
char * e , * p = optarg ;
while ( p )
@ -1543,17 +1560,17 @@ int main(int argc, char **argv)
}
}
break ;
case 21 : /* dpi-desync-repeats */
case 22 : /* dpi-desync-repeats */
if ( sscanf ( optarg , " %u " , & dp - > desync_repeats ) < 1 | | ! dp - > desync_repeats | | dp - > desync_repeats > 20 )
{
DLOG_ERR ( " dpi-desync-repeats must be within 1..20 \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 22 : /* dpi-desync-skip-nosni */
case 23 : /* dpi-desync-skip-nosni */
dp - > desync_skip_nosni = ! optarg | | atoi ( optarg ) ;
break ;
case 23 : /* dpi-desync-split-pos */
case 24 : /* dpi-desync-split-pos */
{
int ct ;
if ( ! parse_split_pos_list ( optarg , dp - > splits + dp - > split_count , MAX_SPLITS - dp - > split_count , & ct ) )
@ -1564,7 +1581,7 @@ int main(int argc, char **argv)
dp - > split_count + = ct ;
}
break ;
case 24 : /* dpi-desync-split-http-req */
case 25 : /* dpi-desync-split-http-req */
// obsolete arg
DLOG_CONDUP ( " WARNING ! --dpi-desync-split-http-req is deprecated. use --dpi-desync-split-pos with markers. \n " , MAX_SPLITS ) ;
if ( dp - > split_count > = MAX_SPLITS )
@ -1579,7 +1596,7 @@ int main(int argc, char **argv)
}
dp - > split_count + + ;
break ;
case 25 : /* dpi-desync-split-tls */
case 26 : /* dpi-desync-split-tls */
// obsolete arg
DLOG_CONDUP ( " WARNING ! --dpi-desync-split-tls is deprecated. use --dpi-desync-split-pos with markers. \n " , MAX_SPLITS ) ;
if ( dp - > split_count > = MAX_SPLITS )
@ -1594,7 +1611,7 @@ int main(int argc, char **argv)
}
dp - > split_count + + ;
break ;
case 26 : /* dpi-desync-split-seqovl */
case 27 : /* dpi-desync-split-seqovl */
if ( ! strcmp ( optarg , " 0 " ) )
{
// allow zero = disable seqovl
@ -1607,7 +1624,7 @@ int main(int argc, char **argv)
exit_clean ( 1 ) ;
}
break ;
case 27 : /* dpi-desync-split-seqovl-pattern */
case 28 : /* dpi-desync-split-seqovl-pattern */
{
char buf [ sizeof ( dp - > seqovl_pattern ) ] ;
size_t sz = sizeof ( buf ) ;
@ -1615,7 +1632,7 @@ int main(int argc, char **argv)
fill_pattern ( dp - > seqovl_pattern , sizeof ( dp - > seqovl_pattern ) , buf , sz ) ;
}
break ;
case 28 : /* dpi-desync-ipfrag-pos-tcp */
case 29 : /* dpi-desync-ipfrag-pos-tcp */
if ( sscanf ( optarg , " %u " , & dp - > desync_ipfrag_pos_tcp ) < 1 | | dp - > desync_ipfrag_pos_tcp < 1 | | dp - > desync_ipfrag_pos_tcp > DPI_DESYNC_MAX_FAKE_LEN )
{
DLOG_ERR ( " dpi-desync-ipfrag-pos-tcp must be within 1..%u range \n " , DPI_DESYNC_MAX_FAKE_LEN ) ;
@ -1627,7 +1644,7 @@ int main(int argc, char **argv)
exit_clean ( 1 ) ;
}
break ;
case 29 : /* dpi-desync-ipfrag-pos-udp */
case 30 : /* dpi-desync-ipfrag-pos-udp */
if ( sscanf ( optarg , " %u " , & dp - > desync_ipfrag_pos_udp ) < 1 | | dp - > desync_ipfrag_pos_udp < 1 | | dp - > desync_ipfrag_pos_udp > DPI_DESYNC_MAX_FAKE_LEN )
{
DLOG_ERR ( " dpi-desync-ipfrag-pos-udp must be within 1..%u range \n " , DPI_DESYNC_MAX_FAKE_LEN ) ;
@ -1639,63 +1656,63 @@ int main(int argc, char **argv)
exit_clean ( 1 ) ;
}
break ;
case 30 : /* dpi-desync-badseq-increments */
case 31 : /* dpi-desync-badseq-increments */
if ( ! parse_badseq_increment ( optarg , & dp - > desync_badseq_increment ) )
{
DLOG_ERR ( " dpi-desync-badseq-increment should be signed decimal or signed 0xHEX \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 31 : /* dpi-desync-badack-increment */
case 32 : /* dpi-desync-badack-increment */
if ( ! parse_badseq_increment ( optarg , & dp - > desync_badseq_ack_increment ) )
{
DLOG_ERR ( " dpi-desync-badack-increment should be signed decimal or signed 0xHEX \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 32 : /* dpi-desync-any-protocol */
case 33 : /* dpi-desync-any-protocol */
dp - > desync_any_proto = ! optarg | | atoi ( optarg ) ;
break ;
case 33 : /* dpi-desync-fake-http */
case 34 : /* dpi-desync-fake-http */
dp - > fake_http_size = sizeof ( dp - > fake_http ) ;
load_file_or_exit ( optarg , dp - > fake_http , & dp - > fake_http_size ) ;
break ;
case 34 : /* dpi-desync-fake-tls */
case 35 : /* dpi-desync-fake-tls */
dp - > fake_tls_size = sizeof ( dp - > fake_tls ) ;
load_file_or_exit ( optarg , dp - > fake_tls , & dp - > fake_tls_size ) ;
break ;
case 35 : /* dpi-desync-fake-unknown */
case 36 : /* dpi-desync-fake-unknown */
dp - > fake_unknown_size = sizeof ( dp - > fake_unknown ) ;
load_file_or_exit ( optarg , dp - > fake_unknown , & dp - > fake_unknown_size ) ;
break ;
case 36 : /* dpi-desync-fake-syndata */
case 37 : /* dpi-desync-fake-syndata */
dp - > fake_syndata_size = sizeof ( dp - > fake_syndata ) ;
load_file_or_exit ( optarg , dp - > fake_syndata , & dp - > fake_syndata_size ) ;
break ;
case 37 : /* dpi-desync-fake-quic */
case 38 : /* dpi-desync-fake-quic */
dp - > fake_quic_size = sizeof ( dp - > fake_quic ) ;
load_file_or_exit ( optarg , dp - > fake_quic , & dp - > fake_quic_size ) ;
break ;
case 38 : /* dpi-desync-fake-wireguard */
case 39 : /* dpi-desync-fake-wireguard */
dp - > fake_wg_size = sizeof ( dp - > fake_wg ) ;
load_file_or_exit ( optarg , dp - > fake_wg , & dp - > fake_wg_size ) ;
break ;
case 39 : /* dpi-desync-fake-dht */
case 40 : /* dpi-desync-fake-dht */
dp - > fake_dht_size = sizeof ( dp - > fake_dht ) ;
load_file_or_exit ( optarg , dp - > fake_dht , & dp - > fake_dht_size ) ;
break ;
case 40 : /* dpi-desync-fake-unknown-udp */
case 41 : /* dpi-desync-fake-unknown-udp */
dp - > fake_unknown_udp_size = sizeof ( dp - > fake_unknown_udp ) ;
load_file_or_exit ( optarg , dp - > fake_unknown_udp , & dp - > fake_unknown_udp_size ) ;
break ;
case 41 : /* dpi-desync-udplen-increment */
case 42 : /* dpi-desync-udplen-increment */
if ( sscanf ( optarg , " %d " , & dp - > udplen_increment ) < 1 | | dp - > udplen_increment > 0x7FFF | | dp - > udplen_increment < - 0x8000 )
{
DLOG_ERR ( " dpi-desync-udplen-increment must be integer within -32768..32767 range \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 42 : /* dpi-desync-udplen-pattern */
case 43 : /* dpi-desync-udplen-pattern */
{
char buf [ sizeof ( dp - > udplen_pattern ) ] ;
size_t sz = sizeof ( buf ) ;
@ -1703,35 +1720,35 @@ int main(int argc, char **argv)
fill_pattern ( dp - > udplen_pattern , sizeof ( dp - > udplen_pattern ) , buf , sz ) ;
}
break ;
case 43 : /* desync-cutoff */
case 44 : /* desync-cutoff */
if ( ! parse_cutoff ( optarg , & dp - > desync_cutoff , & dp - > desync_cutoff_mode ) )
{
DLOG_ERR ( " invalid desync-cutoff value \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 44 : /* desync-start */
case 45 : /* desync-start */
if ( ! parse_cutoff ( optarg , & dp - > desync_start , & dp - > desync_start_mode ) )
{
DLOG_ERR ( " invalid desync-start value \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 45 : /* hostlist */
case 46 : /* hostlist */
if ( ! RegisterHostlist ( dp , false , optarg ) )
{
DLOG_ERR ( " failed to register hostlist '%s' \n " , optarg ) ;
exit_clean ( 1 ) ;
}
break ;
case 46 : /* hostlist-exclude */
case 47 : /* hostlist-exclude */
if ( ! RegisterHostlist ( dp , true , optarg ) )
{
DLOG_ERR ( " failed to register hostlist '%s' \n " , optarg ) ;
exit_clean ( 1 ) ;
}
break ;
case 47 : /* hostlist-auto */
case 48 : /* hostlist-auto */
if ( dp - > hostlist_auto )
{
DLOG_ERR ( " only one auto hostlist per profile is supported \n " ) ;
@ -1758,7 +1775,7 @@ int main(int argc, char **argv)
exit_clean ( 1 ) ;
}
break ;
case 48 : /* hostlist-auto-fail-threshold */
case 49 : /* hostlist-auto-fail-threshold */
dp - > hostlist_auto_fail_threshold = ( uint8_t ) atoi ( optarg ) ;
if ( dp - > hostlist_auto_fail_threshold < 1 | | dp - > hostlist_auto_fail_threshold > 20 )
{
@ -1766,7 +1783,7 @@ int main(int argc, char **argv)
exit_clean ( 1 ) ;
}
break ;
case 49 : /* hostlist-auto-fail-time */
case 50 : /* hostlist-auto-fail-time */
dp - > hostlist_auto_fail_time = ( uint8_t ) atoi ( optarg ) ;
if ( dp - > hostlist_auto_fail_time < 1 )
{
@ -1774,7 +1791,7 @@ int main(int argc, char **argv)
exit_clean ( 1 ) ;
}
break ;
case 50 : /* hostlist-auto-retrans-threshold */
case 51 : /* hostlist-auto-retrans-threshold */
dp - > hostlist_auto_retrans_threshold = ( uint8_t ) atoi ( optarg ) ;
if ( dp - > hostlist_auto_retrans_threshold < 2 | | dp - > hostlist_auto_retrans_threshold > 10 )
{
@ -1782,7 +1799,7 @@ int main(int argc, char **argv)
exit_clean ( 1 ) ;
}
break ;
case 51 : /* hostlist-auto-debug */
case 52 : /* hostlist-auto-debug */
{
FILE * F = fopen ( optarg , " a+t " ) ;
if ( ! F )
@ -1796,23 +1813,37 @@ int main(int argc, char **argv)
}
break ;
case 52 : /* new */
if ( ! ( dpl = dp_list_add ( & params . desync_profiles ) ) )
case 53 : /* new */
if ( bSkip )
{
DLOG_ERR ( " desync_profile_add: out of memory \n " ) ;
exit_clean ( 1 ) ;
dp_clear ( dp ) ;
dp_init ( dp ) ;
dp - > n = desync_profile_count ;
bSkip = false ;
}
else
{
if ( ! ( dpl = dp_list_add ( & params . desync_profiles ) ) )
{
DLOG_ERR ( " desync_profile_add: out of memory \n " ) ;
exit_clean ( 1 ) ;
}
dp = & dpl - > dp ;
dp - > n = + + desync_profile_count ;
}
dp = & dpl - > dp ;
dp - > n = + + desync_profile_count ;
break ;
case 53 : /* filter-l3 */
case 54 : /* skip */
bSkip = true ;
break ;
case 55 : /* filter-l3 */
if ( ! wf_make_l3 ( optarg , & dp - > filter_ipv4 , & dp - > filter_ipv6 ) )
{
DLOG_ERR ( " bad value for --filter-l3 \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 54 : /* filter-tcp */
case 56 : /* filter-tcp */
if ( ! parse_pf_list ( optarg , & dp - > pf_tcp ) )
{
DLOG_ERR ( " Invalid port filter : %s \n " , optarg ) ;
@ -1822,7 +1853,7 @@ int main(int argc, char **argv)
if ( ! port_filters_deny_if_empty ( & dp - > pf_udp ) )
exit_clean ( 1 ) ;
break ;
case 55 : /* filter-udp */
case 57 : /* filter-udp */
if ( ! parse_pf_list ( optarg , & dp - > pf_udp ) )
{
DLOG_ERR ( " Invalid port filter : %s \n " , optarg ) ;
@ -1832,21 +1863,21 @@ int main(int argc, char **argv)
if ( ! port_filters_deny_if_empty ( & dp - > pf_tcp ) )
exit_clean ( 1 ) ;
break ;
case 56 : /* filter-l7 */
case 58 : /* filter-l7 */
if ( ! parse_l7_list ( optarg , & dp - > filter_l7 ) )
{
DLOG_ERR ( " Invalid l7 filter : %s \n " , optarg ) ;
exit_clean ( 1 ) ;
}
break ;
case 57 : /* ipset */
case 59 : /* ipset */
if ( ! RegisterIpset ( dp , false , optarg ) )
{
DLOG_ERR ( " failed to register ipset '%s' \n " , optarg ) ;
exit_clean ( 1 ) ;
}
break ;
case 58 : /* ipset-exclude */
case 60 : /* ipset-exclude */
if ( ! RegisterIpset ( dp , true , optarg ) )
{
DLOG_ERR ( " failed to register ipset '%s' \n " , optarg ) ;
@ -1857,28 +1888,28 @@ int main(int argc, char **argv)
# ifdef __linux__
case 59 : /* bind-fix4 */
case 61 : /* bind-fix4 */
params . bind_fix4 = true ;
break ;
case 60 : /* bind-fix6 */
case 62 : /* bind-fix6 */
params . bind_fix6 = true ;
break ;
# elif defined(__CYGWIN__)
case 59 : /* wf-iface */
case 61 : /* wf-iface */
if ( ! sscanf ( optarg , " %u.%u " , & IfIdx , & SubIfIdx ) )
{
DLOG_ERR ( " bad value for --wf-iface \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 60 : /* wf-l3 */
case 62 : /* wf-l3 */
if ( ! wf_make_l3 ( optarg , & wf_ipv4 , & wf_ipv6 ) )
{
DLOG_ERR ( " bad value for --wf-l3 \n " ) ;
exit_clean ( 1 ) ;
}
break ;
case 61 : /* wf-tcp */
case 63 : /* wf-tcp */
hash_wf_tcp = hash_jen ( optarg , strlen ( optarg ) ) ;
if ( ! wf_make_pf ( optarg , " tcp " , " SrcPort " , wf_pf_tcp_src , sizeof ( wf_pf_tcp_src ) ) | |
! wf_make_pf ( optarg , " tcp " , " DstPort " , wf_pf_tcp_dst , sizeof ( wf_pf_tcp_dst ) ) )
@ -1887,7 +1918,7 @@ int main(int argc, char **argv)
exit_clean ( 1 ) ;
}
break ;
case 62 : /* wf-udp */
case 64 : /* wf-udp */
hash_wf_udp = hash_jen ( optarg , strlen ( optarg ) ) ;
if ( ! wf_make_pf ( optarg , " udp " , " SrcPort " , wf_pf_udp_src , sizeof ( wf_pf_udp_src ) ) | |
! wf_make_pf ( optarg , " udp " , " DstPort " , wf_pf_udp_dst , sizeof ( wf_pf_udp_dst ) ) )
@ -1896,7 +1927,7 @@ int main(int argc, char **argv)
exit_clean ( 1 ) ;
}
break ;
case 63 : /* wf-raw */
case 65 : /* wf-raw */
hash_wf_raw = hash_jen ( optarg , strlen ( optarg ) ) ;
if ( optarg [ 0 ] = = ' @ ' )
{
@ -1910,11 +1941,11 @@ int main(int argc, char **argv)
windivert_filter [ sizeof ( windivert_filter ) - 1 ] = ' \0 ' ;
}
break ;
case 64 : /* wf-save */
case 66 : /* wf-save */
strncpy ( wf_save_file , optarg , sizeof ( wf_save_file ) ) ;
wf_save_file [ sizeof ( wf_save_file ) - 1 ] = ' \0 ' ;
break ;
case 65 : /* ssid-filter */
case 67 : /* ssid-filter */
hash_ssid_filter = hash_jen ( optarg , strlen ( optarg ) ) ;
{
char * e , * p = optarg ;
@ -1932,7 +1963,7 @@ int main(int argc, char **argv)
}
}
break ;
case 66 : /* nlm-filter */
case 68 : /* nlm-filter */
hash_nlm_filter = hash_jen ( optarg , strlen ( optarg ) ) ;
{
char * e , * p = optarg ;
@ -1950,7 +1981,7 @@ int main(int argc, char **argv)
}
}
break ;
case 67 : /* nlm-list */
case 69 : /* nlm-list */
if ( ! nlm_list ( optarg & & ! strcmp ( optarg , " all " ) ) )
{
DLOG_ERR ( " could not get list of NLM networks \n " ) ;
@ -1961,6 +1992,12 @@ int main(int argc, char **argv)
# endif
}
}
if ( bSkip )
{
LIST_REMOVE ( dpl , next ) ;
dp_entry_destroy ( dpl ) ;
desync_profile_count - - ;
}
// do not need args from file anymore
# if !defined( __OpenBSD__) && !defined(__ANDROID__)