diff options
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index b21701d..3968345 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -955,6 +955,32 @@ if_route(struct ifnet *ifp, int flag, int fam) #endif } +void (*vlan_link_state_p)(struct ifnet *, int); /* XXX: private from if_vlan */ + +/* + * Handle a change in the interface link state. + */ +void +if_link_state_change(struct ifnet *ifp, int link_state) +{ + int link; + + /* Notify that the link state has changed. */ + if (ifp->if_link_state != link_state) { + ifp->if_link_state = link_state; + rt_ifmsg(ifp); + if (link_state == LINK_STATE_UP) + link = NOTE_LINKUP; + else if (link_state == LINK_STATE_DOWN) + link = NOTE_LINKDOWN; + else + link = NOTE_LINKINV; + KNOTE_UNLOCKED(&ifp->if_klist, link); + if (ifp->if_nvlans != 0) + (*vlan_link_state_p)(ifp, link); + } +} + /* * Mark an interface down and notify protocols of * the transition. |