miniupnpd: Allow to specify also port number in -o STUN: option

Also update help for -o STUN: option, it can take stun hostname too.
This commit is contained in:
Pali Rohár 2018-07-06 14:06:04 +02:00 committed by Thomas BERNARD
parent 6e5a88098d
commit e6011dc534
1 changed files with 7 additions and 1 deletions

View File

@ -1418,8 +1418,14 @@ init(int argc, char * * argv, struct runtime_vars * v)
if(i+1 < argc) { if(i+1 < argc) {
i++; i++;
if (0 == strncasecmp(argv[i], "STUN:", 5)) { if (0 == strncasecmp(argv[i], "STUN:", 5)) {
char *ptr;
SETFLAG(PERFORMSTUNMASK); SETFLAG(PERFORMSTUNMASK);
ext_stun_host = argv[i] + 5; ext_stun_host = argv[i] + 5;
ptr = strchr(ext_stun_host, ':');
if (ptr) {
ext_stun_port = atoi(ptr+1);
*ptr = 0;
}
} else } else
use_ext_ip_addr = argv[i]; use_ext_ip_addr = argv[i];
} else } else
@ -1860,7 +1866,7 @@ print_usage:
"\tDefault pid file is '%s'.\n" "\tDefault pid file is '%s'.\n"
"\tDefault config file is '%s'.\n" "\tDefault config file is '%s'.\n"
"\tWith -d miniupnpd will run as a standard program.\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) #if defined(USE_PF) || defined(USE_IPF)
"\t-L sets packet log in pf and ipf on.\n" "\t-L sets packet log in pf and ipf on.\n"
#endif #endif