From 4ac939607c37cbe7da6de262afe8a8cce32e887d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 8 May 2024 12:48:12 -0400 Subject: [PATCH] zebra: Move fpm check to inside of netlink_route_nexthop_encap Signed-off-by: Donald Sharp --- zebra/rt_netlink.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 745f6497fb2b..9ac4bb9bf8bb 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1895,11 +1895,14 @@ static inline bool _netlink_set_tag(struct nlmsghdr *n, unsigned int maxlen, * The function returns true if the attribute could be added * to the message, otherwise false is returned. */ -static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, - struct nexthop *nh) +static int netlink_route_nexthop_encap(bool fpm, struct nlmsghdr *n, + size_t nlen, struct nexthop *nh) { struct rtattr *nest; + if (!fpm) + return true; + switch (nh->nh_encap_type) { case NET_VXLAN: if (!nl_attr_put16(n, nlen, RTA_ENCAP_TYPE, nh->nh_encap_type)) @@ -2430,12 +2433,10 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, struct zebra_dplane_ctx *ctx * Add encapsulation information when * installing via FPM. */ - if (fpm) { - if (!netlink_route_nexthop_encap(&req->n, - datalen, - nexthop)) - return 0; - } + if (!netlink_route_nexthop_encap(fpm, &req->n, + datalen, + nexthop)) + return 0; nexthop_num++; break; @@ -2490,11 +2491,10 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, struct zebra_dplane_ctx *ctx * Add encapsulation information when installing via * FPM. */ - if (fpm) { - if (!netlink_route_nexthop_encap( - &req->n, datalen, nexthop)) - return 0; - } + if (!netlink_route_nexthop_encap(fpm, &req->n, + datalen, + nexthop)) + return 0; if (!setsrc && src1) { if (p->family == AF_INET)