From 10f8f55d814fa3a64c94722dc177bea069cbb430 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 27 Jul 2021 07:32:08 +0000 Subject: [PATCH] Add the needed MRT dump defines for RFC8050 support. This will be used to dump add-path enabled systems because the NLRI format changes based on the add-path capability and there is no way to know which format is in use so new message types had to be added. Also extend the ctl_show_rib structure to include the path_id. OK benno@ --- usr.sbin/bgpd/bgpd.h | 4 +++- usr.sbin/bgpd/mrt.h | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index ffd27b1f43d..4c0952d5829 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.415 2021/06/17 16:05:26 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.416 2021/07/27 07:32:08 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -791,6 +791,7 @@ struct ctl_neighbor { #define F_PREF_ANNOUNCE 0x08 #define F_PREF_STALE 0x10 #define F_PREF_INVALID 0x20 +#define F_PREF_PATH_ID 0x40 struct ctl_show_rib { struct bgpd_addr true_nexthop; @@ -800,6 +801,7 @@ struct ctl_show_rib { char descr[PEER_DESCR_LEN]; time_t age; u_int32_t remote_id; + u_int32_t path_id; u_int32_t local_pref; u_int32_t med; u_int32_t weight; diff --git a/usr.sbin/bgpd/mrt.h b/usr.sbin/bgpd/mrt.h index f600912e44b..56a1923020e 100644 --- a/usr.sbin/bgpd/mrt.h +++ b/usr.sbin/bgpd/mrt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mrt.h,v 1.35 2019/12/31 15:09:40 claudio Exp $ */ +/* $OpenBSD: mrt.h,v 1.36 2021/07/27 07:32:08 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker @@ -84,7 +84,11 @@ enum MRT_BGP4MP_SUBTYPES { BGP4MP_MESSAGE_AS4, /* same as BGP4MP_MESSAGE with 4byte AS */ BGP4MP_STATE_CHANGE_AS4, BGP4MP_MESSAGE_LOCAL, /* same as BGP4MP_MESSAGE but for self */ - BGP4MP_MESSAGE_AS4_LOCAL /* originated updates. Not implemented */ + BGP4MP_MESSAGE_AS4_LOCAL, /* originated updates. Not implemented */ + BGP4MP_MESSAGE_ADDPATH, /* same as above but for add-path peers */ + BGP4MP_MESSAGE_AS4_ADDPATH, + BGP4MP_MESSAGE_LOCAL_ADDPATH, + BGP4MP_MESSAGE_AS4_LOCAL_ADDPATH, }; /* size of the BGP4MP headers without payload */ @@ -178,7 +182,12 @@ enum MRT_DUMP_V2_SUBTYPES { MRT_DUMP_V2_RIB_IPV4_MULTICAST=3, MRT_DUMP_V2_RIB_IPV6_UNICAST=4, MRT_DUMP_V2_RIB_IPV6_MULTICAST=5, - MRT_DUMP_V2_RIB_GENERIC=6 + MRT_DUMP_V2_RIB_GENERIC=6, + MRT_DUMP_V2_RIB_IPV4_UNICAST_ADDPATH=8, + MRT_DUMP_V2_RIB_IPV4_MULTICAST_ADDPATH=9, + MRT_DUMP_V2_RIB_IPV6_UNICAST_ADDPATH=10, + MRT_DUMP_V2_RIB_IPV6_MULTICAST_ADDPATH=11, + MRT_DUMP_V2_RIB_GENERIC_ADDPATH=12, }; /* @@ -228,7 +237,7 @@ enum MRT_DUMP_V2_SUBTYPES { * | #entry | rib entries (variable) * +--------+--------+--------+--------+ * - * The RIB_GENERIC subtype is needed for the less common AFI/SAFI pairs + * The RIB_GENERIC subtype is needed for the less common AFI/SAFI pairs. * * +--------+--------+--------+--------+ * | seq_num | @@ -249,6 +258,8 @@ enum MRT_DUMP_V2_SUBTYPES { * +--------+--------+--------+--------+ * | originated_time | * +--------+--------+--------+--------+ + * [ path_id in _ADDPATH variants ] + * +--------+--------+--------+--------+ * | attr_len | bgp_attrs * +--------+--------+--------+--------+ * bgp_attrs (variable) ... @@ -257,6 +268,10 @@ enum MRT_DUMP_V2_SUBTYPES { * Some BGP path attributes need special encoding: * - the AS_PATH attribute MUST be encoded as 4-Byte AS * - the MP_REACH_NLRI only consists of the nexthop len and nexthop address + * + * The non generic ADDPATH variants add the path-identifier between + * originated_time and attr_len. For RIB_GENERIC_ADDPATH the path_id should + * be part of the NLRI. */ /* -- 2.20.1