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 <benoar@dolka.fr>
This commit is contained in:
parent
3bd675ad2c
commit
c7e67e1de2
1 changed files with 0 additions and 15 deletions
15
bgp.c
15
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_update6(struct bgp_peer *peer);
|
||||||
static int bgp_send_notification(struct bgp_peer *peer, uint8_t code,
|
static int bgp_send_notification(struct bgp_peer *peer, uint8_t code,
|
||||||
uint8_t subcode);
|
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 uint16_t our_as;
|
||||||
static struct bgp_route_list *bgp_routes = 0;
|
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",
|
LOG(4, 0, 0, "Unsupported Capability code %d from BGP peer %s\n",
|
||||||
capability->code, peer->name);
|
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 */
|
/* we don't terminate, still; we just jump to the next one */
|
||||||
continue;
|
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",
|
LOG(4, 0, 0, "Unsupported multiprotocol AFI %d and SAFI %d from BGP peer %s\n",
|
||||||
mp_cap->afi, mp_cap->safi, peer->name);
|
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 */
|
/* we don't terminate, still; we just jump to the next one */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1722,12 +1716,6 @@ static int bgp_send_update6(struct bgp_peer *peer)
|
||||||
/* send/buffer NOTIFICATION message */
|
/* send/buffer NOTIFICATION message */
|
||||||
static int bgp_send_notification(struct bgp_peer *peer, uint8_t code,
|
static int bgp_send_notification(struct bgp_peer *peer, uint8_t code,
|
||||||
uint8_t subcode)
|
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;
|
struct bgp_data_notification data;
|
||||||
uint16_t len = 0;
|
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;
|
data.error_subcode = subcode;
|
||||||
len += sizeof(data.error_code);
|
len += sizeof(data.error_code);
|
||||||
|
|
||||||
memcpy(data.data, notification_data, data_len);
|
|
||||||
len += data_len;
|
|
||||||
|
|
||||||
memset(peer->outbuf->packet.header.marker, 0xff,
|
memset(peer->outbuf->packet.header.marker, 0xff,
|
||||||
sizeof(peer->outbuf->packet.header.marker));
|
sizeof(peer->outbuf->packet.header.marker));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue