summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-02-07 13:16:59 -0500
committerDonald Sharp <sharpd@nvidia.com>2022-02-07 13:16:59 -0500
commitc7ca5ccf6ff03d0d439253cf699a11ee80259ca8 (patch)
treecc6fefcecce270250e884637d9aef6b4cff3d7f3
parent35215a013a43e447d1f5e7329c93c80529520a27 (diff)
bgpd: Use AF_UNSPEC instead of setting to 0
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--bgpd/rfapi/rfapi_import.c18
-rw-r--r--bgpd/rfapi/rfapi_rib.c2
2 files changed, 10 insertions, 10 deletions
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 07aed045ca..4b50b46569 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -388,7 +388,7 @@ int rfapiGetVncTunnelUnAddr(struct attr *attr, struct prefix *p)
return 0;
/* MPLS carries UN address in next hop */
rfapiNexthop2Prefix(attr, p);
- if (p->family != 0)
+ if (p->family != AF_UNSPEC)
return 0;
return ENOENT;
@@ -457,7 +457,7 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p)
return 0;
default:
if (p)
- p->family = 0;
+ p->family = AF_UNSPEC;
#ifdef DEBUG_ENCAP_MONITOR
vnc_zlog_debug_verbose(
"%s: bpi->extra->vnc.import.un_family is 0, no UN addr",
@@ -1155,7 +1155,7 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
bpi1->extra->vnc.import.un.addr6;
break;
default:
- pfx_un1.family = 0;
+ pfx_un1.family = AF_UNSPEC;
break;
}
}
@@ -1174,13 +1174,13 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
bpi2->extra->vnc.import.un.addr6;
break;
default:
- pfx_un2.family = 0;
+ pfx_un2.family = AF_UNSPEC;
break;
}
}
}
- if (pfx_un1.family == 0 || pfx_un2.family == 0)
+ if (pfx_un1.family == AF_UNSPEC || pfx_un2.family == AF_UNSPEC)
return 0;
if (pfx_un1.family != pfx_un2.family)
@@ -1358,7 +1358,7 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
struct prefix p;
/* MPLS carries UN address in next hop */
rfapiNexthop2Prefix(bpi->attr, &p);
- if (p.family != 0) {
+ if (p.family != AF_UNSPEC) {
rfapiQprefix2Raddr(&p, &new->un_address);
have_vnc_tunnel_un = 1;
}
@@ -2609,7 +2609,7 @@ static void rfapiCopyUnEncap2VPN(struct bgp_path_info *encap_bpi,
default:
zlog_warn("%s: invalid encap nexthop length: %d", __func__,
encap_bpi->attr->mp_nexthop_len);
- vpn_bpi->extra->vnc.import.un_family = 0;
+ vpn_bpi->extra->vnc.import.un_family = AF_UNSPEC;
break;
}
}
@@ -2634,7 +2634,7 @@ rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table,
__func__);
return 1;
}
- vpn_bpi->extra->vnc.import.un_family = 0;
+ vpn_bpi->extra->vnc.import.un_family = AF_UNSPEC;
memset(&vpn_bpi->extra->vnc.import.un, 0,
sizeof(vpn_bpi->extra->vnc.import.un));
if (CHECK_FLAG(vpn_bpi->flags, BGP_PATH_VALID)) {
@@ -3626,7 +3626,7 @@ void rfapiBgpInfoFilteredImportVPN(
/* Not a big deal, just means VPN route got here first */
vnc_zlog_debug_verbose("%s: no encap route for vn addr %pFX",
__func__, &vn_prefix);
- info_new->extra->vnc.import.un_family = 0;
+ info_new->extra->vnc.import.un_family = AF_UNSPEC;
}
if (rn) {
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index d1f335f549..6b9a8fb4a7 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -1950,7 +1950,7 @@ rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
&& RFAPI_HOST_PREFIX(&rk.aux_prefix)) {
/* mark as "none" if nhp->prefix is 0/32 or
* 0/128 */
- rk.aux_prefix.family = 0;
+ rk.aux_prefix.family = AF_UNSPEC;
}
}