mirror of
https://github.com/bol-van/zapret.git
synced 2025-02-05 23:04:19 +05:00
nfqws,tpws: --version
This commit is contained in:
parent
5f9fa28251
commit
f62b289cb5
@ -457,3 +457,4 @@ v70.1
|
||||
|
||||
nfqws: --dpi-desync-fake-tls-mod=dupsid
|
||||
nfqws,tpws: test accessibility of list files after privs drop
|
||||
nfqws,tpws: --version
|
||||
|
@ -133,6 +133,7 @@ nfqws takes the following parameters:
|
||||
|
||||
--debug=0|1
|
||||
--dry-run ; verify parameters and exit with code 0 if successful
|
||||
--version ; print version and exit
|
||||
--comment ; any text (ignored)
|
||||
--qnum=<nfqueue_number>
|
||||
--daemon ; daemonize
|
||||
@ -660,6 +661,7 @@ tpws is transparent proxy.
|
||||
--debug=0|1|2|syslog|@<filename> ; 1 and 2 means log to console and set debug level. for other targets use --debug-level.
|
||||
--debug-level=0|1|2 ; specify debug level for syslog and @<filename>
|
||||
--dry-run ; verify parameters and exit with code 0 if successful
|
||||
--version ; print version and exit
|
||||
--bind-addr=<v4_addr>|<v6_addr> ; for v6 link locals append %interface_name : fe80::1%br-lan
|
||||
--bind-iface4=<interface_name> ; bind to the first ipv4 addr of interface
|
||||
--bind-iface6=<interface_name> ; bind to the first ipv6 addr of interface
|
||||
|
@ -159,6 +159,7 @@ dvtws, собираемый из тех же исходников (см. [док
|
||||
|
||||
--debug=0|1 ; 1=выводить отладочные сообщения
|
||||
--dry-run ; проверить опции командной строки и выйти. код 0 - успешная проверка.
|
||||
--version ; вывести версию и выйти
|
||||
--comment ; любой текст (игнорируется)
|
||||
--daemon ; демонизировать прогу
|
||||
--pidfile=<file> ; сохранить PID в файл
|
||||
@ -786,6 +787,7 @@ tpws - это transparent proxy.
|
||||
--debug=0|1|2|syslog|@<filename> ; 0,1,2 = логирование на косоль : 0=тихо, 1(default)=подробно, 2=отладка.
|
||||
--debug-level=0|1|2 ; указать уровень логирования для syslog и @<filename>
|
||||
--dry-run ; проверить опции командной строки и выйти. код 0 - успешная проверка.
|
||||
--version ; вывести версию и выйти
|
||||
|
||||
--daemon ; демонизировать прогу
|
||||
--pidfile=<file> ; сохранить PID в файл
|
||||
|
323
nfq/nfqws.c
323
nfq/nfqws.c
@ -1230,6 +1230,7 @@ static void exithelp(void)
|
||||
" @<config_file>|$<config_file>\t\t\t; read file for options. must be the only argument. other options are ignored.\n\n"
|
||||
#endif
|
||||
" --debug=0|1|syslog|@<filename>\n"
|
||||
" --version\t\t\t\t\t; print version and exit\n"
|
||||
" --dry-run\t\t\t\t\t; verify parameters and exit with code 0 if successful\n"
|
||||
" --comment=any_text\n"
|
||||
#ifdef __linux__
|
||||
@ -1488,33 +1489,34 @@ int main(int argc, char **argv)
|
||||
const struct option long_options[] = {
|
||||
{"debug",optional_argument,0,0}, // optidx=0
|
||||
{"dry-run",no_argument,0,0}, // optidx=1
|
||||
{"comment",optional_argument,0,0}, // optidx=2
|
||||
{"version",no_argument,0,0}, // optidx=2
|
||||
{"comment",optional_argument,0,0}, // optidx=3
|
||||
#ifdef __linux__
|
||||
{"qnum",required_argument,0,0}, // optidx=3
|
||||
{"qnum",required_argument,0,0}, // optidx=4
|
||||
#elif defined(BSD)
|
||||
{"port",required_argument,0,0}, // optidx=3
|
||||
{"port",required_argument,0,0}, // optidx=4
|
||||
#else
|
||||
{"disabled_argument_1",no_argument,0,0},// optidx=3
|
||||
{"disabled_argument_1",no_argument,0,0},// optidx=4
|
||||
#endif
|
||||
{"daemon",no_argument,0,0}, // optidx=4
|
||||
{"pidfile",required_argument,0,0}, // optidx=5
|
||||
{"daemon",no_argument,0,0}, // optidx=5
|
||||
{"pidfile",required_argument,0,0}, // optidx=6
|
||||
#ifndef __CYGWIN__
|
||||
{"user",required_argument,0,0 }, // optidx=6
|
||||
{"uid",required_argument,0,0 }, // optidx=7
|
||||
{"user",required_argument,0,0 }, // optidx=7
|
||||
{"uid",required_argument,0,0 }, // optidx=8
|
||||
#else
|
||||
{"disabled_argument_2",no_argument,0,0}, // optidx=6
|
||||
{"disabled_argument_3",no_argument,0,0}, // optidx=7
|
||||
{"disabled_argument_2",no_argument,0,0}, // optidx=7
|
||||
{"disabled_argument_3",no_argument,0,0}, // optidx=8
|
||||
#endif
|
||||
{"wsize",required_argument,0,0}, // optidx=8
|
||||
{"wssize",required_argument,0,0}, // optidx=9
|
||||
{"wssize-cutoff",required_argument,0,0},// optidx=10
|
||||
{"ctrack-timeouts",required_argument,0,0},// optidx=11
|
||||
{"hostcase",no_argument,0,0}, // optidx=12
|
||||
{"hostspell",required_argument,0,0}, // optidx=13
|
||||
{"hostnospace",no_argument,0,0}, // optidx=14
|
||||
{"domcase",no_argument,0,0 }, // optidx=15
|
||||
{"methodeol",no_argument,0,0 }, // optidx=16
|
||||
{"dpi-desync",required_argument,0,0}, // optidx=17
|
||||
{"wsize",required_argument,0,0}, // optidx=9
|
||||
{"wssize",required_argument,0,0}, // optidx=10
|
||||
{"wssize-cutoff",required_argument,0,0},// optidx=11
|
||||
{"ctrack-timeouts",required_argument,0,0},// optidx=12
|
||||
{"hostcase",no_argument,0,0}, // optidx=13
|
||||
{"hostspell",required_argument,0,0}, // optidx=14
|
||||
{"hostnospace",no_argument,0,0}, // optidx=15
|
||||
{"domcase",no_argument,0,0 }, // optidx=16
|
||||
{"methodeol",no_argument,0,0 }, // optidx=17
|
||||
{"dpi-desync",required_argument,0,0}, // optidx=18
|
||||
#ifdef __linux__
|
||||
{"dpi-desync-fwmark",required_argument,0,0}, // optidx=18
|
||||
#elif defined(SO_USER_COOKIE)
|
||||
@ -1522,69 +1524,69 @@ int main(int argc, char **argv)
|
||||
#else
|
||||
{"disabled_argument_4",no_argument,0,0}, // optidx=18
|
||||
#endif
|
||||
{"dpi-desync-ttl",required_argument,0,0}, // optidx=19
|
||||
{"dpi-desync-ttl6",required_argument,0,0}, // optidx=20
|
||||
{"dpi-desync-autottl",optional_argument,0,0}, // optidx=21
|
||||
{"dpi-desync-autottl6",optional_argument,0,0}, // optidx=22
|
||||
{"dpi-desync-fooling",required_argument,0,0}, // optidx=23
|
||||
{"dpi-desync-repeats",required_argument,0,0}, // optidx=24
|
||||
{"dpi-desync-skip-nosni",optional_argument,0,0},// optidx=25
|
||||
{"dpi-desync-split-pos",required_argument,0,0},// optidx=26
|
||||
{"dpi-desync-split-http-req",required_argument,0,0 },// optidx=27
|
||||
{"dpi-desync-split-tls",required_argument,0,0 },// optidx=28
|
||||
{"dpi-desync-split-seqovl",required_argument,0,0 },// optidx=29
|
||||
{"dpi-desync-split-seqovl-pattern",required_argument,0,0 },// optidx=30
|
||||
{"dpi-desync-fakedsplit-pattern",required_argument,0,0 },// optidx=31
|
||||
{"dpi-desync-ipfrag-pos-tcp",required_argument,0,0},// optidx=32
|
||||
{"dpi-desync-ipfrag-pos-udp",required_argument,0,0},// optidx=33
|
||||
{"dpi-desync-badseq-increment",required_argument,0,0},// optidx=34
|
||||
{"dpi-desync-badack-increment",required_argument,0,0},// optidx=35
|
||||
{"dpi-desync-any-protocol",optional_argument,0,0},// optidx=36
|
||||
{"dpi-desync-fake-http",required_argument,0,0},// optidx=37
|
||||
{"dpi-desync-fake-tls",required_argument,0,0},// optidx=38
|
||||
{"dpi-desync-fake-tls-mod",required_argument,0,0},// optidx=39
|
||||
{"dpi-desync-fake-unknown",required_argument,0,0},// optidx=40
|
||||
{"dpi-desync-fake-syndata",required_argument,0,0},// optidx=41
|
||||
{"dpi-desync-fake-quic",required_argument,0,0},// optidx=42
|
||||
{"dpi-desync-fake-wireguard",required_argument,0,0},// optidx=43
|
||||
{"dpi-desync-fake-dht",required_argument,0,0},// optidx=44
|
||||
{"dpi-desync-fake-unknown-udp",required_argument,0,0},// optidx=45
|
||||
{"dpi-desync-udplen-increment",required_argument,0,0},// optidx=46
|
||||
{"dpi-desync-udplen-pattern",required_argument,0,0},// optidx=47
|
||||
{"dpi-desync-cutoff",required_argument,0,0},// optidx=48
|
||||
{"dpi-desync-start",required_argument,0,0},// optidx=49
|
||||
{"hostlist",required_argument,0,0}, // optidx=50
|
||||
{"hostlist-domains",required_argument,0,0},// optidx=51
|
||||
{"hostlist-exclude",required_argument,0,0}, // optidx=52
|
||||
{"hostlist-exclude-domains",required_argument,0,0},// optidx=53
|
||||
{"hostlist-auto",required_argument,0,0}, // optidx=54
|
||||
{"hostlist-auto-fail-threshold",required_argument,0,0}, // optidx=55
|
||||
{"hostlist-auto-fail-time",required_argument,0,0}, // optidx=56
|
||||
{"hostlist-auto-retrans-threshold",required_argument,0,0}, // optidx=57
|
||||
{"hostlist-auto-debug",required_argument,0,0}, // optidx=58
|
||||
{"new",no_argument,0,0}, // optidx=59
|
||||
{"skip",no_argument,0,0}, // optidx=60
|
||||
{"filter-l3",required_argument,0,0}, // optidx=61
|
||||
{"filter-tcp",required_argument,0,0}, // optidx=62
|
||||
{"filter-udp",required_argument,0,0}, // optidx=63
|
||||
{"filter-l7",required_argument,0,0}, // optidx=64
|
||||
{"ipset",required_argument,0,0}, // optidx=65
|
||||
{"ipset-ip",required_argument,0,0}, // optidx=66
|
||||
{"ipset-exclude",required_argument,0,0},// optidx=67
|
||||
{"ipset-exclude-ip",required_argument,0,0}, // optidx=68
|
||||
{"dpi-desync-ttl",required_argument,0,0}, // optidx=20
|
||||
{"dpi-desync-ttl6",required_argument,0,0}, // optidx=21
|
||||
{"dpi-desync-autottl",optional_argument,0,0}, // optidx=22
|
||||
{"dpi-desync-autottl6",optional_argument,0,0}, // optidx=23
|
||||
{"dpi-desync-fooling",required_argument,0,0}, // optidx=24
|
||||
{"dpi-desync-repeats",required_argument,0,0}, // optidx=25
|
||||
{"dpi-desync-skip-nosni",optional_argument,0,0},// optidx=26
|
||||
{"dpi-desync-split-pos",required_argument,0,0},// optidx=27
|
||||
{"dpi-desync-split-http-req",required_argument,0,0 },// optidx=28
|
||||
{"dpi-desync-split-tls",required_argument,0,0 },// optidx=29
|
||||
{"dpi-desync-split-seqovl",required_argument,0,0 },// optidx=30
|
||||
{"dpi-desync-split-seqovl-pattern",required_argument,0,0 },// optidx=31
|
||||
{"dpi-desync-fakedsplit-pattern",required_argument,0,0 },// optidx=32
|
||||
{"dpi-desync-ipfrag-pos-tcp",required_argument,0,0},// optidx=33
|
||||
{"dpi-desync-ipfrag-pos-udp",required_argument,0,0},// optidx=34
|
||||
{"dpi-desync-badseq-increment",required_argument,0,0},// optidx=35
|
||||
{"dpi-desync-badack-increment",required_argument,0,0},// optidx=36
|
||||
{"dpi-desync-any-protocol",optional_argument,0,0},// optidx=37
|
||||
{"dpi-desync-fake-http",required_argument,0,0},// optidx=38
|
||||
{"dpi-desync-fake-tls",required_argument,0,0},// optidx=39
|
||||
{"dpi-desync-fake-tls-mod",required_argument,0,0},// optidx=40
|
||||
{"dpi-desync-fake-unknown",required_argument,0,0},// optidx=41
|
||||
{"dpi-desync-fake-syndata",required_argument,0,0},// optidx=42
|
||||
{"dpi-desync-fake-quic",required_argument,0,0},// optidx=43
|
||||
{"dpi-desync-fake-wireguard",required_argument,0,0},// optidx=44
|
||||
{"dpi-desync-fake-dht",required_argument,0,0},// optidx=45
|
||||
{"dpi-desync-fake-unknown-udp",required_argument,0,0},// optidx=46
|
||||
{"dpi-desync-udplen-increment",required_argument,0,0},// optidx=47
|
||||
{"dpi-desync-udplen-pattern",required_argument,0,0},// optidx=48
|
||||
{"dpi-desync-cutoff",required_argument,0,0},// optidx=49
|
||||
{"dpi-desync-start",required_argument,0,0},// optidx=50
|
||||
{"hostlist",required_argument,0,0}, // optidx=51
|
||||
{"hostlist-domains",required_argument,0,0},// optidx=52
|
||||
{"hostlist-exclude",required_argument,0,0}, // optidx=53
|
||||
{"hostlist-exclude-domains",required_argument,0,0},// optidx=54
|
||||
{"hostlist-auto",required_argument,0,0}, // optidx=55
|
||||
{"hostlist-auto-fail-threshold",required_argument,0,0}, // optidx=56
|
||||
{"hostlist-auto-fail-time",required_argument,0,0}, // optidx=57
|
||||
{"hostlist-auto-retrans-threshold",required_argument,0,0}, // optidx=58
|
||||
{"hostlist-auto-debug",required_argument,0,0}, // optidx=59
|
||||
{"new",no_argument,0,0}, // optidx=60
|
||||
{"skip",no_argument,0,0}, // optidx=61
|
||||
{"filter-l3",required_argument,0,0}, // optidx=62
|
||||
{"filter-tcp",required_argument,0,0}, // optidx=63
|
||||
{"filter-udp",required_argument,0,0}, // optidx=64
|
||||
{"filter-l7",required_argument,0,0}, // optidx=65
|
||||
{"ipset",required_argument,0,0}, // optidx=66
|
||||
{"ipset-ip",required_argument,0,0}, // optidx=67
|
||||
{"ipset-exclude",required_argument,0,0},// optidx=68
|
||||
{"ipset-exclude-ip",required_argument,0,0}, // optidx=69
|
||||
#ifdef __linux__
|
||||
{"bind-fix4",no_argument,0,0}, // optidx=69
|
||||
{"bind-fix6",no_argument,0,0}, // optidx=70
|
||||
{"bind-fix4",no_argument,0,0}, // optidx=70
|
||||
{"bind-fix6",no_argument,0,0}, // optidx=71
|
||||
#elif defined(__CYGWIN__)
|
||||
{"wf-iface",required_argument,0,0}, // optidx=69
|
||||
{"wf-l3",required_argument,0,0}, // optidx=70
|
||||
{"wf-tcp",required_argument,0,0}, // optidx=71
|
||||
{"wf-udp",required_argument,0,0}, // optidx=72
|
||||
{"wf-raw",required_argument,0,0}, // optidx=73
|
||||
{"wf-save",required_argument,0,0}, // optidx=74
|
||||
{"ssid-filter",required_argument,0,0}, // optidx=75
|
||||
{"nlm-filter",required_argument,0,0}, // optidx=76
|
||||
{"nlm-list",optional_argument,0,0}, // optidx=77
|
||||
{"wf-iface",required_argument,0,0}, // optidx=70
|
||||
{"wf-l3",required_argument,0,0}, // optidx=71
|
||||
{"wf-tcp",required_argument,0,0}, // optidx=72
|
||||
{"wf-udp",required_argument,0,0}, // optidx=73
|
||||
{"wf-raw",required_argument,0,0}, // optidx=74
|
||||
{"wf-save",required_argument,0,0}, // optidx=75
|
||||
{"ssid-filter",required_argument,0,0}, // optidx=76
|
||||
{"nlm-filter",required_argument,0,0}, // optidx=77
|
||||
{"nlm-list",optional_argument,0,0}, // optidx=78
|
||||
#endif
|
||||
{NULL,0,NULL,0}
|
||||
};
|
||||
@ -1637,9 +1639,12 @@ int main(int argc, char **argv)
|
||||
case 1: /* dry-run */
|
||||
bDry=true;
|
||||
break;
|
||||
case 2: /* comment */
|
||||
case 2: /* version */
|
||||
exit_clean(0);
|
||||
break;
|
||||
case 3: /* qnum or port */
|
||||
case 3: /* comment */
|
||||
break;
|
||||
case 4: /* qnum or port */
|
||||
#ifdef __linux__
|
||||
params.qnum = atoi(optarg);
|
||||
if (params.qnum < 0 || params.qnum>65535)
|
||||
@ -1659,15 +1664,15 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 4: /* daemon */
|
||||
case 5: /* daemon */
|
||||
daemon = true;
|
||||
break;
|
||||
case 5: /* pidfile */
|
||||
case 6: /* pidfile */
|
||||
strncpy(pidfile, optarg, sizeof(pidfile));
|
||||
pidfile[sizeof(pidfile) - 1] = '\0';
|
||||
break;
|
||||
#ifndef __CYGWIN__
|
||||
case 6: /* user */
|
||||
case 7: /* user */
|
||||
{
|
||||
struct passwd *pwd = getpwnam(optarg);
|
||||
if (!pwd)
|
||||
@ -1680,7 +1685,7 @@ int main(int argc, char **argv)
|
||||
params.droproot = true;
|
||||
break;
|
||||
}
|
||||
case 7: /* uid */
|
||||
case 8: /* uid */
|
||||
params.gid = 0x7FFFFFFF; // default gid. drop gid=0
|
||||
params.droproot = true;
|
||||
if (sscanf(optarg, "%u:%u", ¶ms.uid, ¶ms.gid)<1)
|
||||
@ -1690,32 +1695,32 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case 8: /* wsize */
|
||||
case 9: /* wsize */
|
||||
if (!parse_ws_scale_factor(optarg,&dp->wsize,&dp->wscale))
|
||||
exit_clean(1);
|
||||
break;
|
||||
case 9: /* wssize */
|
||||
case 10: /* wssize */
|
||||
if (!parse_ws_scale_factor(optarg,&dp->wssize,&dp->wsscale))
|
||||
exit_clean(1);
|
||||
break;
|
||||
case 10: /* wssize-cutoff */
|
||||
case 11: /* wssize-cutoff */
|
||||
if (!parse_cutoff(optarg, &dp->wssize_cutoff, &dp->wssize_cutoff_mode))
|
||||
{
|
||||
DLOG_ERR("invalid wssize-cutoff value\n");
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 11: /* ctrack-timeouts */
|
||||
case 12: /* ctrack-timeouts */
|
||||
if (sscanf(optarg, "%u:%u:%u:%u", ¶ms.ctrack_t_syn, ¶ms.ctrack_t_est, ¶ms.ctrack_t_fin, ¶ms.ctrack_t_udp)<3)
|
||||
{
|
||||
DLOG_ERR("invalid ctrack-timeouts value\n");
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 12: /* hostcase */
|
||||
case 13: /* hostcase */
|
||||
dp->hostcase = true;
|
||||
break;
|
||||
case 13: /* hostspell */
|
||||
case 14: /* hostspell */
|
||||
if (strlen(optarg) != 4)
|
||||
{
|
||||
DLOG_ERR("hostspell must be exactly 4 chars long\n");
|
||||
@ -1724,7 +1729,7 @@ int main(int argc, char **argv)
|
||||
dp->hostcase = true;
|
||||
memcpy(dp->hostspell, optarg, 4);
|
||||
break;
|
||||
case 14: /* hostnospace */
|
||||
case 15: /* hostnospace */
|
||||
if (dp->methodeol)
|
||||
{
|
||||
DLOG_ERR("--hostnospace and --methodeol are incompatible\n");
|
||||
@ -1732,10 +1737,10 @@ int main(int argc, char **argv)
|
||||
}
|
||||
dp->hostnospace = true;
|
||||
break;
|
||||
case 15: /* domcase */
|
||||
case 16: /* domcase */
|
||||
dp->domcase = true;
|
||||
break;
|
||||
case 16: /* methodeol */
|
||||
case 17: /* methodeol */
|
||||
if (dp->hostnospace)
|
||||
{
|
||||
DLOG_ERR("--hostnospace and --methodeol are incompatible\n");
|
||||
@ -1743,7 +1748,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
dp->methodeol = true;
|
||||
break;
|
||||
case 17: /* dpi-desync */
|
||||
case 18: /* dpi-desync */
|
||||
{
|
||||
char *mode=optarg,*mode2,*mode3;
|
||||
mode2 = mode ? strchr(mode,',') : NULL;
|
||||
@ -1789,7 +1794,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
#ifndef __CYGWIN__
|
||||
case 18: /* dpi-desync-fwmark/dpi-desync-sockarg */
|
||||
case 19: /* dpi-desync-fwmark/dpi-desync-sockarg */
|
||||
#if defined(__linux__) || defined(SO_USER_COOKIE)
|
||||
params.desync_fwmark = 0;
|
||||
if (sscanf(optarg, "0x%X", ¶ms.desync_fwmark)<=0) sscanf(optarg, "%u", ¶ms.desync_fwmark);
|
||||
@ -1804,27 +1809,27 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
case 19: /* dpi-desync-ttl */
|
||||
case 20: /* dpi-desync-ttl */
|
||||
dp->desync_ttl = (uint8_t)atoi(optarg);
|
||||
break;
|
||||
case 20: /* dpi-desync-ttl6 */
|
||||
case 21: /* dpi-desync-ttl6 */
|
||||
dp->desync_ttl6 = (uint8_t)atoi(optarg);
|
||||
break;
|
||||
case 21: /* dpi-desync-autottl */
|
||||
case 22: /* dpi-desync-autottl */
|
||||
if (!parse_autottl(optarg, &dp->desync_autottl))
|
||||
{
|
||||
DLOG_ERR("dpi-desync-autottl value error\n");
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 22: /* dpi-desync-autottl6 */
|
||||
case 23: /* dpi-desync-autottl6 */
|
||||
if (!parse_autottl(optarg, &dp->desync_autottl6))
|
||||
{
|
||||
DLOG_ERR("dpi-desync-autottl6 value error\n");
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 23: /* dpi-desync-fooling */
|
||||
case 24: /* dpi-desync-fooling */
|
||||
{
|
||||
char *e,*p = optarg;
|
||||
while (p)
|
||||
@ -1859,17 +1864,17 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 24: /* dpi-desync-repeats */
|
||||
case 25: /* 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 25: /* dpi-desync-skip-nosni */
|
||||
case 26: /* dpi-desync-skip-nosni */
|
||||
dp->desync_skip_nosni = !optarg || atoi(optarg);
|
||||
break;
|
||||
case 26: /* dpi-desync-split-pos */
|
||||
case 27: /* dpi-desync-split-pos */
|
||||
{
|
||||
int ct;
|
||||
if (!parse_split_pos_list(optarg,dp->splits+dp->split_count,MAX_SPLITS-dp->split_count,&ct))
|
||||
@ -1880,7 +1885,7 @@ int main(int argc, char **argv)
|
||||
dp->split_count += ct;
|
||||
}
|
||||
break;
|
||||
case 27: /* dpi-desync-split-http-req */
|
||||
case 28: /* 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)
|
||||
@ -1895,7 +1900,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
dp->split_count++;
|
||||
break;
|
||||
case 28: /* dpi-desync-split-tls */
|
||||
case 29: /* 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)
|
||||
@ -1910,7 +1915,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
dp->split_count++;
|
||||
break;
|
||||
case 29: /* dpi-desync-split-seqovl */
|
||||
case 30: /* dpi-desync-split-seqovl */
|
||||
if (!strcmp(optarg,"0"))
|
||||
{
|
||||
// allow zero = disable seqovl
|
||||
@ -1923,7 +1928,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 30: /* dpi-desync-split-seqovl-pattern */
|
||||
case 31: /* dpi-desync-split-seqovl-pattern */
|
||||
{
|
||||
char buf[sizeof(dp->seqovl_pattern)];
|
||||
size_t sz=sizeof(buf);
|
||||
@ -1931,7 +1936,7 @@ int main(int argc, char **argv)
|
||||
fill_pattern(dp->seqovl_pattern,sizeof(dp->seqovl_pattern),buf,sz);
|
||||
}
|
||||
break;
|
||||
case 31: /* dpi-desync-fakedsplit-pattern */
|
||||
case 32: /* dpi-desync-fakedsplit-pattern */
|
||||
{
|
||||
char buf[sizeof(dp->fsplit_pattern)];
|
||||
size_t sz=sizeof(buf);
|
||||
@ -1939,7 +1944,7 @@ int main(int argc, char **argv)
|
||||
fill_pattern(dp->fsplit_pattern,sizeof(dp->fsplit_pattern),buf,sz);
|
||||
}
|
||||
break;
|
||||
case 32: /* dpi-desync-ipfrag-pos-tcp */
|
||||
case 33: /* 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);
|
||||
@ -1951,7 +1956,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 33: /* dpi-desync-ipfrag-pos-udp */
|
||||
case 34: /* 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);
|
||||
@ -1963,71 +1968,71 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 34: /* dpi-desync-badseq-increments */
|
||||
case 35: /* 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 35: /* dpi-desync-badack-increment */
|
||||
case 36: /* 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 36: /* dpi-desync-any-protocol */
|
||||
case 37: /* dpi-desync-any-protocol */
|
||||
dp->desync_any_proto = !optarg || atoi(optarg);
|
||||
break;
|
||||
case 37: /* dpi-desync-fake-http */
|
||||
case 38: /* 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 38: /* dpi-desync-fake-tls */
|
||||
case 39: /* dpi-desync-fake-tls */
|
||||
dp->fake_tls_size = sizeof(dp->fake_tls);
|
||||
load_file_or_exit(optarg,dp->fake_tls,&dp->fake_tls_size);
|
||||
dp->fake_tls_mod |= FAKE_TLS_MOD_CUSTOM_FAKE;
|
||||
break;
|
||||
case 39: /* dpi-desync-fake-tls-mod */
|
||||
case 40: /* dpi-desync-fake-tls-mod */
|
||||
if (!parse_tlsmod_list(optarg,&dp->fake_tls_mod))
|
||||
{
|
||||
DLOG_ERR("Invalid tls mod : %s\n",optarg);
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 40: /* dpi-desync-fake-unknown */
|
||||
case 41: /* 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 41: /* dpi-desync-fake-syndata */
|
||||
case 42: /* 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 42: /* dpi-desync-fake-quic */
|
||||
case 43: /* 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 43: /* dpi-desync-fake-wireguard */
|
||||
case 44: /* 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 44: /* dpi-desync-fake-dht */
|
||||
case 45: /* 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 45: /* dpi-desync-fake-unknown-udp */
|
||||
case 46: /* 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 46: /* dpi-desync-udplen-increment */
|
||||
case 47: /* 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 47: /* dpi-desync-udplen-pattern */
|
||||
case 48: /* dpi-desync-udplen-pattern */
|
||||
{
|
||||
char buf[sizeof(dp->udplen_pattern)];
|
||||
size_t sz=sizeof(buf);
|
||||
@ -2035,21 +2040,21 @@ int main(int argc, char **argv)
|
||||
fill_pattern(dp->udplen_pattern,sizeof(dp->udplen_pattern),buf,sz);
|
||||
}
|
||||
break;
|
||||
case 48: /* desync-cutoff */
|
||||
case 49: /* 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 49: /* desync-start */
|
||||
case 50: /* 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 50: /* hostlist */
|
||||
case 51: /* hostlist */
|
||||
if (bSkip) break;
|
||||
if (!RegisterHostlist(dp, false, optarg))
|
||||
{
|
||||
@ -2057,7 +2062,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 51: /* hostlist-domains */
|
||||
case 52: /* hostlist-domains */
|
||||
if (bSkip) break;
|
||||
if (!anon_hl && !(anon_hl=RegisterHostlist(dp, false, NULL)))
|
||||
{
|
||||
@ -2070,7 +2075,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 52: /* hostlist-exclude */
|
||||
case 53: /* hostlist-exclude */
|
||||
if (bSkip) break;
|
||||
if (!RegisterHostlist(dp, true, optarg))
|
||||
{
|
||||
@ -2078,7 +2083,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 53: /* hostlist-exclude-domains */
|
||||
case 54: /* hostlist-exclude-domains */
|
||||
if (bSkip) break;
|
||||
if (!anon_hl_exclude && !(anon_hl_exclude=RegisterHostlist(dp, true, NULL)))
|
||||
{
|
||||
@ -2091,7 +2096,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 54: /* hostlist-auto */
|
||||
case 55: /* hostlist-auto */
|
||||
if (bSkip) break;
|
||||
if (dp->hostlist_auto)
|
||||
{
|
||||
@ -2119,7 +2124,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 55: /* hostlist-auto-fail-threshold */
|
||||
case 56: /* 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)
|
||||
{
|
||||
@ -2127,7 +2132,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 56: /* hostlist-auto-fail-time */
|
||||
case 57: /* hostlist-auto-fail-time */
|
||||
dp->hostlist_auto_fail_time = (uint8_t)atoi(optarg);
|
||||
if (dp->hostlist_auto_fail_time<1)
|
||||
{
|
||||
@ -2135,7 +2140,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 57: /* hostlist-auto-retrans-threshold */
|
||||
case 58: /* 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)
|
||||
{
|
||||
@ -2143,7 +2148,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 58: /* hostlist-auto-debug */
|
||||
case 59: /* hostlist-auto-debug */
|
||||
{
|
||||
FILE *F = fopen(optarg,"a+t");
|
||||
if (!F)
|
||||
@ -2157,7 +2162,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
|
||||
case 59: /* new */
|
||||
case 60: /* new */
|
||||
if (bSkip)
|
||||
{
|
||||
dp_clear(dp);
|
||||
@ -2179,18 +2184,18 @@ int main(int argc, char **argv)
|
||||
anon_hl = anon_hl_exclude = NULL;
|
||||
anon_ips = anon_ips_exclude = NULL;
|
||||
break;
|
||||
case 60: /* skip */
|
||||
case 61: /* skip */
|
||||
bSkip = true;
|
||||
break;
|
||||
|
||||
case 61: /* filter-l3 */
|
||||
case 62: /* 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 62: /* filter-tcp */
|
||||
case 63: /* filter-tcp */
|
||||
if (!parse_pf_list(optarg,&dp->pf_tcp))
|
||||
{
|
||||
DLOG_ERR("Invalid port filter : %s\n",optarg);
|
||||
@ -2200,7 +2205,7 @@ int main(int argc, char **argv)
|
||||
if (!port_filters_deny_if_empty(&dp->pf_udp))
|
||||
exit_clean(1);
|
||||
break;
|
||||
case 63: /* filter-udp */
|
||||
case 64: /* filter-udp */
|
||||
if (!parse_pf_list(optarg,&dp->pf_udp))
|
||||
{
|
||||
DLOG_ERR("Invalid port filter : %s\n",optarg);
|
||||
@ -2210,14 +2215,14 @@ int main(int argc, char **argv)
|
||||
if (!port_filters_deny_if_empty(&dp->pf_tcp))
|
||||
exit_clean(1);
|
||||
break;
|
||||
case 64: /* filter-l7 */
|
||||
case 65: /* filter-l7 */
|
||||
if (!parse_l7_list(optarg,&dp->filter_l7))
|
||||
{
|
||||
DLOG_ERR("Invalid l7 filter : %s\n",optarg);
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 65: /* ipset */
|
||||
case 66: /* ipset */
|
||||
if (bSkip) break;
|
||||
if (!RegisterIpset(dp, false, optarg))
|
||||
{
|
||||
@ -2225,7 +2230,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 66: /* ipset-ip */
|
||||
case 67: /* ipset-ip */
|
||||
if (bSkip) break;
|
||||
if (!anon_ips && !(anon_ips=RegisterIpset(dp, false, NULL)))
|
||||
{
|
||||
@ -2238,7 +2243,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 67: /* ipset-exclude */
|
||||
case 68: /* ipset-exclude */
|
||||
if (bSkip) break;
|
||||
if (!RegisterIpset(dp, true, optarg))
|
||||
{
|
||||
@ -2246,7 +2251,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 68: /* ipset-exclude-ip */
|
||||
case 69: /* ipset-exclude-ip */
|
||||
if (bSkip) break;
|
||||
if (!anon_ips_exclude && !(anon_ips_exclude=RegisterIpset(dp, true, NULL)))
|
||||
{
|
||||
@ -2262,28 +2267,28 @@ int main(int argc, char **argv)
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
case 69: /* bind-fix4 */
|
||||
case 70: /* bind-fix4 */
|
||||
params.bind_fix4 = true;
|
||||
break;
|
||||
case 70: /* bind-fix6 */
|
||||
case 71: /* bind-fix6 */
|
||||
params.bind_fix6 = true;
|
||||
break;
|
||||
#elif defined(__CYGWIN__)
|
||||
case 69: /* wf-iface */
|
||||
case 70: /* wf-iface */
|
||||
if (!sscanf(optarg,"%u.%u",&IfIdx,&SubIfIdx))
|
||||
{
|
||||
DLOG_ERR("bad value for --wf-iface\n");
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 70: /* wf-l3 */
|
||||
case 71: /* wf-l3 */
|
||||
if (!wf_make_l3(optarg,&wf_ipv4,&wf_ipv6))
|
||||
{
|
||||
DLOG_ERR("bad value for --wf-l3\n");
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 71: /* wf-tcp */
|
||||
case 72: /* 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)))
|
||||
@ -2292,7 +2297,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 72: /* wf-udp */
|
||||
case 73: /* 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)))
|
||||
@ -2301,7 +2306,7 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 73: /* wf-raw */
|
||||
case 74: /* wf-raw */
|
||||
hash_wf_raw=hash_jen(optarg,strlen(optarg));
|
||||
if (optarg[0]=='@')
|
||||
{
|
||||
@ -2315,11 +2320,11 @@ int main(int argc, char **argv)
|
||||
windivert_filter[sizeof(windivert_filter) - 1] = '\0';
|
||||
}
|
||||
break;
|
||||
case 74: /* wf-save */
|
||||
case 75: /* wf-save */
|
||||
strncpy(wf_save_file, optarg, sizeof(wf_save_file));
|
||||
wf_save_file[sizeof(wf_save_file) - 1] = '\0';
|
||||
break;
|
||||
case 75: /* ssid-filter */
|
||||
case 76: /* ssid-filter */
|
||||
hash_ssid_filter=hash_jen(optarg,strlen(optarg));
|
||||
{
|
||||
char *e,*p = optarg;
|
||||
@ -2337,7 +2342,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 76: /* nlm-filter */
|
||||
case 77: /* nlm-filter */
|
||||
hash_nlm_filter=hash_jen(optarg,strlen(optarg));
|
||||
{
|
||||
char *e,*p = optarg;
|
||||
@ -2355,7 +2360,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 77: /* nlm-list */
|
||||
case 78: /* nlm-list */
|
||||
if (!nlm_list(optarg && !strcmp(optarg,"all")))
|
||||
{
|
||||
DLOG_ERR("could not get list of NLM networks\n");
|
||||
|
115
tpws/tpws.c
115
tpws/tpws.c
@ -218,6 +218,7 @@ static void exithelp(void)
|
||||
" --debug=0|1|2|syslog|@<filename>\t; 1 and 2 means log to console and set debug level. for other targets use --debug-level.\n"
|
||||
" --debug-level=0|1|2\t\t\t; specify debug level\n"
|
||||
" --dry-run\t\t\t\t; verify parameters and exit with code 0 if successful\n"
|
||||
" --version\t\t\t\t; print version and exit\n"
|
||||
" --comment=any_text\n"
|
||||
"\nMULTI-STRATEGY:\n"
|
||||
" --new\t\t\t\t\t; begin new strategy\n"
|
||||
@ -712,41 +713,42 @@ void parse_params(int argc, char *argv[])
|
||||
{ "debug",optional_argument,0,0 },// optidx=45
|
||||
{ "debug-level",required_argument,0,0 },// optidx=46
|
||||
{ "dry-run",no_argument,0,0 },// optidx=47
|
||||
{ "comment",optional_argument,0,0 },// optidx=48
|
||||
{ "local-rcvbuf",required_argument,0,0 },// optidx=49
|
||||
{ "local-sndbuf",required_argument,0,0 },// optidx=50
|
||||
{ "remote-rcvbuf",required_argument,0,0 },// optidx=51
|
||||
{ "remote-sndbuf",required_argument,0,0 },// optidx=52
|
||||
{ "socks",no_argument,0,0 },// optidx=53
|
||||
{ "no-resolve",no_argument,0,0 },// optidx=54
|
||||
{ "resolver-threads",required_argument,0,0 },// optidx=55
|
||||
{ "skip-nodelay",no_argument,0,0 },// optidx=56
|
||||
{ "tamper-start",required_argument,0,0 },// optidx=57
|
||||
{ "tamper-cutoff",required_argument,0,0 },// optidx=58
|
||||
{ "connect-bind-addr",required_argument,0,0 },// optidx=59
|
||||
{ "version",no_argument,0,0 },// optidx=48
|
||||
{ "comment",optional_argument,0,0 },// optidx=49
|
||||
{ "local-rcvbuf",required_argument,0,0 },// optidx=50
|
||||
{ "local-sndbuf",required_argument,0,0 },// optidx=51
|
||||
{ "remote-rcvbuf",required_argument,0,0 },// optidx=52
|
||||
{ "remote-sndbuf",required_argument,0,0 },// optidx=53
|
||||
{ "socks",no_argument,0,0 },// optidx=54
|
||||
{ "no-resolve",no_argument,0,0 },// optidx=55
|
||||
{ "resolver-threads",required_argument,0,0 },// optidx=56
|
||||
{ "skip-nodelay",no_argument,0,0 },// optidx=57
|
||||
{ "tamper-start",required_argument,0,0 },// optidx=58
|
||||
{ "tamper-cutoff",required_argument,0,0 },// optidx=59
|
||||
{ "connect-bind-addr",required_argument,0,0 },// optidx=60
|
||||
|
||||
{ "new",no_argument,0,0 }, // optidx=60
|
||||
{ "skip",no_argument,0,0 }, // optidx=61
|
||||
{ "filter-l3",required_argument,0,0 }, // optidx=62
|
||||
{ "filter-tcp",required_argument,0,0 }, // optidx=63
|
||||
{ "filter-l7",required_argument,0,0 }, // optidx=64
|
||||
{ "ipset",required_argument,0,0 }, // optidx=65
|
||||
{ "ipset-ip",required_argument,0,0 }, // optidx=66
|
||||
{ "ipset-exclude",required_argument,0,0 }, // optidx=67
|
||||
{ "ipset-exclude-ip",required_argument,0,0 }, // optidx=68
|
||||
{ "new",no_argument,0,0 }, // optidx=61
|
||||
{ "skip",no_argument,0,0 }, // optidx=62
|
||||
{ "filter-l3",required_argument,0,0 }, // optidx=63
|
||||
{ "filter-tcp",required_argument,0,0 }, // optidx=64
|
||||
{ "filter-l7",required_argument,0,0 }, // optidx=65
|
||||
{ "ipset",required_argument,0,0 }, // optidx=66
|
||||
{ "ipset-ip",required_argument,0,0 }, // optidx=67
|
||||
{ "ipset-exclude",required_argument,0,0 }, // optidx=68
|
||||
{ "ipset-exclude-ip",required_argument,0,0 }, // optidx=69
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
{ "enable-pf",no_argument,0,0 },// optidx=69
|
||||
#elif defined(__APPLE__)
|
||||
{ "local-tcp-user-timeout",required_argument,0,0 }, // optidx=69
|
||||
{ "remote-tcp-user-timeout",required_argument,0,0 }, // optidx=70
|
||||
{ "local-tcp-user-timeout",required_argument,0,0 }, // optidx=79
|
||||
{ "remote-tcp-user-timeout",required_argument,0,0 }, // optidx=71
|
||||
#elif defined(__linux__)
|
||||
{ "local-tcp-user-timeout",required_argument,0,0 }, // optidx=69
|
||||
{ "remote-tcp-user-timeout",required_argument,0,0 }, // optidx=70
|
||||
{ "mss",required_argument,0,0 }, // optidx=71
|
||||
{ "fix-seg",optional_argument,0,0 }, // optidx=72
|
||||
{ "local-tcp-user-timeout",required_argument,0,0 }, // optidx=70
|
||||
{ "remote-tcp-user-timeout",required_argument,0,0 }, // optidx=71
|
||||
{ "mss",required_argument,0,0 }, // optidx=72
|
||||
{ "fix-seg",optional_argument,0,0 }, // optidx=73
|
||||
#ifdef SPLICE_PRESENT
|
||||
{ "nosplice",no_argument,0,0 }, // optidx=73
|
||||
{ "nosplice",no_argument,0,0 }, // optidx=74
|
||||
#endif
|
||||
#endif
|
||||
{ "hostlist-auto-retrans-threshold",optional_argument,0,0}, // ignored. for nfqws command line compatibility
|
||||
@ -1197,43 +1199,46 @@ void parse_params(int argc, char *argv[])
|
||||
case 47: /* dry-run */
|
||||
bDry = true;
|
||||
break;
|
||||
case 48: /* comment */
|
||||
case 48: /* version */
|
||||
exit_clean(0);
|
||||
break;
|
||||
case 49: /* local-rcvbuf */
|
||||
case 49: /* comment */
|
||||
break;
|
||||
case 50: /* local-rcvbuf */
|
||||
#ifdef __linux__
|
||||
params.local_rcvbuf = atoi(optarg)/2;
|
||||
#else
|
||||
params.local_rcvbuf = atoi(optarg);
|
||||
#endif
|
||||
break;
|
||||
case 50: /* local-sndbuf */
|
||||
case 51: /* local-sndbuf */
|
||||
#ifdef __linux__
|
||||
params.local_sndbuf = atoi(optarg)/2;
|
||||
#else
|
||||
params.local_sndbuf = atoi(optarg);
|
||||
#endif
|
||||
break;
|
||||
case 51: /* remote-rcvbuf */
|
||||
case 52: /* remote-rcvbuf */
|
||||
#ifdef __linux__
|
||||
params.remote_rcvbuf = atoi(optarg)/2;
|
||||
#else
|
||||
params.remote_rcvbuf = atoi(optarg);
|
||||
#endif
|
||||
break;
|
||||
case 52: /* remote-sndbuf */
|
||||
case 53: /* remote-sndbuf */
|
||||
#ifdef __linux__
|
||||
params.remote_sndbuf = atoi(optarg)/2;
|
||||
#else
|
||||
params.remote_sndbuf = atoi(optarg);
|
||||
#endif
|
||||
break;
|
||||
case 53: /* socks */
|
||||
case 54: /* socks */
|
||||
params.proxy_type = CONN_TYPE_SOCKS;
|
||||
break;
|
||||
case 54: /* no-resolve */
|
||||
case 55: /* no-resolve */
|
||||
params.no_resolve = true;
|
||||
break;
|
||||
case 55: /* resolver-threads */
|
||||
case 56: /* resolver-threads */
|
||||
params.resolver_threads = atoi(optarg);
|
||||
if (params.resolver_threads<1 || params.resolver_threads>300)
|
||||
{
|
||||
@ -1241,10 +1246,10 @@ void parse_params(int argc, char *argv[])
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 56: /* skip-nodelay */
|
||||
case 57: /* skip-nodelay */
|
||||
params.skip_nodelay = true;
|
||||
break;
|
||||
case 57: /* tamper-start */
|
||||
case 58: /* tamper-start */
|
||||
{
|
||||
const char *p=optarg;
|
||||
if (*p=='n')
|
||||
@ -1258,7 +1263,7 @@ void parse_params(int argc, char *argv[])
|
||||
}
|
||||
params.tamper_lim = true;
|
||||
break;
|
||||
case 58: /* tamper-cutoff */
|
||||
case 59: /* tamper-cutoff */
|
||||
{
|
||||
const char *p=optarg;
|
||||
if (*p=='n')
|
||||
@ -1272,7 +1277,7 @@ void parse_params(int argc, char *argv[])
|
||||
}
|
||||
params.tamper_lim = true;
|
||||
break;
|
||||
case 59: /* connect-bind-addr */
|
||||
case 60: /* connect-bind-addr */
|
||||
{
|
||||
char *p = strchr(optarg,'%');
|
||||
if (p) *p++=0;
|
||||
@ -1300,7 +1305,7 @@ void parse_params(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
|
||||
case 60: /* new */
|
||||
case 61: /* new */
|
||||
if (bSkip)
|
||||
{
|
||||
dp_clear(dp);
|
||||
@ -1321,31 +1326,31 @@ void parse_params(int argc, char *argv[])
|
||||
anon_hl = anon_hl_exclude = NULL;
|
||||
anon_ips = anon_ips_exclude = NULL;
|
||||
break;
|
||||
case 61: /* skip */
|
||||
case 62: /* skip */
|
||||
bSkip = true;
|
||||
break;
|
||||
case 62: /* filter-l3 */
|
||||
case 63: /* 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 63: /* filter-tcp */
|
||||
case 64: /* filter-tcp */
|
||||
if (!parse_pf_list(optarg,&dp->pf_tcp))
|
||||
{
|
||||
DLOG_ERR("Invalid port filter : %s\n",optarg);
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 64: /* filter-l7 */
|
||||
case 65: /* filter-l7 */
|
||||
if (!parse_l7_list(optarg,&dp->filter_l7))
|
||||
{
|
||||
DLOG_ERR("Invalid l7 filter : %s\n",optarg);
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 65: /* ipset */
|
||||
case 66: /* ipset */
|
||||
if (bSkip) break;
|
||||
if (!RegisterIpset(dp, false, optarg))
|
||||
{
|
||||
@ -1354,7 +1359,7 @@ void parse_params(int argc, char *argv[])
|
||||
}
|
||||
params.tamper = true;
|
||||
break;
|
||||
case 66: /* ipset-ip */
|
||||
case 67: /* ipset-ip */
|
||||
if (bSkip) break;
|
||||
if (!anon_ips && !(anon_ips=RegisterIpset(dp, false, NULL)))
|
||||
{
|
||||
@ -1368,7 +1373,7 @@ void parse_params(int argc, char *argv[])
|
||||
}
|
||||
params.tamper = true;
|
||||
break;
|
||||
case 67: /* ipset-exclude */
|
||||
case 68: /* ipset-exclude */
|
||||
if (bSkip) break;
|
||||
if (!RegisterIpset(dp, true, optarg))
|
||||
{
|
||||
@ -1377,7 +1382,7 @@ void parse_params(int argc, char *argv[])
|
||||
}
|
||||
params.tamper = true;
|
||||
break;
|
||||
case 68: /* ipset-exclude-ip */
|
||||
case 69: /* ipset-exclude-ip */
|
||||
if (bSkip) break;
|
||||
if (!anon_ips_exclude && !(anon_ips_exclude=RegisterIpset(dp, true, NULL)))
|
||||
{
|
||||
@ -1393,11 +1398,11 @@ void parse_params(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
case 69: /* enable-pf */
|
||||
case 70: /* enable-pf */
|
||||
params.pf_enable = true;
|
||||
break;
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
case 69: /* local-tcp-user-timeout */
|
||||
case 70: /* local-tcp-user-timeout */
|
||||
params.tcp_user_timeout_local = atoi(optarg);
|
||||
if (params.tcp_user_timeout_local<0 || params.tcp_user_timeout_local>86400)
|
||||
{
|
||||
@ -1405,7 +1410,7 @@ void parse_params(int argc, char *argv[])
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 70: /* remote-tcp-user-timeout */
|
||||
case 71: /* remote-tcp-user-timeout */
|
||||
params.tcp_user_timeout_remote = atoi(optarg);
|
||||
if (params.tcp_user_timeout_remote<0 || params.tcp_user_timeout_remote>86400)
|
||||
{
|
||||
@ -1416,7 +1421,7 @@ void parse_params(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
case 71: /* mss */
|
||||
case 72: /* mss */
|
||||
// this option does not work in any BSD and MacOS. OS may accept but it changes nothing
|
||||
dp->mss = atoi(optarg);
|
||||
if (dp->mss<88 || dp->mss>32767)
|
||||
@ -1425,7 +1430,7 @@ void parse_params(int argc, char *argv[])
|
||||
exit_clean(1);
|
||||
}
|
||||
break;
|
||||
case 72: /* fix-seg */
|
||||
case 73: /* fix-seg */
|
||||
if (!params.fix_seg_avail)
|
||||
{
|
||||
DLOG_ERR("--fix-seg is supported since kernel 4.6\n");
|
||||
@ -1445,7 +1450,7 @@ void parse_params(int argc, char *argv[])
|
||||
params.fix_seg = FIX_SEG_DEFAULT_MAX_WAIT;
|
||||
break;
|
||||
#ifdef SPLICE_PRESENT
|
||||
case 73: /* nosplice */
|
||||
case 74: /* nosplice */
|
||||
params.nosplice = true;
|
||||
break;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user