Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/ng_ether.c
Show First 20 Lines • Show All 408 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static void | static void | ||||
ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) | ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) | ||||
{ | { | ||||
char name[IFNAMSIZ]; | char name[IFNAMSIZ]; | ||||
node_p node; | node_p node; | ||||
/* Only ethernet interfaces are of interest. */ | /* Only ethernet interfaces are of interest. */ | ||||
if (ifp->if_type != IFT_ETHER | if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) | ||||
&& ifp->if_type != IFT_L2VLAN) | |||||
return; | return; | ||||
/* | /* | ||||
* Just return if it's a new interface without an ng_ether companion. | * Just return if it's a new interface without an ng_ether companion. | ||||
*/ | */ | ||||
node = IFP2NG(ifp); | node = IFP2NG(ifp); | ||||
if (node == NULL) | if (node == NULL) | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 321 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static int | static int | ||||
ng_ether_shutdown(node_p node) | ng_ether_shutdown(node_p node) | ||||
{ | { | ||||
const priv_p priv = NG_NODE_PRIVATE(node); | const priv_p priv = NG_NODE_PRIVATE(node); | ||||
if (node->nd_flags & NGF_REALLY_DIE) { | if (node->nd_flags & NGF_REALLY_DIE) { | ||||
/* | /* | ||||
* WE came here because the ethernet card is being unloaded, | * The ifnet is going away, perhaps because the driver was | ||||
* so stop being persistent. | * unloaded or its vnet is being torn down. | ||||
* Actually undo all the things we did on creation. | |||||
* Assume the ifp has already been freed. | |||||
*/ | */ | ||||
NG_NODE_SET_PRIVATE(node, NULL); | NG_NODE_SET_PRIVATE(node, NULL); | ||||
if (priv->ifp != NULL) | |||||
IFP2NG(priv->ifp) = NULL; | |||||
donner: So this is the only effective line in the patch.
It sets the reference from the interface (ipf)… | |||||
markjAuthorUnsubmitted Done Inline ActionsThat's correct. markj: That's correct. | |||||
free(priv, M_NETGRAPH); | free(priv, M_NETGRAPH); | ||||
NG_NODE_UNREF(node); /* free node itself */ | NG_NODE_UNREF(node); /* free node itself */ | ||||
return (0); | return (0); | ||||
} | } | ||||
if (priv->promisc) { /* disable promiscuous mode */ | if (priv->promisc) { /* disable promiscuous mode */ | ||||
(void)ifpromisc(priv->ifp, 0); | (void)ifpromisc(priv->ifp, 0); | ||||
priv->promisc = 0; | priv->promisc = 0; | ||||
} | } | ||||
NG_NODE_REVIVE(node); /* Signal ng_rmnode we are persisant */ | NG_NODE_REVIVE(node); /* Signal ng_rmnode we are persisant */ | ||||
▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines |
So this is the only effective line in the patch.
It sets the reference from the interface (ipf) to the node (if_l2com) ... to zero.