Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC7A1C433F5 for ; Mon, 15 Nov 2021 18:11:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6E4F633CC for ; Mon, 15 Nov 2021 18:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239536AbhKOSOj (ORCPT ); Mon, 15 Nov 2021 13:14:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:53142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237989AbhKOR2d (ORCPT ); Mon, 15 Nov 2021 12:28:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AFBA36328A; Mon, 15 Nov 2021 17:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1636996745; bh=X4A6SHqew7FXLYw05v9NsGSNgp76ZC23EUqzkZWpo8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kOLjWWyBXtl0ds5i5JR7iRQlsJ6G/06IuAQUn34OI064iTqRpIFnlFiKyRCaIxJyM lyajjapxFsC9WHkAz/pSOnFVa3ZedSXWGMTuTzifYvHD+Offiw7G0nBDpD7TL5y4kp DoEaAvgVB7x7vUz5f2q38IcYDjLrmKG/DF1WQu3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , David Ahern , Willem de Bruijn , "David S. Miller" , Sasha Levin , Xintong Hu Subject: [PATCH 5.4 253/355] udp6: allow SO_MARK ctrl msg to affect routing Date: Mon, 15 Nov 2021 18:02:57 +0100 Message-Id: <20211115165321.928988019@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211115165313.549179499@linuxfoundation.org> References: <20211115165313.549179499@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski [ Upstream commit 42dcfd850e514b229d616a53dec06d0f2533217c ] Commit c6af0c227a22 ("ip: support SO_MARK cmsg") added propagation of SO_MARK from cmsg to skb->mark. For IPv4 and raw sockets the mark also affects route lookup, but in case of IPv6 the flow info is initialized before cmsg is parsed. Fixes: c6af0c227a22 ("ip: support SO_MARK cmsg") Reported-and-tested-by: Xintong Hu Signed-off-by: Jakub Kicinski Reviewed-by: David Ahern Reviewed-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/udp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 0f57c682afdd8..818fc99756256 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -1363,7 +1363,6 @@ do_udp_sendmsg: if (!fl6.flowi6_oif) fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; - fl6.flowi6_mark = ipc6.sockc.mark; fl6.flowi6_uid = sk->sk_uid; if (msg->msg_controllen) { @@ -1399,6 +1398,7 @@ do_udp_sendmsg: ipc6.opt = opt; fl6.flowi6_proto = sk->sk_protocol; + fl6.flowi6_mark = ipc6.sockc.mark; fl6.daddr = *daddr; if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr)) fl6.saddr = np->saddr; -- 2.33.0