diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-03-14 15:56:39 +0000 | 
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-17 00:27:08 +0000 | 
| commit | 359c72baadf246d8a596ae5e80d4e6bc2aa6b7c3 (patch) | |
| tree | 8aa3ad9247b2c16a25322c76adf0fd3d253343a1 /vrrpd | |
| parent | 26c7454b7fc6e2c408a453fc0de1a05a5f557bf6 (diff) | |
vrrpd: add asserts for VRRPv2 and IPv6
Disallow adding IPv6 addresses to VRRPv2 routers.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'vrrpd')
| -rw-r--r-- | vrrpd/vrrp.c | 5 | 
1 files changed, 4 insertions, 1 deletions
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);  		}  	}  | 
