diff options
author | phk <phk@FreeBSD.org> | 2005-07-21 09:00:51 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2005-07-21 09:00:51 +0000 |
commit | a2c6f4658e7cf879dba4bc06a47655bc064938ca (patch) | |
tree | 726305d9f747acc40428a9cd0e9a214c3e894c22 /sys/net/if_ethersubr.c | |
parent | 669a168b2209c8b5731687091f183e5161709bca (diff) | |
download | FreeBSD-src-a2c6f4658e7cf879dba4bc06a47655bc064938ca.zip FreeBSD-src-a2c6f4658e7cf879dba4bc06a47655bc064938ca.tar.gz |
Add some KASSERTS to catch null pointers.
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r-- | sys/net/if_ethersubr.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index cf0b299..21afd95 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -345,6 +345,8 @@ ether_output(struct ifnet *ifp, struct mbuf *m, /* Handle ng_ether(4) processing, if any */ if (IFP2AC(ifp)->ac_netgraph != NULL) { + KASSERT(ng_ether_output_p != NULL, + ("ng_ether_output_p is NULL")); if ((error = (*ng_ether_output_p)(ifp, &m)) != 0) { bad: if (m != NULL) m_freem(m); @@ -589,6 +591,8 @@ ether_input(struct ifnet *ifp, struct mbuf *m) /* Handle ng_ether(4) processing, if any */ if (IFP2AC(ifp)->ac_netgraph != NULL) { + KASSERT(ng_ether_input_p != NULL, + ("ng_ether_input_p is NULL")); (*ng_ether_input_p)(ifp, &m); if (m == NULL) return; @@ -857,6 +861,8 @@ discard: * otherwise dispose of it. */ if (IFP2AC(ifp)->ac_netgraph != NULL) { + KASSERT(ng_ether_input_orphan_p != NULL, + ("ng_ether_input_orphan_p is NULL")); /* * Put back the ethernet header so netgraph has a * consistent view of inbound packets. @@ -940,8 +946,11 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *llc) void ether_ifdetach(struct ifnet *ifp) { - if (IFP2AC(ifp)->ac_netgraph != NULL) + if (IFP2AC(ifp)->ac_netgraph != NULL) { + KASSERT(ng_ether_detach_p != NULL, + ("ng_ether_detach_p is NULL")); (*ng_ether_detach_p)(ifp); + } bpfdetach(ifp); if_detach(ifp); if (BDG_LOADED) |