summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap/linus/0064-ipv4-route.c-respect-prefsrc-for-local-routes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap/linus/0064-ipv4-route.c-respect-prefsrc-for-local-routes.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap/linus/0064-ipv4-route.c-respect-prefsrc-for-local-routes.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap/linus/0064-ipv4-route.c-respect-prefsrc-for-local-routes.patch b/extras/recipes-kernel/linux/linux-omap/linus/0064-ipv4-route.c-respect-prefsrc-for-local-routes.patch
new file mode 100644
index 00000000..56e00911
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap/linus/0064-ipv4-route.c-respect-prefsrc-for-local-routes.patch
@@ -0,0 +1,57 @@
1From 1e3d23ed2eae8473568b34fdc323d2fec679616b Mon Sep 17 00:00:00 2001
2From: Joel Sing <jsing@google.com>
3Date: Mon, 3 Jan 2011 20:24:20 +0000
4Subject: [PATCH 64/65] ipv4/route.c: respect prefsrc for local routes
5
6The preferred source address is currently ignored for local routes,
7which results in all local connections having a src address that is the
8same as the local dst address. Fix this by respecting the preferred source
9address when it is provided for local routes.
10
11This bug can be demonstrated as follows:
12
13 # ifconfig dummy0 192.168.0.1
14 # ip route show table local | grep local.*dummy0
15 local 192.168.0.1 dev dummy0 proto kernel scope host src 192.168.0.1
16 # ip route change table local local 192.168.0.1 dev dummy0 \
17 proto kernel scope host src 127.0.0.1
18 # ip route show table local | grep local.*dummy0
19 local 192.168.0.1 dev dummy0 proto kernel scope host src 127.0.0.1
20
21We now establish a local connection and verify the source IP
22address selection:
23
24 # nc -l 192.168.0.1 3128 &
25 # nc 192.168.0.1 3128 &
26 # netstat -ant | grep 192.168.0.1:3128.*EST
27 tcp 0 0 192.168.0.1:3128 192.168.0.1:33228 ESTABLISHED
28 tcp 0 0 192.168.0.1:33228 192.168.0.1:3128 ESTABLISHED
29
30Signed-off-by: Joel Sing <jsing@google.com>
31Signed-off-by: David S. Miller <davem@davemloft.net>
32---
33 net/ipv4/route.c | 8 ++++++--
34 1 files changed, 6 insertions(+), 2 deletions(-)
35
36diff --git a/net/ipv4/route.c b/net/ipv4/route.c
37index df948b0..93bfd95 100644
38--- a/net/ipv4/route.c
39+++ b/net/ipv4/route.c
40@@ -2649,8 +2649,12 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
41 }
42
43 if (res.type == RTN_LOCAL) {
44- if (!fl.fl4_src)
45- fl.fl4_src = fl.fl4_dst;
46+ if (!fl.fl4_src) {
47+ if (res.fi->fib_prefsrc)
48+ fl.fl4_src = res.fi->fib_prefsrc;
49+ else
50+ fl.fl4_src = fl.fl4_dst;
51+ }
52 dev_out = net->loopback_dev;
53 fl.oif = dev_out->ifindex;
54 res.fi = NULL;
55--
561.6.6.1
57