From 6a80214fb381426e1ed2603831a89a97f893f875 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Sun, 28 Jan 2024 13:14:58 +0100 Subject: [PATCH] BGP: fixed MPLS label stack receiving bug Introduced in 515df18da742442323047a13b04ecc2bd97b0855 while merging v2 to v3. --- proto/bgp/bgp.h | 2 -- proto/bgp/packets.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index 075882b5..b59b02d8 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -505,8 +505,6 @@ struct bgp_parse_state { uint err_subcode; jmp_buf err_jmpbuf; - adata *mpls_labels; - /* Cached state for bgp_rte_update() */ u32 last_id; struct rte_src *last_src; diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index b2228db7..624cabc1 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1077,6 +1077,8 @@ bgp_apply_next_hop(struct bgp_parse_state *s, ea_list **to, ip_addr gw, ip_addr static void bgp_apply_mpls_labels(struct bgp_parse_state *s, ea_list **to, u32 lnum, u32 labels[lnum]) { + bgp_set_attr_data(to, BA_MPLS_LABEL_STACK, 0, labels, lnum * sizeof labels[0]); + if (lnum > MPLS_MAX_LABEL_STACK) { REPORT("Too many MPLS labels ($u)", lnum); @@ -1087,7 +1089,7 @@ bgp_apply_mpls_labels(struct bgp_parse_state *s, ea_list **to, u32 lnum, u32 lab /* Handle implicit NULL as empty MPLS stack */ if ((lnum == 1) && (labels[0] == BGP_MPLS_NULL)) - lnum = s->mpls_labels->length = 0; + lnum = 0; if (s->channel->cf->gw_mode == GW_DIRECT) {