mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 11:48:50 +00:00
bgpd: move to switch clause in get name function
bgp_rpki_validation2str implements a switch statement to determine the correct string response from the validation state. So, switch to a switch statement when getting a name by role for code consistency. Signed-off-by: Eugene Bogomazov <eb@qrator.net>
This commit is contained in:
parent
13896bde30
commit
865a7e7b3a
18
bgpd/bgpd.c
18
bgpd/bgpd.c
@ -2001,12 +2001,20 @@ int peer_remote_as(struct bgp *bgp, union sockunion *su, const char *conf_if,
|
||||
|
||||
const char *bgp_get_name_by_role(uint8_t role)
|
||||
{
|
||||
static const char *const bgp_role_names[] = {
|
||||
"provider", "rs-server", "rs-client", "customer", "peer"};
|
||||
if (role == ROLE_UNDEFINED)
|
||||
switch (role) {
|
||||
case ROLE_PROVIDER:
|
||||
return "provider";
|
||||
case ROLE_RS_SERVER:
|
||||
return "rs-server";
|
||||
case ROLE_RS_CLIENT:
|
||||
return "rs-client";
|
||||
case ROLE_CUSTOMER:
|
||||
return "customer";
|
||||
case ROLE_PEER:
|
||||
return "peer";
|
||||
case ROLE_UNDEFINED:
|
||||
return "undefined";
|
||||
if (role <= 5)
|
||||
return bgp_role_names[role];
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user