]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rtnetlink: skip metrics loop for dst_default_metrics
authorDavid Ahern <dsahern@gmail.com>
Fri, 21 Jun 2019 23:27:16 +0000 (16:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Jun 2019 20:14:59 +0000 (13:14 -0700)
dst_default_metrics has all of the metrics initialized to 0, so nothing
will be added to the skb in rtnetlink_put_metrics. Avoid the loop if
metrics is from dst_default_metrics.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c

index 8ac81630ab5c86889616375e6b11c7fa2ef2c5d7..1ee6460f82756be6dd797b000c11f29826e2e710 100644 (file)
@@ -751,6 +751,10 @@ int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics)
        struct nlattr *mx;
        int i, valid = 0;
 
+       /* nothing is dumped for dst_default_metrics, so just skip the loop */
+       if (metrics == dst_default_metrics.metrics)
+               return 0;
+
        mx = nla_nest_start_noflag(skb, RTA_METRICS);
        if (mx == NULL)
                return -ENOBUFS;