summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/mbbsd.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index ed4706b1..5f27d0bd 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1768,6 +1768,24 @@ bool parse_argv(int argc, char *argv[], struct ProgramOption *option)
}
}
+ if ( option->tunnel_mode && option->nport)
+ {
+ // should we do so?
+ signal_restart(SIGCHLD, reapchild);
+
+ // dual mode: we need to fork.
+ if (fork() == 0)
+ {
+ // ports daemon
+ option->tunnel_mode = false;
+ free(option->flag_tunnel_path);
+ option->flag_tunnel_path = NULL;
+ } else {
+ // tunnel mode daemon
+ option->nport = 0;
+ }
+ }
+
if ( option->tunnel_mode && option->nport != 0) {
fprintf(stderr, "you cannot bind ports port in tunnel mode.\n");
return false;