diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-04-17 13:30:19 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-04-17 13:30:19 +0200 |
commit | d518cb32327492ad73c4583bb69d1d678410a631 (patch) | |
tree | eca21051f65d6271b36d07a8d0250da9187e0949 | |
parent | 9d83bd3c524c4bbeb8e6583155dd7df9e8a1b5d3 (diff) |
Accept square bracket notation for IPv6 addresses
-rw-r--r-- | main.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -103,6 +103,7 @@ static int add_listener_arg(char *arg, bool tls) char *host = NULL; char *port = arg; char *s; + int l; s = strrchr(arg, ':'); if (s) { @@ -111,6 +112,14 @@ static int add_listener_arg(char *arg, bool tls) *s = 0; } + if (host && *host == '[') { + l = strlen(host); + if (l >= 2) { + host[l-1] = 0; + host++; + } + } + return uh_socket_bind(host, port, tls); } |