Emit RTA_DEL_REASON from rt6_fill_node() when the deletion reason is not RTA_DEL_REASON_UNSPEC, and reserve room for it in rt6_nlmsg_size().
Every caller still passes RTA_DEL_REASON_UNSPEC. Signed-off-by: Yuyang Huang <[email protected]> --- net/ipv6/route.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index b30becf3f56b..b67c8a31ccd6 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5749,6 +5749,7 @@ static size_t rt6_nlmsg_size(struct fib6_info *f6i) + nla_total_size(sizeof(struct rta_cacheinfo)) + nla_total_size(TCP_CA_NAME_MAX) /* RTAX_CC_ALGO */ + nla_total_size(1) /* RTA_PREF */ + + nla_total_size(4) /* RTA_DEL_REASON */ + nexthop_len; } @@ -5964,6 +5965,10 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, if (rtnl_put_cacheinfo(skb, dst, 0, expires, dst ? dst->error : 0) < 0) goto nla_put_failure; + if (del_reason != RTA_DEL_REASON_UNSPEC && + nla_put_u32(skb, RTA_DEL_REASON, del_reason)) + goto nla_put_failure; + if (nla_put_u8(skb, RTA_PREF, IPV6_EXTRACT_PREF(rt6_flags))) goto nla_put_failure; -- 2.43.0

