Don't send notification when receiving an unsupported capability.
authorBenjamin Cama <benoar@dolka.fr>
Sat, 23 Jul 2011 18:46:39 +0000 (20:46 +0200)
committerBenjamin Cama <benoar@dolka.fr>
Thu, 28 Jul 2011 13:01:57 +0000 (15:01 +0200)
Tested peer (quagga) doesn't interpret it nicely (i.e. it shuts the connection
down). Better not tell anything.

Signed-off-by: Benjamin Cama <benoar@dolka.fr>
bgp.c

diff --git a/bgp.c b/bgp.c
index 795ffc5..420a925 100644 (file)
--- 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));