Add new netgraph control message NGM_ETHER_DETACH, which actually

removes netgraph node and unwraps Ethernet interface.

This gives us ability to unload ng_ether.ko, when all interfaces
are detached, making ng_ether(4) developers happy.

Reviewed by:	ru
This commit is contained in:
glebius 2005-02-14 12:01:09 +00:00
parent db16f02fe3
commit 38b3e66d0e
2 changed files with 11 additions and 0 deletions

View File

@ -186,6 +186,13 @@ static const struct ng_cmdlist ng_ether_cmdlist[] = {
&ng_parse_enaddr_type, &ng_parse_enaddr_type,
NULL NULL
}, },
{
NGM_ETHER_COOKIE,
NGM_ETHER_DETACH,
"detach",
NULL,
NULL
},
{ 0 } { 0 }
}; };
@ -544,6 +551,9 @@ ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook)
(struct sockaddr *)&sa_dl); (struct sockaddr *)&sa_dl);
break; break;
} }
case NGM_ETHER_DETACH:
ng_ether_detach(priv->ifp);
break;
default: default:
error = EINVAL; error = EINVAL;
break; break;

View File

@ -67,6 +67,7 @@ enum {
NGM_ETHER_SET_AUTOSRC, /* enable/disable src addr override */ NGM_ETHER_SET_AUTOSRC, /* enable/disable src addr override */
NGM_ETHER_ADD_MULTI, /* add multicast membership */ NGM_ETHER_ADD_MULTI, /* add multicast membership */
NGM_ETHER_DEL_MULTI, /* delete multicast membership */ NGM_ETHER_DEL_MULTI, /* delete multicast membership */
NGM_ETHER_DETACH, /* our way to be shut down */
}; };
#endif /* _NETGRAPH_NG_ETHER_H_ */ #endif /* _NETGRAPH_NG_ETHER_H_ */