diff options
| author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2020-03-11 08:08:53 +0000 |
|---|---|---|
| committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2020-03-11 08:08:53 +0000 |
| commit | e3bf606c5d658e5fafb5d6168b0d4e7c9b0dd5ce (patch) | |
| tree | 6b7c131b2182cb2ce66be6daa1b77d6923ad3d91 | |
| parent | b0ecfb42d1705bc1423c726a16a182c81047f854 (diff) | |
Notes
| -rw-r--r-- | sbin/ipfw/ipfw2.c | 14 |
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; |
