Skip to content

Commit

Permalink
zebra: Move fpm check to inside of netlink_route_nexthop_encap
Browse files Browse the repository at this point in the history
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed May 8, 2024
1 parent 5702eef commit 4ac9396
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions zebra/rt_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4ac9396

Please sign in to comment.