Commit 79876874ce20d37ecdc7f481ebf142466999152f
Committed by
David S. Miller
1 parent
1668e010cb
Exists in
master
and in
39 other branches
ipv4: Conditionally enable transparent flow flag when connecting
Set FLOWI_FLAG_ANYSRC in flowi->flags if the socket has the transparent socket option set. This way we selectively enable certain connections with non-local source addresses to be routed. Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff
include/net/route.h
... | ... | @@ -27,7 +27,7 @@ |
27 | 27 | #include <net/dst.h> |
28 | 28 | #include <net/inetpeer.h> |
29 | 29 | #include <net/flow.h> |
30 | -#include <net/sock.h> | |
30 | +#include <net/inet_sock.h> | |
31 | 31 | #include <linux/in_route.h> |
32 | 32 | #include <linux/rtnetlink.h> |
33 | 33 | #include <linux/route.h> |
... | ... | @@ -161,6 +161,10 @@ |
161 | 161 | |
162 | 162 | int err; |
163 | 163 | struct net *net = sock_net(sk); |
164 | + | |
165 | + if (inet_sk(sk)->transparent) | |
166 | + fl.flags |= FLOWI_FLAG_ANYSRC; | |
167 | + | |
164 | 168 | if (!dst || !src) { |
165 | 169 | err = __ip_route_output_key(net, rp, &fl); |
166 | 170 | if (err) |