Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1925570imm; Thu, 24 May 2018 03:02:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoK4EEfkNU86LCZuOJcm4OUbjK1TW4ihN6d+HecOhP+rFVM6wZqJikqMGbp5C7MkxUR/ftM X-Received: by 2002:a65:4cc7:: with SMTP id n7-v6mr5371568pgt.354.1527156168953; Thu, 24 May 2018 03:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156168; cv=none; d=google.com; s=arc-20160816; b=KV/0/9FR3AvYADl7n2xjSX6pftUEbEdiVePESdeXH/fTUpRxoPmZxsWL9Gdj7Tycvl WIi/+L4GMdM45+8Zt/ozZoD0bDeASGG0LjPoPUK61eOdkHHSkBS8bAGSNW+RD3kob4gL qeUVQmQT+uwfmmB4bUPpL7WIecI26oOscEALNb/EAK3cUZEPkmEa9UaQOK+Ju3+QYsfq X7xhrRsffiY5+bhEHn5SzbUsA6TS8w+x4uMGUfVYN6R5+Fw0lbKos70g6lpZk7gkPirx C2k/qVtR9Oyi5Xus3e177WXrOmKMIUF68KNGv0iYNguGgidwikFL4mYiq4C1iRmQmcFo wmDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=rmhwVvYWFfZVX9C7XdKkjuoZMJon6dGh5BQorYm8Ovc=; b=T1OwSQx6jFBIGpWxuQ0EN4nxb1jNySxK4bkmCo6ANmuRVSunv8xB7U4qXl+T0WJ4us cDHHPA1tdMfrJE9MtfJNChwnlpoG5GbftcBsrVjODfFDnuAqbZwN3Slf6rIFzV0ojsn5 KtGpou2XU0Bbo2FfhXfIXaC7YJCsJ+T4ATeYqZasqKn1eWA6xfbwfQV7Wq6bFqcN5tuv Y/oMw626GP8BPW1tE07s4h/cPK3Vvjarork5Y4AWbFW0MsNehV2Ey9ynydPS11Hh4cHy R+9K5wJmc0FeRfVE2kRnDo+xPB2p2mWQFaDFDHZTVykpGCF1RHK/t8OuV4HzLa7vdT7+ c6VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JsUNUHs1; 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 g67-v6si21560769pfe.4.2018.05.24.03.02.34; Thu, 24 May 2018 03:02:48 -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=JsUNUHs1; 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 S1030985AbeEXKBl (ORCPT + 99 others); Thu, 24 May 2018 06:01:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:47364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030712AbeEXKBe (ORCPT ); Thu, 24 May 2018 06:01:34 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 3D1EA20890; Thu, 24 May 2018 10:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156093; bh=UndFavkWx2tW4nSFXMNDEf2SlW5EDf8riOPUHU5L/50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JsUNUHs1kh960vf9v8q1CLc/9YIfifxFN3uzVvKRBxAcRnNnwALLtj1HPqxvuyEv/ QZKukmpCm/gsBb5l6J7IrdZn5ywgJk5BW6aA12vF8qzKGyq0bUY/FTjDl0SlKs/YSx gZCSAzuK9ooxPjF3qHF5s8KthQvtZ9XByurCHXN8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Petr Machata , William Tu , "David S. Miller" Subject: [PATCH 4.16 026/161] net: ip6_gre: Split up ip6gre_newlink() Date: Thu, 24 May 2018 11:37:31 +0200 Message-Id: <20180524093021.461588013@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Petr Machata [ Upstream commit 7fa38a7c852ec99e3a7fc375eb2c21c50c2e46b8 ] Extract from ip6gre_newlink() a reusable function ip6gre_newlink_common(). The ip6gre_tnl_link_config() call needs to be made customizable for ERSPAN, thus reorder it with calls to ip6_tnl_change_mtu() and dev_hold(), and extract the whole tail to the caller, ip6gre_newlink(). Thus enable an ERSPAN-specific _newlink() function without a lot of duplicity. Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support") Signed-off-by: Petr Machata Acked-by: William Tu Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_gre.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1848,9 +1848,9 @@ static bool ip6gre_netlink_encap_parms(s return ret; } -static int ip6gre_newlink(struct net *src_net, struct net_device *dev, - struct nlattr *tb[], struct nlattr *data[], - struct netlink_ext_ack *extack) +static int ip6gre_newlink_common(struct net *src_net, struct net_device *dev, + struct nlattr *tb[], struct nlattr *data[], + struct netlink_ext_ack *extack) { struct ip6_tnl *nt; struct net *net = dev_net(dev); @@ -1887,18 +1887,30 @@ static int ip6gre_newlink(struct net *sr if (err) goto out; - ip6gre_tnl_link_config(nt, !tb[IFLA_MTU]); - if (tb[IFLA_MTU]) ip6_tnl_change_mtu(dev, nla_get_u32(tb[IFLA_MTU])); dev_hold(dev); - ip6gre_tunnel_link(ign, nt); out: return err; } +static int ip6gre_newlink(struct net *src_net, struct net_device *dev, + struct nlattr *tb[], struct nlattr *data[], + struct netlink_ext_ack *extack) +{ + int err = ip6gre_newlink_common(src_net, dev, tb, data, extack); + struct ip6_tnl *nt = netdev_priv(dev); + struct net *net = dev_net(dev); + + if (!err) { + ip6gre_tnl_link_config(nt, !tb[IFLA_MTU]); + ip6gre_tunnel_link(net_generic(net, ip6gre_net_id), nt); + } + return err; +} + static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[], struct nlattr *data[], struct netlink_ext_ack *extack)