Commit 79876874 authored by KOVACS Krisztian's avatar KOVACS Krisztian Committed by David S. Miller

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: default avatarKOVACS Krisztian <hidden@sch.bme.hu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1668e010
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <net/dst.h> #include <net/dst.h>
#include <net/inetpeer.h> #include <net/inetpeer.h>
#include <net/flow.h> #include <net/flow.h>
#include <net/sock.h> #include <net/inet_sock.h>
#include <linux/in_route.h> #include <linux/in_route.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/route.h> #include <linux/route.h>
...@@ -161,6 +161,10 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, ...@@ -161,6 +161,10 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
int err; int err;
struct net *net = sock_net(sk); struct net *net = sock_net(sk);
if (inet_sk(sk)->transparent)
fl.flags |= FLOWI_FLAG_ANYSRC;
if (!dst || !src) { if (!dst || !src) {
err = __ip_route_output_key(net, rp, &fl); err = __ip_route_output_key(net, rp, &fl);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment