From 89eeecb89982f5b4819121a7c145d561f2f4d616 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 19 May 2015 18:03:49 -0700 Subject: [PATCH] BGP: Use the new value of dynamic capability in Open The value for dynamic capability used in BGP open during capability negotiation is a deprecated value. Thus, interop with other systems is broken. This patch fixes that by advertising both the old and new values. This ensures interop with older versions of quagga and other non-quagga systems. Signed-off-by: Dinesh G Dutt --- bgpd/bgp_open.c | 10 +++++++++- bgpd/bgp_open.h | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index d35be4b1f3..2928e9b581 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -458,8 +458,9 @@ static const struct message capcode_str[] = { CAPABILITY_CODE_ORF, "Cooperative Route Filtering" }, { CAPABILITY_CODE_RESTART, "Graceful Restart" }, { CAPABILITY_CODE_AS4, "4-octet AS number" }, - { CAPABILITY_CODE_ADDPATH, "AddPath" }, + { CAPABILITY_CODE_ADDPATH, "AddPath" }, { CAPABILITY_CODE_DYNAMIC, "Dynamic" }, + { CAPABILITY_CODE_DYNAMIC_OLD, "Dynamic (Old)" }, { CAPABILITY_CODE_REFRESH_OLD, "Route Refresh (Old)" }, { CAPABILITY_CODE_ORF_OLD, "ORF (Old)" }, }; @@ -475,6 +476,7 @@ static const size_t cap_minsizes[] = [CAPABILITY_CODE_AS4] = CAPABILITY_CODE_AS4_LEN, [CAPABILITY_CODE_ADDPATH] = CAPABILITY_CODE_ADDPATH_LEN, [CAPABILITY_CODE_DYNAMIC] = CAPABILITY_CODE_DYNAMIC_LEN, + [CAPABILITY_CODE_DYNAMIC_OLD] = CAPABILITY_CODE_DYNAMIC_LEN, [CAPABILITY_CODE_REFRESH_OLD] = CAPABILITY_CODE_REFRESH_LEN, [CAPABILITY_CODE_ORF_OLD] = sizeof (struct capability_orf_entry), }; @@ -540,6 +542,7 @@ bgp_capability_parse (struct peer *peer, size_t length, int *mp_capability, case CAPABILITY_CODE_AS4: case CAPABILITY_CODE_ADDPATH: case CAPABILITY_CODE_DYNAMIC: + case CAPABILITY_CODE_DYNAMIC_OLD: /* Check length. */ if (caphdr.length < cap_minsizes[caphdr.code]) { @@ -599,6 +602,7 @@ bgp_capability_parse (struct peer *peer, size_t length, int *mp_capability, return -1; break; case CAPABILITY_CODE_DYNAMIC: + case CAPABILITY_CODE_DYNAMIC_OLD: SET_FLAG (peer->cap, PEER_CAP_DYNAMIC_RCV); break; case CAPABILITY_CODE_AS4: @@ -1085,6 +1089,10 @@ bgp_open_capability (struct stream *s, struct peer *peer) SET_FLAG (peer->cap, PEER_CAP_DYNAMIC_ADV); stream_putc (s, BGP_OPEN_OPT_CAP); stream_putc (s, CAPABILITY_CODE_DYNAMIC_LEN + 2); + stream_putc (s, CAPABILITY_CODE_DYNAMIC_OLD); + stream_putc (s, CAPABILITY_CODE_DYNAMIC_LEN); + stream_putc (s, BGP_OPEN_OPT_CAP); + stream_putc (s, CAPABILITY_CODE_DYNAMIC_LEN + 2); stream_putc (s, CAPABILITY_CODE_DYNAMIC); stream_putc (s, CAPABILITY_CODE_DYNAMIC_LEN); } diff --git a/bgpd/bgp_open.h b/bgpd/bgp_open.h index 6b51d938f5..da6f29d2ab 100644 --- a/bgpd/bgp_open.h +++ b/bgpd/bgp_open.h @@ -74,7 +74,8 @@ struct capability_gr #define CAPABILITY_CODE_ORF 3 /* Cooperative Route Filtering Capability */ #define CAPABILITY_CODE_RESTART 64 /* Graceful Restart Capability */ #define CAPABILITY_CODE_AS4 65 /* 4-octet AS number Capability */ -#define CAPABILITY_CODE_DYNAMIC 66 /* Dynamic Capability */ +#define CAPABILITY_CODE_DYNAMIC_OLD 66 /* Dynamic Capability, deprecated since 2003 */ +#define CAPABILITY_CODE_DYNAMIC 67 /* Dynamic Capability */ #define CAPABILITY_CODE_ADDPATH 69 /* Addpath Capability */ #define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */ #define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */ -- 2.39.5