summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2003-03-15 22:52:23 +0000
committermdodd <mdodd@FreeBSD.org>2003-03-15 22:52:23 +0000
commit3f4c96a9a0b5b5749c4b86502c9e3d30025b4cc7 (patch)
treef27f662c9dbef2a33b267a27559de1c6a33dc84d /sys/net
parent5ad71fcdc126b761aee7fd6be186e2e70a1030f5 (diff)
downloadFreeBSD-src-3f4c96a9a0b5b5749c4b86502c9e3d30025b4cc7.zip
FreeBSD-src-3f4c96a9a0b5b5749c4b86502c9e3d30025b4cc7.tar.gz
iso88025_ifattach() changes:
- Call if_attach(). - Conditionally call bpfattach() based on second function argument.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_iso88025subr.c20
-rw-r--r--sys/net/iso88025.h5
2 files changed, 22 insertions, 3 deletions
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index 5b3f821..3593ec6 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -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;
}
/*
diff --git a/sys/net/iso88025.h b/sys/net/iso88025.h
index 71f2238..f463647 100644
--- a/sys/net/iso88025.h
+++ b/sys/net/iso88025.h
@@ -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 *,
OpenPOWER on IntegriCloud