aboutsummaryrefslogtreecommitdiff
path: root/sbin/ipfw
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2020-03-11 08:08:53 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2020-03-11 08:08:53 +0000
commite3bf606c5d658e5fafb5d6168b0d4e7c9b0dd5ce (patch)
tree6b7c131b2182cb2ce66be6daa1b77d6923ad3d91 /sbin/ipfw
parentb0ecfb42d1705bc1423c726a16a182c81047f854 (diff)
downloadsrc-e3bf606c5d658e5fafb5d6168b0d4e7c9b0dd5ce.tar.gz
src-e3bf606c5d658e5fafb5d6168b0d4e7c9b0dd5ce.zip
Revert r358858 as it breaks some ipfw(8) setups.
Reported by: O. Hartmann <o.hartmann@walstatt.org>
Notes
Notes: svn path=/head/; revision=358871
Diffstat (limited to 'sbin/ipfw')
-rw-r--r--sbin/ipfw/ipfw2.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index b54ffc74ec9f..c81822782644 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -3717,10 +3717,11 @@ add_src(ipfw_insn *cmd, char *av, u_char proto, int cblen, struct tidx *tstate)
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 cblen, struct tidx *tstate)
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;