diff options
author | loos <loos@FreeBSD.org> | 2016-11-15 01:20:36 +0000 |
---|---|---|
committer | loos <loos@FreeBSD.org> | 2016-11-15 01:20:36 +0000 |
commit | 3a397c8fa4ebd59794e6e0d775ee15b42b7b30ee (patch) | |
tree | 59b397da80d0a307437f10e82a7dbf47a3596a8c /sys/netpfil | |
parent | fedf86339a84ca7705c7572a7d7c203af491e3d9 (diff) | |
download | FreeBSD-src-3a397c8fa4ebd59794e6e0d775ee15b42b7b30ee.zip FreeBSD-src-3a397c8fa4ebd59794e6e0d775ee15b42b7b30ee.tar.gz |
Stop abusing from struct ifnet presence to determine the packet direction
for dummynet, use the correct argument for that, remove the false coment
about the presence of struct ifnet.
Fixes the input match of dummynet l2 rules.
Obtained from: pfSense
Sponsored by: Rubicon Communications, LLC (Netgate)
Diffstat (limited to 'sys/netpfil')
-rw-r--r-- | sys/netpfil/ipfw/ip_fw_pfil.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_pfil.c b/sys/netpfil/ipfw/ip_fw_pfil.c index 3460036..8d0b69e 100644 --- a/sys/netpfil/ipfw/ip_fw_pfil.c +++ b/sys/netpfil/ipfw/ip_fw_pfil.c @@ -303,11 +303,9 @@ again: /* * ipfw processing for ethernet packets (in and out). - * Inteface is NULL from ether_demux, and ifp from - * ether_output_frame. */ int -ipfw_check_frame(void *arg, struct mbuf **m0, struct ifnet *dst, int dir, +ipfw_check_frame(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir, struct inpcb *inp) { struct ether_header *eh; @@ -348,7 +346,7 @@ ipfw_check_frame(void *arg, struct mbuf **m0, struct ifnet *dst, int dir, m_adj(m, ETHER_HDR_LEN); /* strip ethernet header */ args.m = m; /* the packet we are looking at */ - args.oif = dir == PFIL_OUT ? dst: NULL; /* destination, if any */ + args.oif = dir == PFIL_OUT ? ifp: NULL; /* destination, if any */ args.next_hop = NULL; /* we do not support forward yet */ args.next_hop6 = NULL; /* we do not support forward yet */ args.eh = &save_eh; /* MAC header for bridged/MAC packets */ @@ -383,14 +381,13 @@ ipfw_check_frame(void *arg, struct mbuf **m0, struct ifnet *dst, int dir, case IP_FW_DUMMYNET: ret = EACCES; - int dir; if (ip_dn_io_ptr == NULL) break; /* i.e. drop */ *m0 = NULL; - dir = PROTO_LAYER2 | (dst ? DIR_OUT : DIR_IN); - ip_dn_io_ptr(&m, dir, &args); + dir = (dir == PFIL_IN) ? DIR_IN : DIR_OUT; + ip_dn_io_ptr(&m, dir | PROTO_LAYER2, &args); return 0; default: |