iso88025_ifattach() changes:

- Call if_attach().
- Conditionally call bpfattach() based on second function argument.
This commit is contained in:
Matthew N. Dodd 2003-03-15 22:52:23 +00:00
parent 69ed274634
commit 089b2f2ead
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112297
2 changed files with 22 additions and 3 deletions

View File

@ -88,8 +88,11 @@ static int iso88025_resolvemulti (struct ifnet *, struct sockaddr **,
#define IFP2AC(IFP) ((struct arpcom *)IFP)
#define senderr(e) do { error = (e); goto bad; } while (0)
/*
* Perform common duties while attaching to interface list
*/
void
iso88025_ifattach(struct ifnet *ifp)
iso88025_ifattach(struct ifnet *ifp, int bpf)
{
struct ifaddr *ifa;
struct sockaddr_dl *sdl;
@ -99,21 +102,34 @@ iso88025_ifattach(struct ifnet *ifp)
ifp->if_type = IFT_ISO88025;
ifp->if_addrlen = ISO88025_ADDR_LEN;
ifp->if_hdrlen = ISO88025_HDR_LEN;
if_attach(ifp); /* Must be called before additional assignments */
ifp->if_output = iso88025_output;
ifp->if_input = iso88025_input;
ifp->if_resolvemulti = iso88025_resolvemulti;
ifp->if_broadcastaddr = iso88025_broadcastaddr;
if (ifp->if_baudrate == 0)
ifp->if_baudrate = TR_16MBPS; /* 16Mbit should be a safe default */
if (ifp->if_mtu == 0)
ifp->if_mtu = ISO88025_DEFAULT_MTU;
ifp->if_broadcastaddr = iso88025_broadcastaddr;
ifa = ifaddr_byindex(ifp->if_index);
if (ifa == 0) {
printf("iso88025_ifattach: no lladdr!\n");
return;
}
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
sdl->sdl_type = IFT_ISO88025;
sdl->sdl_alen = ifp->if_addrlen;
bcopy(IFP2AC(ifp)->ac_enaddr, LLADDR(sdl), ifp->if_addrlen);
if (bpf)
bpfattach(ifp, DLT_IEEE802, ISO88025_HDR_LEN);
return;
}
/*

View File

@ -131,7 +131,10 @@ struct iso88025_addr {
#define ISO88025_MAX_MTU 18000
#define ISO88025_DEFAULT_MTU 1500
void iso88025_ifattach (struct ifnet *);
#define ISO88025_BPF_UNSUPPORTED 0
#define ISO88025_BPF_SUPPORTED 1
void iso88025_ifattach (struct ifnet *, int);
void iso88025_ifdetach (struct ifnet *, int);
int iso88025_ioctl (struct ifnet *, int , caddr_t );
int iso88025_output (struct ifnet *, struct mbuf *, struct sockaddr *,