From a47a01083b6ff9196f39136d68ed32ac70b31d15 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 25 Apr 2000 13:32:17 +0000 Subject: [PATCH] Real parsing of BGP OPEN options including capability negotiation. --- proto/bgp/packets.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index ccaa91c1..504af93b 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -199,6 +199,44 @@ bgp_tx(sock *sk) ; } +static int +bgp_parse_options(struct bgp_conn *conn, byte *opt, int len) +{ + while (len > 0) + { + if (len < 2 || len < 2 + opt[1]) + { bgp_error(conn, 2, 0, 0, 0); return 0; } +#ifdef LOCAL_DEBUG + { + int i; + DBG("\tOption %02x:", opt[0]); + for(i=0; i 0 && hold < 3) { bgp_error(conn, 2, 6, hold, 0); return; } p->remote_id = id; - if (pkt[28]) /* Currently we support no optional parameters */ - { bgp_error(conn, 2, 4, pkt[29], 0); return; } + if (bgp_parse_options(conn, pkt+29, pkt[28])) + return; if (!id || id == 0xffffffff || id == p->local_id) { bgp_error(conn, 2, 3, id, 0); return; }