[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <f5da7436f794a624fd050130953de7a5d85b31ff.1454066754.git.pabeni@redhat.com>
Date: Fri, 29 Jan 2016 12:30:20 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
David Ahern <dsa@...ulusnetworks.com>,
Hajime Tazaki <thehajime@...il.com>, lucien.xin@...il.com,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
Hannes Frederic Sowa <hannes@...essinduktion.org>,
YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>
Subject: [PATCH net v2 2/2] ipv6/udp: use sticky pktinfo egress ifindex on connect()
Currently, the egress interface index specified via IPV6_PKTINFO
is ignored by __ip6_datagram_connect(), so that RFC 3542 section 6.7
can be subverted when the user space application calls connect()
before sendmsg().
Fix it by initializing properly flowi6_oif in connect() before
performing the route lookup.
Signed-off-by: Paolo Abeni <pabeni@...hat.com>
---
net/ipv6/datagram.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 517c55b..4281621 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -162,6 +162,9 @@ ipv4_connected:
fl6.fl6_dport = inet->inet_dport;
fl6.fl6_sport = inet->inet_sport;
+ if (!fl6.flowi6_oif)
+ fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;
+
if (!fl6.flowi6_oif && (addr_type&IPV6_ADDR_MULTICAST))
fl6.flowi6_oif = np->mcast_oif;
--
1.8.3.1
Powered by blists - more mailing lists