diff options
author | Paolo Abeni <pabeni@redhat.com> | 2016-01-29 06:30:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-29 23:31:26 -0500 |
commit | 1cdda91871470f15e79375991bd2eddc6e86ddb1 (patch) | |
tree | 1b85e50c353077ae7e06e932cbc456c10972227b /net | |
parent | 6f21c96a78b835259546d8f3fb4edff0f651d478 (diff) |
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@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/datagram.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 517c55b01ba8..428162155280 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -162,6 +162,9 @@ ipv4_connected: | |||
162 | fl6.fl6_dport = inet->inet_dport; | 162 | fl6.fl6_dport = inet->inet_dport; |
163 | fl6.fl6_sport = inet->inet_sport; | 163 | fl6.fl6_sport = inet->inet_sport; |
164 | 164 | ||
165 | if (!fl6.flowi6_oif) | ||
166 | fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; | ||
167 | |||
165 | if (!fl6.flowi6_oif && (addr_type&IPV6_ADDR_MULTICAST)) | 168 | if (!fl6.flowi6_oif && (addr_type&IPV6_ADDR_MULTICAST)) |
166 | fl6.flowi6_oif = np->mcast_oif; | 169 | fl6.flowi6_oif = np->mcast_oif; |
167 | 170 | ||