* 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))
* 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;
* 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)