Browse Source

Fix #1016

pull/1022/head
Max Lv 8 years ago
parent
commit
2694e86bd9
2 changed files with 14 additions and 1 deletions
  1. 14
      src/manager.c
  2. 1
      src/manager.h

14
src/manager.c

@ -168,6 +168,10 @@ construct_command_line(struct manager_ctx *manager, struct server *server)
int len = strlen(cmd);
snprintf(cmd + len, BUF_SIZE - len, " --fast-open");
}
if (manager->ipv6first) {
int len = strlen(cmd);
snprintf(cmd + len, BUF_SIZE - len, " -6");
}
if (manager->mtu) {
int len = strlen(cmd);
snprintf(cmd + len, BUF_SIZE - len, " --mtu %d", manager->mtu);
@ -621,6 +625,7 @@ main(int argc, char **argv)
int fast_open = 0;
int mode = TCP_ONLY;
int mtu = 0;
int ipv6first = 0;
#ifdef HAVE_SETRLIMIT
static int nofile = 0;
@ -650,7 +655,7 @@ main(int argc, char **argv)
USE_TTY();
while ((c = getopt_long(argc, argv, "f:s:l:k:t:m:c:i:d:a:n:huUvA",
while ((c = getopt_long(argc, argv, "f:s:l:k:t:m:c:i:d:a:n:6huUvA",
long_options, &option_index)) != -1)
switch (c) {
case 0:
@ -709,6 +714,9 @@ main(int argc, char **argv)
case 'U':
mode = UDP_ONLY;
break;
case '6':
ipv6first = 1;
break;
case 'v':
verbose = 1;
break;
@ -774,6 +782,9 @@ main(int argc, char **argv)
if (obfs == 0) {
obfs = conf->obfs;
}
if (ipv6first == 0) {
ipv6first = conf->ipv6_first;
}
#ifdef HAVE_SETRLIMIT
if (nofile == 0) {
nofile = conf->nofile;
@ -851,6 +862,7 @@ main(int argc, char **argv)
manager.nameserver_num = nameserver_num;
manager.mtu = mtu;
manager.obfs = obfs;
manager.ipv6first = ipv6first;
#ifdef HAVE_SETRLIMIT
manager.nofile = nofile;
#endif

1
src/manager.h

@ -51,6 +51,7 @@ struct manager_ctx {
char **nameservers;
int nameserver_num;
int mtu;
int ipv6first;
#ifdef HAVE_SETRLIMIT
int nofile;
#endif

Loading…
Cancel
Save