mirror of
https://github.com/Waujito/youtubeUnblock.git
synced 2026-01-30 22:20:33 +03:00
Allow to disable conntrack in userspace
This commit is contained in:
@@ -198,7 +198,9 @@ Flags that do not scoped to a specific section, used over all the youtubeUnblock
|
|||||||
|
|
||||||
- `--instaflush` Used with tracing. Flushes the buffer instantly, without waiting for explicit new line. Highly useful for debugging crushes.
|
- `--instaflush` Used with tracing. Flushes the buffer instantly, without waiting for explicit new line. Highly useful for debugging crushes.
|
||||||
|
|
||||||
- `--no-gso` Disables support for Google Chrome fat packets which uses GSO. This feature is well tested now, so this flag probably won't fix anything.
|
- `--no-gso` Disables support for TCP fat packets which uses GSO. This feature is well tested now, so this flag probably won't fix anything.
|
||||||
|
|
||||||
|
- `--no-conntrack` Disables support for conntrack in youtubeUnblock.
|
||||||
|
|
||||||
- `--no-ipv6` Disables support for ipv6. May be useful if you don't want for ipv6 socket to be opened.
|
- `--no-ipv6` Disables support for ipv6. May be useful if you don't want for ipv6 socket to be opened.
|
||||||
|
|
||||||
|
|||||||
19
src/args.c
19
src/args.c
@@ -273,6 +273,7 @@ enum {
|
|||||||
OPT_THREADS,
|
OPT_THREADS,
|
||||||
OPT_SILENT,
|
OPT_SILENT,
|
||||||
OPT_NO_GSO,
|
OPT_NO_GSO,
|
||||||
|
OPT_NO_CONNTRACK,
|
||||||
OPT_QUEUE_NUM,
|
OPT_QUEUE_NUM,
|
||||||
OPT_UDP_MODE,
|
OPT_UDP_MODE,
|
||||||
OPT_UDP_FAKE_SEQ_LEN,
|
OPT_UDP_FAKE_SEQ_LEN,
|
||||||
@@ -322,6 +323,7 @@ static struct option long_opt[] = {
|
|||||||
{"trace", 0, 0, OPT_TRACE},
|
{"trace", 0, 0, OPT_TRACE},
|
||||||
{"instaflush", 0, 0, OPT_INSTAFLUSH},
|
{"instaflush", 0, 0, OPT_INSTAFLUSH},
|
||||||
{"no-gso", 0, 0, OPT_NO_GSO},
|
{"no-gso", 0, 0, OPT_NO_GSO},
|
||||||
|
{"no-conntrack", 0, 0, OPT_NO_CONNTRACK},
|
||||||
{"no-ipv6", 0, 0, OPT_NO_IPV6},
|
{"no-ipv6", 0, 0, OPT_NO_IPV6},
|
||||||
{"daemonize", 0, 0, OPT_DAEMONIZE},
|
{"daemonize", 0, 0, OPT_DAEMONIZE},
|
||||||
{"noclose", 0, 0, OPT_NOCLOSE},
|
{"noclose", 0, 0, OPT_NOCLOSE},
|
||||||
@@ -386,6 +388,7 @@ void print_usage(const char *argv0) {
|
|||||||
printf("\t--trace\n");
|
printf("\t--trace\n");
|
||||||
printf("\t--instaflush\n");
|
printf("\t--instaflush\n");
|
||||||
printf("\t--no-gso\n");
|
printf("\t--no-gso\n");
|
||||||
|
printf("\t--no-conntrack\n");
|
||||||
printf("\t--no-ipv6\n");
|
printf("\t--no-ipv6\n");
|
||||||
printf("\t--daemonize\n");
|
printf("\t--daemonize\n");
|
||||||
printf("\t--noclose\n");
|
printf("\t--noclose\n");
|
||||||
@@ -459,7 +462,20 @@ int yparse_args(int argc, char *argv[]) {
|
|||||||
rep_config.verbose = VERBOSE_INFO;
|
rep_config.verbose = VERBOSE_INFO;
|
||||||
break;
|
break;
|
||||||
case OPT_NO_GSO:
|
case OPT_NO_GSO:
|
||||||
|
#ifndef KERNEL_SPACE
|
||||||
rep_config.use_gso = 0;
|
rep_config.use_gso = 0;
|
||||||
|
#else
|
||||||
|
lgerr("--no-gso is not supported in kernel space");
|
||||||
|
goto invalid_opt;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case OPT_NO_CONNTRACK:
|
||||||
|
#ifndef KERNEL_SPACE
|
||||||
|
rep_config.use_conntrack = 0;
|
||||||
|
#else
|
||||||
|
lgerr("--no-conntrack is not supported in kernel space. Compile with make kmake EXTRA_CFLAGS=\"-DNO_CONNTRACK\" instead." );
|
||||||
|
goto invalid_opt;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case OPT_NO_IPV6:
|
case OPT_NO_IPV6:
|
||||||
rep_config.use_ipv6 = 0;
|
rep_config.use_ipv6 = 0;
|
||||||
@@ -1017,6 +1033,9 @@ size_t print_config(char *buffer, size_t buffer_size) {
|
|||||||
if (!config.use_gso) {
|
if (!config.use_gso) {
|
||||||
print_cnf_buf("--no-gso");
|
print_cnf_buf("--no-gso");
|
||||||
}
|
}
|
||||||
|
if (!config.use_conntrack) {
|
||||||
|
print_cnf_buf("--no-conntrack");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KERNEL_SPACE
|
#ifdef KERNEL_SPACE
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ struct config_t {
|
|||||||
int threads;
|
int threads;
|
||||||
int use_gso;
|
int use_gso;
|
||||||
int use_ipv6;
|
int use_ipv6;
|
||||||
|
int use_conntrack;
|
||||||
unsigned int mark;
|
unsigned int mark;
|
||||||
int daemonize;
|
int daemonize;
|
||||||
// Same as daemon() noclose
|
// Same as daemon() noclose
|
||||||
@@ -269,6 +270,7 @@ enum {
|
|||||||
\
|
\
|
||||||
.verbose = VERBOSE_DEBUG, \
|
.verbose = VERBOSE_DEBUG, \
|
||||||
.use_gso = 1, \
|
.use_gso = 1, \
|
||||||
|
.use_conntrack = 1, \
|
||||||
\
|
\
|
||||||
.first_section = NULL, \
|
.first_section = NULL, \
|
||||||
.last_section = NULL, \
|
.last_section = NULL, \
|
||||||
|
|||||||
@@ -788,7 +788,9 @@ int init_queue(int queue_num) {
|
|||||||
if (config.use_gso) {
|
if (config.use_gso) {
|
||||||
cfg_mask |= NFQA_CFG_F_GSO;
|
cfg_mask |= NFQA_CFG_F_GSO;
|
||||||
}
|
}
|
||||||
cfg_mask |= NFQA_CFG_F_CONNTRACK;
|
if (config.use_conntrack) {
|
||||||
|
cfg_mask |= NFQA_CFG_F_CONNTRACK;
|
||||||
|
}
|
||||||
cfg_mask |= NFQA_CFG_F_FAIL_OPEN;
|
cfg_mask |= NFQA_CFG_F_FAIL_OPEN;
|
||||||
|
|
||||||
mnl_attr_put_u32(nlh, NFQA_CFG_FLAGS, htonl(cfg_flags));
|
mnl_attr_put_u32(nlh, NFQA_CFG_FLAGS, htonl(cfg_flags));
|
||||||
|
|||||||
Reference in New Issue
Block a user