linux/net
Joel Sing 9fc3bbb4a7 ipv4/route.c: respect prefsrc for local routes
The preferred source address is currently ignored for local routes,
which results in all local connections having a src address that is the
same as the local dst address. Fix this by respecting the preferred source
address when it is provided for local routes.

This bug can be demonstrated as follows:

 # ifconfig dummy0 192.168.0.1
 # ip route show table local | grep local.*dummy0
 local 192.168.0.1 dev dummy0  proto kernel  scope host  src 192.168.0.1
 # ip route change table local local 192.168.0.1 dev dummy0 \
     proto kernel scope host src 127.0.0.1
 # ip route show table local | grep local.*dummy0
 local 192.168.0.1 dev dummy0  proto kernel  scope host  src 127.0.0.1

We now establish a local connection and verify the source IP
address selection:

 # nc -l 192.168.0.1 3128 &
 # nc 192.168.0.1 3128 &
 # netstat -ant | grep 192.168.0.1:3128.*EST
 tcp        0      0 192.168.0.1:3128        192.168.0.1:33228 ESTABLISHED
 tcp        0      0 192.168.0.1:33228       192.168.0.1:3128  ESTABLISHED

Signed-off-by: Joel Sing <jsing@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-04 11:35:12 -08:00
..
9p
802
8021q
appletalk
atm
ax25
bluetooth
bridge bridge: stp: ensure mac header is set 2011-01-03 12:09:33 -08:00
caif
can CAN: Use inode instead of kernel address for /proc file 2010-12-31 11:13:27 -08:00
ceph
core Revert "ipv4: Allow configuring subnets as local addresses" 2010-12-23 12:03:57 -08:00
dcb
dccp
decnet
dns_resolver
dsa
econet
ethernet
ieee802154
ipv4 ipv4/route.c: respect prefsrc for local routes 2011-01-04 11:35:12 -08:00
ipv6
ipx
irda Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2010-12-26 12:06:56 -08:00
iucv
key
l2tp
lapb
llc
mac80211 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2010-12-26 12:06:56 -08:00
netfilter
netlabel
netlink
netrom
packet
phonet
rds
rfkill
rose
rxrpc
sched
sctp
sunrpc
tipc
unix
wanrouter
wimax
wireless
x25
xfrm
compat.c
Kconfig
Makefile
nonet.c
socket.c
sysctl_net.c
TUNABLE