- Fix another fallout from the if_alloc() conversion:

previously, ifp->if_type was set to IFT_ETHER by
  ether_ifattach(), now it's done by if_alloc() so
  an assignment of if_type to IFT_PROPVIRTUAL after
  if_alloc() but before ether_ifattach() broke it.
  This makes arp(8) and friends happy about the fec
  interfaces, and will allow us to use if_setlladdr()
  on the fec interface.

- Set/reset IFF_DRV_RUNNING/IFF_DRV_OACTIVE in init()
  and stop() methods rather than in ioctl(), like the
  rest of the drivers do.  This fixes a bug when an
  "ifconfig fec0 ipv4_address" would not have made
  the interface running, didn't launch the ticker
  function to track media status of bundled ports,
  etc.
This commit is contained in:
Ruslan Ermilov 2005-11-04 13:50:38 +00:00
parent 8f0371f19d
commit ca5d5ced13
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152030

View file

@ -565,6 +565,9 @@ ng_fec_init(void *arg)
p->fec_ifstat = -1;
}
ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE);
ifp->if_drv_flags |= IFF_DRV_RUNNING;
priv->fec_ch = timeout(ng_fec_tick, priv, hz);
return;
@ -589,6 +592,8 @@ ng_fec_stop(struct ifnet *ifp)
untimeout(ng_fec_tick, priv, priv->fec_ch);
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
return;
}
@ -713,8 +718,6 @@ ng_fec_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
error = EINVAL;
break;
}
ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE);
ifp->if_drv_flags |= IFF_DRV_RUNNING;
ng_fec_init(priv);
}
/*
@ -728,9 +731,7 @@ ng_fec_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
}
} else {
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING |
IFF_DRV_OACTIVE);
ng_fec_stop(ifp);
ng_fec_stop(ifp);
}
break;
@ -1133,7 +1134,6 @@ ng_fec_constructor(node_p node)
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
ifp->if_mtu = NG_FEC_MTU_DEFAULT;
ifp->if_flags = (IFF_SIMPLEX|IFF_BROADCAST|IFF_MULTICAST);
ifp->if_type = IFT_PROPVIRTUAL; /* XXX */
ifp->if_addrlen = 0; /* XXX */
ifp->if_hdrlen = 0; /* XXX */
ifp->if_baudrate = 100000000; /* XXX */