From a474f34c0bd92b1c0241b720240f6cb7c67f5a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Tvrd=C3=ADk?= Date: Tue, 5 Jan 2016 17:53:58 +0100 Subject: [PATCH] MRT Dump: Support for draft-petrie-grow-mrt-add-paths Thanks to Colin Petrie for patch. --- nest/mrtdump.h | 4 +++- proto/bgp/packets.c | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nest/mrtdump.h b/nest/mrtdump.h index d3b13493..9ca9ca4b 100644 --- a/nest/mrtdump.h +++ b/nest/mrtdump.h @@ -41,7 +41,9 @@ /* MRT BGP4MP Subtypes */ #define MRT_BGP4MP_MESSAGE 1 #define MRT_BGP4MP_MESSAGE_AS4 4 -#define MRT_BGP4MP_STATE_CHANGE_AS4 5 +#define MRT_BGP4MP_MESSAGE_ADDPATH 8 /* Experimental draft-petrie-grow-mrt-add-paths */ +#define MRT_BGP4MP_MESSAGE_AS4_ADDPATH 9 /* Experimental draft-petrie-grow-mrt-add-paths */ +#define MRT_BGP4MP_STATE_CHANGE_AS4 5 struct mrt_buffer { diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index a117895c..f2169cdb 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -88,11 +88,19 @@ mrt_dump_bgp_packet(struct bgp_conn *conn, byte *pkt, unsigned len) byte *bp = buf + MRT_HDR_LENGTH; int as4 = conn->bgp->as4_session; + int addpath = conn->bgp->add_path_rx; + + u16 subtype; + if (addpath) + subtype = as4 ? MRT_BGP4MP_MESSAGE_AS4_ADDPATH : MRT_BGP4MP_MESSAGE_ADDPATH; + else + subtype = as4 ? MRT_BGP4MP_MESSAGE_AS4 : MRT_BGP4MP_MESSAGE; bp = mrt_put_bgp4_hdr(bp, conn, as4); memcpy(bp, pkt, len); bp += len; - mrt_dump_message_proto(&conn->bgp->p, MRT_BGP4MP, as4 ? MRT_BGP4MP_MESSAGE_AS4 : MRT_BGP4MP_MESSAGE, buf, bp-buf); + + mrt_dump_message(&conn->bgp->p, MRT_BGP4MP, subtype, buf, bp-buf); } static inline u16