linux_dsm_epyc7002/net
David Ahern 839da4d989 net: ipv4: set orig_oif based on fib result for local traffic
Attempts to connect to a local address with a socket bound
to a device with the local address hangs if there is no listener:

  $ ip addr sh dev eth1
  3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 02:e0:f9:1c:00:37 brd ff:ff:ff:ff:ff:ff
    inet 10.100.1.4/24 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 2001:db8:1::4/120 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::e0:f9ff:fe1c:37/64 scope link
       valid_lft forever preferred_lft forever

  $ vrf-test -I eth1 -r 10.100.1.4
  <hangs when there is no server>

(don't let the command name fool you; vrf-test works without vrfs.)

The problem is that the original intended device, eth1 in this case, is
lost when the tcp reset is sent, so the socket lookup does not find a
match for the reset and the connect attempt hangs. Fix by adjusting
orig_oif for local traffic to the device from the fib lookup result.

With this patch you get the more user friendly:
  $ vrf-test -I eth1 -r 10.100.1.4
  connect failed: 111: Connection refused

orig_oif is saved to the newly created rtable as rt_iif and when set
it is used as the dif for socket lookups. It is set based on flowi4_oif
passed in to ip_route_output_key_hash_rcu and will be set to either
the loopback device, an l3mdev device, nothing (flowi4_oif = 0 which
is the case in the example above) or a netdev index depending on the
lookup path. In each case, resetting orig_oif to the device in the fib
result for the RTN_LOCAL case allows the actual device to be preserved
as the skb tx and rx is done over the loopback or VRF device.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-11 14:40:39 -07:00
..
6lowpan
9p
802
8021q
appletalk
atm net: atm: make atmdev_ops const 2017-08-09 22:43:50 -07:00
ax25
batman-adv Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-08-09 16:28:45 -07:00
bluetooth
bpf
bridge rtnetlink: make rtnl_register accept a flags parameter 2017-08-09 16:57:38 -07:00
caif
can rtnetlink: make rtnl_register accept a flags parameter 2017-08-09 16:57:38 -07:00
ceph
core rtnetlink: fallback to UNSPEC if current family has no doit callback 2017-08-10 09:50:22 -07:00
dcb rtnetlink: make rtnl_register accept a flags parameter 2017-08-09 16:57:38 -07:00
dccp net: ipv6: add second dif to inet6 socket lookups 2017-08-07 11:39:22 -07:00
decnet rtnetlink: make rtnl_register accept a flags parameter 2017-08-09 16:57:38 -07:00
dns_resolver
dsa net: sched: use newly added classid identity helpers 2017-08-11 13:47:01 -07:00
ethernet
hsr
ieee802154
ife
ipv4 net: ipv4: set orig_oif based on fib result for local traffic 2017-08-11 14:40:39 -07:00
ipv6 udp: consistently apply ufo or fragmentation 2017-08-10 09:52:12 -07:00
ipx
irda
iucv
kcm
key
l2tp
l3mdev
lapb
llc
mac80211
mac802154
mpls rtnetlink: make rtnl_register accept a flags parameter 2017-08-09 16:57:38 -07:00
ncsi
netfilter net: ipv6: add second dif to inet6 socket lookups 2017-08-07 11:39:22 -07:00
netlabel
netlink
netrom
nfc
openvswitch
packet Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-08-10 12:11:16 -07:00
phonet rtnetlink: make rtnl_register accept a flags parameter 2017-08-09 16:57:38 -07:00
psample
qrtr rtnetlink: make rtnl_register accept a flags parameter 2017-08-09 16:57:38 -07:00
rds Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-08-09 16:28:45 -07:00
rfkill
rose
rxrpc
sched net: sched: remove cops->tcf_cl_offload 2017-08-11 13:47:01 -07:00
sctp sctp: fix some indents in sm_make_chunk.c 2017-08-11 10:02:44 -07:00
smc
strparser
sunrpc
switchdev net: switchdev: Remove bridge bypass support from switchdev 2017-08-07 14:48:48 -07:00
tipc tipc: remove premature ESTABLISH FSM event at link synchronization 2017-08-09 22:38:06 -07:00
tls
unix
vmw_vsock
wimax
wireless
x25
xfrm xfrm: check that cached bundle is still valid 2017-08-07 14:25:39 -07:00
compat.c
Kconfig
Makefile
socket.c
sysctl_net.c