diff options
author | Jiri Pirko <jiri@resnulli.us> | 2014-10-13 16:34:10 +0200 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-11-05 10:03:20 +0100 |
commit | bc9b1233fe48f27c2325de5ccc584c4b2a0ce12c (patch) | |
tree | 87e018878b1d8040adb536771300b9b32823939d /net | |
parent | 7fccdb578ab6a71fc23690f772d37e7f0050a6bf (diff) | |
download | lwn-bc9b1233fe48f27c2325de5ccc584c4b2a0ce12c.tar.gz lwn-bc9b1233fe48f27c2325de5ccc584c4b2a0ce12c.zip |
ipv4: fix nexthop attlen check in fib_nh_match
[ Upstream commit f76936d07c4eeb36d8dbb64ebd30ab46ff85d9f7 ]
fib_nh_match does not match nexthops correctly. Example:
ip route add 172.16.10/24 nexthop via 192.168.122.12 dev eth0 \
nexthop via 192.168.122.13 dev eth0
ip route del 172.16.10/24 nexthop via 192.168.122.14 dev eth0 \
nexthop via 192.168.122.15 dev eth0
Del command is successful and route is removed. After this patch
applied, the route is correctly matched and result is:
RTNETLINK answers: No such process
Please consider this for stable trees as well.
Fixes: 4e902c57417c4 ("[IPv4]: FIB configuration using struct fib_config")
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/fib_semantics.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 9f1014ab86c6..ec12b169931b 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -534,7 +534,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) return 1; attrlen = rtnh_attrlen(rtnh); - if (attrlen < 0) { + if (attrlen > 0) { struct nlattr *nla, *attrs = rtnh_attrs(rtnh); nla = nla_find(attrs, attrlen, RTA_GATEWAY); |