diff options
author | Andrey V. Elsukov <ae@FreeBSD.org> | 2015-09-16 13:17:00 +0000 |
---|---|---|
committer | Andrey V. Elsukov <ae@FreeBSD.org> | 2015-09-16 13:17:00 +0000 |
commit | b71bed24a60a5d13734d705abcb3250a8860dd8b (patch) | |
tree | ebd089b7e4f3791b0d21c91551e78f5ee1680a73 /sys/net/if_ethersubr.c | |
parent | f0316e1acbd5c77e77e1dcc384201341c4f746e9 (diff) | |
download | src-b71bed24a60a5d13734d705abcb3250a8860dd8b.tar.gz src-b71bed24a60a5d13734d705abcb3250a8860dd8b.zip |
Use KASSERT for some checks, that are late to do.
Discussed with: melifaro, glebius
Notes
Notes:
svn path=/head/; revision=287859
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r-- | sys/net/if_ethersubr.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 862d25948692..9ebb79b6e419 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -392,16 +392,6 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m) return; } #endif - /* - * Do consistency checks to verify assumptions - * made by code past this point. - */ - if ((m->m_flags & M_PKTHDR) == 0) { - if_printf(ifp, "discard frame w/o packet header\n"); - if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); - m_freem(m); - return; - } if (m->m_len < ETHER_HDR_LEN) { /* XXX maybe should pullup? */ if_printf(ifp, "discard frame w/o leading ethernet " @@ -413,19 +403,6 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m) } eh = mtod(m, struct ether_header *); etype = ntohs(eh->ether_type); - if (m->m_pkthdr.rcvif == NULL) { - if_printf(ifp, "discard frame w/o interface pointer\n"); - if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); - m_freem(m); - return; - } -#ifdef DIAGNOSTIC - if (m->m_pkthdr.rcvif != ifp) { - if_printf(ifp, "Warning, frame marked as received on %s\n", - m->m_pkthdr.rcvif->if_xname); - } -#endif - random_harvest_queue(m, sizeof(*m), 2, RANDOM_NET_ETHER); CURVNET_SET_QUIET(ifp->if_vnet); @@ -598,6 +575,9 @@ static void ether_nh_input(struct mbuf *m) { + M_ASSERTPKTHDR(m); + KASSERT(m->m_pkthdr.rcvif != NULL, + ("%s: NULL interface pointer", __func__)); ether_input_internal(m->m_pkthdr.rcvif, m); } |