On 9/22/21 4:16 AM, Xiao Liang wrote:
quoted hunk ↗ jump to hunk
@@ -1682,10 +1683,17 @@ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
/* length of rtnetlink header + attributes */
rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *)rtnh;
- return 0;
+ return rtnh;
nla_put_failure:
- return -EMSGSIZE;
+ return ERR_PTR(-EMSGSIZE);
+}
+
+int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
+ int nh_weight, u8 rt_family)
Adding classid as an input to fib_add_nexthop and checking it for non-0
before adding to the message is a better way to resolve this.