mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 01:57:26 +00:00
bgpd: minor fix and code style compliance
* Applied style suggestions by automated compliance check. * Fixed function bgp_shutdown_enable to use immutable message string. Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
This commit is contained in:
parent
df465afea8
commit
736b68f33a
@ -3600,15 +3600,13 @@ DEFUN (bgp_default_shutdown,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (bgp_shutdown_msg,
|
DEFPY(bgp_shutdown_msg, bgp_shutdown_msg_cmd, "bgp shutdown message MSG...",
|
||||||
bgp_shutdown_msg_cmd,
|
|
||||||
"bgp shutdown message MSG...",
|
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Enable administrative shutdown of the BGP instance\n"
|
"Enable administrative shutdown of the BGP instance\n"
|
||||||
"Add a shutdown message (RFC 8203)\n"
|
"Add a shutdown message (RFC 8203)\n"
|
||||||
"Shutdown message\n")
|
"Shutdown message\n")
|
||||||
{
|
{
|
||||||
char* msgstr = NULL;
|
char *msgstr = NULL;
|
||||||
|
|
||||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
|
|
||||||
@ -3621,10 +3619,8 @@ DEFPY (bgp_shutdown_msg,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (bgp_shutdown, bgp_shutdown_cmd,
|
DEFPY(bgp_shutdown, bgp_shutdown_cmd, "bgp shutdown",
|
||||||
"bgp shutdown",
|
BGP_STR "Enable administrative shutdown of the BGP instance\n")
|
||||||
BGP_STR
|
|
||||||
"Enable administrative shutdown of the BGP instance\n")
|
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
|
|
||||||
@ -3633,12 +3629,8 @@ DEFPY (bgp_shutdown, bgp_shutdown_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (no_bgp_shutdown,
|
DEFPY(no_bgp_shutdown, no_bgp_shutdown_cmd, "no bgp shutdown",
|
||||||
no_bgp_shutdown_cmd,
|
NO_STR BGP_STR "Disable administrative shutdown of the BGP instance\n")
|
||||||
"no bgp shutdown",
|
|
||||||
NO_STR
|
|
||||||
BGP_STR
|
|
||||||
"Disable administrative shutdown of the BGP instance\n")
|
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
|
|
||||||
@ -9376,7 +9368,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
|
|||||||
"pfxSnt",
|
"pfxSnt",
|
||||||
(PAF_SUBGRP(paf))->scount);
|
(PAF_SUBGRP(paf))->scount);
|
||||||
if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)
|
if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)
|
||||||
|| CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHUTDOWN))
|
|| CHECK_FLAG(peer->bgp->flags,
|
||||||
|
BGP_FLAG_SHUTDOWN))
|
||||||
json_object_string_add(json_peer, "state",
|
json_object_string_add(json_peer, "state",
|
||||||
"Idle (Admin)");
|
"Idle (Admin)");
|
||||||
else if (peer->afc_recv[afi][safi])
|
else if (peer->afc_recv[afi][safi])
|
||||||
@ -9495,8 +9488,10 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
|
|||||||
->scount);
|
->scount);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)
|
if (CHECK_FLAG(peer->flags,
|
||||||
|| CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHUTDOWN))
|
PEER_FLAG_SHUTDOWN)
|
||||||
|
|| CHECK_FLAG(peer->bgp->flags,
|
||||||
|
BGP_FLAG_SHUTDOWN))
|
||||||
vty_out(vty, " Idle (Admin)");
|
vty_out(vty, " Idle (Admin)");
|
||||||
else if (CHECK_FLAG(
|
else if (CHECK_FLAG(
|
||||||
peer->sflags,
|
peer->sflags,
|
||||||
|
11
bgpd/bgpd.c
11
bgpd/bgpd.c
@ -4024,7 +4024,7 @@ static void peer_flag_modify_action(struct peer *peer, uint32_t flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Enable global administrative shutdown of all peers of BGP instance */
|
/* Enable global administrative shutdown of all peers of BGP instance */
|
||||||
void bgp_shutdown_enable(struct bgp *bgp, char *msg)
|
void bgp_shutdown_enable(struct bgp *bgp, const char *msg)
|
||||||
{
|
{
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
@ -4046,12 +4046,13 @@ void bgp_shutdown_enable(struct bgp *bgp, 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)
|
||||||
bgp_notify_send_with_data(peer, BGP_NOTIFY_CEASE,
|
bgp_notify_send_with_data(
|
||||||
|
peer, BGP_NOTIFY_CEASE,
|
||||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN,
|
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN,
|
||||||
(uint8_t *)(msg),
|
(uint8_t *)(msg), strlen(msg));
|
||||||
strlen(msg));
|
|
||||||
else
|
else
|
||||||
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
bgp_notify_send(
|
||||||
|
peer, BGP_NOTIFY_CEASE,
|
||||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
|
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1951,7 +1951,7 @@ extern struct peer_af *peer_af_create(struct peer *, afi_t, safi_t);
|
|||||||
extern struct peer_af *peer_af_find(struct peer *, afi_t, safi_t);
|
extern struct peer_af *peer_af_find(struct peer *, afi_t, safi_t);
|
||||||
extern int peer_af_delete(struct peer *, afi_t, safi_t);
|
extern int peer_af_delete(struct peer *, afi_t, safi_t);
|
||||||
|
|
||||||
extern void bgp_shutdown_enable(struct bgp *bgp, char *msg);
|
extern void bgp_shutdown_enable(struct bgp *bgp, const char *msg);
|
||||||
extern void bgp_shutdown_disable(struct bgp *bgp);
|
extern void bgp_shutdown_disable(struct bgp *bgp);
|
||||||
|
|
||||||
extern void bgp_close(void);
|
extern void bgp_close(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user