mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 07:03:57 +00:00
Merge pull request #10317 from ton31337/fix/shutdown_msg
bgpd: Make sure we are playing with non-NULL for bgp shutdown message
This commit is contained in:
commit
4d33086cad
17
bgpd/bgpd.c
17
bgpd/bgpd.c
@ -4320,10 +4320,6 @@ void bgp_shutdown_enable(struct bgp *bgp, const char *msg)
|
|||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
/* length(1) + message(N) */
|
/* length(1) + message(N) */
|
||||||
uint8_t data[BGP_ADMIN_SHUTDOWN_MSG_LEN + 1];
|
uint8_t data[BGP_ADMIN_SHUTDOWN_MSG_LEN + 1];
|
||||||
size_t datalen = strlen(msg);
|
|
||||||
|
|
||||||
data[0] = datalen;
|
|
||||||
memcpy(data + 1, msg, datalen);
|
|
||||||
|
|
||||||
/* do nothing if already shut down */
|
/* do nothing if already shut down */
|
||||||
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SHUTDOWN))
|
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SHUTDOWN))
|
||||||
@ -4341,16 +4337,25 @@ void bgp_shutdown_enable(struct bgp *bgp, const char *msg)
|
|||||||
|
|
||||||
/* send a RFC 4486 notification message if necessary */
|
/* send a RFC 4486 notification message if necessary */
|
||||||
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) {
|
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) {
|
||||||
if (msg)
|
if (msg) {
|
||||||
|
size_t datalen = strlen(msg);
|
||||||
|
|
||||||
|
if (datalen > BGP_ADMIN_SHUTDOWN_MSG_LEN)
|
||||||
|
datalen = BGP_ADMIN_SHUTDOWN_MSG_LEN;
|
||||||
|
|
||||||
|
data[0] = datalen;
|
||||||
|
memcpy(data + 1, msg, datalen);
|
||||||
|
|
||||||
bgp_notify_send_with_data(
|
bgp_notify_send_with_data(
|
||||||
peer, BGP_NOTIFY_CEASE,
|
peer, BGP_NOTIFY_CEASE,
|
||||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN, data,
|
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN, data,
|
||||||
datalen + 1);
|
datalen + 1);
|
||||||
else
|
} else {
|
||||||
bgp_notify_send(
|
bgp_notify_send(
|
||||||
peer, BGP_NOTIFY_CEASE,
|
peer, BGP_NOTIFY_CEASE,
|
||||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
|
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* reset start timer to initial value */
|
/* reset start timer to initial value */
|
||||||
peer->v_start = BGP_INIT_START_TIMER;
|
peer->v_start = BGP_INIT_START_TIMER;
|
||||||
|
Loading…
Reference in New Issue
Block a user