summaryrefslogtreecommitdiffstats
path: root/bgpd/rfapi
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2021-07-01 17:05:11 +0200
committerDonatas Abraitis <donatas.abraitis@gmail.com>2021-07-01 22:50:39 +0200
commit12256b84a540434485b16433f83aa23928405560 (patch)
treee1ef59c861d62e6527ebe87f6527142f18cfef8d /bgpd/rfapi
parentbabeld: Drop in_prefix() function (diff)
downloadfrr-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/rfapi')
-rw-r--r--bgpd/rfapi/rfapi.c4
-rw-r--r--bgpd/rfapi/rfapi_private.h2
-rw-r--r--bgpd/rfapi/rfapi_vty.c4
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c2
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c6
-rw-r--r--bgpd/rfapi/vnc_zebra.c5
6 files changed, 12 insertions, 11 deletions
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);