summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:55:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:55:46 +0000
commit4f40546c96c6aeaa4371161dca9db21071bcc5d2 (patch)
tree41199f3c71bb1b62bdee8e83577351f6ee70d031 /bgpd
parentAdding upstream version 10.0. (diff)
downloadfrr-upstream/10.0.1.tar.xz
frr-upstream/10.0.1.zip
Adding upstream version 10.0.1.upstream/10.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_attr.c9
-rw-r--r--bgpd/bgp_fsm.c19
-rw-r--r--bgpd/bgp_mplsvpn.c5
-rw-r--r--bgpd/bgp_open.c4
-rw-r--r--bgpd/bgp_route.c81
-rw-r--r--bgpd/bgp_route.h8
-rw-r--r--bgpd/bgp_routemap.c60
-rw-r--r--bgpd/bgp_snmp_bgp4.c4
-rw-r--r--bgpd/bgp_updgrp_adv.c13
-rw-r--r--bgpd/bgp_vpn.c2
-rw-r--r--bgpd/bgp_zebra.c9
-rw-r--r--bgpd/bgpd.c45
12 files changed, 159 insertions, 100 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 53420b4..40e074d 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1518,6 +1518,7 @@ static bool bgp_attr_flag_invalid(struct bgp_attr_parser_args *args)
uint8_t mask = BGP_ATTR_FLAG_EXTLEN;
const uint8_t flags = args->flags;
const uint8_t attr_code = args->type;
+ struct peer *peer = args->peer;
/* there may be attributes we don't know about */
if (attr_code > attr_flags_values_max)
@@ -1525,6 +1526,14 @@ static bool bgp_attr_flag_invalid(struct bgp_attr_parser_args *args)
if (attr_flags_values[attr_code] == 0)
return false;
+ /* If `neighbor X path-attribute <discard|treat-as-withdraw>` is
+ * configured, then ignore checking optional, trasitive flags.
+ * The attribute/route will be discarded/withdrawned later instead
+ * of dropping the session.
+ */
+ if (peer->discard_attrs[attr_code] || peer->withdraw_attrs[attr_code])
+ return false;
+
/* RFC4271, "For well-known attributes, the Transitive bit MUST be set
* to
* 1."
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 234dbb0..5043439 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -1777,7 +1777,7 @@ bgp_connect_fail(struct peer_connection *connection)
{
struct peer *peer = connection->peer;
- if (peer_dynamic_neighbor(peer)) {
+ if (peer_dynamic_neighbor_no_nsf(peer)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s (dynamic neighbor) deleted (%s)",
peer->host, __func__);
@@ -2895,19 +2895,22 @@ int bgp_neighbor_graceful_restart(struct peer *peer,
peer_old_state = bgp_peer_gr_mode_get(peer);
- if (peer_old_state == PEER_INVALID) {
- zlog_debug("[BGP_GR] peer_old_state == Invalid state !");
+ if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
+ zlog_debug("%s [BGP_GR] peer_old_state: %d", __func__,
+ peer_old_state);
+
+ if (peer_old_state == PEER_INVALID)
return BGP_ERR_GR_OPERATION_FAILED;
- }
peer_state = peer->PEER_GR_FSM[peer_old_state][peer_gr_cmd];
peer_new_state = peer_state.next_state;
- if (peer_new_state == PEER_INVALID) {
- zlog_debug(
- "[BGP_GR] Invalid bgp graceful restart command used !");
+ if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
+ zlog_debug("%s [BGP_GR] peer_new_state: %d", __func__,
+ peer_new_state);
+
+ if (peer_new_state == PEER_INVALID)
return BGP_ERR_GR_INVALID_CMD;
- }
if (peer_new_state != peer_old_state) {
result = peer_state.action_fun(peer, peer_old_state,
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index af8990a..58e3097 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -2230,8 +2230,9 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp, /* to */
* Let the kernel to decide with double lookup the real next-hop
* interface when installing the route.
*/
- if (src_bgp || bpi_ultimate->sub_type == BGP_ROUTE_STATIC ||
- bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE) {
+ if (src_vrf->vrf_id != VRF_DEFAULT &&
+ (src_bgp || bpi_ultimate->sub_type == BGP_ROUTE_STATIC ||
+ bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)) {
ifp = if_get_vrf_loopback(src_vrf->vrf_id);
if (ifp)
static_attr.nh_ifindex = ifp->ifindex;
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 6447586..6c96ffc 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -939,8 +939,8 @@ static int bgp_capability_software_version(struct peer *peer,
peer->soft_version = XSTRDUP(MTYPE_BGP_SOFT_VERSION, str);
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s sent Software Version: %s", peer->host,
- peer->soft_version);
+ zlog_debug("%s received Software Version: %s",
+ peer->host, peer->soft_version);
}
return 0;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 38983e2..a69d6ee 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -553,6 +553,15 @@ void bgp_path_info_unset_flag(struct bgp_dest *dest, struct bgp_path_info *pi,
bgp_pcount_adjust(dest, pi);
}
+static bool use_bgp_med_value(struct attr *attr, struct bgp *bgp)
+{
+ if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC) ||
+ CHECK_FLAG(bgp->flags, BGP_FLAG_MED_MISSING_AS_WORST))
+ return true;
+
+ return false;
+}
+
/* Get MED value. If MED value is missing and "bgp bestpath
missing-as-worst" is specified, treat it as the worst value. */
static uint32_t bgp_med_value(struct attr *attr, struct bgp *bgp)
@@ -6833,6 +6842,10 @@ int bgp_static_set(struct vty *vty, bool negate, const char *ip_str,
bgp_static->label = label;
bgp_static->prd = prd;
+ if (rd_str)
+ bgp_static->prd_pretty = XSTRDUP(MTYPE_BGP,
+ rd_str);
+
if (rmap) {
XFREE(MTYPE_ROUTE_MAP_NAME,
bgp_static->rmap.name);
@@ -9400,14 +9413,16 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
}
/* MED/Metric */
- if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
+ if (use_bgp_med_value(attr, path->peer->bgp)) {
+ uint32_t value = bgp_med_value(attr, path->peer->bgp);
+
if (json_paths)
- json_object_int_add(json_path, "metric", attr->med);
+ json_object_int_add(json_path, "metric", value);
else if (wide)
- vty_out(vty, "%7u", attr->med);
+ vty_out(vty, "%7u", value);
else
- vty_out(vty, "%10u", attr->med);
- else if (!json_paths) {
+ vty_out(vty, "%10u", value);
+ } else if (!json_paths) {
if (wide)
vty_out(vty, "%*s", 7, " ");
else
@@ -9528,7 +9543,7 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
}
/* called from terminal list command */
-void route_vty_out_tmp(struct vty *vty, struct bgp_dest *dest,
+void route_vty_out_tmp(struct vty *vty, struct bgp *bgp, struct bgp_dest *dest,
const struct prefix *p, struct attr *attr, safi_t safi,
bool use_json, json_object *json_ar, bool wide)
{
@@ -9587,10 +9602,11 @@ void route_vty_out_tmp(struct vty *vty, struct bgp_dest *dest,
&attr->mp_nexthop_global_in);
}
- if (attr->flag
- & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
- json_object_int_add(json_net, "metric",
- attr->med);
+ if (use_bgp_med_value(attr, bgp)) {
+ uint32_t value = bgp_med_value(attr, bgp);
+
+ json_object_int_add(json_net, "metric", value);
+ }
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
json_object_int_add(json_net, "locPrf",
@@ -9630,13 +9646,15 @@ void route_vty_out_tmp(struct vty *vty, struct bgp_dest *dest,
else
vty_out(vty, "%*s", len, " ");
}
- if (attr->flag
- & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
+
+ if (use_bgp_med_value(attr, bgp)) {
+ uint32_t value = bgp_med_value(attr, bgp);
+
if (wide)
- vty_out(vty, "%7u", attr->med);
+ vty_out(vty, "%7u", value);
else
- vty_out(vty, "%10u", attr->med);
- else if (wide)
+ vty_out(vty, "%10u", value);
+ } else if (wide)
vty_out(vty, " ");
else
vty_out(vty, " ");
@@ -10631,11 +10649,13 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
vty_out(vty, " Origin %s",
bgp_origin_long_str[attr->origin]);
- if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)) {
+ if (use_bgp_med_value(attr, bgp)) {
+ uint32_t value = bgp_med_value(attr, bgp);
+
if (json_paths)
- json_object_int_add(json_path, "metric", attr->med);
+ json_object_int_add(json_path, "metric", value);
else
- vty_out(vty, ", metric %u", attr->med);
+ vty_out(vty, ", metric %u", value);
}
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
@@ -11875,7 +11895,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
} else {
if (incremental_print) {
vty_out(vty, "\"prefix\": \"%pFX\",\n", p);
- vty_out(vty, "\"version\": \"%" PRIu64 "\",\n",
+ vty_out(vty, "\"version\": \"%" PRIu64 "\",",
dest->version);
} else {
json_object_string_addf(json, "prefix", "%pFX",
@@ -14279,7 +14299,7 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
json_ar, json_net,
"%pFX", rn_p);
} else
- route_vty_out_tmp(vty, dest, rn_p,
+ route_vty_out_tmp(vty, bgp, dest, rn_p,
&attr, safi, use_json,
json_ar, wide);
bgp_attr_flush(&attr);
@@ -14342,11 +14362,15 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
"%pFX",
rn_p);
} else
- route_vty_out_tmp(
- vty, dest, rn_p,
- &attr, safi,
- use_json,
- json_ar, wide);
+ route_vty_out_tmp(vty,
+ bgp,
+ dest,
+ rn_p,
+ &attr,
+ safi,
+ use_json,
+ json_ar,
+ wide);
(*output_count)++;
} else {
(*filtered_count)++;
@@ -14384,9 +14408,10 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
json_ar, json_net,
"%pFX", rn_p);
} else
- route_vty_out_tmp(
- vty, dest, rn_p, pi->attr, safi,
- use_json, json_ar, wide);
+ route_vty_out_tmp(vty, bgp, dest, rn_p,
+ pi->attr, safi,
+ use_json, json_ar,
+ wide);
(*output_count)++;
}
}
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 2d82f0f..2929c75 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -845,10 +845,10 @@ extern void route_vty_out(struct vty *vty, const struct prefix *p,
extern void route_vty_out_tag(struct vty *vty, const struct prefix *p,
struct bgp_path_info *path, int display,
safi_t safi, json_object *json);
-extern void route_vty_out_tmp(struct vty *vty, struct bgp_dest *dest,
- const struct prefix *p, struct attr *attr,
- safi_t safi, bool use_json, json_object *json_ar,
- bool wide);
+extern void route_vty_out_tmp(struct vty *vty, struct bgp *bgp,
+ struct bgp_dest *dest, const struct prefix *p,
+ struct attr *attr, safi_t safi, bool use_json,
+ json_object *json_ar, bool wide);
extern void route_vty_out_overlay(struct vty *vty, const struct prefix *p,
struct bgp_path_info *path, int display,
json_object *json);
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index d604a7a..dbc3d64 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -5219,27 +5219,23 @@ DEFPY_YANG (match_peer,
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
- if (addrv4_str) {
- snprintf(
- xpath_value, sizeof(xpath_value),
- "%s/rmap-match-condition/frr-bgp-route-map:peer-ipv4-address",
- xpath);
- nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
- addrv4_str);
- } else if (addrv6_str) {
- snprintf(
- xpath_value, sizeof(xpath_value),
- "%s/rmap-match-condition/frr-bgp-route-map:peer-ipv6-address",
- xpath);
- nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
- addrv6_str);
- } else {
- snprintf(
- xpath_value, sizeof(xpath_value),
- "%s/rmap-match-condition/frr-bgp-route-map:peer-interface",
- xpath);
- nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, intf);
- }
+ snprintf(xpath_value, sizeof(xpath_value),
+ "%s/rmap-match-condition/frr-bgp-route-map:peer-ipv4-address",
+ xpath);
+ nb_cli_enqueue_change(vty, xpath_value,
+ addrv4_str ? NB_OP_MODIFY : NB_OP_DESTROY,
+ addrv4_str);
+ snprintf(xpath_value, sizeof(xpath_value),
+ "%s/rmap-match-condition/frr-bgp-route-map:peer-ipv6-address",
+ xpath);
+ nb_cli_enqueue_change(vty, xpath_value,
+ addrv6_str ? NB_OP_MODIFY : NB_OP_DESTROY,
+ addrv6_str);
+ snprintf(xpath_value, sizeof(xpath_value),
+ "%s/rmap-match-condition/frr-bgp-route-map:peer-interface",
+ xpath);
+ nb_cli_enqueue_change(vty, xpath_value,
+ intf ? NB_OP_MODIFY : NB_OP_DESTROY, intf);
return nb_cli_apply_changes(vty, NULL);
}
@@ -5882,10 +5878,11 @@ DEFUN_YANG (set_table_id,
DEFUN_YANG (no_set_table_id,
no_set_table_id_cmd,
- "no set table",
+ "no set table [(1-4294967295)]",
NO_STR
SET_STR
- "export route to non-main kernel table\n")
+ "export route to non-main kernel table\n"
+ "Kernel routing table id\n")
{
const char *xpath = "./set-action[action='frr-bgp-route-map:table']";
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
@@ -6273,13 +6270,12 @@ DEFPY_YANG(
}
DEFUN_YANG (no_set_aspath_prepend,
- no_set_aspath_prepend_cmd,
- "no set as-path prepend [ASNUM] [last-as [(1-10)]]",
+ no_set_aspath_prepend_last_as_cmd,
+ "no set as-path prepend [last-as [(1-10)]]",
NO_STR
SET_STR
"Transform BGP AS_PATH attribute\n"
"Prepend to the as-path\n"
- AS_STR
"Use the peers AS-number\n"
"Number of times to insert\n")
{
@@ -6290,6 +6286,15 @@ DEFUN_YANG (no_set_aspath_prepend,
return nb_cli_apply_changes(vty, NULL);
}
+ALIAS_YANG (no_set_aspath_prepend,
+ no_set_aspath_prepend_as_cmd,
+ "no set as-path prepend ASNUM...",
+ NO_STR
+ SET_STR
+ "Transform BGP AS_PATH attribute\n"
+ "Prepend to the as-path\n"
+ AS_STR)
+
DEFUN_YANG (set_aspath_exclude,
set_aspath_exclude_cmd,
"set as-path exclude ASNUM...",
@@ -7966,7 +7971,8 @@ void bgp_route_map_init(void)
install_element(RMAP_NODE, &set_aspath_exclude_access_list_cmd);
install_element(RMAP_NODE, &set_aspath_replace_asn_cmd);
install_element(RMAP_NODE, &set_aspath_replace_access_list_cmd);
- install_element(RMAP_NODE, &no_set_aspath_prepend_cmd);
+ install_element(RMAP_NODE, &no_set_aspath_prepend_last_as_cmd);
+ install_element(RMAP_NODE, &no_set_aspath_prepend_as_cmd);
install_element(RMAP_NODE, &no_set_aspath_exclude_cmd);
install_element(RMAP_NODE, &no_set_aspath_exclude_all_cmd);
install_element(RMAP_NODE, &no_set_aspath_exclude_access_list_cmd);
diff --git a/bgpd/bgp_snmp_bgp4.c b/bgpd/bgp_snmp_bgp4.c
index 3d04dc2..755777c 100644
--- a/bgpd/bgp_snmp_bgp4.c
+++ b/bgpd/bgp_snmp_bgp4.c
@@ -401,7 +401,7 @@ static struct bgp_path_info *bgp4PathAttrLookup(struct variable *v, oid name[],
/* Set OID offset for prefix. */
offset = name + v->namelen;
oid2in_addr(offset, IN_ADDR_SIZE, &addr->prefix);
- offset++;
+ offset += IN_ADDR_SIZE;
/* Prefix length. */
addr->prefixlen = *offset;
@@ -497,7 +497,7 @@ static struct bgp_path_info *bgp4PathAttrLookup(struct variable *v, oid name[],
offset = name + v->namelen;
oid_copy_in_addr(offset, &rn_p->u.prefix4);
- offset++;
+ offset += IN_ADDR_SIZE;
*offset = rn_p->prefixlen;
offset++;
oid_copy_in_addr(offset,
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index 267a756..9d62265 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -304,15 +304,16 @@ static void subgrp_show_adjq_vty(struct update_subgroup *subgrp,
}
if ((flags & UPDWALK_FLAGS_ADVQUEUE) && adj->adv &&
adj->adv->baa) {
- route_vty_out_tmp(
- vty, dest, dest_p, adj->adv->baa->attr,
- SUBGRP_SAFI(subgrp), 0, NULL, false);
+ route_vty_out_tmp(vty, bgp, dest, dest_p,
+ adj->adv->baa->attr,
+ SUBGRP_SAFI(subgrp), 0, NULL,
+ false);
output_count++;
}
if ((flags & UPDWALK_FLAGS_ADVERTISED) && adj->attr) {
- route_vty_out_tmp(vty, dest, dest_p, adj->attr,
- SUBGRP_SAFI(subgrp), 0, NULL,
- false);
+ route_vty_out_tmp(vty, bgp, dest, dest_p,
+ adj->attr, SUBGRP_SAFI(subgrp),
+ 0, NULL, false);
output_count++;
}
}
diff --git a/bgpd/bgp_vpn.c b/bgpd/bgp_vpn.c
index 8fe24eb..2470fb8 100644
--- a/bgpd/bgp_vpn.c
+++ b/bgpd/bgp_vpn.c
@@ -191,7 +191,7 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer,
}
rd_header = 0;
}
- route_vty_out_tmp(vty, rm, bgp_dest_get_prefix(rm),
+ route_vty_out_tmp(vty, bgp, rm, bgp_dest_get_prefix(rm),
attr, safi, use_json, json_routes,
false);
output_count++;
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 87f2e55..fe29662 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -3187,12 +3187,12 @@ static int bgp_zebra_process_srv6_locator_add(ZAPI_CALLBACK_ARGS)
struct bgp *bgp = bgp_get_default();
const char *loc_name = bgp->srv6_locator_name;
- if (zapi_srv6_locator_decode(zclient->ibuf, &loc) < 0)
- return -1;
-
if (!bgp || !bgp->srv6_enabled)
return 0;
+ if (zapi_srv6_locator_decode(zclient->ibuf, &loc) < 0)
+ return -1;
+
if (bgp_zebra_srv6_manager_get_locator_chunk(loc_name) < 0)
return -1;
@@ -3210,6 +3210,9 @@ static int bgp_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS)
struct in6_addr *tovpn_sid;
struct prefix_ipv6 tmp_prefi;
+ if (!bgp)
+ return 0;
+
if (zapi_srv6_locator_decode(zclient->ibuf, &loc) < 0)
return -1;
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 1a03a06..d6d874b 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1446,11 +1446,11 @@ int bgp_peer_gr_init(struct peer *peer)
{
/* PEER_GLOBAL_INHERIT Mode */
/* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
- { PEER_GR, bgp_peer_gr_action }, { PEER_INVALID, NULL },
+ { PEER_GR, bgp_peer_gr_action }, { PEER_GLOBAL_INHERIT, NULL },
/* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD */
- { PEER_DISABLE, bgp_peer_gr_action}, { PEER_INVALID, NULL },
+ { PEER_DISABLE, bgp_peer_gr_action }, { PEER_GLOBAL_INHERIT, NULL },
/* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD */
- { PEER_HELPER, bgp_peer_gr_action }, { PEER_INVALID, NULL }
+ { PEER_HELPER, bgp_peer_gr_action }, { PEER_GLOBAL_INHERIT, NULL }
}
};
memcpy(&peer->PEER_GR_FSM, local_Peer_GR_FSM,
@@ -1473,6 +1473,29 @@ static void bgp_srv6_init(struct bgp *bgp)
static void bgp_srv6_cleanup(struct bgp *bgp)
{
+ for (afi_t afi = AFI_IP; afi < AFI_MAX; afi++) {
+ if (bgp->vpn_policy[afi].tovpn_sid_locator != NULL)
+ srv6_locator_chunk_free(
+ &bgp->vpn_policy[afi].tovpn_sid_locator);
+ if (bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent != NULL)
+ XFREE(MTYPE_BGP_SRV6_SID,
+ bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent);
+ if (bgp->vpn_policy[afi].tovpn_sid != NULL) {
+ sid_unregister(bgp, bgp->vpn_policy[afi].tovpn_sid);
+ XFREE(MTYPE_BGP_SRV6_SID,
+ bgp->vpn_policy[afi].tovpn_sid);
+ }
+ }
+
+ if (bgp->tovpn_sid_locator != NULL)
+ srv6_locator_chunk_free(&bgp->tovpn_sid_locator);
+ if (bgp->tovpn_zebra_vrf_sid_last_sent != NULL)
+ XFREE(MTYPE_BGP_SRV6_SID, bgp->tovpn_zebra_vrf_sid_last_sent);
+ if (bgp->tovpn_sid != NULL) {
+ sid_unregister(bgp, bgp->tovpn_sid);
+ XFREE(MTYPE_BGP_SRV6_SID, bgp->tovpn_sid);
+ }
+
if (bgp->srv6_locator_chunks)
list_delete(&bgp->srv6_locator_chunks);
if (bgp->srv6_functions)
@@ -1537,10 +1560,10 @@ struct peer *peer_new(struct bgp *bgp)
SET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
if (CHECK_FLAG(bgp->flags, BGP_FLAG_ENFORCE_FIRST_AS))
- SET_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS);
+ peer_flag_set(peer, PEER_FLAG_ENFORCE_FIRST_AS);
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SOFT_VERSION_CAPABILITY))
- SET_FLAG(peer->flags, PEER_FLAG_CAPABILITY_SOFT_VERSION);
+ peer_flag_set(peer, PEER_FLAG_CAPABILITY_SOFT_VERSION);
SET_FLAG(peer->flags_invert, PEER_FLAG_CAPABILITY_FQDN);
SET_FLAG(peer->flags, PEER_FLAG_CAPABILITY_FQDN);
@@ -4097,18 +4120,6 @@ void bgp_free(struct bgp *bgp)
if (bgp->vpn_policy[afi].tovpn_rd_pretty)
XFREE(MTYPE_BGP_NAME,
bgp->vpn_policy[afi].tovpn_rd_pretty);
- if (bgp->vpn_policy[afi].tovpn_sid_locator != NULL)
- srv6_locator_chunk_free(
- &bgp->vpn_policy[afi].tovpn_sid_locator);
- if (bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent != NULL)
- XFREE(MTYPE_BGP_SRV6_SID,
- bgp->vpn_policy[afi]
- .tovpn_zebra_vrf_sid_last_sent);
- if (bgp->vpn_policy[afi].tovpn_sid != NULL) {
- sid_unregister(bgp, bgp->vpn_policy[afi].tovpn_sid);
- XFREE(MTYPE_BGP_SRV6_SID,
- bgp->vpn_policy[afi].tovpn_sid);
- }
}
bgp_srv6_cleanup(bgp);
bgp_confederation_id_unset(bgp);