Skip to content

Commit 569f9e4

Browse files
committed
zebra: Move fpm check to inside of netlink_route_nexthop_encap
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
1 parent ba5a353 commit 569f9e4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

zebra/rt_netlink.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,11 +1895,14 @@ static inline bool _netlink_set_tag(struct nlmsghdr *n, unsigned int maxlen,
18951895
* The function returns true if the attribute could be added
18961896
* to the message, otherwise false is returned.
18971897
*/
1898-
static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen,
1899-
struct nexthop *nh)
1898+
static int netlink_route_nexthop_encap(bool fpm, struct nlmsghdr *n,
1899+
size_t nlen, struct nexthop *nh)
19001900
{
19011901
struct rtattr *nest;
19021902

1903+
if (!fpm)
1904+
return true;
1905+
19031906
switch (nh->nh_encap_type) {
19041907
case NET_VXLAN:
19051908
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
24302433
* Add encapsulation information when
24312434
* installing via FPM.
24322435
*/
2433-
if (fpm) {
2434-
if (!netlink_route_nexthop_encap(&req->n,
2435-
datalen,
2436-
nexthop))
2437-
return 0;
2438-
}
2436+
if (!netlink_route_nexthop_encap(fpm, &req->n,
2437+
datalen,
2438+
nexthop))
2439+
return 0;
24392440

24402441
nexthop_num++;
24412442
break;
@@ -2490,11 +2491,10 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, struct zebra_dplane_ctx *ctx
24902491
* Add encapsulation information when installing via
24912492
* FPM.
24922493
*/
2493-
if (fpm) {
2494-
if (!netlink_route_nexthop_encap(
2495-
&req->n, datalen, nexthop))
2496-
return 0;
2497-
}
2494+
if (!netlink_route_nexthop_encap(fpm, &req->n,
2495+
datalen,
2496+
nexthop))
2497+
return 0;
24982498

24992499
if (!setsrc && src1) {
25002500
if (p->family == AF_INET)

0 commit comments

Comments
 (0)