Merge pull request #10518 from donaldsharp/af_unspec

Af unspec
This commit is contained in:
Igor Ryzhov 2022-02-07 23:29:33 +03:00 committed by GitHub
commit 16cdf5ddbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 23 deletions

View File

@ -457,7 +457,7 @@ static int _ptm_msg_read(struct stream *msg, int command, vrf_id_t vrf_id,
}
/* Sanity check: peer and local address must match IP types. */
if (bpc->bpc_local.sa_sin.sin_family != 0
if (bpc->bpc_local.sa_sin.sin_family != AF_UNSPEC
&& (bpc->bpc_local.sa_sin.sin_family
!= bpc->bpc_peer.sa_sin.sin_family)) {
zlog_warn("ptm-read: peer family doesn't match local type");

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -1135,7 +1135,7 @@ static int lib_access_list_entry_any_destroy(struct nb_cb_destroy_args *args)
f = nb_running_get_entry(args->dnode, NULL, true);
fz = &f->u.zfilter;
fz->prefix.family = 0;
fz->prefix.family = AF_UNSPEC;
acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);

View File

@ -2983,7 +2983,7 @@ void ospf_lsa_maxage_delete(struct ospf *ospf, struct ospf_lsa *lsa)
struct prefix lsa_prefix;
memset(&lsa_prefix, 0, sizeof(struct prefix));
lsa_prefix.family = 0;
lsa_prefix.family = AF_UNSPEC;
lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT;
lsa_prefix.u.ptr = (uintptr_t)lsa;
@ -3024,7 +3024,7 @@ void ospf_lsa_maxage(struct ospf *ospf, struct ospf_lsa *lsa)
}
memset(&lsa_prefix, 0, sizeof(struct prefix));
lsa_prefix.family = 0;
lsa_prefix.family = AF_UNSPEC;
lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT;
lsa_prefix.u.ptr = (uintptr_t)lsa;

View File

@ -70,7 +70,7 @@ void ospf_lsdb_cleanup(struct ospf_lsdb *lsdb)
void ls_prefix_set(struct prefix_ls *lp, struct ospf_lsa *lsa)
{
if (lp && lsa && lsa->data) {
lp->family = 0;
lp->family = AF_UNSPEC;
lp->prefixlen = 64;
lp->id = lsa->data->id;
lp->adv_router = lsa->data->adv_router;
@ -199,7 +199,7 @@ struct ospf_lsa *ospf_lsdb_lookup_by_id(struct ospf_lsdb *lsdb, uint8_t type,
table = lsdb->type[type].db;
memset(&lp, 0, sizeof(struct prefix_ls));
lp.family = 0;
lp.family = AF_UNSPEC;
lp.prefixlen = 64;
lp.id = id;
lp.adv_router = adv_router;
@ -226,7 +226,7 @@ struct ospf_lsa *ospf_lsdb_lookup_by_id_next(struct ospf_lsdb *lsdb,
table = lsdb->type[type].db;
memset(&lp, 0, sizeof(struct prefix_ls));
lp.family = 0;
lp.family = AF_UNSPEC;
lp.prefixlen = 64;
lp.id = id;
lp.adv_router = adv_router;

View File

@ -1779,7 +1779,7 @@ static int ospf_snmp_vl_add(struct ospf_vl_data *vl_data)
struct route_node *rn;
memset(&lp, 0, sizeof(struct prefix_ls));
lp.family = 0;
lp.family = AF_UNSPEC;
lp.prefixlen = 64;
lp.id = vl_data->vl_area_id;
lp.adv_router = vl_data->vl_peer;
@ -1798,7 +1798,7 @@ static int ospf_snmp_vl_delete(struct ospf_vl_data *vl_data)
struct route_node *rn;
memset(&lp, 0, sizeof(struct prefix_ls));
lp.family = 0;
lp.family = AF_UNSPEC;
lp.prefixlen = 64;
lp.id = vl_data->vl_area_id;
lp.adv_router = vl_data->vl_peer;
@ -1820,7 +1820,7 @@ static struct ospf_vl_data *ospf_snmp_vl_lookup(struct in_addr *area_id,
struct ospf_vl_data *vl_data;
memset(&lp, 0, sizeof(struct prefix_ls));
lp.family = 0;
lp.family = AF_UNSPEC;
lp.prefixlen = 64;
lp.id = *area_id;
lp.adv_router = *neighbor;
@ -1843,7 +1843,7 @@ static struct ospf_vl_data *ospf_snmp_vl_lookup_next(struct in_addr *area_id,
struct ospf_vl_data *vl_data;
memset(&lp, 0, sizeof(struct prefix_ls));
lp.family = 0;
lp.family = AF_UNSPEC;
lp.prefixlen = 64;
lp.id = *area_id;
lp.adv_router = *neighbor;

View File

@ -6578,7 +6578,7 @@ static void show_lsa_prefix_set(struct vty *vty, struct prefix_ls *lp,
struct in_addr *id, struct in_addr *adv_router)
{
memset(lp, 0, sizeof(struct prefix_ls));
lp->family = 0;
lp->family = AF_UNSPEC;
if (id == NULL)
lp->prefixlen = 0;
else if (adv_router == NULL) {

View File

@ -2369,7 +2369,7 @@ static unsigned nexthop_active_check(struct route_node *rn,
else if (rn->p.family == AF_INET6)
family = AFI_IP6;
else
family = 0;
family = AF_UNSPEC;
if (IS_ZEBRA_DEBUG_NHG_DETAIL)
zlog_debug("%s: re %p, nexthop %pNHv", __func__, re, nexthop);