diff options
author | cy <cy@FreeBSD.org> | 2014-10-12 16:58:45 +0000 |
---|---|---|
committer | cy <cy@FreeBSD.org> | 2014-10-12 16:58:45 +0000 |
commit | 23579b38ee472fc10536eec639dfc95ece1511fa (patch) | |
tree | 8e2535aa50bad20e87125f6040ae42ec326c5b09 /contrib/ipfilter | |
parent | 60a2447c51d9311672eac793a98aed47ddad7404 (diff) | |
download | FreeBSD-src-23579b38ee472fc10536eec639dfc95ece1511fa.zip FreeBSD-src-23579b38ee472fc10536eec639dfc95ece1511fa.tar.gz |
MFC r271977
3561691 gethost never returns an ipv6 address
Obtained from: ipfilter CVS repo (r1.34), netbsd CVS repo (r1.4)
Diffstat (limited to 'contrib/ipfilter')
-rw-r--r-- | contrib/ipfilter/tools/ipnat_y.y | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/ipfilter/tools/ipnat_y.y b/contrib/ipfilter/tools/ipnat_y.y index 71fb8ee..b8d22f9 100644 --- a/contrib/ipfilter/tools/ipnat_y.y +++ b/contrib/ipfilter/tools/ipnat_y.y @@ -1164,17 +1164,19 @@ hexnumber: hostname: YY_STR { i6addr_t addr; + int family; +#ifdef USE_INET6 + if (nat->in_v[0] == 6) + family = AF_INET6; + else +#endif + family = AF_INET; bzero(&$$, sizeof($$)); - if (gethost(AF_INET, $1, - &addr) == 0) { - $$.a = addr; - $$.f = AF_INET; - } else - if (gethost(AF_INET6, $1, + $$.f = family; + if (gethost(family, $1, &addr) == 0) { $$.a = addr; - $$.f = AF_INET6; } else { FPRINTF(stderr, "Unknown host '%s'\n", |