- Initialize interface as UP when hook is connected.

- Call if_link_state_change() when netgraph flow control
  messages are received.

Sponsored by:	Rambler
This commit is contained in:
Gleb Smirnoff 2005-04-20 14:22:13 +00:00
parent 3b1c41c548
commit 15749e57aa

@ -378,6 +378,7 @@ static int
ng_eiface_newhook(node_p node, hook_p hook, const char *name)
{
priv_p priv = NG_NODE_PRIVATE(node);
struct ifnet *ifp = &priv->sc_ifp;
if (strcmp(name, NG_EIFACE_HOOK_ETHER))
return (EPFNOSUPPORT);
@ -386,6 +387,8 @@ ng_eiface_newhook(node_p node, hook_p hook, const char *name)
priv->ether = hook;
NG_HOOK_SET_PRIVATE(hook, &priv->ether);
if_link_state_change(ifp, LINK_STATE_UP);
return (0);
}
@ -484,10 +487,10 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
case NGM_FLOW_COOKIE:
switch (msg->header.cmd) {
case NGM_LINK_IS_UP:
ifp->if_flags |= IFF_RUNNING;
if_link_state_change(ifp, LINK_STATE_UP);
break;
case NGM_LINK_IS_DOWN:
ifp->if_flags &= ~IFF_RUNNING;
if_link_state_change(ifp, LINK_STATE_DOWN);
break;
default:
break;