Skip to content

Commit

Permalink
Merge pull request FRRouting#13524 from pguibert6WIND/mpls_vpn_lsr_re…
Browse files Browse the repository at this point in the history
…distribute

MPLS vpn LSR redistribute
  • Loading branch information
riw777 committed Jun 20, 2023
2 parents 95070f2 + 961b898 commit 68da3ea
Show file tree
Hide file tree
Showing 34 changed files with 2,070 additions and 117 deletions.
17 changes: 17 additions & 0 deletions bgpd/bgp_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,20 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,

return BGP_NLRI_PARSE_OK;
}

bool bgp_labels_same(const mpls_label_t *tbl_a, const uint32_t num_labels_a,
const mpls_label_t *tbl_b, const uint32_t num_labels_b)
{
uint32_t i;

if (num_labels_a != num_labels_b)
return false;
if (num_labels_a == 0)
return true;

for (i = 0; i < num_labels_a; i++) {
if (tbl_a[i] != tbl_b[i])
return false;
}
return true;
}
4 changes: 4 additions & 0 deletions bgpd/bgp_label.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ extern mpls_label_t bgp_adv_label(struct bgp_dest *dest,

extern int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet);
extern bool bgp_labels_same(const mpls_label_t *tbl_a,
const uint32_t num_labels_a,
const mpls_label_t *tbl_b,
const uint32_t num_labels_b);

static inline int bgp_labeled_safi(safi_t safi)
{
Expand Down
31 changes: 29 additions & 2 deletions bgpd/bgp_labelpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,16 @@ DEFUN(show_bgp_labelpool_ledger, show_bgp_labelpool_ledger_cmd,
vty_out(vty, "%-18s %u\n", "nexthop",
lcb->label);
break;
case LP_TYPE_BGP_L3VPN_BIND:
if (uj) {
json_object_string_add(json_elem, "prefix",
"l3vpn-bind");
json_object_int_add(json_elem, "label",
lcb->label);
} else
vty_out(vty, "%-18s %u\n", "l3vpn-bind",
lcb->label);
break;
}
}
if (uj)
Expand Down Expand Up @@ -941,6 +951,15 @@ DEFUN(show_bgp_labelpool_inuse, show_bgp_labelpool_inuse_cmd,
vty_out(vty, "%-18s %u\n", "nexthop",
label);
break;
case LP_TYPE_BGP_L3VPN_BIND:
if (uj) {
json_object_string_add(json_elem, "prefix",
"l3vpn-bind");
json_object_int_add(json_elem, "label", label);
} else
vty_out(vty, "%-18s %u\n", "l3vpn-bind",
label);
break;
}
}
if (uj)
Expand Down Expand Up @@ -1020,6 +1039,13 @@ DEFUN(show_bgp_labelpool_requests, show_bgp_labelpool_requests_cmd,
else
vty_out(vty, "Nexthop\n");
break;
case LP_TYPE_BGP_L3VPN_BIND:
if (uj)
json_object_string_add(json_elem, "prefix",
"l3vpn-bind");
else
vty_out(vty, "L3VPN-BIND\n");
break;
}
}
if (uj)
Expand Down Expand Up @@ -1121,7 +1147,8 @@ static void show_bgp_nexthop_label_afi(struct vty *vty, afi_t afi,
if (!detail)
continue;
vty_out(vty, " Paths:\n");
LIST_FOREACH (path, &(iter->paths), label_nh_thread) {
LIST_FOREACH (path, &(iter->paths),
mplsvpn.blnc.label_nh_thread) {
dest = path->net;
table = bgp_dest_table(dest);
assert(dest && table);
Expand Down Expand Up @@ -1703,7 +1730,7 @@ void bgp_label_per_nexthop_free(struct bgp_label_per_nexthop_cache *blnc)
bgp_zebra_send_nexthop_label(ZEBRA_MPLS_LABELS_DELETE,
blnc->label, blnc->nh->ifindex,
blnc->nh->vrf_id, ZEBRA_LSP_BGP,
&blnc->nexthop);
&blnc->nexthop, 0, NULL);
bgp_lp_release(LP_TYPE_NEXTHOP, blnc, blnc->label);
}
bgp_label_per_nexthop_cache_del(blnc->tree, blnc);
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_labelpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define LP_TYPE_VRF 0x00000001
#define LP_TYPE_BGP_LU 0x00000002
#define LP_TYPE_NEXTHOP 0x00000003
#define LP_TYPE_BGP_L3VPN_BIND 0x00000004

PREDECL_LIST(lp_fifo);

Expand Down
Loading

0 comments on commit 68da3ea

Please sign in to comment.