Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2478665yba; Mon, 15 Apr 2019 12:29:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6cgRtiw/WovUtfOEKHBR7Z679Y1S5OneL5nZAVa5VEEy0tke2jx4wPuO/PQPkcDe18D6q X-Received: by 2002:a63:3185:: with SMTP id x127mr26135771pgx.299.1555356589104; Mon, 15 Apr 2019 12:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555356589; cv=none; d=google.com; s=arc-20160816; b=Zmz7wkIe1RE2LhAhAOnhjvgRvMOxxt/qFARF7IeHD/+//R1ZHmqOEv0M2s77bg3jZZ efZPpTxb/htdvTXnsvn4IMwZmAITRk5VuTZ1ksOXNEYSDIaHlh0R0KC9ck9BWynHhgRv FSOHqGG8zhx+uDaKlbygxGmXOVdb+FLE9zLnFPKgAEmn54H4fWpl2EGJDQrstlnB9P1G gk2C4cAtSW5+0aHkM28uTZ/7YWoKahD3sXZXb9rD7ZuIrM6OZ05073jGYo34whi8Vku1 jCNwSxsH9WSki9APAi8XC1cWPOhA0W+7aWRXjpa9ePX3TwjhcfdclLw22kYnVJPWZoP3 PTPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zZczYz5Wx06aiFQyYsczlYN4efK2iWq6ete02Q9Lxmw=; b=ShHZECdxx8Q7fuZTb2rfAVCm5kJyNaP0ILzrP0LRfGA9QH92pppMdTpiulGcMCtQN9 mfTsJqx1PjoIz3prWm+/Z9eelu25uKb90r6H2m7FAqL5stkyL84Cdf/NRRRivwdpM9/U r/JMxYoWgBrlBdCfB42i94wj9sQaOYzXZeI3i2bm0p0X8+Me8cMX7KRNTtjQdAgOFsyk hYXGU97FtcN2Gf3R3eacI2/c3Qi9Ch9qanAGGu9nP9Z9fu6JdIAvBPVjpzOvXWHC9/SO PlJPiD1xZasMKHtsJEZEWfVmsAxvtjyN41/V5py6qyLmb9NrAoRA2gjj+vAiSGSPJENS hRvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yeDZAgEF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si42745298plr.17.2019.04.15.12.29.32; Mon, 15 Apr 2019 12:29:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yeDZAgEF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729169AbfDOTDP (ORCPT + 99 others); Mon, 15 Apr 2019 15:03:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:34888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728218AbfDOTDO (ORCPT ); Mon, 15 Apr 2019 15:03:14 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C017218A1; Mon, 15 Apr 2019 19:03:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354993; bh=n2gv8qFwiiU6baE8359bj6VPBL/6yHIXjhbw0gn2NlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yeDZAgEF3QCjsUPVBhqpc5CCfI8Pyvfbe1H3JqlCjBRRjLMLq4GXKfA4vmnkyZA2z 1Kj402yf3ln4PFwcHPWU2Sc0fVMljLi6ZExavKFYicei0GLndSWOWQLVF77Jrvmn/z PMROaLZiyyTTrvqtWkEBBhDILYFEbwm7qeVe3LMU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Suryaputra , David Ahern , "David S. Miller" Subject: [PATCH 4.14 27/69] vrf: check accept_source_route on the original netdevice Date: Mon, 15 Apr 2019 20:58:45 +0200 Message-Id: <20190415183731.164528959@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183726.036654568@linuxfoundation.org> References: <20190415183726.036654568@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Suryaputra [ Upstream commit 8c83f2df9c6578ea4c5b940d8238ad8a41b87e9e ] Configuration check to accept source route IP options should be made on the incoming netdevice when the skb->dev is an l3mdev master. The route lookup for the source route next hop also needs the incoming netdev. v2->v3: - Simplify by passing the original netdevice down the stack (per David Ahern). Signed-off-by: Stephen Suryaputra Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/ip.h | 2 +- net/ipv4/ip_input.c | 7 +++---- net/ipv4/ip_options.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) --- a/include/net/ip.h +++ b/include/net/ip.h @@ -603,7 +603,7 @@ int ip_options_get_from_user(struct net unsigned char __user *data, int optlen); void ip_options_undo(struct ip_options *opt); void ip_forward_options(struct sk_buff *skb); -int ip_options_rcv_srr(struct sk_buff *skb); +int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev); /* * Functions provided by ip_sockglue.c --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -259,11 +259,10 @@ int ip_local_deliver(struct sk_buff *skb ip_local_deliver_finish); } -static inline bool ip_rcv_options(struct sk_buff *skb) +static inline bool ip_rcv_options(struct sk_buff *skb, struct net_device *dev) { struct ip_options *opt; const struct iphdr *iph; - struct net_device *dev = skb->dev; /* It looks as overkill, because not all IP options require packet mangling. @@ -299,7 +298,7 @@ static inline bool ip_rcv_options(struct } } - if (ip_options_rcv_srr(skb)) + if (ip_options_rcv_srr(skb, dev)) goto drop; } @@ -362,7 +361,7 @@ static int ip_rcv_finish(struct net *net } #endif - if (iph->ihl > 5 && ip_rcv_options(skb)) + if (iph->ihl > 5 && ip_rcv_options(skb, dev)) goto drop; rt = skb_rtable(skb); --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c @@ -612,7 +612,7 @@ void ip_forward_options(struct sk_buff * } } -int ip_options_rcv_srr(struct sk_buff *skb) +int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev) { struct ip_options *opt = &(IPCB(skb)->opt); int srrspace, srrptr; @@ -647,7 +647,7 @@ int ip_options_rcv_srr(struct sk_buff *s orefdst = skb->_skb_refdst; skb_dst_set(skb, NULL); - err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev); + err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, dev); rt2 = skb_rtable(skb); if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) { skb_dst_drop(skb);