BGP: Handle router-id correctly in config and display.

BGP is currently displaying the in-use router-id in the config. This is
conditional on a CONFIG flag, however, that flag is set even when there
is no configured router-id and the router-id learnt from Zebra is in-use.
The CONFIG flag for router-id is redundant since there is a separate
variable for the configured value, so use that and deprecate the CONFIG
flag. This also makes BGP behave like OSPF.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-8077, CM-8220
Reviewed By: CCR-3793
Testing Done: Manual verification (in 2.5-br)

Note: Imported from 2.5-br patch bgpd-fix-router-id-config-display.patch
This commit is contained in:
vivek 2015-11-17 13:57:56 -08:00
parent 798c5f61f8
commit c2d58d6d0f
3 changed files with 9 additions and 9 deletions

View File

@ -738,6 +738,9 @@ DEFUN (bgp_router_id,
return CMD_WARNING;
}
if (IPV4_ADDR_SAME (&bgp->router_id_static, &id))
return CMD_SUCCESS;
bgp->router_id_static = id;
bgp_router_id_set (bgp, &id);

View File

@ -210,12 +210,10 @@ bgp_router_id_set (struct bgp *bgp, struct in_addr *id)
struct peer *peer;
struct listnode *node, *nnode;
if (bgp_config_check (bgp, BGP_CONFIG_ROUTER_ID)
&& IPV4_ADDR_SAME (&bgp->router_id, id))
if (IPV4_ADDR_SAME (&bgp->router_id, id))
return 0;
IPV4_ADDR_COPY (&bgp->router_id, id);
bgp_config_set (bgp, BGP_CONFIG_ROUTER_ID);
/* Set all peer's local identifier with this value. */
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
@ -6787,9 +6785,9 @@ bgp_config_write (struct vty *vty)
vty_out (vty, " no bgp fast-external-failover%s", VTY_NEWLINE);
/* BGP router ID. */
if (CHECK_FLAG (bgp->config, BGP_CONFIG_ROUTER_ID))
vty_out (vty, " bgp router-id %s%s", inet_ntoa (bgp->router_id),
VTY_NEWLINE);
if (bgp->router_id_static.s_addr != 0)
vty_out (vty, " bgp router-id %s%s",
inet_ntoa (bgp->router_id_static), VTY_NEWLINE);
/* BGP log-neighbor-changes. */
if (!bgp_flag_check (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES))

View File

@ -178,9 +178,8 @@ struct bgp
/* BGP configuration. */
u_int16_t config;
#define BGP_CONFIG_ROUTER_ID (1 << 0)
#define BGP_CONFIG_CLUSTER_ID (1 << 1)
#define BGP_CONFIG_CONFEDERATION (1 << 2)
#define BGP_CONFIG_CLUSTER_ID (1 << 0)
#define BGP_CONFIG_CONFEDERATION (1 << 1)
/* BGP router identifier. */
struct in_addr router_id;