Skip to content

Commit

Permalink
ipv4: Conditionally enable transparent flow flag when connecting
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
KOVACS Krisztian authored and David S. Miller committed Oct 1, 2008
1 parent 1668e01 commit 7987687
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/net/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <net/dst.h>
#include <net/inetpeer.h>
#include <net/flow.h>
#include <net/sock.h>
#include <net/inet_sock.h>
#include <linux/in_route.h>
#include <linux/rtnetlink.h>
#include <linux/route.h>
Expand Down Expand Up @@ -161,6 +161,10 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,

int err;
struct net *net = sock_net(sk);

if (inet_sk(sk)->transparent)
fl.flags |= FLOWI_FLAG_ANYSRC;

if (!dst || !src) {
err = __ip_route_output_key(net, rp, &fl);
if (err)
Expand Down

0 comments on commit 7987687

Please sign in to comment.