diff options
author | Julian Anastasov <ja@ssi.bg> | 2011-08-07 09:16:09 +0000 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-11-20 17:18:34 +0100 |
commit | d6a0c2cd7bb847a071f5cb34dcd8e852b0ea6090 (patch) | |
tree | daab58c17ce2cd244faa2c2c1c4327e9ede3a625 /net/ipv4 | |
parent | 426ae89532eaba233c2a46795f5d480081934e97 (diff) | |
download | kernel_samsung_tuna-d6a0c2cd7bb847a071f5cb34dcd8e852b0ea6090.zip kernel_samsung_tuna-d6a0c2cd7bb847a071f5cb34dcd8e852b0ea6090.tar.gz kernel_samsung_tuna-d6a0c2cd7bb847a071f5cb34dcd8e852b0ea6090.tar.bz2 |
ipv4: route non-local sources for raw socket
The raw sockets can provide source address for
routing but their privileges are not considered. We
can provide non-local source address, make sure the
FLOWI_FLAG_ANYSRC flag is set if socket has privileges
for this, i.e. based on hdrincl (IP_HDRINCL) and
transparent flags.
Change-Id: I136b161c584deac3885efbf217e959e1a829fc1d
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/raw.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 3d8bb18..799125f 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -565,7 +565,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE, inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol, - FLOWI_FLAG_CAN_SLEEP, daddr, saddr, 0, 0); + inet_sk_flowi_flags(sk) | FLOWI_FLAG_CAN_SLEEP, + daddr, saddr, 0, 0); if (!inet->hdrincl) { err = raw_probe_proto_opt(&fl4, msg); |