Merge pull request #12568 from YutaroHayakawa/YutaroHayakawa/fpm-nexthop

fpm: Send NH message to FPM even if the local kernel doesn't support it
This commit is contained in:
Donald Sharp 2023-01-06 08:22:31 -05:00 committed by GitHub
commit b15826e81b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -863,7 +863,7 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx)
case DPLANE_OP_NH_DELETE: case DPLANE_OP_NH_DELETE:
rv = netlink_nexthop_msg_encode(RTM_DELNEXTHOP, ctx, nl_buf, rv = netlink_nexthop_msg_encode(RTM_DELNEXTHOP, ctx, nl_buf,
sizeof(nl_buf)); sizeof(nl_buf), true);
if (rv <= 0) { if (rv <= 0) {
zlog_err("%s: netlink_nexthop_msg_encode failed", zlog_err("%s: netlink_nexthop_msg_encode failed",
__func__); __func__);
@ -875,7 +875,7 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx)
case DPLANE_OP_NH_INSTALL: case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_NH_UPDATE: case DPLANE_OP_NH_UPDATE:
rv = netlink_nexthop_msg_encode(RTM_NEWNEXTHOP, ctx, nl_buf, rv = netlink_nexthop_msg_encode(RTM_NEWNEXTHOP, ctx, nl_buf,
sizeof(nl_buf)); sizeof(nl_buf), true);
if (rv <= 0) { if (rv <= 0) {
zlog_err("%s: netlink_nexthop_msg_encode failed", zlog_err("%s: netlink_nexthop_msg_encode failed",
__func__); __func__);

View File

@ -2501,7 +2501,7 @@ static bool _netlink_nexthop_build_group(struct nlmsghdr *n, size_t req_size,
*/ */
ssize_t netlink_nexthop_msg_encode(uint16_t cmd, ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
const struct zebra_dplane_ctx *ctx, const struct zebra_dplane_ctx *ctx,
void *buf, size_t buflen) void *buf, size_t buflen, bool fpm)
{ {
struct { struct {
struct nlmsghdr n; struct nlmsghdr n;
@ -2528,9 +2528,10 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
/* /*
* 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, but FPM may possible to
* handle this.
*/ */
if (!kernel_nexthops_supported()) { if (!fpm && !kernel_nexthops_supported()) {
if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_NHG) if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_NHG)
zlog_debug( zlog_debug(
"%s: nhg_id %u (%s): kernel nexthops not supported, ignoring", "%s: nhg_id %u (%s): kernel nexthops not supported, ignoring",
@ -2850,7 +2851,7 @@ static ssize_t netlink_nexthop_msg_encoder(struct zebra_dplane_ctx *ctx,
return -1; return -1;
} }
return netlink_nexthop_msg_encode(cmd, ctx, buf, buflen); return netlink_nexthop_msg_encode(cmd, ctx, buf, buflen, false);
} }
enum netlink_msg_status enum netlink_msg_status

View File

@ -84,7 +84,7 @@ extern int netlink_nexthop_change(struct nlmsghdr *h, ns_id_t ns_id,
extern int netlink_nexthop_read(struct zebra_ns *zns); extern int netlink_nexthop_read(struct zebra_ns *zns);
extern ssize_t netlink_nexthop_msg_encode(uint16_t cmd, extern ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
const struct zebra_dplane_ctx *ctx, const struct zebra_dplane_ctx *ctx,
void *buf, size_t buflen); void *buf, size_t buflen, bool fpm);
extern ssize_t netlink_lsp_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf, extern ssize_t netlink_lsp_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf,
size_t buflen); size_t buflen);