diff options
author | Donald Sharp <sharpd@nvidia.com> | 2024-05-08 18:48:12 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2024-05-09 17:52:51 +0200 |
commit | 569f9e439418a06ac0ddf9b68cd1943cbf860d1d (patch) | |
tree | fe376cbe4555a49d740fd6fd5ab3f8d2149a6b05 /zebra/rt_netlink.c | |
parent | zebra: Move netlink_route_nexthop_encap (diff) | |
download | frr-569f9e439418a06ac0ddf9b68cd1943cbf860d1d.tar.xz frr-569f9e439418a06ac0ddf9b68cd1943cbf860d1d.zip |
zebra: Move fpm check to inside of netlink_route_nexthop_encap
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to '')
-rw-r--r-- | zebra/rt_netlink.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 745f6497f..9ac4bb9bf 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) |