lkml.org 
[lkml]   [2016]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.12 009/116] ipv6/udp: use sticky pktinfo egress ifindex on connect()
    Date
    From: Paolo Abeni <pabeni@redhat.com>

    3.12-stable review patch. If anyone has any objections, please let me know.

    ===============

    [ Upstream commit 1cdda91871470f15e79375991bd2eddc6e86ddb1 ]

    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>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    ---
    net/ipv6/datagram.c | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
    index e24fa8c01dd2..fcfa2885df0e 100644
    --- a/net/ipv6/datagram.c
    +++ b/net/ipv6/datagram.c
    @@ -163,6 +163,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;

    --
    2.7.2
    \
     
     \ /
      Last update: 2016-03-04 11:21    [W:4.148 / U:0.460 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site