From: Quentin Young Date: Thu, 14 Mar 2019 15:56:39 +0000 (+0000) Subject: vrrpd: add asserts for VRRPv2 and IPv6 X-Git-Tag: base_7.2~330^2~25 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=359c72baadf246d8a596ae5e80d4e6bc2aa6b7c3;p=mirror%2Ffrr.git vrrpd: add asserts for VRRPv2 and IPv6 Disallow adding IPv6 addresses to VRRPv2 routers. Signed-off-by: Quentin Young --- diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c index ff39d78ed3..8f54bcf7c3 100644 --- a/vrrpd/vrrp.c +++ b/vrrpd/vrrp.c @@ -373,6 +373,7 @@ int vrrp_add_ip(struct vrrp_router *r, struct ipaddr *ip) int af = (ip->ipa_type == IPADDR_V6) ? AF_INET6 : AF_INET; assert(r->family == af); + assert(!(r->vr->version == 2 && ip->ipa_type == IPADDR_V6)); if (vrrp_has_ip(r->vr, ip)) return 0; @@ -416,6 +417,8 @@ int vrrp_add_ipv4(struct vrrp_vrouter *vr, struct in_addr v4) int vrrp_add_ipv6(struct vrrp_vrouter *vr, struct in6_addr v6) { + assert(vr->version != 2); + struct ipaddr ip; ip.ipa_type = IPADDR_V6; ip.ipaddr_v6 = v6; @@ -1649,7 +1652,7 @@ static void vrrp_autoconfig_autoaddrupdate(struct vrrp_router *r) r->vr->vrid, family2str(r->family), ipbuf); if (r->family == AF_INET) vrrp_add_ipv4(r->vr, c->address->u.prefix4); - else + else if (r->vr->version == 3) vrrp_add_ipv6(r->vr, c->address->u.prefix6); } }