diff options
author | Phil Sutter <phil@nwl.cc> | 2016-08-23 13:14:31 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-23 17:09:28 -0700 |
commit | f8edcd127b5fa2a82bec22b204b434dc363011b2 (patch) | |
tree | 4c99280ad51a601f0c103ce42a60ade57e724402 /net/core/rtnetlink.c | |
parent | e7b48a32dc5db48ca14e6472b920102c7e53f5aa (diff) | |
download | linux-f8edcd127b5fa2a82bec22b204b434dc363011b2.tar.gz linux-f8edcd127b5fa2a82bec22b204b434dc363011b2.tar.bz2 linux-f8edcd127b5fa2a82bec22b204b434dc363011b2.zip |
net: rtnetlink: Don't export empty RTAX_FEATURES
Since the features bit field has bits for internal only use as well, it
may happen that the kernel exports RTAX_FEATURES attribute with zero
value which is pointless.
Fix this by making sure the attribute is added only if the exported
value is non-zero.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 189cc78c77eb..318fc5231b2b 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -704,6 +704,8 @@ int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics) } else if (i == RTAX_FEATURES - 1) { u32 user_features = metrics[i] & RTAX_FEATURE_MASK; + if (!user_features) + continue; BUILD_BUG_ON(RTAX_FEATURE_MASK & DST_FEATURE_MASK); if (nla_put_u32(skb, i + 1, user_features)) goto nla_put_failure; |