summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter
diff options
context:
space:
mode:
authorcy <cy@FreeBSD.org>2014-09-22 16:21:25 +0000
committercy <cy@FreeBSD.org>2014-09-22 16:21:25 +0000
commit8937a6a4b7239cc2c03e57e014f1bcaee1c6c688 (patch)
treec214aa21b83d365f8d56d16bb062ff7b9d84bd71 /contrib/ipfilter
parent8f082668d04c6a91668059ff9bdebcfa153839f0 (diff)
downloadFreeBSD-src-8937a6a4b7239cc2c03e57e014f1bcaee1c6c688.zip
FreeBSD-src-8937a6a4b7239cc2c03e57e014f1bcaee1c6c688.tar.gz
3561691 gethost never returns an ipv6 address
Approved by: glebius (mentor) 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.y16
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",
OpenPOWER on IntegriCloud