From: Benjamin Cama Date: Sat, 23 Jul 2011 18:46:39 +0000 (+0200) Subject: Don't send notification when receiving an unsupported capability. X-Git-Tag: debian/2.2.1-1fdn1~1^2^2~6 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/c7e67e1de278393c129179469be6de9fed282187?ds=inline;hp=3bd675ad2c2b0c1cb3dfe52deb179f24e05c41b4 Don't send notification when receiving an unsupported capability. Tested peer (quagga) doesn't interpret it nicely (i.e. it shuts the connection down). Better not tell anything. Signed-off-by: Benjamin Cama --- diff --git a/bgp.c b/bgp.c index 795ffc5..420a925 100644 --- a/bgp.c +++ b/bgp.c @@ -49,8 +49,6 @@ static int bgp_send_update(struct bgp_peer *peer); static int bgp_send_update6(struct bgp_peer *peer); static int bgp_send_notification(struct bgp_peer *peer, uint8_t code, uint8_t subcode); -static int bgp_send_notification_full(struct bgp_peer *peer, uint8_t code, - uint8_t subcode, char *notification_data, uint16_t data_len); static uint16_t our_as; static struct bgp_route_list *bgp_routes = 0; @@ -1238,8 +1236,6 @@ static int bgp_handle_input(struct bgp_peer *peer) LOG(4, 0, 0, "Unsupported Capability code %d from BGP peer %s\n", capability->code, peer->name); - bgp_send_notification_full(peer, BGP_ERR_OPEN, BGP_ERR_OPN_UNSUP_CAP, - (char *)capability, 2 + capability->len); /* we don't terminate, still; we just jump to the next one */ continue; } @@ -1251,8 +1247,6 @@ static int bgp_handle_input(struct bgp_peer *peer) LOG(4, 0, 0, "Unsupported multiprotocol AFI %d and SAFI %d from BGP peer %s\n", mp_cap->afi, mp_cap->safi, peer->name); - bgp_send_notification_full(peer, BGP_ERR_OPEN, BGP_ERR_OPN_UNSUP_CAP, - (char *)capability, 2 + capability->len); /* we don't terminate, still; we just jump to the next one */ continue; } @@ -1722,12 +1716,6 @@ static int bgp_send_update6(struct bgp_peer *peer) /* send/buffer NOTIFICATION message */ static int bgp_send_notification(struct bgp_peer *peer, uint8_t code, uint8_t subcode) -{ - return bgp_send_notification_full(peer, code, subcode, NULL, 0); -} - -static int bgp_send_notification_full(struct bgp_peer *peer, uint8_t code, - uint8_t subcode, char *notification_data, uint16_t data_len) { struct bgp_data_notification data; uint16_t len = 0; @@ -1738,9 +1726,6 @@ static int bgp_send_notification_full(struct bgp_peer *peer, uint8_t code, data.error_subcode = subcode; len += sizeof(data.error_code); - memcpy(data.data, notification_data, data_len); - len += data_len; - memset(peer->outbuf->packet.header.marker, 0xff, sizeof(peer->outbuf->packet.header.marker));