Add some KASSERTS to catch null pointers.

This commit is contained in:
phk 2005-07-21 09:00:51 +00:00
parent 669a168b22
commit a2c6f4658e

View File

@ -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)