summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Rosenboim <lrosenbo@wrs.com>2012-12-07 21:25:00 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2013-01-14 17:58:42 +0100
commita689e6a9f470d2a72493b907c94ef23516bbbda6 (patch)
tree90dc123c2f7528c59e08c9aa492dfd4a92603aed
parenta0de1d16cd00694b07b266d4a5dae5985e9072ff (diff)
bgpd: fix error response to invalid BGP version number
BGP4-ANVL 20.1 ANVL tries to open BGP with version 5 and expects correct notification in response. Quagga sends notification, but with incorrect information in it. The data needs to be a 2-byte value, and for now we respond with 0004 for any peer version other than 4. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--bgpd/bgp_packet.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 2d62c8da..968c8e4d 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1411,14 +1411,16 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
/* Peer BGP version check. */
if (version != BGP_VERSION_4)
{
- u_int8_t maxver = BGP_VERSION_4;
+ u_int16_t maxver = htons(BGP_VERSION_4);
+ /* XXX this reply may not be correct if version < 4 XXX */
if (BGP_DEBUG (normal, NORMAL))
zlog_debug ("%s bad protocol version, remote requested %d, local request %d",
peer->host, version, BGP_VERSION_4);
+ /* Data must be in network byte order here */
bgp_notify_send_with_data (peer,
BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_UNSUP_VERSION,
- &maxver, 1);
+ (u_int8_t *) &maxver, 2);
return -1;
}