summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_evpn_vty.c4
-rw-r--r--bgpd/bgp_label.c6
-rw-r--r--bgpd/bgp_labelpool.c24
-rw-r--r--bgpd/bgp_labelpool.h4
-rw-r--r--bgpd/bgp_mplsvpn.c7
-rw-r--r--bgpd/bgp_packet.c2
-rw-r--r--isisd/isis_srv6.c21
-rw-r--r--isisd/isis_srv6.h2
-rw-r--r--isisd/isis_zebra.c1
-rw-r--r--lib/keychain_nb.c4
-rw-r--r--lib/northbound.c29
-rw-r--r--lib/northbound.h11
-rw-r--r--lib/srv6.c3
13 files changed, 89 insertions, 29 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 958a9c6492..e7fe9b669d 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -113,7 +113,7 @@ static void display_vrf_import_rt(struct vty *vty, struct vrf_irt_node *irt,
break;
case ECOMMUNITY_ENCODE_AS4:
- pnt = ptr_get_be32(pnt, &eas.val);
+ pnt = ptr_get_be32(pnt, &eas.as);
eas.val = (*pnt++ << 8);
eas.val |= (*pnt++);
@@ -222,7 +222,7 @@ static void display_import_rt(struct vty *vty, struct irt_node *irt,
break;
case ECOMMUNITY_ENCODE_AS4:
- pnt = ptr_get_be32(pnt, &eas.val);
+ pnt = ptr_get_be32(pnt, &eas.as);
eas.val = (*pnt++ << 8);
eas.val |= (*pnt++);
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index 5db3621738..8ed9584b0a 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -387,6 +387,8 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
*/
if (!have_label_to_reg) {
SET_FLAG(dest->flags, BGP_NODE_LABEL_REQUESTED);
+ struct bgp_table *table;
+
if (BGP_DEBUG(labelpool, LABELPOOL))
zlog_debug(
"%s: Requesting label from LP for %pFX",
@@ -396,7 +398,9 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
* the pool. This means we'll never register
* FECs withoutvalid labels.
*/
- bgp_lp_get(LP_TYPE_BGP_LU, dest,
+ table = bgp_dest_table(dest);
+
+ bgp_lp_get(LP_TYPE_BGP_LU, dest, table->bgp->vrf_id,
bgp_reg_for_label_callback);
return;
}
diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c
index 23e0c191dc..5012f69267 100644
--- a/bgpd/bgp_labelpool.c
+++ b/bgpd/bgp_labelpool.c
@@ -77,6 +77,7 @@ struct lp_lcb {
mpls_label_t label; /* MPLS_LABEL_NONE = not allocated */
int type;
void *labelid; /* unique ID */
+ vrf_id_t vrf_id;
/*
* callback for label allocation and loss
*
@@ -97,6 +98,7 @@ struct lp_cbq_item {
int type;
mpls_label_t label;
void *labelid;
+ vrf_id_t vrf_id;
bool allocated; /* false = lost */
};
@@ -105,6 +107,7 @@ static wq_item_status lp_cbq_docallback(struct work_queue *wq, void *data)
struct lp_cbq_item *lcbq = data;
int rc;
int debug = BGP_DEBUG(labelpool, LABELPOOL);
+ struct bgp *bgp = bgp_lookup_by_vrf_id(lcbq->vrf_id);
if (debug)
zlog_debug("%s: calling callback with labelid=%p label=%u allocated=%d",
@@ -117,6 +120,9 @@ static wq_item_status lp_cbq_docallback(struct work_queue *wq, void *data)
return WQ_SUCCESS;
}
+ if (!bgp)
+ return WQ_SUCCESS;
+
rc = (*(lcbq->cbfunc))(lcbq->label, lcbq->labelid, lcbq->allocated);
if (lcbq->allocated && rc) {
@@ -320,10 +326,8 @@ static mpls_label_t get_label_from_pool(void *labelid)
/*
* Success indicated by value of "label" field in returned LCB
*/
-static struct lp_lcb *lcb_alloc(
- int type,
- void *labelid,
- int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated))
+static struct lp_lcb *lcb_alloc(int type, void *labelid, vrf_id_t vrf_id,
+ int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated))
{
/*
* Set up label control block
@@ -334,6 +338,7 @@ static struct lp_lcb *lcb_alloc(
new->label = get_label_from_pool(labelid);
new->type = type;
new->labelid = labelid;
+ new->vrf_id = vrf_id;
new->cbfunc = cbfunc;
return new;
@@ -365,10 +370,8 @@ static struct lp_lcb *lcb_alloc(
* Prior requests for a given labelid are detected so that requests and
* assignments are not duplicated.
*/
-void bgp_lp_get(
- int type,
- void *labelid,
- int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated))
+void bgp_lp_get(int type, void *labelid, vrf_id_t vrf_id,
+ int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated))
{
struct lp_lcb *lcb;
int requested = 0;
@@ -383,7 +386,7 @@ void bgp_lp_get(
if (!skiplist_search(lp->ledger, labelid, (void **)&lcb)) {
requested = 1;
} else {
- lcb = lcb_alloc(type, labelid, cbfunc);
+ lcb = lcb_alloc(type, labelid, vrf_id, cbfunc);
if (debug)
zlog_debug("%s: inserting lcb=%p label=%u",
__func__, lcb, lcb->label);
@@ -413,6 +416,7 @@ void bgp_lp_get(
q->type = lcb->type;
q->label = lcb->label;
q->labelid = lcb->labelid;
+ q->vrf_id = lcb->vrf_id;
q->allocated = true;
/* if this is a LU request, lock node before queueing */
@@ -580,6 +584,7 @@ static void bgp_sync_label_manager(struct event *e)
q->type = lcb->type;
q->label = lcb->label;
q->labelid = lcb->labelid;
+ q->vrf_id = lcb->vrf_id;
q->allocated = true;
if (debug)
@@ -693,6 +698,7 @@ void bgp_lp_event_zebra_up(void)
q->type = lcb->type;
q->label = lcb->label;
q->labelid = lcb->labelid;
+ q->vrf_id = lcb->vrf_id;
q->allocated = false;
check_bgp_lu_cb_lock(lcb);
work_queue_add(lp->callback_q, q);
diff --git a/bgpd/bgp_labelpool.h b/bgpd/bgp_labelpool.h
index a17482d112..509f9e625d 100644
--- a/bgpd/bgp_labelpool.h
+++ b/bgpd/bgp_labelpool.h
@@ -35,8 +35,8 @@ struct labelpool {
extern void bgp_lp_init(struct event_loop *master, struct labelpool *pool);
extern void bgp_lp_finish(void);
-extern void bgp_lp_get(int type, void *labelid,
- int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated));
+extern void bgp_lp_get(int type, void *labelid, vrf_id_t vrf_id,
+ int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated));
extern void bgp_lp_release(int type, void *labelid, mpls_label_t label);
extern void bgp_lp_event_chunk(uint32_t first, uint32_t last);
extern void bgp_lp_event_zebra_down(void);
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 1db65d144a..d5c907bc8d 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -1450,7 +1450,7 @@ _vpn_leak_from_vrf_get_per_nexthop_label(struct bgp_path_info *pi,
/* request a label to zebra for this nexthop
* the response from zebra will trigger the callback
*/
- bgp_lp_get(LP_TYPE_NEXTHOP, blnc,
+ bgp_lp_get(LP_TYPE_NEXTHOP, blnc, from_bgp->vrf_id,
bgp_mplsvpn_get_label_per_nexthop_cb);
}
@@ -1490,7 +1490,8 @@ static mpls_label_t bgp_mplsvpn_get_vpn_label(struct vpn_policy *bgp_policy)
{
if (bgp_policy->tovpn_label == MPLS_LABEL_NONE &&
CHECK_FLAG(bgp_policy->flags, BGP_VPN_POLICY_TOVPN_LABEL_AUTO)) {
- bgp_lp_get(LP_TYPE_VRF, bgp_policy, vpn_leak_label_callback);
+ bgp_lp_get(LP_TYPE_VRF, bgp_policy, bgp_policy->bgp->vrf_id,
+ vpn_leak_label_callback);
return MPLS_INVALID_LABEL;
}
return bgp_policy->tovpn_label;
@@ -4348,7 +4349,7 @@ void bgp_mplsvpn_nh_label_bind_register_local_label(struct bgp *bgp,
label);
bmnc->bgp_vpn = bgp;
bmnc->allocation_in_progress = true;
- bgp_lp_get(LP_TYPE_BGP_L3VPN_BIND, bmnc,
+ bgp_lp_get(LP_TYPE_BGP_L3VPN_BIND, bmnc, bgp->vrf_id,
bgp_mplsvpn_nh_label_bind_get_local_label_cb);
}
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index dac6597b7b..2dbeb3cbde 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -2788,6 +2788,8 @@ static int bgp_route_refresh_receive(struct peer_connection *connection,
"%pBP rcvd Remove-All pfxlist ORF request",
peer);
prefix_bgp_orf_remove_all(afi, name);
+ peer->orf_plist[afi][safi] = prefix_bgp_orf_lookup(afi,
+ name);
break;
}
diff --git a/isisd/isis_srv6.c b/isisd/isis_srv6.c
index 2348bd043a..8e9c21aa23 100644
--- a/isisd/isis_srv6.c
+++ b/isisd/isis_srv6.c
@@ -658,6 +658,27 @@ int isis_srv6_ifp_up_notify(struct interface *ifp)
}
/**
+ * Request SRv6 locator info from the SID Manager for all IS-IS areas where SRv6
+ * is enabled and a locator has been configured.
+ * This function is called as soon as the connection with Zebra is established
+ * to get information about all configured locators.
+ */
+void isis_srv6_locators_request(void)
+{
+ struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT);
+ struct listnode *node;
+ struct isis_area *area;
+
+ if (!isis)
+ return;
+
+ for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
+ if (area->srv6db.config.enabled &&
+ area->srv6db.config.srv6_locator_name[0] != '\0' && !area->srv6db.srv6_locator)
+ isis_zebra_srv6_manager_get_locator(area->srv6db.config.srv6_locator_name);
+}
+
+/**
* IS-IS SRv6 initialization for given area.
*
* @param area IS-IS area
diff --git a/isisd/isis_srv6.h b/isisd/isis_srv6.h
index bde14965f6..bb221b760a 100644
--- a/isisd/isis_srv6.h
+++ b/isisd/isis_srv6.h
@@ -156,6 +156,8 @@ isis_srv6_sid_alloc(struct isis_area *area, struct srv6_locator *locator,
struct in6_addr *sid_value);
extern void isis_srv6_sid_free(struct isis_srv6_sid *sid);
+void isis_srv6_locators_request(void);
+
extern void isis_srv6_area_init(struct isis_area *area);
extern void isis_srv6_area_term(struct isis_area *area);
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index caf7d3ddfb..b985ad1f7d 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -805,6 +805,7 @@ static void isis_zebra_connected(struct zclient *zclient)
zclient_register_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
zclient_register_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, VRF_DEFAULT);
+ isis_srv6_locators_request();
}
/**
diff --git a/lib/keychain_nb.c b/lib/keychain_nb.c
index 57967b30a5..7c3df1c857 100644
--- a/lib/keychain_nb.c
+++ b/lib/keychain_nb.c
@@ -587,9 +587,9 @@ static int key_chains_key_chain_key_crypto_algorithm_destroy(
if (args->event != NB_EV_APPLY)
return NB_OK;
- name = yang_dnode_get_string(args->dnode, "../../../name");
+ name = yang_dnode_get_string(args->dnode, "../../name");
keychain = keychain_lookup(name);
- index = (uint32_t)yang_dnode_get_uint64(args->dnode, "../../key-id");
+ index = (uint32_t)yang_dnode_get_uint64(args->dnode, "../key-id");
key = key_lookup(keychain, index);
key->hash_algo = KEYCHAIN_ALGO_NULL;
keychain_touch(keychain);
diff --git a/lib/northbound.c b/lib/northbound.c
index a385cc9ece..f5c4ca266f 100644
--- a/lib/northbound.c
+++ b/lib/northbound.c
@@ -514,20 +514,33 @@ void nb_config_diff_created(const struct lyd_node *dnode, uint32_t *seq,
static void nb_config_diff_deleted(const struct lyd_node *dnode, uint32_t *seq,
struct nb_config_cbs *changes)
{
+ struct nb_node *nb_node = dnode->schema->priv;
+ struct lyd_node *child;
+ bool recursed = false;
+
/* Ignore unimplemented nodes. */
- if (!dnode->schema->priv)
+ if (!nb_node)
return;
+ /*
+ * If the CB structure indicates it (recurse flag set), call the destroy
+ * callbacks for the children of a containment node.
+ */
+ if (CHECK_FLAG(dnode->schema->nodetype, LYS_CONTAINER | LYS_LIST) &&
+ CHECK_FLAG(nb_node->cbs.flags, F_NB_CB_DESTROY_RECURSE)) {
+ recursed = true;
+ LY_LIST_FOR (lyd_child(dnode), child) {
+ nb_config_diff_deleted(child, seq, changes);
+ }
+ }
+
if (nb_cb_operation_is_valid(NB_CB_DESTROY, dnode->schema))
nb_config_diff_add_change(changes, NB_CB_DESTROY, seq, dnode);
- else if (CHECK_FLAG(dnode->schema->nodetype, LYS_CONTAINER)) {
- struct lyd_node *child;
-
+ else if (CHECK_FLAG(dnode->schema->nodetype, LYS_CONTAINER) && !recursed) {
/*
- * Non-presence containers need special handling since they
- * don't have "destroy" callbacks. In this case, what we need to
- * do is to call the "destroy" callbacks of their child nodes
- * when applicable (i.e. optional nodes).
+ * If we didn't already above, call destroy on the children of
+ * this container (it's an NP container) as NP containers have
+ * no destroy CB themselves.
*/
LY_LIST_FOR (lyd_child(dnode), child) {
nb_config_diff_deleted(child, seq, changes);
diff --git a/lib/northbound.h b/lib/northbound.h
index 97a1d31e57..f81b2ecab5 100644
--- a/lib/northbound.h
+++ b/lib/northbound.h
@@ -370,6 +370,11 @@ struct nb_callbacks {
int (*destroy)(struct nb_cb_destroy_args *args);
/*
+ * Flags to control the how northbound callbacks are invoked.
+ */
+ uint flags;
+
+ /*
* Configuration callback.
*
* A list entry or leaf-list entry has been moved. Only applicable when
@@ -587,6 +592,12 @@ struct nb_callbacks {
void (*cli_show_end)(struct vty *vty, const struct lyd_node *dnode);
};
+/*
+ * Flag indicating the northbound should recurse destroy the children of this
+ * node when it is destroyed.
+ */
+#define F_NB_CB_DESTROY_RECURSE 0x01
+
struct nb_dependency_callbacks {
void (*get_dependant_xpath)(const struct lyd_node *dnode, char *xpath);
void (*get_dependency_xpath)(const struct lyd_node *dnode, char *xpath);
diff --git a/lib/srv6.c b/lib/srv6.c
index e6fc375fbb..76655a820b 100644
--- a/lib/srv6.c
+++ b/lib/srv6.c
@@ -76,7 +76,6 @@ void seg6local_context2json(const struct seg6local_context *ctx,
{
switch (action) {
case ZEBRA_SEG6_LOCAL_ACTION_END:
- json_object_boolean_add(json, "USP", true);
return;
case ZEBRA_SEG6_LOCAL_ACTION_END_X:
case ZEBRA_SEG6_LOCAL_ACTION_END_DX6:
@@ -116,7 +115,7 @@ const char *seg6local_context2str(char *str, size_t size,
switch (action) {
case ZEBRA_SEG6_LOCAL_ACTION_END:
- snprintf(str, size, "USP");
+ snprintf(str, size, "-");
return str;
case ZEBRA_SEG6_LOCAL_ACTION_END_X: