From 936fbaef4794277a56185c535574df0f2771c117 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 1 Jul 2021 17:42:03 +0300 Subject: [PATCH] *: Replace IPV4_MAX_PREFIXLEN to IPV4_MAX_BITLEN Just drop IPV4_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis --- bgpd/bgp_network.c | 6 +++--- ldpd/labelmapping.c | 2 +- lib/prefix.c | 17 +++++++++-------- lib/prefix.h | 1 - lib/table.c | 2 +- lib/zclient.c | 2 +- ospfd/ospf_asbr.c | 2 +- ospfd/ospf_interface.c | 12 ++++++------ ospfd/ospf_te.c | 12 ++++++------ ospfd/ospf_ti_lfa.c | 2 +- ospfd/ospf_zebra.c | 2 +- pimd/pim_iface.c | 2 +- pimd/pim_ifchannel.c | 2 +- pimd/pim_register.c | 2 +- pimd/pim_rp.c | 4 ++-- pimd/pim_tlv.c | 2 +- pimd/pim_upstream.c | 2 +- pimd/pim_util.c | 2 +- ripd/rip_interface.c | 2 +- ripd/ripd.c | 2 +- zebra/connected.c | 11 +++++------ zebra/kernel_socket.c | 2 +- zebra/zebra_dplane.c | 3 +-- zebra/zebra_mpls.c | 2 +- zebra/zebra_nhg.c | 2 +- zebra/zebra_pbr.c | 2 +- zebra/zebra_rib.c | 2 +- 27 files changed, 51 insertions(+), 53 deletions(-) diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 1ddf1f4cf..3c061ef1e 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -101,7 +101,7 @@ static int bgp_md5_set_socket(int socket, union sockunion *su, su2.sin6.sin6_port = 0; /* For addresses, use the non-extended signature functionality */ - if ((su2.sa.sa_family == AF_INET && prefixlen == IPV4_MAX_PREFIXLEN) + if ((su2.sa.sa_family == AF_INET && prefixlen == IPV4_MAX_BITLEN) || (su2.sa.sa_family == AF_INET6 && prefixlen == IPV6_MAX_BITLEN)) ret = sockopt_tcp_signature(socket, &su2, password); else @@ -163,7 +163,7 @@ static int bgp_md5_set_password(struct peer *peer, const char *password) peer->su.sa.sa_family) { uint16_t prefixlen = peer->su.sa.sa_family == AF_INET - ? IPV4_MAX_PREFIXLEN + ? IPV4_MAX_BITLEN : IPV6_MAX_BITLEN; /* @@ -744,7 +744,7 @@ int bgp_connect(struct peer *peer) if (peer->password) { uint16_t prefixlen = peer->su.sa.sa_family == AF_INET - ? IPV4_MAX_PREFIXLEN + ? IPV4_MAX_BITLEN : IPV6_MAX_BITLEN; bgp_md5_set_connect(peer->fd, &peer->su, prefixlen, diff --git a/ldpd/labelmapping.c b/ldpd/labelmapping.c index 53f3c00fb..13d324312 100644 --- a/ldpd/labelmapping.c +++ b/ldpd/labelmapping.c @@ -724,7 +724,7 @@ tlv_decode_fec_elm(struct nbr *nbr, struct ldp_msg *msg, char *buf, map->fec.prefix.prefixlen = buf[off]; off += sizeof(uint8_t); if ((map->fec.prefix.af == AF_IPV4 - && map->fec.prefix.prefixlen > IPV4_MAX_PREFIXLEN) + && map->fec.prefix.prefixlen > IPV4_MAX_BITLEN) || (map->fec.prefix.af == AF_IPV6 && map->fec.prefix.prefixlen > IPV6_MAX_BITLEN)) { session_shutdown(nbr, S_BAD_TLV_VAL, msg->id, diff --git a/lib/prefix.c b/lib/prefix.c index 7dbb5f07f..1c57715e8 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -577,7 +577,7 @@ int str2prefix_ipv4(const char *str, struct prefix_ipv4 *p) /* Get prefix length. */ plen = (uint8_t)atoi(++pnt); - if (plen > IPV4_MAX_PREFIXLEN) + if (plen > IPV4_MAX_BITLEN) return 0; p->family = AF_INET; @@ -1128,7 +1128,7 @@ void apply_classful_mask_ipv4(struct prefix_ipv4 *p) destination = ntohl(p->prefix.s_addr); - if (p->prefixlen == IPV4_MAX_PREFIXLEN) + if (p->prefixlen == IPV4_MAX_BITLEN) ; /* do nothing for host routes */ else if (IN_CLASSC(destination)) { @@ -1148,12 +1148,13 @@ in_addr_t ipv4_broadcast_addr(in_addr_t hostaddr, int masklen) struct in_addr mask; masklen2ip(masklen, &mask); - return (masklen != IPV4_MAX_PREFIXLEN - 1) ? - /* normal case */ - (hostaddr | ~mask.s_addr) - : - /* For prefix 31 return 255.255.255.255 (RFC3021) */ - htonl(0xFFFFFFFF); + return (masklen != IPV4_MAX_BITLEN - 1) + ? + /* normal case */ + (hostaddr | ~mask.s_addr) + : + /* For prefix 31 return 255.255.255.255 (RFC3021) */ + htonl(0xFFFFFFFF); } /* Utility function to convert ipv4 netmask to prefixes diff --git a/lib/prefix.h b/lib/prefix.h index 890dcd7ef..bc4cb7f44 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -372,7 +372,6 @@ union prefixconstptr { /* Max bit/byte length of IPv4 address. */ #define IPV4_MAX_BYTELEN 4 #define IPV4_MAX_BITLEN 32 -#define IPV4_MAX_PREFIXLEN 32 #define IPV4_ADDR_CMP(D,S) memcmp ((D), (S), IPV4_MAX_BYTELEN) static inline bool ipv4_addr_same(const struct in_addr *a, diff --git a/lib/table.c b/lib/table.c index 171b3a897..e6030ca4c 100644 --- a/lib/table.c +++ b/lib/table.c @@ -230,7 +230,7 @@ struct route_node *route_node_match_ipv4(struct route_table *table, memset(&p, 0, sizeof(struct prefix_ipv4)); p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.prefix = *addr; return route_node_match(table, (struct prefix *)&p); diff --git a/lib/zclient.c b/lib/zclient.c index c0efeebeb..7979f13f2 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1432,7 +1432,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) STREAM_GETC(s, api->prefix.prefixlen); switch (api->prefix.family) { case AF_INET: - if (api->prefix.prefixlen > IPV4_MAX_PREFIXLEN) { + if (api->prefix.prefixlen > IPV4_MAX_BITLEN) { flog_err( EC_LIB_ZAPI_ENCODE, "%s: V4 prefixlen is %d which should not be more than 32", diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index 2fd195bb6..192dbe4fc 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -361,7 +361,7 @@ bool is_valid_summary_addr(struct prefix_ipv4 *p) return false; /*Host route shouldn't be configured as summary addres*/ - if (p->prefixlen == IPV4_MAX_PREFIXLEN) + if (p->prefixlen == IPV4_MAX_BITLEN) return false; return true; diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index b3aba247d..029f929c1 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -188,7 +188,7 @@ struct ospf_interface *ospf_if_table_lookup(struct interface *ifp, struct ospf_interface *rninfo = NULL; p = *prefix; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; /* route_node_get implicitely locks */ if ((rn = route_node_lookup(IF_OIFS(ifp), &p))) { @@ -205,7 +205,7 @@ static void ospf_add_to_if(struct interface *ifp, struct ospf_interface *oi) struct prefix p; p = *oi->address; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; apply_mask(&p); rn = route_node_get(IF_OIFS(ifp), &p); @@ -223,7 +223,7 @@ static void ospf_delete_from_if(struct interface *ifp, struct prefix p; p = *oi->address; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; rn = route_node_lookup(IF_OIFS(oi->ifp), &p); assert(rn); @@ -566,7 +566,7 @@ void ospf_free_if_params(struct interface *ifp, struct in_addr addr) struct route_node *rn; p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.prefix = addr; rn = route_node_lookup(IF_OIFS_PARAMS(ifp), (struct prefix *)&p); if (!rn || !rn->info) @@ -601,7 +601,7 @@ struct ospf_if_params *ospf_lookup_if_params(struct interface *ifp, struct route_node *rn; p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.prefix = addr; rn = route_node_lookup(IF_OIFS_PARAMS(ifp), (struct prefix *)&p); @@ -621,7 +621,7 @@ struct ospf_if_params *ospf_get_if_params(struct interface *ifp, struct route_node *rn; p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.prefix = addr; apply_mask_ipv4(&p); diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 333fa6a3a..d95e677f6 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -1840,7 +1840,7 @@ static void ospf_te_update_subnet(struct ls_ted *ted, struct ls_vertex *vertex, /** * Delete Subnet that correspond to the given IPv4 address and export deletion - * information before removal. Prefix length is fixed to IPV4_MAX_PREFIXLEN. + * information before removal. Prefix length is fixed to IPV4_MAX_BITLEN. * * @param ted Links State Database * @param addr IPv4 address @@ -1852,7 +1852,7 @@ static void ospf_te_delete_subnet(struct ls_ted *ted, struct in_addr addr) /* Search subnet that correspond to the address/32 as prefix */ p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.u.prefix4 = addr; subnet = ls_find_subnet(ted, p); @@ -1944,7 +1944,7 @@ static int ospf_te_parse_router_lsa(struct ls_ted *ted, struct ospf_lsa *lsa) ntohs(rl->link[i].metric)); /* Add corresponding subnet */ p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.u.prefix4 = rl->link[i].link_data; metric = ntohs(rl->link[i].metric); ospf_te_update_subnet(ted, vertex, p, metric); @@ -1952,7 +1952,7 @@ static int ospf_te_parse_router_lsa(struct ls_ted *ted, struct ospf_lsa *lsa) case LSA_LINK_TYPE_STUB: /* Keep only /32 prefix */ p.prefixlen = ip_masklen(rl->link[i].link_data); - if (p.prefixlen == IPV4_MAX_PREFIXLEN) { + if (p.prefixlen == IPV4_MAX_BITLEN) { p.family = AF_INET; p.u.prefix4 = rl->link[i].link_id; metric = ntohs(rl->link[i].metric); @@ -2086,12 +2086,12 @@ static void ospf_te_update_remote_asbr(struct ls_ted *ted, struct ls_edge *edge) /* Update corresponding Subnets */ p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.u.prefix4 = attr->standard.local; ospf_te_update_subnet(ted, edge->source, p, attr->standard.te_metric); p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.u.prefix4 = attr->standard.remote_addr; ospf_te_update_subnet(ted, vertex, p, attr->standard.te_metric); diff --git a/ospfd/ospf_ti_lfa.c b/ospfd/ospf_ti_lfa.c index 59b3b624e..347128a4f 100644 --- a/ospfd/ospf_ti_lfa.c +++ b/ospfd/ospf_ti_lfa.c @@ -849,7 +849,7 @@ void ospf_ti_lfa_generate_p_spaces(struct ospf_area *area, stub_prefix.family = AF_INET; child_prefix.family = AF_INET; - child_prefix.prefixlen = IPV4_MAX_PREFIXLEN; + child_prefix.prefixlen = IPV4_MAX_BITLEN; p = ((uint8_t *)root->lsa) + OSPF_LSA_HEADER_SIZE + 4; lim = ((uint8_t *)root->lsa) + ntohs(root->lsa->length); diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index df112edc6..017915e0e 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -138,7 +138,7 @@ static int ospf_interface_address_delete(ZAPI_CALLBACK_ARGS) ifp = c->ifp; p = *c->address; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; rn = route_node_lookup(IF_OIFS(ifp), &p); if (!rn) { diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 353f13300..48b019c8c 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -1139,7 +1139,7 @@ struct pim_neighbor *pim_if_find_neighbor(struct interface *ifp, p.family = AF_INET; p.u.prefix4 = addr; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, neighnode, neigh)) { diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 1bf3a619b..9ee06edfc 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -1248,7 +1248,7 @@ int pim_ifchannel_local_membership_add(struct interface *ifp, AFI_IP, pim->spt.plist); struct prefix g; g.family = AF_INET; - g.prefixlen = IPV4_MAX_PREFIXLEN; + g.prefixlen = IPV4_MAX_BITLEN; g.u.prefix4 = up->sg.grp; if (prefix_list_apply(plist, &g) diff --git a/pimd/pim_register.c b/pimd/pim_register.c index 90b69a54f..7313a2fba 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -393,7 +393,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr, plist = prefix_list_lookup(AFI_IP, pim->register_plist); src.family = AF_INET; - src.prefixlen = IPV4_MAX_PREFIXLEN; + src.prefixlen = IPV4_MAX_BITLEN; src.u.prefix4 = sg.src; if (prefix_list_apply(plist, &src) == PREFIX_DENY) { diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index a31fec036..fc56a8817 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -124,7 +124,7 @@ void pim_rp_init(struct pim_instance *pim) } rp_info->group.family = AF_INET; rp_info->rp.rpf_addr.family = AF_INET; - rp_info->rp.rpf_addr.prefixlen = IPV4_MAX_PREFIXLEN; + rp_info->rp.rpf_addr.prefixlen = IPV4_MAX_BITLEN; rp_info->rp.rpf_addr.u.prefix4.s_addr = INADDR_NONE; listnode_add(pim->rp_list, rp_info); @@ -417,7 +417,7 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, rp_info = XCALLOC(MTYPE_PIM_RP, sizeof(*rp_info)); rp_info->rp.rpf_addr.family = AF_INET; - rp_info->rp.rpf_addr.prefixlen = IPV4_MAX_PREFIXLEN; + rp_info->rp.rpf_addr.prefixlen = IPV4_MAX_BITLEN; rp_info->rp.rpf_addr.u.prefix4 = rp_addr; prefix_copy(&rp_info->group, &group); rp_info->rp_src = rp_src_flag; diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c index 8d6d3a416..62cecac41 100644 --- a/pimd/pim_tlv.c +++ b/pimd/pim_tlv.c @@ -481,7 +481,7 @@ int pim_parse_addr_ucast(struct prefix *p, const uint8_t *buf, int buf_size) p->family = AF_INET; /* notice: AF_INET != PIM_MSG_ADDRESS_FAMILY_IPV4 */ memcpy(&p->u.prefix4, addr, sizeof(struct in_addr)); - p->prefixlen = IPV4_MAX_PREFIXLEN; + p->prefixlen = IPV4_MAX_BITLEN; addr += sizeof(struct in_addr); break; diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 918a9a9c7..2b674b423 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -2174,7 +2174,7 @@ void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim, np = prefix_list_lookup(AFI_IP, nlist); g.family = AF_INET; - g.prefixlen = IPV4_MAX_PREFIXLEN; + g.prefixlen = IPV4_MAX_BITLEN; frr_each (rb_pim_upstream, &pim->upstream_head, up) { if (up->sg.src.s_addr != INADDR_ANY) diff --git a/pimd/pim_util.c b/pimd/pim_util.c index 15bde256d..11a0abd19 100644 --- a/pimd/pim_util.c +++ b/pimd/pim_util.c @@ -115,7 +115,7 @@ int pim_is_group_224_0_0_0_24(struct in_addr group_addr) group.family = AF_INET; group.u.prefix4 = group_addr; - group.prefixlen = IPV4_MAX_PREFIXLEN; + group.prefixlen = IPV4_MAX_BITLEN; return prefix_match(&group_224, &group); } diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index bdae2c5ef..7a8e10f30 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -160,7 +160,7 @@ static void rip_request_interface_send(struct interface *ifp, uint8_t version) * destination addr */ to.sin_addr = connected->destination->u.prefix4; else if (connected->address->prefixlen - < IPV4_MAX_PREFIXLEN) + < IPV4_MAX_BITLEN) /* calculate the appropriate broadcast * address */ to.sin_addr.s_addr = ipv4_broadcast_addr( diff --git a/ripd/ripd.c b/ripd/ripd.c index 7d940efd9..fe4a349b1 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2429,7 +2429,7 @@ static void rip_update_interface(struct connected *ifc, uint8_t version, /* use specified broadcast or peer destination * addr */ to.sin_addr = ifc->destination->u.prefix4; - else if (ifc->address->prefixlen < IPV4_MAX_PREFIXLEN) + else if (ifc->address->prefixlen < IPV4_MAX_BITLEN) /* calculate the appropriate broadcast address */ to.sin_addr.s_addr = ipv4_broadcast_addr( diff --git a/zebra/connected.c b/zebra/connected.c index dc7193eb4..1c3dfe2a2 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -330,8 +330,8 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr, p = prefix_ipv4_new(); p->family = AF_INET; p->prefix = *addr; - p->prefixlen = CHECK_FLAG(flags, ZEBRA_IFA_PEER) ? IPV4_MAX_PREFIXLEN - : prefixlen; + p->prefixlen = + CHECK_FLAG(flags, ZEBRA_IFA_PEER) ? IPV4_MAX_BITLEN : prefixlen; ifc->address = (struct prefix *)p; /* If there is a peer address. */ @@ -358,8 +358,7 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr, } /* no destination address was supplied */ - if (!dest && (prefixlen == IPV4_MAX_PREFIXLEN) - && if_is_pointopoint(ifp)) + if (!dest && (prefixlen == IPV4_MAX_BITLEN) && if_is_pointopoint(ifp)) zlog_debug( "PtP interface %s with addr %pI4/%d needs a peer address", ifp->name, addr, prefixlen); @@ -512,8 +511,8 @@ void connected_delete_ipv4(struct interface *ifp, int flags, memset(&p, 0, sizeof(struct prefix)); p.family = AF_INET; p.u.prefix4 = *addr; - p.prefixlen = CHECK_FLAG(flags, ZEBRA_IFA_PEER) ? IPV4_MAX_PREFIXLEN - : prefixlen; + p.prefixlen = + CHECK_FLAG(flags, ZEBRA_IFA_PEER) ? IPV4_MAX_BITLEN : prefixlen; if (dest) { memset(&d, 0, sizeof(struct prefix)); diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index d3e5f4233..252bf0478 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -1066,7 +1066,7 @@ void rtm_read(struct rt_msghdr *rtm) p.family = AF_INET; p.u.prefix4 = dest.sin.sin_addr; if (flags & RTF_HOST) - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; else p.prefixlen = ip_masklen(mask.sin.sin_addr); diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 90009cf17..04411fa0d 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -2537,8 +2537,7 @@ static int dplane_ctx_pw_init(struct zebra_dplane_ctx *ctx, */ memcpy(&p.u, &pw->nexthop, sizeof(pw->nexthop)); p.family = pw->af; - p.prefixlen = - ((pw->af == AF_INET) ? IPV4_MAX_PREFIXLEN : IPV6_MAX_BITLEN); + p.prefixlen = ((pw->af == AF_INET) ? IPV4_MAX_BITLEN : IPV6_MAX_BITLEN); afi = (pw->af == AF_INET) ? AFI_IP : AFI_IP6; table = zebra_vrf_table(afi, SAFI_UNICAST, pw->vrf_id); diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 638a06d66..a2d1513ce 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -613,7 +613,7 @@ static int nhlfe_nexthop_active_ipv4(zebra_nhlfe_t *nhlfe, /* Lookup nexthop in IPv4 routing table. */ memset(&p, 0, sizeof(struct prefix_ipv4)); p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.prefix = nexthop->gate.ipv4; rn = route_node_match(table, (struct prefix *)&p); diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index d48dc68df..7495a3a69 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -2118,7 +2118,7 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe, switch (afi) { case AFI_IP: p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.u.prefix4 = *ipv4; break; case AFI_IP6: diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c index d26e15e27..7bcd09737 100644 --- a/zebra/zebra_pbr.c +++ b/zebra/zebra_pbr.c @@ -925,7 +925,7 @@ static const char *zebra_pbr_prefix2str(union prefixconstptr pu, const struct prefix *p = pu.p; char buf[PREFIX2STR_BUFFER]; - if ((p->family == AF_INET && p->prefixlen == IPV4_MAX_PREFIXLEN) + if ((p->family == AF_INET && p->prefixlen == IPV4_MAX_BITLEN) || (p->family == AF_INET6 && p->prefixlen == IPV6_MAX_BITLEN)) { snprintf(str, size, "%s", inet_ntop(p->family, &p->u.prefix, buf, PREFIX2STR_BUFFER)); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index b25e31fd1..12cc0b4e8 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -349,7 +349,7 @@ struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id, p.family = afi; if (afi == AFI_IP) { p.u.prefix4 = addr->ipv4; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; } else { p.u.prefix6 = addr->ipv6; p.prefixlen = IPV6_MAX_BITLEN; -- 2.39.5