Skip to content

Commit

Permalink
zebra: Introduce early route processing on the MetaQ
Browse files Browse the repository at this point in the history
Currently if an operator does this operation:

sharpd@eva ~/frr8> sudo ip nexthop add id 5000 via 192.168.119.44 dev enp39s0 ; sudo ip route add 10.0.0.1 nhid 5000
2022/06/30 08:52:40 ZEBRA: [ZHQK5-J9M1R] proto2zebra: Please add this protocol(0) to proper rt_netlink.c handling
2022/06/30 08:52:40 ZEBRA: [PS16P-365FK][EC 4043309076] Zebra failed to find the nexthop hash entry for id=5000 in a route entry
sharpd@eva ~/frr8> vtysh -c "show ip route 10.0.0.1"
Routing entry for 0.0.0.0/0
  Known via "kernel", distance 0, metric 100, best
  Last update 00:01:58 ago
  * 192.168.119.1, via enp39s0

The route is dropped by zebra with no warnings.  This is not good,
but unlikely to happen at this point in time.  In order to fix
this issue route processing from inputs needs to happen after nexthop
group processing from inputs.  This was not possible because
nexthop groups are placed on the metaQ.  As such the above
nexthop group creation is placed on the metaQ for processing
in META_QUEUE_NHG.  Then the route is read in and processed
immediately.  The nexthop group is not found ( not processed yet!)
and the route is dropped in zebra.

Modify the code to have early route processing of validity
on the MetaQ.  This preserves the order of operations.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Aug 17, 2022
1 parent 53216df commit d7ac4c4
Show file tree
Hide file tree
Showing 3 changed files with 719 additions and 544 deletions.
17 changes: 9 additions & 8 deletions zebra/rib.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,17 @@ struct route_entry {
/* meta-queue structure:
* sub-queue 0: nexthop group objects
* sub-queue 1: EVPN/VxLAN objects
* sub-queue 2: Early Label Processing
* sub-queue 2: connected
* sub-queue 3: kernel
* sub-queue 4: static
* sub-queue 5: RIP, RIPng, OSPF, OSPF6, IS-IS, EIGRP, NHRP
* sub-queue 6: iBGP, eBGP
* sub-queue 7: any other origin (if any) typically those that
* sub-queue 2: Early Route Processing
* sub-queue 3: Early Label Processing
* sub-queue 4: connected
* sub-queue 5: kernel
* sub-queue 6: static
* sub-queue 7: RIP, RIPng, OSPF, OSPF6, IS-IS, EIGRP, NHRP
* sub-queue 8: iBGP, eBGP
* sub-queue 9: any other origin (if any) typically those that
* don't generate routes
*/
#define MQ_SIZE 9
#define MQ_SIZE 10
struct meta_queue {
struct list *subq[MQ_SIZE];
uint32_t size; /* sum of lengths of all subqueues */
Expand Down
7 changes: 4 additions & 3 deletions zebra/zapi_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
struct nhg_backup_info *bnhg = NULL;
int ret;
vrf_id_t vrf_id;
struct nhg_hash_entry nhe;
struct nhg_hash_entry nhe, *n = NULL;

s = msg;
if (zapi_route_decode(s, &api) < 0) {
Expand Down Expand Up @@ -2161,9 +2161,10 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
zebra_nhe_init(&nhe, afi, ng->nexthop);
nhe.nhg.nexthop = ng->nexthop;
nhe.backup_info = bnhg;
n = zebra_nhe_copy(&nhe, 0);
}
ret = rib_add_multipath_nhe(afi, api.safi, &api.prefix, src_p,
re, &nhe, false);
ret = rib_add_multipath_nhe(afi, api.safi, &api.prefix, src_p, re, n,
false);

/*
* rib_add_multipath_nhe only fails in a couple spots
Expand Down
Loading

0 comments on commit d7ac4c4

Please sign in to comment.