Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Sep 2014 16:21:25 +0000 (UTC)
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271977 - head/contrib/ipfilter/tools
Message-ID:  <201409221621.s8MGLPMx080451@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cy
Date: Mon Sep 22 16:21:25 2014
New Revision: 271977
URL: http://svnweb.freebsd.org/changeset/base/271977

Log:
  3561691 gethost never returns an ipv6 address
  
  Approved by:	glebius (mentor)
  Obtained from:	ipfilter CVS repo (r1.34), netbsd CVS repo (r1.4)

Modified:
  head/contrib/ipfilter/tools/ipnat_y.y

Modified: head/contrib/ipfilter/tools/ipnat_y.y
==============================================================================
--- head/contrib/ipfilter/tools/ipnat_y.y	Mon Sep 22 16:20:47 2014	(r271976)
+++ head/contrib/ipfilter/tools/ipnat_y.y	Mon Sep 22 16:21:25 2014	(r271977)
@@ -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",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409221621.s8MGLPMx080451>