From 3036004116c8d9e9f9504e1b974236d3061f189f Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 1 Jul 2021 17:37:04 +0300 Subject: [PATCH] bgpd: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlen Signed-off-by: Donatas Abraitis --- bgpd/rfapi/rfapi_import.c | 10 +++++----- bgpd/rfapi/rfapi_vty.c | 2 +- bgpd/rfapi/vnc_export_bgp.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 43f24cd3cc..07aed045ca 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -405,7 +405,7 @@ int rfapiGetVncTunnelUnAddr(struct attr *attr, struct prefix *p) case 8: if (p) { p->family = AF_INET; - p->prefixlen = 32; + p->prefixlen = IPV4_MAX_BITLEN; memcpy(p->u.val, pEncap->value, 4); } @@ -445,7 +445,7 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p) if (p) { p->family = bpi->extra->vnc.import.un_family; p->u.prefix4 = bpi->extra->vnc.import.un.addr4; - p->prefixlen = 32; + p->prefixlen = IPV4_MAX_BITLEN; } return 0; case AF_INET6: @@ -2519,7 +2519,7 @@ void rfapiNexthop2Prefix(struct attr *attr, struct prefix *p) switch (p->family = BGP_MP_NEXTHOP_FAMILY(attr->mp_nexthop_len)) { case AF_INET: p->u.prefix4 = attr->mp_nexthop_global_in; - p->prefixlen = 32; + p->prefixlen = IPV4_MAX_BITLEN; break; case AF_INET6: @@ -2537,7 +2537,7 @@ void rfapiUnicastNexthop2Prefix(afi_t afi, struct attr *attr, struct prefix *p) { if (afi == AFI_IP) { p->family = AF_INET; - p->prefixlen = 32; + p->prefixlen = IPV4_MAX_BITLEN; p->u.prefix4 = attr->nexthop; } else { rfapiNexthop2Prefix(attr, p); @@ -2871,7 +2871,7 @@ static int rfapiGetNexthop(struct attr *attr, struct prefix *prefix) switch (BGP_MP_NEXTHOP_FAMILY(attr->mp_nexthop_len)) { case AF_INET: prefix->family = AF_INET; - prefix->prefixlen = 32; + prefix->prefixlen = IPV4_MAX_BITLEN; prefix->u.prefix4 = attr->mp_nexthop_global_in; break; case AF_INET6: diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index e19952d1b0..0c40aeb54e 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -260,7 +260,7 @@ int rfapiRaddr2Qprefix(struct rfapi_ip_addr *hia, struct prefix *pfx) switch (hia->addr_family) { case AF_INET: - pfx->prefixlen = 32; + pfx->prefixlen = IPV4_MAX_BITLEN; pfx->u.prefix4 = hia->addr.v4; break; case AF_INET6: diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index c90fcf8d72..f8b8c7d680 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -164,7 +164,7 @@ static int getce(struct bgp *bgp, struct attr *attr, struct prefix *pfx_ce) memset((uint8_t *)pfx_ce, 0, sizeof(*pfx_ce)); memcpy(&pfx_ce->u.prefix4, ecp + 2, 4); pfx_ce->family = AF_INET; - pfx_ce->prefixlen = 32; + pfx_ce->prefixlen = IPV4_MAX_BITLEN; return 0; }