diff options
author | Joel Sing <jsing@google.com> | 2011-01-03 20:24:20 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-04 11:35:12 -0800 |
commit | 9fc3bbb4a752f108cf096d96640f3b548bbbce6c (patch) | |
tree | ce1f8d7a53c2a93a42e64b4148587cff0132ba6d /security | |
parent | e6f26129ebbb0071016e2526036f42036ccf30e1 (diff) | |
download | linux-3.10-9fc3bbb4a752f108cf096d96640f3b548bbbce6c.tar.gz linux-3.10-9fc3bbb4a752f108cf096d96640f3b548bbbce6c.tar.bz2 linux-3.10-9fc3bbb4a752f108cf096d96640f3b548bbbce6c.zip |
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>
Diffstat (limited to 'security')
0 files changed, 0 insertions, 0 deletions