Browse Source

support command-line ipv6 addresses given in [] format

git.mgm/mediaproxy-ng/2.0
Richard Fuchs 14 years ago
parent
commit
8bc2f0505d
2 changed files with 10 additions and 2 deletions
  1. +8
    -0
      daemon/aux.h
  2. +2
    -2
      daemon/main.c

+ 8
- 0
daemon/aux.h View File

@ -113,6 +113,14 @@ static inline void smart_ntop(char *o, struct in6_addr *a, size_t len) {
inet_ntop(AF_INET6, a, o, len);
}
static inline int smart_pton(int af, const char *src, void *dst) {
if (af == AF_INET6) {
if (src[0] == '[')
return inet_pton(af, src+1, dst);
}
return inet_pton(af, src, dst);
}
#endif

+ 2
- 2
daemon/main.c View File

@ -197,11 +197,11 @@ static void options(int *argc, char ***argv) {
}
if (ipv6s) {
if (inet_pton(AF_INET6, ipv6s, &ipv6) != 1)
if (smart_pton(AF_INET6, ipv6s, &ipv6) != 1)
die("Invalid IPv6 address (--ip6)\n");
}
if (adv_ipv6s) {
if (inet_pton(AF_INET6, adv_ipv6s, &adv_ipv6) != 1)
if (smart_pton(AF_INET6, adv_ipv6s, &adv_ipv6) != 1)
die("Invalid IPv6 address (--advertised-ip6)\n");
}


Loading…
Cancel
Save