mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
o Provide functions carp_ifa_addroute()/carp_ifa_delroute()
to cleanup routes from a single ifa. o Implement carp_addroute()/carp_delroute() via above functions. o Call carp_ifa_delroute() in the carp_detach() to avoid junk routes left in routing table, in case if user removes an address in a MASTER state. [1] Reported by: az [1]
This commit is contained in:
parent
9b3e7585a8
commit
2512b096a2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230863
@ -269,7 +269,9 @@ static void carp_master_down_locked(struct carp_softc *);
|
||||
static void carp_send_ad(void *);
|
||||
static void carp_send_ad_locked(struct carp_softc *);
|
||||
static void carp_addroute(struct carp_softc *);
|
||||
static void carp_ifa_addroute(struct ifaddr *);
|
||||
static void carp_delroute(struct carp_softc *);
|
||||
static void carp_ifa_delroute(struct ifaddr *);
|
||||
static void carp_send_ad_all(void *, int);
|
||||
static void carp_demote_adj(int, char *);
|
||||
|
||||
@ -907,22 +909,29 @@ carp_addroute(struct carp_softc *sc)
|
||||
struct ifaddr *ifa;
|
||||
|
||||
CARP_FOREACH_IFA(sc, ifa)
|
||||
switch (ifa->ifa_addr->sa_family) {
|
||||
carp_ifa_addroute(ifa);
|
||||
}
|
||||
|
||||
static void
|
||||
carp_ifa_addroute(struct ifaddr *ifa)
|
||||
{
|
||||
|
||||
switch (ifa->ifa_addr->sa_family) {
|
||||
#ifdef INET
|
||||
case AF_INET:
|
||||
in_addprefix(ifatoia(ifa), RTF_UP);
|
||||
ifa_add_loopback_route(ifa,
|
||||
(struct sockaddr *)&ifatoia(ifa)->ia_addr);
|
||||
break;
|
||||
case AF_INET:
|
||||
in_addprefix(ifatoia(ifa), RTF_UP);
|
||||
ifa_add_loopback_route(ifa,
|
||||
(struct sockaddr *)&ifatoia(ifa)->ia_addr);
|
||||
break;
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
ifa_add_loopback_route(ifa,
|
||||
(struct sockaddr *)&ifatoia6(ifa)->ia_addr);
|
||||
in6_ifaddloop(ifa);
|
||||
break;
|
||||
case AF_INET6:
|
||||
ifa_add_loopback_route(ifa,
|
||||
(struct sockaddr *)&ifatoia6(ifa)->ia_addr);
|
||||
in6_ifaddloop(ifa);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -931,22 +940,29 @@ carp_delroute(struct carp_softc *sc)
|
||||
struct ifaddr *ifa;
|
||||
|
||||
CARP_FOREACH_IFA(sc, ifa)
|
||||
switch (ifa->ifa_addr->sa_family) {
|
||||
carp_ifa_delroute(ifa);
|
||||
}
|
||||
|
||||
static void
|
||||
carp_ifa_delroute(struct ifaddr *ifa)
|
||||
{
|
||||
|
||||
switch (ifa->ifa_addr->sa_family) {
|
||||
#ifdef INET
|
||||
case AF_INET:
|
||||
ifa_del_loopback_route(ifa,
|
||||
(struct sockaddr *)&ifatoia(ifa)->ia_addr);
|
||||
in_scrubprefix(ifatoia(ifa), LLE_STATIC);
|
||||
break;
|
||||
case AF_INET:
|
||||
ifa_del_loopback_route(ifa,
|
||||
(struct sockaddr *)&ifatoia(ifa)->ia_addr);
|
||||
in_scrubprefix(ifatoia(ifa), LLE_STATIC);
|
||||
break;
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
ifa_del_loopback_route(ifa,
|
||||
(struct sockaddr *)&ifatoia6(ifa)->ia_addr);
|
||||
in6_ifremloop(ifa);
|
||||
break;
|
||||
case AF_INET6:
|
||||
ifa_del_loopback_route(ifa,
|
||||
(struct sockaddr *)&ifatoia6(ifa)->ia_addr);
|
||||
in6_ifremloop(ifa);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef INET
|
||||
@ -1856,6 +1872,7 @@ carp_detach(struct ifaddr *ifa)
|
||||
#endif
|
||||
}
|
||||
|
||||
carp_ifa_delroute(ifa);
|
||||
carp_multicast_cleanup(sc, ifa->ifa_addr->sa_family);
|
||||
|
||||
ifa->ifa_carp = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user