From patchwork Thu Aug 27 06:48:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 261864 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=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 94F0FC433E3 for ; Thu, 27 Aug 2020 06:49:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 779E622BED for ; Thu, 27 Aug 2020 06:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727846AbgH0GtR (ORCPT ); Thu, 27 Aug 2020 02:49:17 -0400 Received: from mailrelay116.isp.belgacom.be ([195.238.20.143]:45455 "EHLO mailrelay116.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgH0GtR (ORCPT ); Thu, 27 Aug 2020 02:49:17 -0400 IronPort-SDR: M89Lnt8T9St0Qw5ATvBGJvPHEtvn+73Xd8vWOHksDqFFlqiso6Et0zX/vo2GsZTC9XvHrt9Tgq A0fz7swgYCaYqA+R3Nqf/goZMg3m02qaUOso7ujDNddUJEKeC87kaFzAYMcrwZcHQkD/oySd3W fDBM72plmCLGtN87alyyPxuBd7olpemXCznFZX+hxDcQmRFWv2bmpumzNkxjudgXQmvgeL8KwI cq1WdGCSQW17dm9TkzPIjyaQqPHfpHtmuKtBjaPVj65oBxE6QhPme8lbL3kzsS97VkqAiuL2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EexsI1+Fbnr0ntcBDWAKsxI4TOP0lF2NTCBcZ2ipUqIi6TE0FpimAZ3ARo+zmryB2jm0HplMamBBEFCMHm/id5+YVPcUdCKSPshhnyQAVbigTY8hyB6vuBb5y7V5NOrU/DMXtZb42dhr6O3ciwsy+SZ3D8uDyWGNSX97nmcSSz8xxqB/rlR3yk2f3qhgn/xYCdtT6utHUgggLpHcwfd3C8vxWgPBeNeGVkqmTs+9Dj4vHZoNxIoCalhwHv2uhw7O2i6tDaNTkbGXQNQ376jV93v8PcBwzzDBzqZyoUMhR55hPGenj6g32RLeC4PTkk6a3/KkfK4S9DXO5WGO0SyEsRcLA0ZLTazZUCVHNQPtptPj6xaaQg== X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CCBAD4Vkdf/xCltltfgRCBQ4EeglBfjTiSS5ICCwEBAQEBAQEBATQBAgQBAYRMgjslNwYOAgMBAQEDAgUBAQYBAQEBAQEFBAGGD0WCNyKDRwsBIyOBPxKDJoJYKbMaM4QQgUODRYFCgTiIJ4UZgUE/hF+KNAS2UoJtgwyEXJI2DyGgRJJLoVyBe00gGIMkUBkNnGhCMDcCBgoBAQMJVwE9AZATAQE X-IPAS-Result: A2CCBAD4Vkdf/xCltltfgRCBQ4EeglBfjTiSS5ICCwEBAQEBAQEBATQBAgQBAYRMgjslNwYOAgMBAQEDAgUBAQYBAQEBAQEFBAGGD0WCNyKDRwsBIyOBPxKDJoJYKbMaM4QQgUODRYFCgTiIJ4UZgUE/hF+KNAS2UoJtgwyEXJI2DyGgRJJLoVyBe00gGIMkUBkNnGhCMDcCBgoBAQMJVwE9AZATAQE Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 27 Aug 2020 08:49:13 +0200 From: Fabian Frederick To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabian Frederick Subject: [PATCH 1/7 net-next] vxlan: don't collect metadata if remote checksum is wrong Date: Thu, 27 Aug 2020 08:48:56 +0200 Message-Id: <20200827064856.5580-1-fabf@skynet.be> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org call vxlan_remcsum() before md filling in vxlan_rcv() Signed-off-by: Fabian Frederick --- drivers/net/vxlan.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index b9fefe27e3e89..47c762f7f5b11 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1875,6 +1875,10 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) !net_eq(vxlan->net, dev_net(vxlan->dev)))) goto drop; + if (vs->flags & VXLAN_F_REMCSUM_RX) + if (!vxlan_remcsum(&unparsed, skb, vs->flags)) + goto drop; + if (vxlan_collect_metadata(vs)) { struct metadata_dst *tun_dst; @@ -1891,9 +1895,6 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) memset(md, 0, sizeof(*md)); } - if (vs->flags & VXLAN_F_REMCSUM_RX) - if (!vxlan_remcsum(&unparsed, skb, vs->flags)) - goto drop; if (vs->flags & VXLAN_F_GBP) vxlan_parse_gbp_hdr(&unparsed, skb, vs->flags, md); /* Note that GBP and GPE can never be active together. This is From patchwork Thu Aug 27 06:49:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 261863 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=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 306BCC433E1 for ; Thu, 27 Aug 2020 06:50:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 117F522B4D for ; Thu, 27 Aug 2020 06:50:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727929AbgH0Gt6 (ORCPT ); Thu, 27 Aug 2020 02:49:58 -0400 Received: from mailrelay116.isp.belgacom.be ([195.238.20.143]:45520 "EHLO mailrelay116.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgH0Gtz (ORCPT ); Thu, 27 Aug 2020 02:49:55 -0400 IronPort-SDR: s3e3tqtdf6ANvBmo3WwYoKxkWBArPy7z+/fQimz9HHrwKmDWcz8HAHWwsLpp8X2hpe3GLv2UYO 1UjC/EZK/YC/oM6/0x9DuY1HK52x8sNKbCasrsE+1ffcjM0hTyzAsHFOAB8zIqG/IFMBvX6mVP 5M025jt+yiZuY7cbeUiUvSxF7QZsH+uzpXKsUVXdzUlxn9vRypGwseyMlgrbnY/HGuQmDfjppl LPOjFOq4NoWtfFeTTqSfhcNStdMRipu1Lhww4SldRze3eDnC/7uRLMOb/jnFUr8/5oiC13vbba RnI= X-Belgacom-Dynamic: yes IronPort-PHdr: 9a23:CkolBxJUhJHXqgaLctmcpTZWNBhigK39O0sv0rFitYgXKv/6rarrMEGX3/hxlliBBdydt6sazbOM6Ou5ATBIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfLJ/IA+roQnPuMQajpZuJro+xxDUvnZGZuNayH9yK1mOhRj8/MCw/JBi8yRUpf0s8tNLXLv5caolU7FWFSwqPG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IMDiIj6R+/g6bKZTEn0iDlq2pPfAS1STD3HyA3GyDoAdSXVgjAu3+QXkDax6O/pzC7UTYQur2BA== X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AwBAD4Vkdf/xCltltfgRCBQ4EeglBfjTiSS5AFgX0LAQEBAQEBAQEBNAECBAEBhEyCOyU2Bw4CAwEBAQMCBQEBBgEBAQEBAQUEAYYPRYI3IoNHCwEjI4E/EoMmglgpsxozhBCBQ4NFgUKBOIgnhRmBQT+BEYNOijQEmhmcOYJtgwyEXJI2DyGgRJJLoU0OgXxNIBiDJFAZDY4rF44mQjA3AgYKAQEDCVcBPQGQEwEB X-IPAS-Result: A2AwBAD4Vkdf/xCltltfgRCBQ4EeglBfjTiSS5AFgX0LAQEBAQEBAQEBNAECBAEBhEyCOyU2Bw4CAwEBAQMCBQEBBgEBAQEBAQUEAYYPRYI3IoNHCwEjI4E/EoMmglgpsxozhBCBQ4NFgUKBOIgnhRmBQT+BEYNOijQEmhmcOYJtgwyEXJI2DyGgRJJLoU0OgXxNIBiDJFAZDY4rF44mQjA3AgYKAQEDCVcBPQGQEwEB Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 27 Aug 2020 08:49:54 +0200 From: Fabian Frederick To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabian Frederick Subject: [PATCH 3/7 net-next] vxlan: move encapsulation warning Date: Thu, 27 Aug 2020 08:49:36 +0200 Message-Id: <20200827064936.5682-1-fabf@skynet.be> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org vxlan_xmit_one() was only called from vxlan_xmit() without rdst and info was already tested. Emit warning in that function instead Signed-off-by: Fabian Frederick --- drivers/net/vxlan.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index cc904f003f158..14f903d09c010 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -2650,11 +2650,6 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); label = vxlan->cfg.label; } else { - if (!info) { - WARN_ONCE(1, "%s: Missing encapsulation instructions\n", - dev->name); - goto drop; - } remote_ip.sa.sa_family = ip_tunnel_info_af(info); if (remote_ip.sa.sa_family == AF_INET) { remote_ip.sin.sin_addr.s_addr = info->key.u.ipv4.dst; @@ -2889,6 +2884,10 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) info->mode & IP_TUNNEL_INFO_TX) { vni = tunnel_id_to_key32(info->key.tun_id); } else { + if (!info) + WARN_ONCE(1, "%s: Missing encapsulation instructions\n", + dev->name); + if (info && info->mode & IP_TUNNEL_INFO_TX) vxlan_xmit_one(skb, dev, vni, NULL, false); else From patchwork Thu Aug 27 06:50:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 261862 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=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 2CD78C433DF for ; Thu, 27 Aug 2020 06:50:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 028F2207BC for ; Thu, 27 Aug 2020 06:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727115AbgH0Guk (ORCPT ); Thu, 27 Aug 2020 02:50:40 -0400 Received: from mailrelay116.isp.belgacom.be ([195.238.20.143]:45576 "EHLO mailrelay116.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgH0Guk (ORCPT ); Thu, 27 Aug 2020 02:50:40 -0400 IronPort-SDR: GRLZ7WcFO6WVt6F6tdr/XT/maDaktNshkCXAQttBEndOQMdR+6zw7vGAjgtLKHV1SLTCfuOVv4 9y/XC+5kbFOdmFIs9Ec2IL0k6F+PmTsWvJ7c6pVeY1Kdvtcp8Wm8mMV8s8tQkRNJa+JHdk2MDl L6AAleUCBlg2mhawADrbcgHCxYJEw+WbIibH2yDq/tSZW8q1tv5xym0Jbjufwlugv2aCHIws20 bOlmG0TsCZ1fCU7NRP5rYqOl51BA2C3/zxES3gNNQCKg+WHiRql3tAKLiHaZLcAjm3v2MK2HAO fXQ= X-Belgacom-Dynamic: yes IronPort-PHdr: 9a23:mxkVPxNXUp7UKYv6aqgl6mtUPXoX/o7sNwtQ0KIMzox0K/z4psbcNUDSrc9gkEXOFd2Cra4d1ayP6furADRcqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5zIRmssAndqMcbjYR/JqotxRbCv2dFdflRyW50P1yYggzy5t23/J5t8iRQv+wu+stdWqjkfKo2UKJVAi0+P286+MPkux/DTRCS5nQHSWUZjgBIAwne4x7kWJr6rzb3ufB82CmeOs32UKw0VDG/5KplVBPklCEKPCM//WrKiMJ/kbhbrQqhqRJh3oDaboKbOv1xca3SZt4WWWlMU9xNWyFbHo+wc40CBPcBM+ZCqIn9okMDoxukCga3BePg0DlIjWL2060gzesuDB/J3BYhH90Ss3TfsdL4NKkIXu+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EBAQEBAQUEAYYPRUMBDAGBZiKDRwsBIyOBPxKDJoJYKbMaM4QQgUODRYFCgTgBiCaFGYFBP4RfijQEj26KK5w5gm2DDIRckjYPIaBELZIeoV2Bek0gGIMkUBkNnGhCMDcCBgoBAQMJVwE9AYUginMBAQ X-IPAS-Result: A2DgBgD4Vkdf/xCltltfgRCBRYEcglBfjTiSS5ICCwEBAQEBAQEBATQBAgQBAYRMgjslOBMCAwEBAQMCBQEBBgEBAQEBAQUEAYYPRUMBDAGBZiKDRwsBIyOBPxKDJoJYKbMaM4QQgUODRYFCgTgBiCaFGYFBP4RfijQEj26KK5w5gm2DDIRckjYPIaBELZIeoV2Bek0gGIMkUBkNnGhCMDcCBgoBAQMJVwE9AYUginMBAQ Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 27 Aug 2020 08:50:35 +0200 From: Fabian Frederick To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabian Frederick Subject: [PATCH 5/7 net-next] vxlan: add VXLAN_NL2FLAG macro Date: Thu, 27 Aug 2020 08:50:19 +0200 Message-Id: <20200827065019.5787-1-fabf@skynet.be> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Replace common flag assignment with a macro. This could yet be simplified with changelink/supported but it would remove clarity Signed-off-by: Fabian Frederick --- drivers/net/vxlan.c | 113 +++++--------------------------------------- include/net/vxlan.h | 10 ++++ 2 files changed, 23 insertions(+), 100 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1e9ab1002281c..e9b561b9d23e1 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -4034,14 +4034,7 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[], if (data[IFLA_VXLAN_TTL]) conf->ttl = nla_get_u8(data[IFLA_VXLAN_TTL]); - if (data[IFLA_VXLAN_TTL_INHERIT]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_TTL_INHERIT, - VXLAN_F_TTL_INHERIT, changelink, false, - extack); - if (err) - return err; - - } + VXLAN_NL2FLAG(IFLA_VXLAN_TTL_INHERIT, VXLAN_F_TTL_INHERIT, changelink, false); if (data[IFLA_VXLAN_LABEL]) conf->label = nla_get_be32(data[IFLA_VXLAN_LABEL]) & @@ -4061,37 +4054,10 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[], if (data[IFLA_VXLAN_AGEING]) conf->age_interval = nla_get_u32(data[IFLA_VXLAN_AGEING]); - if (data[IFLA_VXLAN_PROXY]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_PROXY, - VXLAN_F_PROXY, changelink, false, - extack); - if (err) - return err; - } - - if (data[IFLA_VXLAN_RSC]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_RSC, - VXLAN_F_RSC, changelink, false, - extack); - if (err) - return err; - } - - if (data[IFLA_VXLAN_L2MISS]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_L2MISS, - VXLAN_F_L2MISS, changelink, false, - extack); - if (err) - return err; - } - - if (data[IFLA_VXLAN_L3MISS]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_L3MISS, - VXLAN_F_L3MISS, changelink, false, - extack); - if (err) - return err; - } + VXLAN_NL2FLAG(IFLA_VXLAN_PROXY, VXLAN_F_PROXY, changelink, false); + VXLAN_NL2FLAG(IFLA_VXLAN_RSC, VXLAN_F_RSC, changelink, false); + VXLAN_NL2FLAG(IFLA_VXLAN_L2MISS, VXLAN_F_L2MISS, changelink, false); + VXLAN_NL2FLAG(IFLA_VXLAN_L3MISS, VXLAN_F_L3MISS, changelink, false); if (data[IFLA_VXLAN_LIMIT]) { if (changelink) { @@ -4102,13 +4068,7 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[], conf->addrmax = nla_get_u32(data[IFLA_VXLAN_LIMIT]); } - if (data[IFLA_VXLAN_COLLECT_METADATA]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_COLLECT_METADATA, - VXLAN_F_COLLECT_METADATA, changelink, false, - extack); - if (err) - return err; - } + VXLAN_NL2FLAG(IFLA_VXLAN_COLLECT_METADATA, VXLAN_F_COLLECT_METADATA, changelink, false); if (data[IFLA_VXLAN_PORT_RANGE]) { if (!changelink) { @@ -4142,60 +4102,13 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[], conf->flags |= VXLAN_F_UDP_ZERO_CSUM_TX; } - if (data[IFLA_VXLAN_UDP_ZERO_CSUM6_TX]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, - VXLAN_F_UDP_ZERO_CSUM6_TX, changelink, - false, extack); - if (err) - return err; - } - - if (data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, - VXLAN_F_UDP_ZERO_CSUM6_RX, changelink, - false, extack); - if (err) - return err; - } - - if (data[IFLA_VXLAN_REMCSUM_TX]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_REMCSUM_TX, - VXLAN_F_REMCSUM_TX, changelink, false, - extack); - if (err) - return err; - } - - if (data[IFLA_VXLAN_REMCSUM_RX]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_REMCSUM_RX, - VXLAN_F_REMCSUM_RX, changelink, false, - extack); - if (err) - return err; - } - - if (data[IFLA_VXLAN_GBP]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_GBP, - VXLAN_F_GBP, changelink, false, extack); - if (err) - return err; - } - - if (data[IFLA_VXLAN_GPE]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_GPE, - VXLAN_F_GPE, changelink, false, - extack); - if (err) - return err; - } - - if (data[IFLA_VXLAN_REMCSUM_NOPARTIAL]) { - err = vxlan_nl2flag(conf, data, IFLA_VXLAN_REMCSUM_NOPARTIAL, - VXLAN_F_REMCSUM_NOPARTIAL, changelink, - false, extack); - if (err) - return err; - } + VXLAN_NL2FLAG(IFLA_VXLAN_UDP_ZERO_CSUM6_TX, VXLAN_F_UDP_ZERO_CSUM6_TX, changelink, false); + VXLAN_NL2FLAG(IFLA_VXLAN_UDP_ZERO_CSUM6_RX, VXLAN_F_UDP_ZERO_CSUM6_RX, changelink, false); + VXLAN_NL2FLAG(IFLA_VXLAN_REMCSUM_TX, IFLA_VXLAN_REMCSUM_TX, changelink, false); + VXLAN_NL2FLAG(IFLA_VXLAN_REMCSUM_RX, VXLAN_F_REMCSUM_RX, changelink, false); + VXLAN_NL2FLAG(IFLA_VXLAN_GBP, VXLAN_F_GBP, changelink, false); + VXLAN_NL2FLAG(IFLA_VXLAN_GPE, VXLAN_F_GPE, changelink, false); + VXLAN_NL2FLAG(IFLA_VXLAN_REMCSUM_NOPARTIAL, VXLAN_F_REMCSUM_NOPARTIAL, changelink, false); if (tb[IFLA_MTU]) { if (changelink) { diff --git a/include/net/vxlan.h b/include/net/vxlan.h index 3a41627cbdfe5..8a56b7a0f75f9 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h @@ -290,6 +290,16 @@ struct vxlan_dev { VXLAN_F_UDP_ZERO_CSUM6_RX | \ VXLAN_F_COLLECT_METADATA) + +#define VXLAN_NL2FLAG(iflag, flag, changelink, changelink_supported) { \ + if (data[iflag]) { \ + err = vxlan_nl2flag(conf, data, iflag, flag, changelink, \ + changelink_supported, extack); \ + if (err) \ + return err; \ + } \ +} + struct net_device *vxlan_dev_create(struct net *net, const char *name, u8 name_assign_type, struct vxlan_config *conf); From patchwork Thu Aug 27 06:50:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 261861 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=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 B1ED5C433E1 for ; Thu, 27 Aug 2020 06:51:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B75522B49 for ; Thu, 27 Aug 2020 06:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727999AbgH0GvH (ORCPT ); Thu, 27 Aug 2020 02:51:07 -0400 Received: from mailrelay116.isp.belgacom.be ([195.238.20.143]:45598 "EHLO mailrelay116.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgH0GvG (ORCPT ); Thu, 27 Aug 2020 02:51:06 -0400 IronPort-SDR: 7oItj6Q/RRRJl9YHkqWN1IGbOxZ9arKM155BRwRCEg9pcXZdEK7NU/+1Lrh5PIy7IUKFqZF6mO aYb68JgGgV4ZXA25qbgWVX8QD5gxFG5meQkk8Ul4Ghu3Nw42fx5+NvAC1c6vhadet25HU6WYpc V/cjixsZFVANKBP1PCeQHNxhC3OzXwJVSS5cq+qLIeN5ek4FXwcWqxThVdv5pJzg2mGRmovx7z xlmk5rw+YfNZ6PK9On8upWiARih0g7y2Ul5/td+oamG3YvKEdSRgiI8phr8pOA6v3MXd4ayBZZ TGc= X-Belgacom-Dynamic: yes IronPort-PHdr: 9a23:jkXQxxWjHsneVasusvsBzDUEbb7V8LGtZVwlr6E/grcLSJyIuqrYZRSEvKdThVPEFb/W9+hDw7KP9fy5BypZu83K6SheOLV3FDY9wf0MmAIhB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vfb+yEBtpLsysJ15+vNmhE27jF0Ecud3H+XT21unWMHWSU23KZhrkx50FuD1rJ4g/NAH9xJ+/xJShs6NYLbz+FiBdD9QBnOftmSRVa9QdWnATcxQcwtw9MUeElyBYbqsheW0yO0Dro9m7WVCZkw9azAmX78O4I1yGvM3YEigkMgT88JMnep1YBl8A2GKYfDkkyf34iweKgRxi/G9y/Xw2OEsmlDUx92XLmDV31JNRielsjw+k6XF+zmMr8gKAYUkcM= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AxAwD4Vkdf/xCltltfgRCBQ4EeglBfjTiSS5AFgX0LAQEBAQEBAQEBNAECBAEBhEyCOyU0CQ4CAwEBAQMCBQEBBgEBAQEBAQUEAYYPRYI3IoNHCwEjI4E/EoMmglgpsxozhBCBQ4NFgUKBOIgnhRmBQT+EX4oSIgS2UoJtgwyEXJI2DyGgRC2SHpsdhimCEU0gGDuCaVAZDZxoQjA3AgYKAQEDCVcBPQGQEwEB X-IPAS-Result: A2AxAwD4Vkdf/xCltltfgRCBQ4EeglBfjTiSS5AFgX0LAQEBAQEBAQEBNAECBAEBhEyCOyU0CQ4CAwEBAQMCBQEBBgEBAQEBAQUEAYYPRYI3IoNHCwEjI4E/EoMmglgpsxozhBCBQ4NFgUKBOIgnhRmBQT+EX4oSIgS2UoJtgwyEXJI2DyGgRC2SHpsdhimCEU0gGDuCaVAZDZxoQjA3AgYKAQEDCVcBPQGQEwEB Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 27 Aug 2020 08:51:01 +0200 From: Fabian Frederick To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabian Frederick Subject: [PATCH 7/7 net-next] vxlan: fix vxlan_find_sock() documentation for l3mdev Date: Thu, 27 Aug 2020 08:50:46 +0200 Message-Id: <20200827065046.5888-1-fabf@skynet.be> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since commit aab8cc3630e32 ("vxlan: add support for underlay in non-default VRF") vxlan_find_sock() also checks if socket is assigned to the right level 3 master device when lower device is not in the default VRF. Signed-off-by: Fabian Frederick --- drivers/net/vxlan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1501a5633a97e..2c6189e988ba3 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -190,8 +190,9 @@ static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb) return list_first_entry(&fdb->remotes, struct vxlan_rdst, list); } -/* Find VXLAN socket based on network namespace, address family and UDP port - * and enabled unshareable flags. +/* Find VXLAN socket based on network namespace, address family, UDP port, + * enabled unshareable flags and socket device binding (see l3mdev with + * non-default VRF). */ static struct vxlan_sock *vxlan_find_sock(struct net *net, sa_family_t family, __be16 port, u32 flags, int ifindex)