Skip to content

Commit

Permalink
zebra: Add kernel condition check to see if it supports nexthops
Browse files Browse the repository at this point in the history
Added a check on startup for determining if the kernel supports
nexthop objects. It sets an appropriate bool on the zebra namespace
struct.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
  • Loading branch information
sworleys committed Oct 25, 2019
1 parent 4f09639 commit cc4e065
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions zebra/if_netlink.c
Expand Up @@ -1482,9 +1482,17 @@ void interface_list(struct zebra_ns *zns)
* so we need to get the nexthop info
* from the kernel before we can do that
*/
// TODO: Mark a failure with boolean on dataplane provider to indicate
// it is a kenrel that doesn't support nh objects.
netlink_nexthop_read(zns);

if (netlink_nexthop_read(zns)) {
/* If the nexthop read fails, assume the kernel
* cannot handle nexthop objects.
*/
zlog_debug("Nexthop objects disabled on this kernel");
zns->supports_nh = false;
} else {
zns->supports_nh = true;
}

interface_addr_lookup_netlink(zns);
}

Expand Down
1 change: 1 addition & 0 deletions zebra/zebra_ns.h
Expand Up @@ -54,6 +54,7 @@ struct zebra_ns {
struct nlsock netlink_cmd; /* command channel */
struct nlsock netlink_dplane; /* dataplane channel */
struct thread *t_netlink;
bool supports_nh; /* Does kernel support nexthop objects? */
#endif

struct route_table *if_table;
Expand Down

0 comments on commit cc4e065

Please sign in to comment.