summaryrefslogtreecommitdiffstats
path: root/sys/net/if_iso88025subr.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-11-11 16:04:59 +0000
committerru <ru@FreeBSD.org>2005-11-11 16:04:59 +0000
commitf70f525b491a7d4a0a4f60eb7d69095f6f6e12e4 (patch)
treec961eb29eda0888de8f7fedb7d3eb12e58d687d3 /sys/net/if_iso88025subr.c
parentf82904627463e2f13912d433c5855e8bc112a3f3 (diff)
downloadFreeBSD-src-f70f525b491a7d4a0a4f60eb7d69095f6f6e12e4.zip
FreeBSD-src-f70f525b491a7d4a0a4f60eb7d69095f6f6e12e4.tar.gz
- Store pointer to the link-level address right in "struct ifnet"
rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr. - Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead.
Diffstat (limited to 'sys/net/if_iso88025subr.c')
-rw-r--r--sys/net/if_iso88025subr.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index d78de12..5d5a3a2 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -114,17 +114,13 @@ iso88025_ifattach(struct ifnet *ifp, const u_int8_t *lla, int bpf)
if (ifp->if_mtu == 0)
ifp->if_mtu = ISO88025_DEFAULT_MTU;
- ifa = ifaddr_byindex(ifp->if_index);
- if (ifa == 0) {
- if_printf(ifp, "%s() no lladdr!\n", __func__);
- return;
- }
+ ifa = ifp->if_addr;
+ KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
sdl->sdl_type = IFT_ISO88025;
sdl->sdl_alen = ifp->if_addrlen;
bcopy(lla, LLADDR(sdl), ifp->if_addrlen);
- IFP2ENADDR(ifp) = LLADDR(sdl);
if (bpf)
bpfattach(ifp, DLT_IEEE802, ISO88025_HDR_LEN);
@@ -182,10 +178,10 @@ iso88025_ioctl(struct ifnet *ifp, int command, caddr_t data)
if (ipx_nullhost(*ina))
ina->x_host = *(union ipx_host *)
- IFP2ENADDR(ifp);
+ IF_LLADDR(ifp);
else
bcopy((caddr_t) ina->x_host.c_host,
- (caddr_t) IFP2ENADDR(ifp),
+ (caddr_t) IF_LLADDR(ifp),
ISO88025_ADDR_LEN);
/*
@@ -205,7 +201,7 @@ iso88025_ioctl(struct ifnet *ifp, int command, caddr_t data)
struct sockaddr *sa;
sa = (struct sockaddr *) & ifr->ifr_data;
- bcopy(IFP2ENADDR(ifp),
+ bcopy(IF_LLADDR(ifp),
(caddr_t) sa->sa_data, ISO88025_ADDR_LEN);
}
break;
@@ -275,7 +271,7 @@ iso88025_output(ifp, m, dst, rt0)
/* Generate a generic 802.5 header for the packet */
gen_th.ac = TR_AC;
gen_th.fc = TR_LLC_FRAME;
- (void)memcpy((caddr_t)gen_th.iso88025_shost, IFP2ENADDR(ifp),
+ (void)memcpy((caddr_t)gen_th.iso88025_shost, IF_LLADDR(ifp),
ISO88025_ADDR_LEN);
if (rif_len) {
gen_th.iso88025_shost[0] |= TR_RII;
@@ -521,7 +517,7 @@ iso88025_input(ifp, m)
*/
if ((ifp->if_flags & IFF_PROMISC) &&
((th->iso88025_dhost[0] & 1) == 0) &&
- (bcmp(IFP2ENADDR(ifp), (caddr_t) th->iso88025_dhost,
+ (bcmp(IF_LLADDR(ifp), (caddr_t) th->iso88025_dhost,
ISO88025_ADDR_LEN) != 0))
goto dropanyway;
@@ -651,7 +647,7 @@ iso88025_input(ifp, m)
l->llc_dsap = l->llc_ssap;
l->llc_ssap = c;
if (m->m_flags & (M_BCAST | M_MCAST))
- bcopy((caddr_t)IFP2ENADDR(ifp),
+ bcopy((caddr_t)IF_LLADDR(ifp),
(caddr_t)th->iso88025_dhost,
ISO88025_ADDR_LEN);
sa.sa_family = AF_UNSPEC;
OpenPOWER on IntegriCloud