mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 09:20:25 +00:00
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>
This commit is contained in:
parent
b36bedd2c3
commit
72938edfbc
@ -2100,16 +2100,35 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||||||
mpls_lse_t out_lse[MPLS_MAX_LABELS];
|
mpls_lse_t out_lse[MPLS_MAX_LABELS];
|
||||||
char label_buf[256];
|
char label_buf[256];
|
||||||
int num_labels = 0;
|
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
|
* Nothing to do if the kernel doesn't support nexthop objects or
|
||||||
* we dont want to install this type of NHG
|
* we dont want to install this type of NHG
|
||||||
*/
|
*/
|
||||||
if (!kernel_nexthops_supported()
|
if (!kernel_nexthops_supported()) {
|
||||||
|| (proto_nexthops_only()
|
if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_NHG)
|
||||||
&& !is_proto_nhg(dplane_ctx_get_nhe_id(ctx),
|
zlog_debug(
|
||||||
dplane_ctx_get_nhe_type(ctx))))
|
"%s: nhg_id %u (%s): kernel nexthops not supported, ignoring",
|
||||||
|
__func__, id, zebra_route_string(type));
|
||||||
return 0;
|
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';
|
label_buf[0] = '\0';
|
||||||
|
|
||||||
@ -2130,15 +2149,6 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||||||
req->nhm.nh_family = AF_UNSPEC;
|
req->nhm.nh_family = AF_UNSPEC;
|
||||||
/* TODO: Scope? */
|
/* 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))
|
if (!nl_attr_put32(&req->n, buflen, NHA_ID, id))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -2259,8 +2269,7 @@ nexthop_done:
|
|||||||
nh->vrf_id, label_buf);
|
nh->vrf_id, label_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
req->nhm.nh_protocol =
|
req->nhm.nh_protocol = zebra2proto(type);
|
||||||
zebra2proto(dplane_ctx_get_nhe_type(ctx));
|
|
||||||
|
|
||||||
} else if (cmd != RTM_DELNEXTHOP) {
|
} else if (cmd != RTM_DELNEXTHOP) {
|
||||||
flog_err(
|
flog_err(
|
||||||
|
Loading…
Reference in New Issue
Block a user