Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932071AbcCAXyn (ORCPT ); Tue, 1 Mar 2016 18:54:43 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:34623 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755334AbcCAXyf (ORCPT ); Tue, 1 Mar 2016 18:54:35 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=kyOD57gmkYSpdpOTpIqvmmt6qZv5Szz0NlGYh8biH4bFzDb2N/Xo4tsqXNtbI8i00lSHAz9ZNKJc v4xIGubialDmSNZsAna7YEQbQG4fBZotyjoiWE6gE4jUoAGxaMgdMLmwRTkccd7UQqnXR3TkX36r 25aLAjS4LWg9pvgwtXY=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 016/342] ipv6/udp: use sticky pktinfo egress ifindex on connect() X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Paolo Abeni , Hannes Frederic Sowa , "David S. Miller" Message-Id: <20160301234528.502861091@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.6d7d097754014fd7a5a0c60578c5e821 X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:53:48 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1134 Lines: 34 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paolo Abeni [ 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 Acked-by: Hannes Frederic Sowa Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/datagram.c | 3 +++ 1 file changed, 3 insertions(+) --- 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;