summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2020-05-28 13:22:18 -0400
committerStephen Worley <sworley@cumulusnetworks.com>2020-09-28 12:40:59 -0400
commit72938edfbc95ee86bccb84633d144951ae2b2b97 (patch)
treeeeaef49d7f0903ba091f7e93eb04d21ad685efdd /zebra/rt_netlink.c
parentb36bedd2c3ff98e75383630c2a637339c7f76eb5 (diff)
zebra: add logging for NHG ignoring in netlink
Add some logging for when we choose to ignore a NHG install for one reason or another. Also, cleanup some of the code using the same accessor functions for the context object. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 34841aa4a5..46de751f95 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -2100,16 +2100,35 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
mpls_lse_t out_lse[MPLS_MAX_LABELS];
char label_buf[256];
int num_labels = 0;
+ uint32_t id = dplane_ctx_get_nhe_id(ctx);
+ int type = dplane_ctx_get_nhe_type(ctx);
+
+ if (!id) {
+ flog_err(
+ EC_ZEBRA_NHG_FIB_UPDATE,
+ "Failed trying to update a nexthop group in the kernel that does not have an ID");
+ return -1;
+ }
/*
* Nothing to do if the kernel doesn't support nexthop objects or
* we dont want to install this type of NHG
*/
- if (!kernel_nexthops_supported()
- || (proto_nexthops_only()
- && !is_proto_nhg(dplane_ctx_get_nhe_id(ctx),
- dplane_ctx_get_nhe_type(ctx))))
+ if (!kernel_nexthops_supported()) {
+ if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_NHG)
+ zlog_debug(
+ "%s: nhg_id %u (%s): kernel nexthops not supported, ignoring",
+ __func__, id, zebra_route_string(type));
return 0;
+ }
+
+ if (proto_nexthops_only() && !is_proto_nhg(id, type)) {
+ if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_NHG)
+ zlog_debug(
+ "%s: nhg_id %u (%s): proto-based nexthops only, ignoring",
+ __func__, id, zebra_route_string(type));
+ return 0;
+ }
label_buf[0] = '\0';
@@ -2130,15 +2149,6 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
req->nhm.nh_family = AF_UNSPEC;
/* TODO: Scope? */
- uint32_t id = dplane_ctx_get_nhe_id(ctx);
-
- if (!id) {
- flog_err(
- EC_ZEBRA_NHG_FIB_UPDATE,
- "Failed trying to update a nexthop group in the kernel that does not have an ID");
- return -1;
- }
-
if (!nl_attr_put32(&req->n, buflen, NHA_ID, id))
return 0;
@@ -2259,8 +2269,7 @@ nexthop_done:
nh->vrf_id, label_buf);
}
- req->nhm.nh_protocol =
- zebra2proto(dplane_ctx_get_nhe_type(ctx));
+ req->nhm.nh_protocol = zebra2proto(type);
} else if (cmd != RTM_DELNEXTHOP) {
flog_err(