From 5812840b24c56bf64126ab5a6538cd16cfd125e7 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Fri, 26 Aug 2016 09:19:38 +0800 Subject: [PATCH] Fix typo --- src/local.c | 1 + src/manager.c | 14 ++++++++++++++ src/manager.h | 1 + src/redir.c | 1 + src/server.c | 1 + src/tunnel.c | 1 + src/utils.c | 2 +- 7 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/local.c b/src/local.c index 4a42a703..7018eb9f 100644 --- a/src/local.c +++ b/src/local.c @@ -1121,6 +1121,7 @@ int main(int argc, char **argv) #endif case '?': // The option character is not recognized. + LOGE("Unrecognized option: %s", optarg); opterr = 1; break; } diff --git a/src/manager.c b/src/manager.c index 5c0b7bc9..82936f5a 100644 --- a/src/manager.c +++ b/src/manager.c @@ -159,6 +159,10 @@ static char *construct_command_line(struct manager_ctx *manager, struct server * int len = strlen(cmd); 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++) { int len = strlen(cmd); 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 fast_open = 0; int mode = TCP_ONLY; + int mtu = 0; int server_num = 0; char *server_host[MAX_REMOTE_NUM]; @@ -604,6 +609,7 @@ int main(int argc, char **argv) { "acl" , required_argument, 0, 0 }, { "manager-address", required_argument, 0, 0 }, { "executable" , required_argument, 0, 0 }, + { "mtu" , required_argument, 0, 0 }, { "help" , no_argument , 0, 0 }, { 0, 0, 0, 0 } }; @@ -625,6 +631,9 @@ int main(int argc, char **argv) } else if (option_index == 3) { executable = optarg; } else if (option_index == 4) { + mtu = atoi(optarg); + LOGI("set MTU to %d", mtu); + } else if (option_index == 5) { usage(); exit(EXIT_SUCCESS); } @@ -678,6 +687,7 @@ int main(int argc, char **argv) break; case '?': // The option character is not recognized. + LOGE("Unrecognized option: %s", optarg); opterr = 1; break; } @@ -717,6 +727,9 @@ int main(int argc, char **argv) if (mode == TCP_ONLY) { mode = conf->mode; } + if (mtu == 0) { + mtu = conf->mtu; + } } if (server_num == 0) { @@ -787,6 +800,7 @@ int main(int argc, char **argv) manager.host_num = server_num; manager.nameservers = nameservers; manager.nameserver_num = nameserver_num; + manager.mtu = mtu; // initialize ev loop struct ev_loop *loop = EV_DEFAULT; diff --git a/src/manager.h b/src/manager.h index b3f1431f..af5fde1f 100644 --- a/src/manager.h +++ b/src/manager.h @@ -49,6 +49,7 @@ struct manager_ctx { int host_num; char **nameservers; int nameserver_num; + int mtu; }; struct server { diff --git a/src/redir.c b/src/redir.c index 67977169..b775d858 100644 --- a/src/redir.c +++ b/src/redir.c @@ -789,6 +789,7 @@ int main(int argc, char **argv) break; case '?': // The option character is not recognized. + LOGE("Unrecognized option: %s", optarg); opterr = 1; break; } diff --git a/src/server.c b/src/server.c index 28039a7a..39298e3b 100644 --- a/src/server.c +++ b/src/server.c @@ -1544,6 +1544,7 @@ int main(int argc, char **argv) break; case '?': // The option character is not recognized. + LOGE("Unrecognized option: %s", optarg); opterr = 1; break; } diff --git a/src/tunnel.c b/src/tunnel.c index ac70bd98..329cb9e2 100644 --- a/src/tunnel.c +++ b/src/tunnel.c @@ -829,6 +829,7 @@ int main(int argc, char **argv) #endif case '?': // The option character is not recognized. + LOGE("Unrecognized option: %s", optarg); opterr = 1; break; } diff --git a/src/utils.c b/src/utils.c index 3d745b9d..eddefa22 100644 --- a/src/utils.c +++ b/src/utils.c @@ -267,7 +267,7 @@ void usage() " [-b ] Local address to bind.\n"); printf("\n"); printf( - " [-u] Enable UDP relay,\n"); + " [-u] Enable UDP relay.\n"); #ifdef MODULE_REDIR printf( " TPROXY is required in redir mode.\n");