0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 10:11:53 +00:00

MRT Dump: Support for draft-petrie-grow-mrt-add-paths

Thanks to Colin Petrie for patch.
This commit is contained in:
Pavel Tvrdík 2016-01-05 17:53:58 +01:00
parent 5125741512
commit 696acee0c7
2 changed files with 12 additions and 2 deletions

View File

@ -41,7 +41,9 @@
/* MRT BGP4MP Subtypes */ /* MRT BGP4MP Subtypes */
#define MRT_BGP4MP_MESSAGE 1 #define MRT_BGP4MP_MESSAGE 1
#define MRT_BGP4MP_MESSAGE_AS4 4 #define MRT_BGP4MP_MESSAGE_AS4 4
#define MRT_BGP4MP_STATE_CHANGE_AS4 5 #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 */
struct mrt_buffer struct mrt_buffer
{ {

View File

@ -87,11 +87,19 @@ mrt_dump_bgp_packet(struct bgp_conn *conn, byte *pkt, unsigned len)
byte *buf = alloca(128+len); /* 128 is enough for MRT headers */ byte *buf = alloca(128+len); /* 128 is enough for MRT headers */
byte *bp = buf + MRT_HDR_LENGTH; byte *bp = buf + MRT_HDR_LENGTH;
int as4 = conn->bgp->as4_session; 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); bp = mrt_put_bgp4_hdr(bp, conn, as4);
memcpy(bp, pkt, len); memcpy(bp, pkt, len);
bp += 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_proto(&conn->bgp->p, MRT_BGP4MP, subtype, buf, bp-buf);
} }
static inline u16 static inline u16