From 49572c5b0d9c429a309ccf364f83cb90c7799fde Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Sat, 24 Apr 2004 21:59:41 +0000 Subject: [PATCH] arpcom untangling: - use ifp instead if &ac->ac_if in a couple of nd6* calls; this removes a useless dependency. - use IFP2AC(ifp) instead of an extra variable to point to the struct arpcom; this does not remove the nesting dependency between arpcom and ifnet but makes it more evident. --- sys/net/if_ethersubr.c | 7 +++---- sys/net/if_fddisubr.c | 5 ++--- sys/net/if_iso88025subr.c | 5 ++--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 4b10239d4883..ae599476b319 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -138,7 +138,6 @@ ether_output(struct ifnet *ifp, struct mbuf *m, struct ether_header *eh; int loop_copy = 0; int hlen; /* link layer header length */ - struct arpcom *ac = IFP2AC(ifp); #ifdef MAC error = mac_check_ifnet_transmit(ifp, m); @@ -193,7 +192,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, #endif #ifdef INET6 case AF_INET6: - if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) { + if (!nd6_storelladdr(ifp, rt, m, dst, (u_char *)edst)) { /* Something bad happened */ return(0); } @@ -220,7 +219,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, if ((aa = at_ifawithnet((struct sockaddr_at *)dst)) == NULL) { goto bad; } - if (!aarpresolve(ac, m, (struct sockaddr_at *)dst, edst)) + if (!aarpresolve(IFP2AC(ifp), m, (struct sockaddr_at *)dst, edst)) return (0); /* * In the phase 2 case, need to prepend an mbuf for the llc header. @@ -280,7 +279,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, (void)memcpy(eh->ether_shost, esrc, sizeof(eh->ether_shost)); else - (void)memcpy(eh->ether_shost, ac->ac_enaddr, + (void)memcpy(eh->ether_shost, IFP2AC(ifp)->ac_enaddr, sizeof(eh->ether_shost)); /* diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 0602c431ea1f..d9330ee51cad 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -119,7 +119,6 @@ fddi_output(ifp, m, dst, rt0) u_char esrc[FDDI_ADDR_LEN], edst[FDDI_ADDR_LEN]; struct rtentry *rt; struct fddi_header *fh; - struct arpcom *ac = IFP2AC(ifp); #ifdef MAC error = mac_check_ifnet_transmit(ifp, m); @@ -192,7 +191,7 @@ fddi_output(ifp, m, dst, rt0) #ifdef NETATALK case AF_APPLETALK: { struct at_ifaddr *aa; - if (!aarpresolve(ac, m, (struct sockaddr_at *)dst, edst)) + if (!aarpresolve(IFP2AC(ifp), m, (struct sockaddr_at *)dst, edst)) return (0); /* * ifaddr is the first thing in at_ifaddr @@ -314,7 +313,7 @@ fddi_output(ifp, m, dst, rt0) if (hdrcmplt) bcopy((caddr_t)esrc, (caddr_t)fh->fddi_shost, FDDI_ADDR_LEN); else - bcopy((caddr_t)ac->ac_enaddr, (caddr_t)fh->fddi_shost, + bcopy(IFP2AC(ifp)->ac_enaddr, (caddr_t)fh->fddi_shost, FDDI_ADDR_LEN); /* diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c index 5f1b802cf17e..72b246f84f86 100644 --- a/sys/net/if_iso88025subr.c +++ b/sys/net/if_iso88025subr.c @@ -246,7 +246,6 @@ iso88025_output(ifp, m, dst, rt0) struct iso88025_header gen_th; struct sockaddr_dl *sdl = NULL; struct rtentry *rt; - struct arpcom *ac = IFP2AC(ifp); #ifdef MAC error = mac_check_ifnet_transmit(ifp, m); @@ -272,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, (caddr_t)ac->ac_enaddr, + (void)memcpy((caddr_t)gen_th.iso88025_shost, IFP2AC(ifp)->ac_enaddr, ISO88025_ADDR_LEN); if (rif_len) { gen_th.iso88025_shost[0] |= TR_RII; @@ -321,7 +320,7 @@ iso88025_output(ifp, m, dst, rt0) #endif /* INET */ #ifdef INET6 case AF_INET6: - if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) { + if (!nd6_storelladdr(ifp, rt, m, dst, (u_char *)edst)) { /* Something bad happened */ return(0); }