diff options
author | melifaro <melifaro@FreeBSD.org> | 2013-11-28 15:28:51 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2013-11-28 15:28:51 +0000 |
commit | 031fdfe55b95e0bcae95f6e991b74eac2d2d3104 (patch) | |
tree | e2d5d27656bdefab216e2911529800c671cd3e05 /sys/netpfil/ipfw/ip_fw2.c | |
parent | 4425f4524efe3fe0ba4db6c363aab68aca6aa108 (diff) | |
download | FreeBSD-src-031fdfe55b95e0bcae95f6e991b74eac2d2d3104.zip FreeBSD-src-031fdfe55b95e0bcae95f6e991b74eac2d2d3104.tar.gz |
Simplify O_NAT opcode handling.
MFC after: 2 weeks
Sponsored by: Yandex LLC
Diffstat (limited to 'sys/netpfil/ipfw/ip_fw2.c')
-rw-r--r-- | sys/netpfil/ipfw/ip_fw2.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c index 8540bdf..7bbfff3 100644 --- a/sys/netpfil/ipfw/ip_fw2.c +++ b/sys/netpfil/ipfw/ip_fw2.c @@ -2413,38 +2413,35 @@ do { \ } case O_NAT: + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ if (!IPFW_NAT_LOADED) { retval = IP_FW_DENY; - } else { - struct cfg_nat *t; - int nat_id; + break; + } - set_match(args, f_pos, chain); - /* Check if this is 'global' nat rule */ - if (cmd->arg1 == 0) { - retval = ipfw_nat_ptr(args, NULL, m); - l = 0; - done = 1; - break; - } - t = ((ipfw_insn_nat *)cmd)->nat; - if (t == NULL) { + struct cfg_nat *t; + int nat_id; + + set_match(args, f_pos, chain); + /* Check if this is 'global' nat rule */ + if (cmd->arg1 == 0) { + retval = ipfw_nat_ptr(args, NULL, m); + break; + } + t = ((ipfw_insn_nat *)cmd)->nat; + if (t == NULL) { nat_id = IP_FW_ARG_TABLEARG(cmd->arg1); t = (*lookup_nat_ptr)(&chain->nat, nat_id); if (t == NULL) { retval = IP_FW_DENY; - l = 0; /* exit inner loop */ - done = 1; /* exit outer loop */ break; } if (cmd->arg1 != IP_FW_TABLEARG) ((ipfw_insn_nat *)cmd)->nat = t; - } - retval = ipfw_nat_ptr(args, t, m); } - l = 0; /* exit inner loop */ - done = 1; /* exit outer loop */ + retval = ipfw_nat_ptr(args, t, m); break; case O_REASS: { |