summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_msg_write.c
diff options
context:
space:
mode:
authorChris Hall <GMCH@hestia.halldom.com>2010-08-04 11:20:31 +0100
committerChris Hall <GMCH@hestia.halldom.com>2010-08-04 11:20:31 +0100
commit11fe7d1d77cfd7b29ea14cc05b7fb2ea6ba13b74 (patch)
tree09b66e2a01eac2c3a8f610fed5bec9fbb062abfb /bgpd/bgp_msg_write.c
parent4af8f7adc4fe05de92cb11912af029c623feb821 (diff)
downloadquagga-11fe7d1d77cfd7b29ea14cc05b7fb2ea6ba13b74.tar.bz2
quagga-11fe7d1d77cfd7b29ea14cc05b7fb2ea6ba13b74.tar.xz
Fix various capability flags so that sessions are restarted.
For some reason (unknown) changing the following did NOT restart any active session: neighbor dont-capability-negotiate neighbor override-capability neighbor strict-capability-match since these can all change the nature of a session, this seems to be a (long time) bug, and has been fixed. Also, per RFC 5492: if (during OpenSent and OpenConfirm) get a NOTIFICATION: "Open/Unsupported Optional Parameter", treat that as "don't understand capabilities" and suppress sending of capabilities. Advanced to "ex05".
Diffstat (limited to 'bgpd/bgp_msg_write.c')
-rw-r--r--bgpd/bgp_msg_write.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/bgpd/bgp_msg_write.c b/bgpd/bgp_msg_write.c
index ee4a510c..21e48d69 100644
--- a/bgpd/bgp_msg_write.c
+++ b/bgpd/bgp_msg_write.c
@@ -167,7 +167,8 @@ bgp_msg_send_keepalive(bgp_connection connection, bool must_send)
*/
static void
-bgp_open_options(struct stream *s, bgp_open_state open_state) ;
+bgp_open_options(struct stream *s, bgp_open_state open_state,
+ bool cap_suppress) ;
static void
bgp_open_capability_orf (struct stream *s, iAFI_t afi, iSAFI_t safi,
@@ -205,7 +206,7 @@ bgp_msg_send_open(bgp_connection connection, bgp_open_state open_state)
stream_put_ipv4(s, open_state->bgp_id) ;
/* Set OPEN message options */
- bgp_open_options(s, open_state) ;
+ bgp_open_options(s, open_state, connection->cap_suppress) ;
/* Set BGP message length. */
length = bgp_packet_set_size(s) ;
@@ -213,12 +214,20 @@ bgp_msg_send_open(bgp_connection connection, bgp_open_state open_state)
if (BGP_DEBUG (normal, NORMAL))
{
char buf[INET_ADDRSTRLEN] ;
+ const char* no_cap ;
+
+ if (!open_state->can_capability)
+ no_cap = " (sans capabilities)" ;
+ else if (connection->cap_suppress)
+ no_cap = " (capabilities suppressed)" ;
+ else
+ no_cap = "" ;
inet_ntop(AF_INET, &open_state->bgp_id, buf, INET_ADDRSTRLEN) ;
- zlog_debug ("%s sending OPEN, version %d, my as %u, holdtime %d, id %s",
+ zlog_debug ("%s sending OPEN, version %d, my as %u, holdtime %d, id %s%s",
connection->host, BGP_VERSION_4, open_state->my_as,
- open_state->holdtime, buf) ;
+ open_state->holdtime, buf, no_cap) ;
} ;
@@ -251,7 +260,7 @@ enum
* Creates an empty options part of there are no capabilities to set.
*/
static void
-bgp_open_options(struct stream *s, bgp_open_state open_state)
+bgp_open_options(struct stream *s, bgp_open_state open_state, bool cap_suppress)
{
u_char len ;
unsigned long cp ;
@@ -264,7 +273,7 @@ bgp_open_options(struct stream *s, bgp_open_state open_state)
stream_putc(s, 0);
/* If do not send capability, quit now -- zero options. */
- if (!open_state->can_capability)
+ if (!open_state->can_capability || cap_suppress)
return;
/* TODO: RFC 5492 (2009): SHOULD send only one Capability Option !! */