]> git.baikalelectronics.ru Git - kernel.git/commit
net: Fix the arp error in some cases
authorguodeqing <geffrey.guo@huawei.com>
Wed, 17 Jun 2020 02:07:16 +0000 (10:07 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Jun 2020 03:21:51 +0000 (20:21 -0700)
commit57213e81e4be9b950e4d9f588116746fdd8ef4fb
tree2dea2051db8a200da22c3431fccdccbd318589b3
parent912b7d74f7e6f8004cc3d4a0cb26736110b2e234
net: Fix the arp error in some cases

ie.,
$ ifconfig eth0 6.6.6.6 netmask 255.255.255.0

$ ip rule add from 6.6.6.6 table 6666

$ ip route add 9.9.9.9 via 6.6.6.6

$ ping -I 6.6.6.6 9.9.9.9
PING 9.9.9.9 (9.9.9.9) from 6.6.6.6 : 56(84) bytes of data.

3 packets transmitted, 0 received, 100% packet loss, time 2079ms

$ arp
Address     HWtype  HWaddress           Flags Mask            Iface
6.6.6.6             (incomplete)                              eth0

The arp request address is error, this is because fib_table_lookup in
fib_check_nh lookup the destnation 9.9.9.9 nexthop, the scope of
the fib result is RT_SCOPE_LINK,the correct scope is RT_SCOPE_HOST.
Here I add a check of whether this is RT_TABLE_MAIN to solve this problem.

Fixes: 2380f43c75ca ("net: Use passed in table for nexthop lookups")
Signed-off-by: guodeqing <geffrey.guo@huawei.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/fib_semantics.c