diff options
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_bfd.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_evpn.c | 13 | ||||
-rw-r--r-- | bgpd/bgp_fsm.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_mplsvpn.c | 31 | ||||
-rw-r--r-- | bgpd/bgp_network.c | 5 | ||||
-rw-r--r-- | bgpd/bgp_packet.c | 2 |
6 files changed, 23 insertions, 32 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index ce46b21f0..91b6929ff 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -101,7 +101,7 @@ static void bgp_bfd_peer_sendmsg(struct peer *peer, int command) bfd_info = (struct bfd_info *)peer->bfd_info; - if (peer->bgp && (peer->bgp->inst_type == BGP_INSTANCE_TYPE_VRF)) + if (peer->bgp->inst_type == BGP_INSTANCE_TYPE_VRF) vrf_id = peer->bgp->vrf_id; if (command == ZEBRA_BFD_DEST_DEREGISTER) { diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index b3d6f388b..448cc91cc 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -367,15 +367,12 @@ static void map_vrf_to_rt(struct bgp *bgp_vrf, struct ecommunity_val *eval) mask_ecom_global_admin(&eval_tmp, eval); irt = lookup_vrf_import_rt(&eval_tmp); - if (irt && irt->vrfs) - if (is_vrf_present_in_irt_vrfs(irt->vrfs, bgp_vrf)) - /* Already mapped. */ - return; + if (irt && is_vrf_present_in_irt_vrfs(irt->vrfs, bgp_vrf)) + /* Already mapped. */ + return; - if (!irt) { + if (!irt) irt = vrf_import_rt_new(&eval_tmp); - assert(irt); - } /* Add VRF to the list for this RT. */ listnode_add(irt->vrfs, bgp_vrf); @@ -3983,7 +3980,7 @@ void bgp_evpn_derive_auto_rd_for_vrf(struct bgp *bgp) bgp->vrf_prd.family = AF_UNSPEC; bgp->vrf_prd.prefixlen = 64; sprintf(buf, "%s:%hu", inet_ntoa(bgp->router_id), bgp->vrf_rd_id); - str2prefix_rd(buf, &bgp->vrf_prd); + (void)str2prefix_rd(buf, &bgp->vrf_prd); } /* diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 3255aff2a..e4a0a1d40 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1377,7 +1377,7 @@ int bgp_start(struct peer *peer) return 0; } - if (peer->bgp && peer->bgp->vrf_id == VRF_UNKNOWN) { + if (peer->bgp->vrf_id == VRF_UNKNOWN) { if (bgp_debug_neighbor_events(peer)) zlog_err( "%s [FSM] In a VRF that is not initialised yet", diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 5ed43e4bd..7e4b89659 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -457,16 +457,13 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */ struct bgp_node *bn; const char *debugmsg; - if (debug) { - const char *s = ""; - - if (info_vrf->attr && info_vrf->attr->ecommunity) { - s = ecommunity_ecom2str(info_vrf->attr->ecommunity, - ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - } + if (debug && info_vrf->attr->ecommunity) { + char *s = ecommunity_ecom2str(info_vrf->attr->ecommunity, + ECOMMUNITY_FORMAT_ROUTE_MAP, 0); zlog_debug("%s: info_vrf->type=%d, EC{%s}", __func__, info_vrf->type, s); + XFREE(MTYPE_ECOMMUNITY_STR, s); } if (!bgp_vpn) @@ -517,15 +514,13 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */ } } - if (debug) { - const char *s = ""; + if (debug && static_attr.ecommunity) { + char *s = ecommunity_ecom2str(static_attr.ecommunity, + ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - if (static_attr.ecommunity) { - s = ecommunity_ecom2str(static_attr.ecommunity, - ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - } zlog_debug("%s: post route map static_attr.ecommunity{%s}", __func__, s); + XFREE(MTYPE_ECOMMUNITY_STR, s); } /* @@ -550,15 +545,13 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */ static_attr.ecommunity = new_ecom; SET_FLAG(static_attr.flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES)); - if (debug) { - const char *s = ""; + if (debug && static_attr.ecommunity) { + char *s = ecommunity_ecom2str(static_attr.ecommunity, + ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - if (static_attr.ecommunity) { - s = ecommunity_ecom2str(static_attr.ecommunity, - ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - } zlog_debug("%s: post merge static_attr.ecommunity{%s}", __func__, s); + XFREE(MTYPE_ECOMMUNITY_STR, s); } /* Nexthop */ diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 71454dfe0..37d06c1e5 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -447,6 +447,9 @@ static char *bgp_get_bound_name(struct peer *peer) { char *name = NULL; + if (!peer) + return NULL; + if ((peer->bgp->vrf_id == VRF_DEFAULT) && !peer->ifname && !peer->conf_if) return NULL; @@ -455,8 +458,6 @@ static char *bgp_get_bound_name(struct peer *peer) && peer->su.sa.sa_family != AF_INET6) return NULL; // unexpected - if (!peer) - return name; /* For IPv6 peering, interface (unnumbered or link-local with interface) * takes precedence over VRF. For IPv4 peering, explicit interface or * VRF are the situations to bind. diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index cb702d80d..d17c33441 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -389,7 +389,7 @@ int bgp_generate_updgrp_packets(struct thread *thread) if (peer->status != Established) return 0; - if (peer->bgp && peer->bgp->main_peers_update_hold) + if (peer->bgp->main_peers_update_hold) return 0; do { |