summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2022-02-28 14:57:35 -0600
committerGitHub <noreply@github.com>2022-02-28 14:57:35 -0600
commit868efb9e9f6aa5b2475f51347c5768146f04e701 (patch)
tree09241d5f2810d6ee2c176221e5c54c4cbb268171
parent0acdda46c4b95b508e2061a84d1bcfe754e0b835 (diff)
parentfd149fe625a8f9d3605b781c359ae09e5f7d853b (diff)
Merge pull request #10672 from donaldsharp/bsd_zebra_graceful_restart_cleanup
Bsd zebra graceful restart cleanup
-rw-r--r--doc/user/zebra.rst3
-rw-r--r--zebra/kernel_socket.c19
-rw-r--r--zebra/zebra_rib.c6
3 files changed, 18 insertions, 10 deletions
diff --git a/doc/user/zebra.rst b/doc/user/zebra.rst
index b016481d72..15c6088b7a 100644
--- a/doc/user/zebra.rst
+++ b/doc/user/zebra.rst
@@ -29,6 +29,9 @@ Besides the common invocation options (:ref:`common-invocation-options`), the
Zebra, when started, will read in routes. Those routes that Zebra
identifies that it was the originator of will be swept in TIME seconds.
If no time is specified then we will sweep those routes immediately.
+ Under the *BSD's, there is no way to properly store the originating
+ route and the route types in this case will show up as a static route
+ with an admin distance of 255.
.. option:: -r, --retain
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index d812094848..ce1f17111b 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -1011,6 +1011,8 @@ void rtm_read(struct rt_msghdr *rtm)
ifindex_t ifindex = 0;
afi_t afi;
char fbuf[64];
+ int32_t proto = ZEBRA_ROUTE_KERNEL;
+ uint8_t distance = 0;
zebra_flags = 0;
@@ -1042,8 +1044,11 @@ void rtm_read(struct rt_msghdr *rtm)
if (!(flags & RTF_GATEWAY))
return;
- if (flags & RTF_PROTO1)
+ if (flags & RTF_PROTO1) {
SET_FLAG(zebra_flags, ZEBRA_FLAG_SELFROUTE);
+ proto = ZEBRA_ROUTE_STATIC;
+ distance = 255;
+ }
memset(&nh, 0, sizeof(nh));
@@ -1111,13 +1116,13 @@ void rtm_read(struct rt_msghdr *rtm)
0, true);
if (rtm->rtm_type == RTM_GET || rtm->rtm_type == RTM_ADD
|| rtm->rtm_type == RTM_CHANGE)
- rib_add(afi, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL, 0,
- zebra_flags, &p, NULL, &nh, 0, RT_TABLE_MAIN,
- 0, 0, 0, 0, false);
+ rib_add(afi, SAFI_UNICAST, VRF_DEFAULT, proto, 0, zebra_flags,
+ &p, NULL, &nh, 0, RT_TABLE_MAIN, 0, 0, distance, 0,
+ false);
else
- rib_delete(afi, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL,
- 0, zebra_flags, &p, NULL, &nh, 0, RT_TABLE_MAIN, 0,
- 0, true);
+ rib_delete(afi, SAFI_UNICAST, VRF_DEFAULT, proto, 0,
+ zebra_flags, &p, NULL, &nh, 0, RT_TABLE_MAIN, 0,
+ distance, true);
}
/* Interface function for the kernel routing table updates. Support
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index af159da3cc..e376d4b2af 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -116,6 +116,7 @@ static const struct {
[ZEBRA_ROUTE_OPENFABRIC] = {ZEBRA_ROUTE_OPENFABRIC, 115, 5},
[ZEBRA_ROUTE_VRRP] = {ZEBRA_ROUTE_VRRP, 255, 7},
[ZEBRA_ROUTE_SRTE] = {ZEBRA_ROUTE_SRTE, 255, 7},
+ [ZEBRA_ROUTE_ALL] = {ZEBRA_ROUTE_ALL, 255, 7},
/* Any new route type added to zebra, should be mirrored here */
/* no entry/default: 150 */
@@ -4386,9 +4387,8 @@ static void check_route_info(void)
* ZEBRA_ROUTE_ALL is also ignored.
*/
for (int i = 0; i < len; i++) {
- if (i == ZEBRA_ROUTE_SYSTEM || i == ZEBRA_ROUTE_ALL)
- continue;
- assert(route_info[i].key);
+ assert(route_info[i].key >= ZEBRA_ROUTE_SYSTEM &&
+ route_info[i].key < ZEBRA_ROUTE_MAX);
assert(route_info[i].meta_q_map < MQ_SIZE);
}
}