diff options
-rw-r--r-- | sys/net/if.c | 18 | ||||
-rw-r--r-- | sys/net/if_var.h | 1 |
2 files changed, 12 insertions, 7 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index f271929..5c422c1 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -128,7 +128,6 @@ static void if_freemulti(struct ifmultiaddr *); static void if_grow(void); static void if_init(void *); static void if_check(void *); -static void if_qflush(struct ifnet *); static void if_route(struct ifnet *, int flag, int fam); static int if_setflag(struct ifnet *, int, int, int *, int); static void if_slowtimo(void *); @@ -613,8 +612,15 @@ if_attach(struct ifnet *ifp) getmicrotime(&ifp->if_lastchange); ifp->if_data.ifi_epoch = time_uptime; ifp->if_data.ifi_datalen = sizeof(struct if_data); - ifp->if_transmit = if_transmit; - ifp->if_qflush = if_qflush; + KASSERT((ifp->if_transmit == NULL && ifp->if_qflush == NULL) || + (ifp->if_transmit != NULL && ifp->if_qflush != NULL), + ("transmit and qflush must both either be set or both be NULL")); + + if (ifp->if_transmit == NULL) { + ifp->if_transmit = if_transmit; + ifp->if_qflush = if_qflush; + } + #ifdef MAC mac_ifnet_init(ifp); mac_ifnet_create(ifp); @@ -1510,9 +1516,7 @@ if_unroute(struct ifnet *ifp, int flag, int fam) if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFDOWN, ifa->ifa_addr); ifp->if_qflush(ifp); - if (ifp->if_snd.ifq_head != NULL) - if_qflush(ifp); - + #ifdef DEV_CARP if (ifp->if_carp) carp_carpdev_state(ifp->if_carp); @@ -1641,7 +1645,7 @@ if_up(struct ifnet *ifp) /* * Flush an interface queue. */ -static void +void if_qflush(struct ifnet *ifp) { struct mbuf *m, *n; diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 50846f8..4b7447d 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -757,6 +757,7 @@ void if_free_type(struct ifnet *, u_char); void if_initname(struct ifnet *, const char *, int); void if_link_state_change(struct ifnet *, int); int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); +void if_qflush(struct ifnet *); int if_setlladdr(struct ifnet *, const u_char *, int); void if_up(struct ifnet *); /*void ifinit(void);*/ /* declared in systm.h for main() */ |