Browse Source

Fix typo

pull/778/head
Max Lv 8 years ago
parent
commit
5812840b24
7 changed files with 20 additions and 1 deletions
  1. 1
      src/local.c
  2. 14
      src/manager.c
  3. 1
      src/manager.h
  4. 1
      src/redir.c
  5. 1
      src/server.c
  6. 1
      src/tunnel.c
  7. 2
      src/utils.c

1
src/local.c

@ -1121,6 +1121,7 @@ int main(int argc, char **argv)
#endif #endif
case '?': case '?':
// The option character is not recognized. // The option character is not recognized.
LOGE("Unrecognized option: %s", optarg);
opterr = 1; opterr = 1;
break; break;
} }

14
src/manager.c

@ -159,6 +159,10 @@ static char *construct_command_line(struct manager_ctx *manager, struct server *
int len = strlen(cmd); int len = strlen(cmd);
snprintf(cmd + len, BUF_SIZE - len, " --fast-open"); snprintf(cmd + len, BUF_SIZE - len, " --fast-open");
} }
if (manager->mtu) {
int len = strlen(cmd);
snprintf(cmd + len, BUF_SIZE - len, " --mtu %d", manager->mtu);
}
for (i = 0; i < manager->nameserver_num; i++) { for (i = 0; i < manager->nameserver_num; i++) {
int len = strlen(cmd); int len = strlen(cmd);
snprintf(cmd + len, BUF_SIZE - len, " -d %s", manager->nameservers[i]); snprintf(cmd + len, BUF_SIZE - len, " -d %s", manager->nameservers[i]);
@ -589,6 +593,7 @@ int main(int argc, char **argv)
int auth = 0; int auth = 0;
int fast_open = 0; int fast_open = 0;
int mode = TCP_ONLY; int mode = TCP_ONLY;
int mtu = 0;
int server_num = 0; int server_num = 0;
char *server_host[MAX_REMOTE_NUM]; char *server_host[MAX_REMOTE_NUM];
@ -604,6 +609,7 @@ int main(int argc, char **argv)
{ "acl" , required_argument, 0, 0 }, { "acl" , required_argument, 0, 0 },
{ "manager-address", required_argument, 0, 0 }, { "manager-address", required_argument, 0, 0 },
{ "executable" , required_argument, 0, 0 }, { "executable" , required_argument, 0, 0 },
{ "mtu" , required_argument, 0, 0 },
{ "help" , no_argument , 0, 0 }, { "help" , no_argument , 0, 0 },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
@ -625,6 +631,9 @@ int main(int argc, char **argv)
} else if (option_index == 3) { } else if (option_index == 3) {
executable = optarg; executable = optarg;
} else if (option_index == 4) { } else if (option_index == 4) {
mtu = atoi(optarg);
LOGI("set MTU to %d", mtu);
} else if (option_index == 5) {
usage(); usage();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
@ -678,6 +687,7 @@ int main(int argc, char **argv)
break; break;
case '?': case '?':
// The option character is not recognized. // The option character is not recognized.
LOGE("Unrecognized option: %s", optarg);
opterr = 1; opterr = 1;
break; break;
} }
@ -717,6 +727,9 @@ int main(int argc, char **argv)
if (mode == TCP_ONLY) { if (mode == TCP_ONLY) {
mode = conf->mode; mode = conf->mode;
} }
if (mtu == 0) {
mtu = conf->mtu;
}
} }
if (server_num == 0) { if (server_num == 0) {
@ -787,6 +800,7 @@ int main(int argc, char **argv)
manager.host_num = server_num; manager.host_num = server_num;
manager.nameservers = nameservers; manager.nameservers = nameservers;
manager.nameserver_num = nameserver_num; manager.nameserver_num = nameserver_num;
manager.mtu = mtu;
// initialize ev loop // initialize ev loop
struct ev_loop *loop = EV_DEFAULT; struct ev_loop *loop = EV_DEFAULT;

1
src/manager.h

@ -49,6 +49,7 @@ struct manager_ctx {
int host_num; int host_num;
char **nameservers; char **nameservers;
int nameserver_num; int nameserver_num;
int mtu;
}; };
struct server { struct server {

1
src/redir.c

@ -789,6 +789,7 @@ int main(int argc, char **argv)
break; break;
case '?': case '?':
// The option character is not recognized. // The option character is not recognized.
LOGE("Unrecognized option: %s", optarg);
opterr = 1; opterr = 1;
break; break;
} }

1
src/server.c

@ -1544,6 +1544,7 @@ int main(int argc, char **argv)
break; break;
case '?': case '?':
// The option character is not recognized. // The option character is not recognized.
LOGE("Unrecognized option: %s", optarg);
opterr = 1; opterr = 1;
break; break;
} }

1
src/tunnel.c

@ -829,6 +829,7 @@ int main(int argc, char **argv)
#endif #endif
case '?': case '?':
// The option character is not recognized. // The option character is not recognized.
LOGE("Unrecognized option: %s", optarg);
opterr = 1; opterr = 1;
break; break;
} }

2
src/utils.c

@ -267,7 +267,7 @@ void usage()
" [-b <local_address>] Local address to bind.\n"); " [-b <local_address>] Local address to bind.\n");
printf("\n"); printf("\n");
printf( printf(
" [-u] Enable UDP relay,\n");
" [-u] Enable UDP relay.\n");
#ifdef MODULE_REDIR #ifdef MODULE_REDIR
printf( printf(
" TPROXY is required in redir mode.\n"); " TPROXY is required in redir mode.\n");

Loading…
Cancel
Save