From e6011dc534f25d6291b98668f62e7c012ed3062b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Fri, 6 Jul 2018 14:06:04 +0200 Subject: [PATCH] miniupnpd: Allow to specify also port number in -o STUN: option Also update help for -o STUN: option, it can take stun hostname too. --- miniupnpd/miniupnpd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/miniupnpd/miniupnpd.c b/miniupnpd/miniupnpd.c index 789f32a..722097f 100644 --- a/miniupnpd/miniupnpd.c +++ b/miniupnpd/miniupnpd.c @@ -1418,8 +1418,14 @@ init(int argc, char * * argv, struct runtime_vars * v) if(i+1 < argc) { i++; if (0 == strncasecmp(argv[i], "STUN:", 5)) { + char *ptr; SETFLAG(PERFORMSTUNMASK); ext_stun_host = argv[i] + 5; + ptr = strchr(ext_stun_host, ':'); + if (ptr) { + ext_stun_port = atoi(ptr+1); + *ptr = 0; + } } else use_ext_ip_addr = argv[i]; } else @@ -1860,7 +1866,7 @@ print_usage: "\tDefault pid file is '%s'.\n" "\tDefault config file is '%s'.\n" "\tWith -d miniupnpd will run as a standard program.\n" - "\t-o argument is either an IPv4 address or \"STUN:xx.xx.xx.xx\".\n" + "\t-o argument is either an IPv4 address or \"STUN:host[:port]\".\n" #if defined(USE_PF) || defined(USE_IPF) "\t-L sets packet log in pf and ipf on.\n" #endif