mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-19 17:03:19 +00:00
bgpd: Use correct encoding before printing shutdown msg
Using `bgp shutdown message MSG...`. Length should be decoded from the first byte, but it's decoded from the data instead. Before: ``` %NOTIFICATION: sent to neighbor 192.168.0.2 6/2 (Cease/Administratively Shutdown) 70 bytes 5b 54 49 43 4b 45 54 2d 31 2d 31 34 33 38 33 36 37 33 39 30 5d 20 73 ``` After: ``` %NOTIFICATION: sent to neighbor 192.168.0.2 6/2 (Cease/Administratively Shutdown) "[TICKET-1-1438367390] software upgrade; Expected downtime for 2 hours;" ``` On receiving side: ``` "[TICKET-1-1438367390] software upgrade; Expected downtime for 2 hours;" ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
parent
b776f48c36
commit
202a171144
10
bgpd/bgpd.c
10
bgpd/bgpd.c
@ -4318,6 +4318,12 @@ void bgp_shutdown_enable(struct bgp *bgp, const char *msg)
|
||||
{
|
||||
struct peer *peer;
|
||||
struct listnode *node;
|
||||
/* length(1) + message(N) */
|
||||
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 */
|
||||
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SHUTDOWN))
|
||||
@ -4338,8 +4344,8 @@ void bgp_shutdown_enable(struct bgp *bgp, const char *msg)
|
||||
if (msg)
|
||||
bgp_notify_send_with_data(
|
||||
peer, BGP_NOTIFY_CEASE,
|
||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN,
|
||||
(uint8_t *)(msg), strlen(msg));
|
||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN, data,
|
||||
datalen + 1);
|
||||
else
|
||||
bgp_notify_send(
|
||||
peer, BGP_NOTIFY_CEASE,
|
||||
|
Loading…
Reference in New Issue
Block a user