diff options
| author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2021-07-01 18:05:11 +0300 | 
|---|---|---|
| committer | Donatas Abraitis <donatas.abraitis@gmail.com> | 2021-07-01 23:50:39 +0300 | 
| commit | 12256b84a540434485b16433f83aa23928405560 (patch) | |
| tree | e1ef59c861d62e6527ebe87f6527142f18cfef8d | |
| parent | 45833edae0fe12c87cdb90f939c07d282959e1b9 (diff) | |
*: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlen
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
| -rw-r--r-- | babeld/kernel.c | 10 | ||||
| -rw-r--r-- | bgpd/bgp_label.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 2 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi.c | 4 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_private.h | 2 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 4 | ||||
| -rw-r--r-- | bgpd/rfapi/vnc_export_bgp.c | 2 | ||||
| -rw-r--r-- | bgpd/rfapi/vnc_import_bgp.c | 6 | ||||
| -rw-r--r-- | bgpd/rfapi/vnc_zebra.c | 5 | ||||
| -rw-r--r-- | isisd/isis_route.c | 2 | ||||
| -rw-r--r-- | isisd/isis_tlvs.c | 2 | ||||
| -rw-r--r-- | ldpd/lde.c | 4 | ||||
| -rw-r--r-- | ldpd/util.c | 2 | ||||
| -rw-r--r-- | lib/command_match.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_asbr.c | 6 | ||||
| -rw-r--r-- | ospfd/ospf_vty.c | 2 | ||||
| -rw-r--r-- | pbrd/pbr_zebra.c | 2 | ||||
| -rw-r--r-- | pimd/pim_bsm.c | 2 | ||||
| -rw-r--r-- | pimd/pim_igmpv3.c | 2 | ||||
| -rw-r--r-- | pimd/pim_msdp_packet.c | 2 | ||||
| -rw-r--r-- | pimd/pim_register.c | 2 | ||||
| -rw-r--r-- | pimd/pim_rp.c | 6 | ||||
| -rw-r--r-- | pimd/pim_tlv.c | 2 | ||||
| -rw-r--r-- | pimd/pim_util.c | 4 | ||||
| -rw-r--r-- | ripd/ripd.c | 3 | ||||
| -rw-r--r-- | sharpd/sharp_vty.c | 10 | ||||
| -rw-r--r-- | zebra/connected.c | 2 | ||||
| -rw-r--r-- | zebra/interface.c | 4 | ||||
| -rw-r--r-- | zebra/router-id.c | 8 | ||||
| -rw-r--r-- | zebra/zebra_nhg.c | 5 | 
30 files changed, 57 insertions, 54 deletions
diff --git a/babeld/kernel.c b/babeld/kernel.c index e3c76bdd92..3941db8d5f 100644 --- a/babeld/kernel.c +++ b/babeld/kernel.c @@ -176,11 +176,11 @@ zebra_route(int add, int family, const unsigned char *pref, unsigned short plen,  	switch (family) {          case AF_INET:              uchar_to_inaddr(&api_nh->gate.ipv4, gate); -            if (IPV4_ADDR_SAME (&api_nh->gate.ipv4, &quagga_prefix.u.prefix4) && -                    quagga_prefix.prefixlen == 32) { -                api_nh->type = NEXTHOP_TYPE_IFINDEX; -            } else { -                api_nh->type = NEXTHOP_TYPE_IPV4_IFINDEX; +	    if (IPV4_ADDR_SAME(&api_nh->gate.ipv4, &quagga_prefix.u.prefix4) +		&& quagga_prefix.prefixlen == IPV4_MAX_BITLEN) { +		    api_nh->type = NEXTHOP_TYPE_IFINDEX; +	    } else { +		    api_nh->type = NEXTHOP_TYPE_IPV4_IFINDEX;              }              break;          case AF_INET6: diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index 975f7ecbd7..3c8f2f3668 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -390,7 +390,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,  			return BGP_NLRI_PARSE_ERROR_LABEL_LENGTH;  		} -		if ((afi == AFI_IP && p.prefixlen > 32) +		if ((afi == AFI_IP && p.prefixlen > IPV4_MAX_BITLEN)  		    || (afi == AFI_IP6 && p.prefixlen > IPV6_MAX_BITLEN))  			return BGP_NLRI_PARSE_ERROR_PREFIX_LENGTH; diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 8e794a1635..0de48dcf78 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1440,7 +1440,7 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf,	    /* to */  	case AF_INET:  		/* save */  		nexthop_orig.u.prefix4 = path_vpn->attr->mp_nexthop_global_in; -		nexthop_orig.prefixlen = 32; +		nexthop_orig.prefixlen = IPV4_MAX_BITLEN;  		if (CHECK_FLAG(bgp_vrf->af_flags[afi][safi],  			       BGP_CONFIG_VRF_TO_VRF_IMPORT)) { diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 814fc8e3f6..8bed5156b7 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -1613,7 +1613,7 @@ rfapi_query_inner(void *handle, struct rfapi_ip_addr *target,  			memset(&rprefix, 0, sizeof(rprefix));  			rprefix.prefix.addr_family = target->addr_family;  			if (target->addr_family == AF_INET) { -				rprefix.length = 32; +				rprefix.length = IPV4_MAX_BITLEN;  			} else {  				rprefix.length = IPV6_MAX_BITLEN;  			} @@ -1690,7 +1690,7 @@ rfapi_query_inner(void *handle, struct rfapi_ip_addr *target,  		memset(&rprefix, 0, sizeof(rprefix));  		rprefix.prefix.addr_family = target->addr_family;  		if (target->addr_family == AF_INET) { -			rprefix.length = 32; +			rprefix.length = IPV4_MAX_BITLEN;  		} else {  			rprefix.length = IPV6_MAX_BITLEN;  		} diff --git a/bgpd/rfapi/rfapi_private.h b/bgpd/rfapi/rfapi_private.h index 2451298ed4..bc0e192ae2 100644 --- a/bgpd/rfapi/rfapi_private.h +++ b/bgpd/rfapi/rfapi_private.h @@ -267,7 +267,7 @@ struct rfapi {  #define RFAPI_HOST_PREFIX(prefix)                                              \  	(((prefix)->family == AF_INET)                                         \ -		 ? ((prefix)->prefixlen == 32)                                 \ +		 ? ((prefix)->prefixlen == IPV4_MAX_BITLEN)                    \  		 : (((prefix)->family == AF_INET6)                             \  			    ? ((prefix)->prefixlen == IPV6_MAX_BITLEN)         \  			    : 0)) diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 9cf21a7db4..45ef7230b5 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -174,7 +174,7 @@ int rfapiQprefix2Raddr(struct prefix *qprefix, struct rfapi_ip_addr *raddr)  	raddr->addr_family = qprefix->family;  	switch (qprefix->family) {  	case AF_INET: -		if (qprefix->prefixlen != 32) +		if (qprefix->prefixlen != IPV4_MAX_BITLEN)  			return -1;  		raddr->addr.v4 = qprefix->u.prefix4;  		break; @@ -1734,7 +1734,7 @@ int rfapiCliGetPrefixAddr(struct vty *vty, const char *str, struct prefix *p)  	}  	switch (p->family) {  	case AF_INET: -		if (p->prefixlen != 32) { +		if (p->prefixlen != IPV4_MAX_BITLEN) {  			vty_out(vty, "Not a host address: \"%s\"%s", str,  				HVTYNL);  			return CMD_WARNING; diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index dc5d3f73ef..68dc5a4f60 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -597,7 +597,7 @@ encap_attr_export(struct attr *new, struct attr *orig,  		orig_nexthop.family =  			BGP_MP_NEXTHOP_FAMILY(orig->mp_nexthop_len);  		if (orig_nexthop.family == AF_INET) { -			orig_nexthop.prefixlen = 32; +			orig_nexthop.prefixlen = IPV4_MAX_BITLEN;  			orig_nexthop.u.prefix4 = orig->mp_nexthop_global_in;  		} else if (orig_nexthop.family == AF_INET6) {  			orig_nexthop.prefixlen = IPV6_MAX_BITLEN; diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 21fe1fac69..0358c8d665 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -108,7 +108,7 @@ static int is_host_prefix(const struct prefix *p)  {  	switch (p->family) {  	case AF_INET: -		return (p->prefixlen == 32); +		return (p->prefixlen == IPV4_MAX_BITLEN);  	case AF_INET6:  		return (p->prefixlen == IPV6_MAX_BITLEN);  	} @@ -1073,7 +1073,7 @@ static void vnc_import_bgp_del_route_mode_plain(struct bgp *bgp,  	vnaddr.addr_family = vn_pfx->family;  	switch (vn_pfx->family) {  	case AF_INET: -		if (vn_pfx->prefixlen != 32) { +		if (vn_pfx->prefixlen != IPV4_MAX_BITLEN) {  			vnc_zlog_debug_verbose(  				"%s: redist VN plen (%d) != 32, skipping",  				__func__, vn_pfx->prefixlen); @@ -1147,7 +1147,7 @@ static void vnc_import_bgp_del_route_mode_nvegroup(struct bgp *bgp,  	vnaddr.addr_family = vn_pfx->family;  	switch (vn_pfx->family) {  	case AF_INET: -		if (vn_pfx->prefixlen != 32) { +		if (vn_pfx->prefixlen != IPV4_MAX_BITLEN) {  			vnc_zlog_debug_verbose(  				"%s: redist VN plen (%d) != 32, skipping",  				__func__, vn_pfx->prefixlen); diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index a6a64d30ed..ba849e4e0b 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -105,7 +105,8 @@ static void vnc_redistribute_add(struct prefix *p, uint32_t metric,  	vnaddr.addr_family = bgp->rfapi_cfg->rfg_redist->vn_prefix.family;  	switch (bgp->rfapi_cfg->rfg_redist->vn_prefix.family) {  	case AF_INET: -		if (bgp->rfapi_cfg->rfg_redist->vn_prefix.prefixlen != 32) { +		if (bgp->rfapi_cfg->rfg_redist->vn_prefix.prefixlen +		    != IPV4_MAX_BITLEN) {  			vnc_zlog_debug_verbose(  				"%s: redist nve group VN prefix len (%d) != 32, skipping",  				__func__, @@ -154,7 +155,7 @@ static void vnc_redistribute_add(struct prefix *p, uint32_t metric,  		switch (pfx_un.prefix.addr_family) {  		case AF_INET: -			if (pfx_un.length != 32) { +			if (pfx_un.length != IPV4_MAX_BITLEN) {  				vnc_zlog_debug_verbose(  					"%s: redist nve group UN prefix len (%d) != 32, skipping",  					__func__, pfx_un.length); diff --git a/isisd/isis_route.c b/isisd/isis_route.c index 4fd15f6c42..bf0079d814 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -221,7 +221,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,  		/* update neighbor router address */  		switch (prefix->family) {  		case AF_INET: -			if (depth == 2 && prefix->prefixlen == 32) +			if (depth == 2 && prefix->prefixlen == IPV4_MAX_BITLEN)  				adj->router_address = prefix->u.prefix4;  			break;  		case AF_INET6: diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 2a486c754e..17dbb1903d 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -2057,7 +2057,7 @@ static int unpack_item_extended_ip_reach(uint16_t mtid, uint8_t len,  	rv->down = (control & ISIS_EXTENDED_IP_REACH_DOWN);  	rv->prefix.family = AF_INET;  	rv->prefix.prefixlen = control & 0x3f; -	if (rv->prefix.prefixlen > 32) { +	if (rv->prefix.prefixlen > IPV4_MAX_BITLEN) {  		sbuf_push(log, indent, "Prefixlen %u is implausible for IPv4\n",  			  rv->prefix.prefixlen);  		goto out; diff --git a/ldpd/lde.c b/ldpd/lde.c index 1249db9937..2d35d097a1 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -751,8 +751,8 @@ lde_update_label(struct fec_node *fn)  	/* should we allocate a label for this fec? */  	switch (fn->fec.type) {  	case FEC_TYPE_IPV4: -		if ((ldeconf->ipv4.flags & F_LDPD_AF_ALLOCHOSTONLY) && -		    fn->fec.u.ipv4.prefixlen != 32) +		if ((ldeconf->ipv4.flags & F_LDPD_AF_ALLOCHOSTONLY) +		    && fn->fec.u.ipv4.prefixlen != IPV4_MAX_BITLEN)  			return (NO_LABEL);  		if (lde_acl_check(ldeconf->ipv4.acl_label_allocate_for,  		    AF_INET, (union ldpd_addr *)&fn->fec.u.ipv4.prefix, diff --git a/ldpd/util.c b/ldpd/util.c index ce74e9099b..019d846ada 100644 --- a/ldpd/util.c +++ b/ldpd/util.c @@ -182,7 +182,7 @@ ldp_prefixcmp(int af, const union ldpd_addr *a, const union ldpd_addr *b,  	case AF_INET:  		if (prefixlen == 0)  			return (0); -		if (prefixlen > 32) +		if (prefixlen > IPV4_MAX_BITLEN)  			fatalx("ldp_prefixcmp: bad IPv4 prefixlen");  		mask = htonl(prefixlen2mask(prefixlen));  		aa = htonl(a->v4.s_addr) & mask; diff --git a/lib/command_match.c b/lib/command_match.c index 367362f7b5..5703510148 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -813,7 +813,7 @@ static enum match_type match_ipv4_prefix(const char *str)  		str++;  	} -	if (atoi(sp) > 32) +	if (atoi(sp) > IPV4_MAX_BITLEN)  		return no_match;  	return exact_match; diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index b53fc717a6..d4e52f0ede 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1400,7 +1400,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,  		/* create/update binding in external_id_table */  		prefix_id.family = AF_INET; -		prefix_id.prefixlen = 32; +		prefix_id.prefixlen = IPV4_MAX_BITLEN;  		prefix_id.u.prefix4.s_addr = htonl(info->id);  		node = route_node_get(ospf6->external_id_table, &prefix_id);  		node->info = match; @@ -1465,7 +1465,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,  	/* create/update binding in external_id_table */  	prefix_id.family = AF_INET; -	prefix_id.prefixlen = 32; +	prefix_id.prefixlen = IPV4_MAX_BITLEN;  	prefix_id.u.prefix4.s_addr = htonl(info->id);  	node = route_node_get(ospf6->external_id_table, &prefix_id);  	node->info = route; @@ -1548,7 +1548,7 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex,  	/* remove binding in external_id_table */  	prefix_id.family = AF_INET; -	prefix_id.prefixlen = 32; +	prefix_id.prefixlen = IPV4_MAX_BITLEN;  	prefix_id.u.prefix4.s_addr = htonl(info->id);  	node = route_node_lookup(ospf6->external_id_table, &prefix_id);  	assert(node); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 54ce248d89..f9a76355fd 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6616,7 +6616,7 @@ static void show_lsa_prefix_set(struct vty *vty, struct prefix_ls *lp,  	if (id == NULL)  		lp->prefixlen = 0;  	else if (adv_router == NULL) { -		lp->prefixlen = 32; +		lp->prefixlen = IPV4_MAX_BITLEN;  		lp->id = *id;  	} else {  		lp->prefixlen = 64; diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index 6c353d9492..a2eecbbf50 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -460,7 +460,7 @@ void pbr_send_rnh(struct nexthop *nhop, bool reg)  	case NEXTHOP_TYPE_IPV4_IFINDEX:  		p.family = AF_INET;  		p.u.prefix4.s_addr = nhop->gate.ipv4.s_addr; -		p.prefixlen = 32; +		p.prefixlen = IPV4_MAX_BITLEN;  		break;  	case NEXTHOP_TYPE_IPV6:  	case NEXTHOP_TYPE_IPV6_IFINDEX: diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index ad5257630b..0181e885fd 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -1253,7 +1253,7 @@ int pim_bsm_process(struct interface *ifp, struct ip *ip_hdr, uint8_t *buf,  	bshdr = (struct bsm_hdr *)(buf + PIM_MSG_HEADER_LEN);  	pim_inet4_dump("<bsr?>", bshdr->bsr_addr.addr, bsr_str,  		       sizeof(bsr_str)); -	if (bshdr->hm_len > 32) { +	if (bshdr->hm_len > IPV4_MAX_BITLEN) {  		zlog_warn("Bad hashmask length for IPv4; got %hhu, expected value in range 0-32",  			  bshdr->hm_len);  		pim->bsm_dropped++; diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index 3ae7744eb0..afa2db5f15 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -1953,7 +1953,7 @@ int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from,  		g.family = AF_INET;  		g.u.prefix4 = rec_group; -		g.prefixlen = 32; +		g.prefixlen = IPV4_MAX_BITLEN;  		/* determine filtering status for group */  		filtered = pim_is_group_filtered(ifp->info, &rec_group); diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c index 6d49708827..eb5f46951e 100644 --- a/pimd/pim_msdp_packet.c +++ b/pimd/pim_msdp_packet.c @@ -505,7 +505,7 @@ static void pim_msdp_pkt_sa_rx_one(struct pim_msdp_peer *mp, struct in_addr rp)  	sg.grp.s_addr = stream_get_ipv4(mp->ibuf);  	sg.src.s_addr = stream_get_ipv4(mp->ibuf); -	if (prefix_len != 32) { +	if (prefix_len != IPV4_MAX_BITLEN) {  		/* ignore SA update if the prefix length is not 32 */  		flog_err(EC_PIM_MSDP_PACKET,  			 "rxed sa update with invalid prefix length %d", diff --git a/pimd/pim_register.c b/pimd/pim_register.c index 7313a2fba2..9d5b864ab0 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -89,7 +89,7 @@ void pim_register_stop_send(struct interface *ifp, struct prefix_sg *sg,  	p.family = AF_INET;  	p.u.prefix4 = sg->src; -	p.prefixlen = 32; +	p.prefixlen = IPV4_MAX_BITLEN;  	length = pim_encode_addr_ucast(b1, &p);  	b1length += length; diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index fc56a8817a..b6521132f7 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -1036,7 +1036,7 @@ int pim_rp_i_am_rp(struct pim_instance *pim, struct in_addr group)  	memset(&g, 0, sizeof(g));  	g.family = AF_INET; -	g.prefixlen = 32; +	g.prefixlen = IPV4_MAX_BITLEN;  	g.u.prefix4 = group;  	rp_info = pim_rp_find_match_group(pim, &g); @@ -1059,7 +1059,7 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group)  	memset(&g, 0, sizeof(g));  	g.family = AF_INET; -	g.prefixlen = 32; +	g.prefixlen = IPV4_MAX_BITLEN;  	g.u.prefix4 = group;  	rp_info = pim_rp_find_match_group(pim, &g); @@ -1103,7 +1103,7 @@ int pim_rp_set_upstream_addr(struct pim_instance *pim, struct in_addr *up,  	memset(&g, 0, sizeof(g));  	g.family = AF_INET; -	g.prefixlen = 32; +	g.prefixlen = IPV4_MAX_BITLEN;  	g.u.prefix4 = group;  	rp_info = pim_rp_find_match_group(pim, &g); diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c index 62cecac41e..8e6ff2f3a7 100644 --- a/pimd/pim_tlv.c +++ b/pimd/pim_tlv.c @@ -626,7 +626,7 @@ int pim_parse_addr_source(struct prefix_sg *sg, uint8_t *flags,  		   messages  		   received with any other mask length.  		*/ -		if (mask_len != 32) { +		if (mask_len != IPV4_MAX_BITLEN) {  			zlog_warn("%s: IPv4 bad source address mask: %d",  				  __func__, mask_len);  			return -4; diff --git a/pimd/pim_util.c b/pimd/pim_util.c index 11a0abd193..decc491ede 100644 --- a/pimd/pim_util.c +++ b/pimd/pim_util.c @@ -134,7 +134,7 @@ int pim_is_group_224_4(struct in_addr group_addr)  	group.family = AF_INET;  	group.u.prefix4 = group_addr; -	group.prefixlen = 32; +	group.prefixlen = IPV4_MAX_BITLEN;  	return prefix_match(&group_all, &group);  } @@ -148,7 +148,7 @@ bool pim_is_group_filtered(struct pim_interface *pim_ifp, struct in_addr *grp)  		return false;  	grp_pfx.family = AF_INET; -	grp_pfx.prefixlen = 32; +	grp_pfx.prefixlen = IPV4_MAX_BITLEN;  	grp_pfx.u.prefix4 = *grp;  	pl = prefix_list_lookup(AFI_IP, pim_ifp->boundary_oil_plist); diff --git a/ripd/ripd.c b/ripd/ripd.c index fe4a349b1a..ccd4bf1bac 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2143,7 +2143,8 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to,  					       &rp->p)) {  					if ((ifc->address->prefixlen  					     != rp->p.prefixlen) -					    && (rp->p.prefixlen != 32)) +					    && (rp->p.prefixlen +						!= IPV4_MAX_BITLEN))  						continue;  				} else {  					memcpy(&classfull, &rp->p, diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index 271696daf9..f8c46894ba 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -141,7 +141,7 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,  	if (n) {  		type_import = false; -		p.prefixlen = 32; +		p.prefixlen = IPV4_MAX_BITLEN;  		p.u.prefix4 = nhop;  		p.family = AF_INET;  	} @@ -239,7 +239,7 @@ DEFPY (install_routes,  	if (start4.s_addr != INADDR_ANY) {  		prefix.family = AF_INET; -		prefix.prefixlen = 32; +		prefix.prefixlen = IPV4_MAX_BITLEN;  		prefix.u.prefix4 = start4;  	} else {  		prefix.family = AF_INET6; @@ -383,7 +383,7 @@ DEFPY (install_seg6_routes,  	if (start4.s_addr != INADDR_ANY) {  		prefix.family = AF_INET; -		prefix.prefixlen = 32; +		prefix.prefixlen = IPV4_MAX_BITLEN;  		prefix.u.prefix4 = start4;  	} else {  		prefix.family = AF_INET6; @@ -568,7 +568,7 @@ DEFPY (remove_routes,  	if (start4.s_addr != INADDR_ANY) {  		prefix.family = AF_INET; -		prefix.prefixlen = 32; +		prefix.prefixlen = IPV4_MAX_BITLEN;  		prefix.u.prefix4 = start4;  	} else {  		prefix.family = AF_INET6; @@ -878,7 +878,7 @@ DEFPY (neigh_discover,  	if (dst4.s_addr != INADDR_ANY) {  		prefix.family = AF_INET; -		prefix.prefixlen = 32; +		prefix.prefixlen = IPV4_MAX_BITLEN;  		prefix.u.prefix4 = dst4;  	} else {  		prefix.family = AF_INET6; diff --git a/zebra/connected.c b/zebra/connected.c index 1c3dfe2a2f..e1dd0dbdff 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -75,7 +75,7 @@ static void connected_announce(struct interface *ifp, struct connected *ifc)  	if (!if_is_loopback(ifp) && ifc->address->family == AF_INET &&  	    !IS_ZEBRA_IF_VRF(ifp)) { -		if (ifc->address->prefixlen == 32) +		if (ifc->address->prefixlen == IPV4_MAX_BITLEN)  			SET_FLAG(ifc->flags, ZEBRA_IFA_UNNUMBERED);  		else  			UNSET_FLAG(ifc->flags, ZEBRA_IFA_UNNUMBERED); diff --git a/zebra/interface.c b/zebra/interface.c index 7fd967dd8b..408c016494 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -3055,7 +3055,7 @@ static int ip_address_install(struct vty *vty, struct interface *ifp,  	}  	if (peer_str) { -		if (lp.prefixlen != 32) { +		if (lp.prefixlen != IPV4_MAX_BITLEN) {  			vty_out(vty,  				"%% Local prefix length for P-t-P address must be /32\n");  			return CMD_WARNING_CONFIG_FAILED; @@ -3186,7 +3186,7 @@ static int ip_address_uninstall(struct vty *vty, struct interface *ifp,  	}  	if (peer_str) { -		if (lp.prefixlen != 32) { +		if (lp.prefixlen != IPV4_MAX_BITLEN) {  			vty_out(vty,  				"%% Local prefix length for P-t-P address must be /32\n");  			return CMD_WARNING_CONFIG_FAILED; diff --git a/zebra/router-id.c b/zebra/router-id.c index e10eec55de..689b9787ee 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -81,7 +81,7 @@ int router_id_get(afi_t afi, struct prefix *p, struct zebra_vrf *zvrf)  	case AFI_IP:  		p->u.prefix4.s_addr = INADDR_ANY;  		p->family = AF_INET; -		p->prefixlen = 32; +		p->prefixlen = IPV4_MAX_BITLEN;  		if (zvrf->rid_user_assigned.u.prefix4.s_addr != INADDR_ANY)  			p->u.prefix4.s_addr =  				zvrf->rid_user_assigned.u.prefix4.s_addr; @@ -276,7 +276,7 @@ DEFUN (ip_router_id,  	if (!inet_pton(AF_INET, argv[idx]->arg, &rid.u.prefix4))  		return CMD_WARNING_CONFIG_FAILED; -	rid.prefixlen = 32; +	rid.prefixlen = IPV4_MAX_BITLEN;  	rid.family = AF_INET;  	argv_find(argv, argc, "NAME", &idx); @@ -342,7 +342,7 @@ DEFUN (ip_router_id_in_vrf,  	if (!inet_pton(AF_INET, argv[idx]->arg, &rid.u.prefix4))  		return CMD_WARNING_CONFIG_FAILED; -	rid.prefixlen = 32; +	rid.prefixlen = IPV4_MAX_BITLEN;  	rid.family = AF_INET;  	router_id_set(AFI_IP, &rid, zvrf); @@ -599,7 +599,7 @@ void router_id_init(struct zebra_vrf *zvrf)  	zvrf->rid6_lo_sorted_list->cmp = router_id_v6_cmp;  	zvrf->rid_user_assigned.family = AF_INET; -	zvrf->rid_user_assigned.prefixlen = 32; +	zvrf->rid_user_assigned.prefixlen = IPV4_MAX_BITLEN;  	zvrf->rid6_user_assigned.family = AF_INET6;  	zvrf->rid6_user_assigned.prefixlen = IPV6_MAX_BITLEN;  } diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 3535bffd54..cfd4ccf817 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -2049,7 +2049,7 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,  	}  	if (top -	    && ((top->family == AF_INET && top->prefixlen == 32 +	    && ((top->family == AF_INET && top->prefixlen == IPV4_MAX_BITLEN  		 && nexthop->gate.ipv4.s_addr == top->u.prefix4.s_addr)  		|| (top->family == AF_INET6 && top->prefixlen == IPV6_MAX_BITLEN  		    && memcmp(&nexthop->gate.ipv6, &top->u.prefix6, 16) @@ -2151,7 +2151,8 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,  		 * host route.  		 */  		if (prefix_same(&rn->p, top)) -			if (((afi == AFI_IP) && (rn->p.prefixlen != 32)) +			if (((afi == AFI_IP) +			     && (rn->p.prefixlen != IPV4_MAX_BITLEN))  			    || ((afi == AFI_IP6)  				&& (rn->p.prefixlen != IPV6_MAX_BITLEN))) {  				if (IS_ZEBRA_DEBUG_RIB_DETAILED)  | 
