mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 10:22:07 +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;
|
||||
}
|
||||
|
||||
DEFPY (bgp_shutdown_msg,
|
||||
bgp_shutdown_msg_cmd,
|
||||
"bgp shutdown message MSG...",
|
||||
BGP_STR
|
||||
"Enable administrative shutdown of the BGP instance\n"
|
||||
"Add a shutdown message (RFC 8203)\n"
|
||||
"Shutdown message\n")
|
||||
DEFPY(bgp_shutdown_msg, bgp_shutdown_msg_cmd, "bgp shutdown message MSG...",
|
||||
BGP_STR
|
||||
"Enable administrative shutdown of the BGP instance\n"
|
||||
"Add a shutdown message (RFC 8203)\n"
|
||||
"Shutdown message\n")
|
||||
{
|
||||
char* msgstr = NULL;
|
||||
char *msgstr = NULL;
|
||||
|
||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||
|
||||
@ -3621,10 +3619,8 @@ DEFPY (bgp_shutdown_msg,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY (bgp_shutdown, bgp_shutdown_cmd,
|
||||
"bgp shutdown",
|
||||
BGP_STR
|
||||
"Enable administrative shutdown of the BGP instance\n")
|
||||
DEFPY(bgp_shutdown, bgp_shutdown_cmd, "bgp shutdown",
|
||||
BGP_STR "Enable administrative shutdown of the BGP instance\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||
|
||||
@ -3633,12 +3629,8 @@ DEFPY (bgp_shutdown, bgp_shutdown_cmd,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY (no_bgp_shutdown,
|
||||
no_bgp_shutdown_cmd,
|
||||
"no bgp shutdown",
|
||||
NO_STR
|
||||
BGP_STR
|
||||
"Disable administrative shutdown of the BGP instance\n")
|
||||
DEFPY(no_bgp_shutdown, no_bgp_shutdown_cmd, "no bgp shutdown",
|
||||
NO_STR BGP_STR "Disable administrative shutdown of the BGP instance\n")
|
||||
{
|
||||
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",
|
||||
(PAF_SUBGRP(paf))->scount);
|
||||
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",
|
||||
"Idle (Admin)");
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)
|
||||
|| CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHUTDOWN))
|
||||
if (CHECK_FLAG(peer->flags,
|
||||
PEER_FLAG_SHUTDOWN)
|
||||
|| CHECK_FLAG(peer->bgp->flags,
|
||||
BGP_FLAG_SHUTDOWN))
|
||||
vty_out(vty, " Idle (Admin)");
|
||||
else if (CHECK_FLAG(
|
||||
peer->sflags,
|
||||
|
15
bgpd/bgpd.c
15
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 */
|
||||
void bgp_shutdown_enable(struct bgp *bgp, char *msg)
|
||||
void bgp_shutdown_enable(struct bgp *bgp, const char *msg)
|
||||
{
|
||||
struct peer *peer;
|
||||
struct listnode *node;
|
||||
@ -4046,13 +4046,14 @@ void bgp_shutdown_enable(struct bgp *bgp, char *msg)
|
||||
/* send a RFC 4486 notification message if necessary */
|
||||
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) {
|
||||
if (msg)
|
||||
bgp_notify_send_with_data(peer, BGP_NOTIFY_CEASE,
|
||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN,
|
||||
(uint8_t *)(msg),
|
||||
strlen(msg));
|
||||
bgp_notify_send_with_data(
|
||||
peer, BGP_NOTIFY_CEASE,
|
||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN,
|
||||
(uint8_t *)(msg), strlen(msg));
|
||||
else
|
||||
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
|
||||
bgp_notify_send(
|
||||
peer, BGP_NOTIFY_CEASE,
|
||||
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
|
||||
}
|
||||
|
||||
/* reset start timer to initial value */
|
||||
|
@ -453,7 +453,7 @@ struct bgp {
|
||||
#define BGP_FLAG_SHOW_NEXTHOP_HOSTNAME (1 << 26)
|
||||
|
||||
/* This flag is set if the instance is in administrative shutdown */
|
||||
#define BGP_FLAG_SHUTDOWN (1 << 27)
|
||||
#define BGP_FLAG_SHUTDOWN (1 << 27)
|
||||
|
||||
enum global_mode GLOBAL_GR_FSM[BGP_GLOBAL_GR_MODE]
|
||||
[BGP_GLOBAL_GR_EVENT_CMD];
|
||||
@ -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 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_close(void);
|
||||
|
Loading…
Reference in New Issue
Block a user