diff options
author | Cy Schubert <cy@FreeBSD.org> | 2014-09-22 16:21:25 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2014-09-22 16:21:25 +0000 |
commit | 19455ef7e4640426fd304f0f0eb2f7104ccad0ad (patch) | |
tree | c214aa21b83d365f8d56d16bb062ff7b9d84bd71 /contrib/ipfilter | |
parent | 9696feebe2320c9976607df4090f91a34c6549c3 (diff) | |
download | src-19455ef7e4640426fd304f0f0eb2f7104ccad0ad.tar.gz src-19455ef7e4640426fd304f0f0eb2f7104ccad0ad.zip |
3561691 gethost never returns an ipv6 address
Approved by: glebius (mentor)
Obtained from: ipfilter CVS repo (r1.34), netbsd CVS repo (r1.4)
Notes
Notes:
svn path=/head/; revision=271977
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 71fb8ee37106..b8d22f979e88 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", |