MCPcopy Create free account
hub / github.com/F-Stack/f-stack / do_link_state_change

Function do_link_state_change

freebsd/net/if.c:2265–2300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2263}
2264
2265static void
2266do_link_state_change(void *arg, int pending)
2267{
2268 struct ifnet *ifp;
2269 int link_state;
2270
2271 ifp = arg;
2272 link_state = ifp->if_link_state;
2273
2274 CURVNET_SET(ifp->if_vnet);
2275 rt_ifmsg(ifp);
2276 if (ifp->if_vlantrunk != NULL)
2277 (*vlan_link_state_p)(ifp);
2278
2279 if ((ifp->if_type == IFT_ETHER || ifp->if_type == IFT_L2VLAN) &&
2280 ifp->if_l2com != NULL)
2281 (*ng_ether_link_state_p)(ifp, link_state);
2282 if (ifp->if_carp)
2283 (*carp_linkstate_p)(ifp);
2284 if (ifp->if_bridge)
2285 ifp->if_bridge_linkstate(ifp);
2286 if (ifp->if_lagg)
2287 (*lagg_linkstate_p)(ifp, link_state);
2288
2289 if (IS_DEFAULT_VNET(curvnet))
2290 devctl_notify("IFNET", ifp->if_xname,
2291 (link_state == LINK_STATE_UP) ? "LINK_UP" : "LINK_DOWN",
2292 NULL);
2293 if (pending > 1)
2294 if_printf(ifp, "%d link states coalesced\n", pending);
2295 if (log_link_state_change)
2296 if_printf(ifp, "link state changed to %s\n",
2297 (link_state == LINK_STATE_UP) ? "UP" : "DOWN" );
2298 EVENTHANDLER_INVOKE(ifnet_link_event, ifp, link_state);
2299 CURVNET_RESTORE();
2300}
2301
2302/*
2303 * Mark an interface down and notify protocols of

Callers

nothing calls this directly

Calls 3

rt_ifmsgFunction · 0.85
if_printfFunction · 0.85
devctl_notifyFunction · 0.50

Tested by

no test coverage detected