Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 2020 08:08:54 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358871 - head/sbin/ipfw
Message-ID:  <202003110808.02B88sst052315@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Wed Mar 11 08:08:53 2020
New Revision: 358871
URL: https://svnweb.freebsd.org/changeset/base/358871

Log:
  Revert r358858 as it breaks some ipfw(8) setups.
  
  Reported by:	O. Hartmann <o.hartmann@walstatt.org>

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Wed Mar 11 05:45:33 2020	(r358870)
+++ head/sbin/ipfw/ipfw2.c	Wed Mar 11 08:08:53 2020	(r358871)
@@ -3717,10 +3717,11 @@ add_src(ipfw_insn *cmd, char *av, u_char proto, int cb
 	if (proto == IPPROTO_IPV6  || strcmp(av, "me6") == 0 ||
 	    inet_pton(AF_INET6, host, &a) == 1)
 		ret = add_srcip6(cmd, av, cblen, tstate);
-	else if (proto == IPPROTO_IP || strcmp(av, "me") == 0 ||
-	    inet_pton(AF_INET, host, &a) == 1)
+	/* XXX: should check for IPv4, not !IPv6 */
+	if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 ||
+	    inet_pton(AF_INET6, host, &a) != 1))
 		ret = add_srcip(cmd, av, cblen, tstate);
-	else if (ret == NULL && strcmp(av, "any") != 0)
+	if (ret == NULL && strcmp(av, "any") != 0)
 		ret = cmd;
 
 	return ret;
@@ -3747,10 +3748,11 @@ add_dst(ipfw_insn *cmd, char *av, u_char proto, int cb
 	if (proto == IPPROTO_IPV6  || strcmp(av, "me6") == 0 ||
 	    inet_pton(AF_INET6, host, &a) == 1)
 		ret = add_dstip6(cmd, av, cblen, tstate);
-	else if (proto == IPPROTO_IP || strcmp(av, "me") == 0 ||
-	    inet_pton(AF_INET, host, &a) == 1)
+	/* XXX: should check for IPv4, not !IPv6 */
+	if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 ||
+	    inet_pton(AF_INET6, host, &a) != 1))
 		ret = add_dstip(cmd, av, cblen, tstate);
-	else if (ret == NULL && strcmp(av, "any") != 0)
+	if (ret == NULL && strcmp(av, "any") != 0)
 		ret = cmd;
 
 	return ret;



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