From 02d2342bc2d78ff157a84154ae3b835da1020fa7 Mon Sep 17 00:00:00 2001 From: fenner Date: Sat, 23 Mar 1996 01:32:30 +0000 Subject: [PATCH] Send ARP's for aliased subnets with the proper source address. Get rid of ac->ac_ipaddr and arpwhohas() since they assume that an interface has only one address. Obtained from: BSD/OS 2.1, via Rich Stevens --- sys/netinet/if_ether.c | 22 +++++++--------------- sys/netinet/if_ether.h | 3 +-- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 257a94bb4af9..bd6ea2a06b68 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_ether.c 8.1 (Berkeley) 6/10/93 - * $Id: if_ether.c,v 1.27 1996/02/05 18:04:30 wollman Exp $ + * $Id: if_ether.c,v 1.28 1996/02/20 17:54:17 fenner Exp $ */ /* @@ -106,7 +106,6 @@ static void arprequest __P((struct arpcom *, u_long *, u_long *, u_char *)); static void arpintr __P((void)); static void arptfree __P((struct llinfo_arp *)); static void arptimer __P((void *)); -static void arpwhohas __P((struct arpcom *ac, struct in_addr *addr)); static struct llinfo_arp *arplookup __P((u_long, int, int)); static void in_arpinput __P((struct mbuf *)); @@ -258,16 +257,6 @@ arp_rtrequest(req, rt, sa) Free((caddr_t)la); } } -/* - * Broadcast an ARP packet, asking who has addr on interface ac. - */ -static void -arpwhohas(ac, addr) - struct arpcom *ac; - struct in_addr *addr; -{ - arprequest(ac, &ac->ac_ipaddr.s_addr, &addr->s_addr, ac->ac_enaddr); -} /* * Broadcast an ARP request. Caller specifies: @@ -375,7 +364,10 @@ arpresolve(ac, rt, m, dst, desten, rt0) if (la->la_asked == 0 || rt->rt_expire != time.tv_sec) { rt->rt_expire = time.tv_sec; if (la->la_asked++ < arp_maxtries) - arpwhohas(ac, &(SIN(dst)->sin_addr)); + arprequest(ac, + &(SIN(rt0->rt_ifa->ifa_addr)->sin_addr.s_addr), + &(SIN(dst)->sin_addr.s_addr), + ac->ac_enaddr); else { rt->rt_flags |= RTF_REJECT; rt->rt_expire += arpt_down; @@ -634,8 +626,8 @@ arp_ifinit(ac, ifa) struct arpcom *ac; struct ifaddr *ifa; { - ac->ac_ipaddr = IA_SIN(ifa)->sin_addr; - arpwhohas(ac, &ac->ac_ipaddr); + arprequest(ac, &(IA_SIN(ifa)->sin_addr.s_addr), + &(IA_SIN(ifa)->sin_addr.s_addr), ac->ac_enaddr); ifa->ifa_rtrequest = arp_rtrequest; ifa->ifa_flags |= RTF_CLONING; } diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h index 387dc38bf28a..54c71c37f860 100644 --- a/sys/netinet/if_ether.h +++ b/sys/netinet/if_ether.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 - * $Id: if_ether.h,v 1.12 1995/12/05 02:01:42 davidg Exp $ + * $Id: if_ether.h,v 1.13 1995/12/09 16:06:54 phk Exp $ */ #ifndef _NETINET_IF_ETHER_H_ @@ -120,7 +120,6 @@ struct arpcom { */ struct ifnet ac_if; /* network-visible interface */ u_char ac_enaddr[6]; /* ethernet hardware address */ - struct in_addr ac_ipaddr; /* copy of ip address- XXX */ struct ether_multi *ac_multiaddrs; /* list of ether multicast addrs */ int ac_multicnt; /* length of ac_multiaddrs list */ };