Decompose arp_ifinit() into arp_add_ifa_lle() and arp_announce_ifaddr().
Rename arp_ifinit2() into arp_announce_ifaddr(). Eliminate zeroing ifa_rtrequest: it was used for calling arp_rtrequest() which was responsible for handling route cloning requests. It became obsolete since r186119 (L2/L3 split).
This commit is contained in:
parent
a0ced91366
commit
90aacc3eb3
@ -1091,26 +1091,13 @@ arp_mark_lle_reachable(struct llentry *la)
|
|||||||
la->la_preempt = V_arp_maxtries;
|
la->la_preempt = V_arp_maxtries;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
/*
|
||||||
arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa)
|
* Add pernament link-layer record for given interface address.
|
||||||
|
*/
|
||||||
|
static __noinline void
|
||||||
|
arp_add_ifa_lle(struct ifnet *ifp, const struct sockaddr *dst)
|
||||||
{
|
{
|
||||||
struct llentry *lle, *lle_tmp;
|
struct llentry *lle, *lle_tmp;
|
||||||
struct sockaddr_in *dst_in;
|
|
||||||
struct sockaddr *dst;
|
|
||||||
|
|
||||||
if (ifa->ifa_carp != NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ifa->ifa_rtrequest = NULL;
|
|
||||||
|
|
||||||
dst_in = IA_SIN(ifa);
|
|
||||||
dst = (struct sockaddr *)dst_in;
|
|
||||||
|
|
||||||
if (ntohl(IA_SIN(ifa)->sin_addr.s_addr) == INADDR_ANY)
|
|
||||||
return;
|
|
||||||
|
|
||||||
arprequest(ifp, &IA_SIN(ifa)->sin_addr,
|
|
||||||
&IA_SIN(ifa)->sin_addr, IF_LLADDR(ifp));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interface address LLE record is considered static
|
* Interface address LLE record is considered static
|
||||||
@ -1144,12 +1131,30 @@ arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
arp_ifinit2(struct ifnet *ifp, struct ifaddr *ifa, u_char *enaddr)
|
arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa)
|
||||||
{
|
{
|
||||||
if (ntohl(IA_SIN(ifa)->sin_addr.s_addr) != INADDR_ANY)
|
const struct sockaddr_in *dst_in;
|
||||||
arprequest(ifp, &IA_SIN(ifa)->sin_addr,
|
const struct sockaddr *dst;
|
||||||
&IA_SIN(ifa)->sin_addr, enaddr);
|
|
||||||
ifa->ifa_rtrequest = NULL;
|
if (ifa->ifa_carp != NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dst = ifa->ifa_addr;
|
||||||
|
dst_in = (const struct sockaddr_in *)dst;
|
||||||
|
|
||||||
|
if (ntohl(dst_in->sin_addr.s_addr) == INADDR_ANY)
|
||||||
|
return;
|
||||||
|
arp_announce_ifaddr(ifp, dst_in->sin_addr, IF_LLADDR(ifp));
|
||||||
|
|
||||||
|
arp_add_ifa_lle(ifp, dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
arp_announce_ifaddr(struct ifnet *ifp, struct in_addr addr, u_char *enaddr)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (ntohl(addr.s_addr) != INADDR_ANY)
|
||||||
|
arprequest(ifp, &addr, &addr, enaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -119,7 +119,7 @@ int arpresolve(struct ifnet *ifp, int is_gw, struct mbuf *m,
|
|||||||
void arprequest(struct ifnet *, const struct in_addr *,
|
void arprequest(struct ifnet *, const struct in_addr *,
|
||||||
const struct in_addr *, u_char *);
|
const struct in_addr *, u_char *);
|
||||||
void arp_ifinit(struct ifnet *, struct ifaddr *);
|
void arp_ifinit(struct ifnet *, struct ifaddr *);
|
||||||
void arp_ifinit2(struct ifnet *, struct ifaddr *, u_char *);
|
void arp_announce_ifaddr(struct ifnet *, struct in_addr addr, u_char *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1009,10 +1009,14 @@ static void
|
|||||||
carp_send_arp(struct carp_softc *sc)
|
carp_send_arp(struct carp_softc *sc)
|
||||||
{
|
{
|
||||||
struct ifaddr *ifa;
|
struct ifaddr *ifa;
|
||||||
|
struct in_addr addr;
|
||||||
|
|
||||||
CARP_FOREACH_IFA(sc, ifa)
|
CARP_FOREACH_IFA(sc, ifa) {
|
||||||
if (ifa->ifa_addr->sa_family == AF_INET)
|
if (ifa->ifa_addr->sa_family != AF_INET)
|
||||||
arp_ifinit2(sc->sc_carpdev, ifa, LLADDR(&sc->sc_addr));
|
continue;
|
||||||
|
addr = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
|
||||||
|
arp_announce_ifaddr(sc->sc_carpdev, addr, LLADDR(&sc->sc_addr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user