diff options
author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2021-07-01 17:05:11 +0200 |
---|---|---|
committer | Donatas Abraitis <donatas.abraitis@gmail.com> | 2021-07-01 22:50:39 +0200 |
commit | 12256b84a540434485b16433f83aa23928405560 (patch) | |
tree | e1ef59c861d62e6527ebe87f6527142f18cfef8d /bgpd | |
parent | babeld: Drop in_prefix() function (diff) | |
download | frr-12256b84a540434485b16433f83aa23928405560.tar.xz frr-12256b84a540434485b16433f83aa23928405560.zip |
*: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlen
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'bgpd')
-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 |
8 files changed, 14 insertions, 13 deletions
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index 975f7ecbd..3c8f2f366 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 8e794a163..0de48dcf7 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 814fc8e3f..8bed5156b 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 2451298ed..bc0e192ae 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 9cf21a7db..45ef7230b 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 dc5d3f73e..68dc5a4f6 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 21fe1fac6..0358c8d66 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 a6a64d30e..ba849e4e0 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); |