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; }