From 7412a6392267fbd53746ceb00b51465d857558e8 Mon Sep 17 00:00:00 2001 From: Fredi Raspall Date: Wed, 2 May 2018 16:30:26 +0200 Subject: [PATCH] bgpd/bgp_zebra.c: Fix process of label-chunk msg All messages to/from the label manager include two additional fields: protocol and instance. This patch fixes the parsing of label chunks response used by BGPd, which did not consider the two fields. Signed-off-by: Fredi Raspall --- bgpd/bgp_zebra.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 93a509c219..d943bee95b 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -2405,12 +2405,25 @@ static void bgp_zebra_process_label_chunk( uint8_t response_keep; uint32_t first; uint32_t last; + uint8_t proto; + unsigned short instance; s = zclient->ibuf; + STREAM_GETC(s, proto); + STREAM_GETW(s, instance); STREAM_GETC(s, response_keep); STREAM_GETL(s, first); STREAM_GETL(s, last); + if (zclient->redist_default != proto) { + zlog_err("Got LM msg with wrong proto %u", proto); + return; + } + if (zclient->instance != instance) { + zlog_err("Got LM msg with wrong instance %u", proto); + return; + } + if (first > last || first < MPLS_LABEL_UNRESERVED_MIN || last > MPLS_LABEL_UNRESERVED_MAX) { -- 2.39.5