Commit a474f34c authored by Pavel Tvrdík's avatar Pavel Tvrdík
Browse files

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

Thanks to Colin Petrie for patch.
parent bd5d7e28
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@
/* MRT BGP4MP Subtypes */
#define MRT_BGP4MP_MESSAGE	1
#define MRT_BGP4MP_MESSAGE_AS4	4
#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
+9 −1
Original line number Diff line number Diff line
@@ -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