mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-09 18:50:39 +00:00
bgpd: use memcmp to check bgp marker
performance Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
958b450c69
commit
442c9afbd2
@ -522,9 +522,11 @@ static bool validate_header(struct peer *peer)
|
|||||||
{
|
{
|
||||||
u_int16_t size, type;
|
u_int16_t size, type;
|
||||||
|
|
||||||
/* Marker check */
|
static uint8_t marker[BGP_MARKER_SIZE] = {
|
||||||
for (int i = 0; i < BGP_MARKER_SIZE; i++)
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
if (peer->ibuf_work->data[i] != 0xff) {
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||||
|
|
||||||
|
if (memcmp(marker, peer->ibuf_work->data, BGP_MARKER_SIZE) != 0) {
|
||||||
bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR,
|
bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR,
|
||||||
BGP_NOTIFY_HEADER_NOT_SYNC);
|
BGP_NOTIFY_HEADER_NOT_SYNC);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user