Skip to content

Commit

Permalink
vrrp: check prefix length when checking if deleted address is a VIP
Browse files Browse the repository at this point in the history
It is possible, for example, to configure both 10.1.0.3/32 and
10.1.0.3/24 on the same interface. When checking whether an address
deleted from an interface is one of our VIPs, we need to also check
the prefix length.

Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
  • Loading branch information
pqarmitage committed Sep 20, 2023
1 parent d07d122 commit bd7cc2b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion keepalived/core/keepalived_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ address_is_ours(struct ifaddrmsg *ifa, struct in_addr *addr, interface_t *ifp)
vip_list;
vip_list = vip_list == &vrrp->vip ? &vrrp->evip : NULL) {
list_for_each_entry(ip_addr, vip_list, e_list) {
if (addr_is_equal(ifa, addr, ip_addr, ifp))
if (addr_is_equal(ifa, addr, ip_addr, ifp) &&
ifa->ifa_prefixlen == ip_addr->ifa.ifa_prefixlen)
return ip_addr->dont_track ? NULL : vrrp;
}
}
Expand Down

0 comments on commit bd7cc2b

Please sign in to comment.