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.
This commit is contained in:
luigi 2004-04-24 21:59:41 +00:00
parent 838e42639a
commit bc64d173e0
3 changed files with 7 additions and 10 deletions

View File

@ -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));
/*

View File

@ -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);
/*

View File

@ -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);
}