Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2446117yba; Mon, 15 Apr 2019 11:48:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrvcgj7yIxJ/5bP1y4UmsxKUTEYqY+Czb6CSuYbrx2S5jEWGU4SlKWoHd30PZUf6A5RT+A X-Received: by 2002:a17:902:b48c:: with SMTP id y12mr75158881plr.280.1555354103069; Mon, 15 Apr 2019 11:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555354103; cv=none; d=google.com; s=arc-20160816; b=Erm922XDVLjk6NM5FIAL59ZdikuO/XcZmjfyC2Fr1DdrCAH6scM5aq0PpbpLvb/vdH cagenK5H+ne5uEBVhyM43f9k8jeCH0XwVtVeji1tp7d/1wAznuXP6r87u6h4jMH0T58c a2zfQvc5fO3T1iDcqp6az/Rqe954VE12LS4omhbikzbnM4XwT79s4bDzRrPT1pU/ZjZF pzx2KllNvy+8W+Ua3/hng71wbUUooOB3T9M0EKYNzLyvwMx69MxfzXrzCanbKBbEPimR 4ppHmkO5n16Y4RFM+WtaWxpxKN1R3xJ6Jzbh/iOYAfBwV2ywtlrvlgZbJU+bCotmVFJR 5D1A== 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=FGRQ0Fz6x/eit03/eXQ5Y+dgOeu9TBAekJ5yyOFDEKI=; b=aMJ0ybHYtU5DfuGy7d9256wIIy4g8QVQQ1jYGV+Pu2h5/6ma6ZVOD93q4NhjX7I0YO P0OtgqcH2g43+wn7vAnsxS8S6pM+NS5TvAzk+VkJfLR0KW6c12zHzNqIvPl43r5i0Z9w pp+RP0kvb4iri+pupYwGeDhCEzbqDi52MDq9/64I1Y7XTHvHmqNMZLGe+YqAIZoDphkl Vam522ZlF0GrEbEnP/ui3Lip1FhFthvlxfba0hrsKdlTtralDnypJdgrWrskq7dlaGCc yIT6Y30tYK+uOi8+ge02f9GU2Cwy26qn3H5Leebf9js/PcR2Xzz0e8VkV4Mc7lPROw4T Jhbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cGbgA4qU; 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 a9si16667480pls.395.2019.04.15.11.48.07; Mon, 15 Apr 2019 11:48:23 -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=cGbgA4qU; 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 S1728811AbfDOSrD (ORCPT + 99 others); Mon, 15 Apr 2019 14:47:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:49964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728786AbfDOSrA (ORCPT ); Mon, 15 Apr 2019 14:47:00 -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 A8296218FC; Mon, 15 Apr 2019 18:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354019; bh=vzlzmWxzTtKvmH/ZOwAKKyMqhwy3x8/6Q1taPPIiVP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cGbgA4qUNs1X2deIUxSPjWwL+y/wIB+/QToX7KcOXqlyd8lOUFkGwedpV7JGYUPi6 1LzlTICn8jU/pouSd8L2F9NzZ+SntmwLsD4UJseheOj9VHPXIatPfyIq5KyxfGDqr/ 2iujeK5c3TVRG3TojeuBw2XslZXV2TSAVst3JcW4= 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.9 56/76] vrf: check accept_source_route on the original netdevice Date: Mon, 15 Apr 2019 20:44:20 +0200 Message-Id: <20190415183724.048353439@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183707.712011689@linuxfoundation.org> References: <20190415183707.712011689@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 @@ -580,7 +580,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; } @@ -361,7 +360,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 @@ -614,7 +614,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; @@ -649,7 +649,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);