From patchwork Tue Mar 3 17:41:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 229907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2EB8C3F2D8 for ; Tue, 3 Mar 2020 18:09:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C26EA208C3 for ; Tue, 3 Mar 2020 18:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258959; bh=pksQzQrc2MQjwThxrNUTZcxbQzloIIfnOaEIB9Dr76w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=W1gq592sqXau6uP3p/8xsMqNyDIgIUSHh2i9xSvJtICbqj79XdpC4NKRzPDVXYu2o jAcrKSTdfKxwmLl1x9LvkMCpDl55YlplvMJwpVcdzp8jEclUw9GpXsqeLZXnHIYxWT lXBYCFRo1SrwktlZjetMqS2iEFIbkKmlXVSc5am4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731883AbgCCRwv (ORCPT ); Tue, 3 Mar 2020 12:52:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:33174 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730142AbgCCRwt (ORCPT ); Tue, 3 Mar 2020 12:52:49 -0500 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 5333B21739; Tue, 3 Mar 2020 17:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257967; bh=pksQzQrc2MQjwThxrNUTZcxbQzloIIfnOaEIB9Dr76w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KA3jEvyspSOS6GXQEMieerM7dD2fbDFXTW1MWQGvPm0BWsLtZUkJELxo94IdTNEHd rtcfQJfBNJU1ErIUUCgFfETll1OmGVTIqtNzq8nUTj0/gghy9riHxWc3KjTsFpwtpN mcOG5q9CY4Rg8F3Me0Sqe2nbjUPnwEKPaSbA3a2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Poirier , Michal Kubecek , David Ahern , "David S. Miller" Subject: [PATCH 5.4 021/152] ipv6: Fix nlmsg_flags when splitting a multipath route Date: Tue, 3 Mar 2020 18:41:59 +0100 Message-Id: <20200303174304.880495781@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174302.523080016@linuxfoundation.org> References: <20200303174302.523080016@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Benjamin Poirier [ Upstream commit afecdb376bd81d7e16578f0cfe82a1aec7ae18f3 ] When splitting an RTA_MULTIPATH request into multiple routes and adding the second and later components, we must not simply remove NLM_F_REPLACE but instead replace it by NLM_F_CREATE. Otherwise, it may look like the netlink message was malformed. For example, ip route add 2001:db8::1/128 dev dummy0 ip route change 2001:db8::1/128 nexthop via fe80::30:1 dev dummy0 \ nexthop via fe80::30:2 dev dummy0 results in the following warnings: [ 1035.057019] IPv6: RTM_NEWROUTE with no NLM_F_CREATE or NLM_F_REPLACE [ 1035.057517] IPv6: NLM_F_CREATE should be set when creating new route This patch makes the nlmsg sequence look equivalent for __ip6_ins_rt() to what it would get if the multipath route had been added in multiple netlink operations: ip route add 2001:db8::1/128 dev dummy0 ip route change 2001:db8::1/128 nexthop via fe80::30:1 dev dummy0 ip route append 2001:db8::1/128 nexthop via fe80::30:2 dev dummy0 Fixes: 27596472473a ("ipv6: fix ECMP route replacement") Signed-off-by: Benjamin Poirier Reviewed-by: Michal Kubecek Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/route.c | 1 + 1 file changed, 1 insertion(+) --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5155,6 +5155,7 @@ static int ip6_route_multipath_add(struc */ cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | NLM_F_REPLACE); + cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; nhn++; }