]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: allow derived router-id update if previously 0x0
authorDon Slice <dslice@nvidia.com>
Tue, 22 Sep 2020 13:14:52 +0000 (06:14 -0700)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Mon, 28 Sep 2020 08:22:05 +0000 (11:22 +0300)
Problem found that if a router-id was not defined or derived
initially, the bgp->router_id would be set to 0x0 and used
for determining auto-rd values. When bgp received a subsequent
router-id update from zebra, bgp would not completely process
the update since it was treated as updating an already derived
router-id with a new value, which is not desired.  This also
could leave the auto rd/rt inforamation missing or invalid in
some cases.  This fix allows updating the derived router-id if
the previous value was 0/0.

Ticket: CM-31441
Signed-off-by: Don Slice <dslice@nvidia.com>
bgpd/bgpd.c

index cf6335d3734965de8002760f4f9a67d0ad4714ae..41d4c0e4169206788657f476085860033824b68b 100644 (file)
@@ -289,7 +289,15 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id)
                                                        bgp->name_pretty,
                                                        bgp->vrf_id,
                                                        inet_ntoa(*addr));
-                                       bgp_router_id_set(bgp, addr, false);
+                                       /*
+                                        * if old router-id was 0x0, set flag
+                                        * to use this new value
+                                        */
+                                       bgp_router_id_set(bgp, addr,
+                                                         (bgp->router_id.s_addr
+                                                          == INADDR_ANY)
+                                                                 ? true
+                                                                 : false);
                                }
                        }
                }
@@ -312,7 +320,15 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id)
                                                        bgp->name_pretty,
                                                        bgp->vrf_id,
                                                        inet_ntoa(*addr));
-                                       bgp_router_id_set(bgp, addr, false);
+                                       /*
+                                        * if old router-id was 0x0, set flag
+                                        * to use this new value
+                                        */
+                                       bgp_router_id_set(bgp, addr,
+                                                         (bgp->router_id.s_addr
+                                                          == INADDR_ANY)
+                                                                 ? true
+                                                                 : false);
                                }
                        }