Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c22a133a authored by David Ahern's avatar David Ahern Committed by David S. Miller
Browse files

rtnetlink: skip metrics loop for dst_default_metrics



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: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4191faa2
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -751,6 +751,10 @@ int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics)
	struct nlattr *mx;
	struct nlattr *mx;
	int i, valid = 0;
	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);
	mx = nla_nest_start_noflag(skb, RTA_METRICS);
	if (mx == NULL)
	if (mx == NULL)
		return -ENOBUFS;
		return -ENOBUFS;