]> git.puffer.fish Git - matthieu/frr.git/commitdiff
BGP: Handle router-id correctly in config and display.
authorvivek <vivek@cumulusnetworks.com>
Tue, 17 Nov 2015 21:57:56 +0000 (13:57 -0800)
committervivek <vivek@cumulusnetworks.com>
Tue, 17 Nov 2015 21:57:56 +0000 (13:57 -0800)
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

bgpd/bgp_vty.c
bgpd/bgpd.c
bgpd/bgpd.h

index de6f4d8b56415581f188c7efb1d878716c5c395f..53448da3491126577562587ee1cc4703c16887ae 100644 (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);
 
index 3ad59ff0c12bcecb4a21b22f9372ad790f6449a1..0c92532ba0534215948fa08683ec6248ac5b717d 100644 (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))
index 76486a4290f6405aa9364fb25c444b1ffb9d80e5..f64866aed538aa0b47d1749d36ecdcce9fddff89 100644 (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;