Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5894548imb; Fri, 8 Mar 2019 04:58:30 -0800 (PST) X-Google-Smtp-Source: APXvYqxJx8FPMJg9FNMEryF5NQkOki8PLRMntbU/6QkSvsQqVkjK5vm12C7pgKf06ecPB7bzbK0y X-Received: by 2002:a63:d158:: with SMTP id c24mr16342183pgj.34.1552049910427; Fri, 08 Mar 2019 04:58:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552049910; cv=none; d=google.com; s=arc-20160816; b=DS+TvwcjyRaJ4YmSY8q/ClYTvqh/MrJTp5Jd1Fv7kLyCNWKpfeTQ8Ksr+Pzb6HA3U0 810MKxU3zy6KN6tP/2NYYxPm+Tr1uT6p88yk2ouuihtPB2JCeDY5ueQl6iMO34XOGZSg bl4EbbStQ1xvW815UrMJIybs+ZU5OW+mEehMXZhbVd7/fcE3BXJ+VA9bNT0GnRHMpdvp klItiOcodDKSb5BjAWJVlbXUVtuXDpZlg6Jo6b8AeTcHtToV9dia1ZSy+hWtCqQWuxUk fwXmPsgqzSgCBeC5ilGfmj2yAmfEbaSqPPpONa2LbvWSv9sUpmeCDbpsbXNbHpAYur8M nQzg== 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=ttkWJtCsYj9/RZmCZHshLBJwFzlo903lBLrYlwkRHGs=; b=O8Yl7ZHoVZYDVLBLzbePMZkxyDdoC2u8FZKuiMuujcAaXF2xVS+4o73Tsrp8jk8wA0 NJzfh+RYtQxrCEu3giILRghpCB7H4iHSqf6zHw8FWs/YZ3Hk8ftoGLnaczDjlht1mHec 1wFjKy/ZQHBEfKpPpp498aBQ3fda/Vu7Ruj52hTs6GlehxTWpo4g5nn5hr4Pd4DajHOQ nglMdqkDkt/oCnSac7y4JO+F8HVFUr9GC7/qBPb2u4OTJntpOvw+6La9Nw/sblPE9pPf o6zNScNqf/4xDCY8FZCYDkzUlB4NCHj35BqFOj7SI5hASSfX5t/pYuLRdiXQJwxhpqwH rslQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qCJyA11A; 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 z23si6542896pgj.168.2019.03.08.04.58.14; Fri, 08 Mar 2019 04:58:30 -0800 (PST) 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=qCJyA11A; 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 S1727027AbfCHMzv (ORCPT + 99 others); Fri, 8 Mar 2019 07:55:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:60012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727566AbfCHMzu (ORCPT ); Fri, 8 Mar 2019 07:55:50 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 42A212085A; Fri, 8 Mar 2019 12:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552049749; bh=cnKZtL8E7iRQyAhW45qK/c/VVQ878C2wwQ/Aekkm9NE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qCJyA11Aqkn9U3fk1ipuPJCSFuytG0sDlBZWRqxJTL1pkjeQ06N7EpBkP+EQQlSPG wu4lwSSYt8C5EWUPGmXXGeUjfR2fEz/ESpf4+RCLTG8aJ91uOz2OiWmDdHkmGYg6+h TJD8eV6yhMJsf7DExVHieH0Zi4Fe5D2PWMxGwCuA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Ahern , "David S. Miller" Subject: [PATCH 4.20 52/76] ipv6: Return error for RTA_VIA attribute Date: Fri, 8 Mar 2019 13:50:04 +0100 Message-Id: <20190308124916.650301498@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308124914.789210760@linuxfoundation.org> References: <20190308124914.789210760@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Ahern [ Upstream commit e3818541b49fb88650ba339d33cc53e4095da5b3 ] IPv6 currently does not support nexthops outside of the AF_INET6 family. Specifically, it does not handle RTA_VIA attribute. If it is passed in a route add request, the actual route added only uses the device which is clearly not what the user intended: $ ip -6 ro add 2001:db8:2::/64 via inet 172.16.1.1 dev eth0 $ ip ro ls ... 2001:db8:2::/64 dev eth0 metric 1024 pref medium Catch this and fail the route add: $ ip -6 ro add 2001:db8:2::/64 via inet 172.16.1.1 dev eth0 Error: IPv6 does not support RTA_VIA attribute. Fixes: 03c0566542f4c ("mpls: Netlink commands to add, remove, and dump routes") Signed-off-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/route.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -4163,6 +4163,10 @@ static int rtm_to_fib6_config(struct sk_ cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]); cfg->fc_flags |= RTF_GATEWAY; } + if (tb[RTA_VIA]) { + NL_SET_ERR_MSG(extack, "IPv6 does not support RTA_VIA attribute"); + goto errout; + } if (tb[RTA_DST]) { int plen = (rtm->rtm_dst_len + 7) >> 3;