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",
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to