summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-01-14 09:00:46 +0000
committerglebius <glebius@FreeBSD.org>2005-01-14 09:00:46 +0000
commit4db2b8d392653d006688b34d58bdb4ff6bc93523 (patch)
treed9fa7d7031281028b0d46da348135c088236c843 /sys/net/if_ethersubr.c
parent3c319ea2eac56f153a87df3c9616031973d63110 (diff)
downloadFreeBSD-src-4db2b8d392653d006688b34d58bdb4ff6bc93523.zip
FreeBSD-src-4db2b8d392653d006688b34d58bdb4ff6bc93523.tar.gz
o Clean up interface between ip_fw_chk() and its callers:
- ip_fw_chk() returns action as function return value. Field retval is removed from args structure. Action is not flag any more. It is one of integer constants. - Any action-specific cookies are returned either in new "cookie" field in args structure (dummynet, future netgraph glue), or in mbuf tag attached to packet (divert, tee, some future action). o Convert parsing of return value from ip_fw_chk() in ipfw_check_{in,out}() to a switch structure, so that the functions are more readable, and a future actions can be added with less modifications. Approved by: andre MFC after: 2 months
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r--sys/net/if_ethersubr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 2a0df50..590e551 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -440,13 +440,15 @@ ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst,
*m0 = m;
*rule = args.rule;
- if ( (i & IP_FW_PORT_DENY_FLAG) || m == NULL) /* drop */
+ if (i == IP_FW_DENY) /* drop */
return 0;
- if (i == 0) /* a PASS rule. */
+ KASSERT(m != NULL, ("ether_ipfw_chk: m is NULL"));
+
+ if (i == IP_FW_PASS) /* a PASS rule. */
return 1;
- if (DUMMYNET_LOADED && (i & IP_FW_PORT_DYNT_FLAG)) {
+ if (DUMMYNET_LOADED && (i == IP_FW_DUMMYNET)) {
/*
* Pass the pkt to dummynet, which consumes it.
* If shared, make a copy and keep the original.
@@ -462,7 +464,7 @@ ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst,
*/
*m0 = NULL ;
}
- ip_dn_io_ptr(m, (i & 0xffff),
+ ip_dn_io_ptr(m, args.cookie,
dst ? DN_TO_ETH_OUT: DN_TO_ETH_DEMUX, &args);
return 0;
}
OpenPOWER on IntegriCloud