From patchwork Tue Oct 8 23:51:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1173552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZyhzD9T8"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46nvJF5PG2z9sPL for ; Wed, 9 Oct 2019 10:51:24 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6F3C9C64; Tue, 8 Oct 2019 23:51:20 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 550499E7 for ; Tue, 8 Oct 2019 23:51:19 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 5B839604 for ; Tue, 8 Oct 2019 23:51:18 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id q10so388664pfl.0 for ; Tue, 08 Oct 2019 16:51:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=TUZsMBSgaZe6pDDVyJ1D3MlIppe7mklGl9ZCCm9Jk80=; b=ZyhzD9T8KqdNDmAyADT3OyeiW+aaz3+6kcgpOnvLx/uU4xXFf6Aib259iHCtvf+7Lb tOZh2Ho/bk8gqBC+cjDllZBO6XU/+esofbPJPxPRoZPkMA1tMu8cjzkWqL6QXuU6h1HC C/SDFS/pUW7j/LSCGmJAR3son0unXJxsL3Y+qcn7Z5fdyd8T+Ztkeok7E99LlAqzHHXq 6i+bcQ9DU6yKnjR/D/3IQ9Y3qQj4CrBDyHubHUl57w59+dFCRkQ34WPymuyW1CoQMS61 4uYO9pW4g83qyew8Q+IvAx+0Ri9P9SsAuFPRttOc8zz4P4LBmpCjRTa59ie0QJ+yl4gt /DVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TUZsMBSgaZe6pDDVyJ1D3MlIppe7mklGl9ZCCm9Jk80=; b=ff+y/B+yRHAqKSxOHUeDj4ZQwMFYy1W85If435ia4QsEkx1himnX8WLAHXhxoavp/E Mou6AXfERBhYpI864/kXH8TnQD7KfgYarA97RgVSokoNJLvrDJyqE8N+D0SYaXGieqAw v6En7MSirPDzQu0NtvWD2TcEKK7oMuTRs3zRXQwaeMf+7eVpsLoXrhUMoP4CaSbDe4vT OpzS9O0zvq5v7VYWF75q7i7PFXzoRyNkAuv/w/j2E7JRMn1s3kNM5pMTe0L30Ffm4e3h dl9pZDseoSwDzsiBWnOi04pFQH15KjB57b9L6hoe9nl7YgqWYUCSbkRCtkeVsIyti8sY UwDA== X-Gm-Message-State: APjAAAVecfOvtdqTu4SgVDXzI52SMLQrmX9wU9R+xGLQ+8zEcrc4xjz7 C3Kkov/W4XZX6jJQzC815nRYUAV9 X-Google-Smtp-Source: APXvYqzWF2VvuUVj23ovfTCgald2AlwtWFWv5LuUlAhF112DexT4fcLgQnJ1NGWCfwF07dZEWtqISw== X-Received: by 2002:a17:90a:80ca:: with SMTP id k10mr536741pjw.88.1570578677198; Tue, 08 Oct 2019 16:51:17 -0700 (PDT) Received: from gizo.domain (97-115-119-26.ptld.qwest.net. [97.115.119.26]) by smtp.gmail.com with ESMTPSA id z25sm212905pfn.7.2019.10.08.16.51.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2019 16:51:15 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Tue, 8 Oct 2019 16:51:11 -0700 Message-Id: <1570578672-28261-1-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Roopa Prabhu Subject: [ovs-dev] [PATCH 1/2] compat: Backport IP_TUNNEL_INFO_BRIDGE X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Roopa Prabhu Upstream commit: commit f35581d64e55fc65753a62957b3b98127d560d07 Author: Roopa Prabhu Date: Tue Jan 31 22:59:51 2017 -0800 ip_tunnels: new IP_TUNNEL_INFO_BRIDGE flag for ip_tunnel_info mode New ip_tunnel_info flag to represent bridged tunnel metadata. Used by bridge driver later in the series to pass per vlan dst metadata to bridge ports. Signed-off-by: Roopa Prabhu Signed-off-by: David S. Miller Cc: Roopa Prabhu Signed-off-by: Greg Rose --- datapath/linux/compat/include/net/ip_tunnels.h | 1 + 1 file changed, 1 insertion(+) diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h index da64a94..e70c54a 100644 --- a/datapath/linux/compat/include/net/ip_tunnels.h +++ b/datapath/linux/compat/include/net/ip_tunnels.h @@ -165,6 +165,7 @@ struct ip_tunnel_key { /* Flags for ip_tunnel_info mode. */ #define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */ #define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */ +#define IP_TUNNEL_INFO_BRIDGE 0x04 /* represents a bridged tunnel id */ struct ip_tunnel_info { struct ip_tunnel_key key; From patchwork Tue Oct 8 23:51:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1173553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iEx9dk8D"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46nvK34xFtz9sPL for ; Wed, 9 Oct 2019 10:52:07 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 5326CC79; Tue, 8 Oct 2019 23:51:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 25FE09E7 for ; Tue, 8 Oct 2019 23:51:20 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 834B5604 for ; Tue, 8 Oct 2019 23:51:19 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id u20so130754plq.4 for ; Tue, 08 Oct 2019 16:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WDp81bViQ7hzhGwk89LcacIheA8ieNiKJMexwJKan28=; b=iEx9dk8DUHeUpvINZEl1aVceJ/OVhclR92FzxUyZSyqbymtGCsgbfQ4BK6rapGmpbi EVZ0BYM50xcn1PVjywQUjnqto4ix3SRjU4OMZJRUblUfyakDq5t62WnvQOUR+Bt2RJSj hNnt9NI+0Gb3QttYuDvVKDQbRoIZHpNuvxK3FScGzgAmB+kydqsTw+xqVqWLOMqu8hsX gmo5Bgeke8WMzuHWLaKhqkEa30W/uOfg21JkbWEg4sGEPjRXE3CU/69/hnV780Si813x 5/GtDUVegyo6S3qKG7k8wYthNul1PTM/iWD/hLbRK6pL1mifgVQo80xT1CKEuTmcn94D 2G6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WDp81bViQ7hzhGwk89LcacIheA8ieNiKJMexwJKan28=; b=HIOKM6JrX7FppRno4y2bfNqTPebZuH1xbS4EGJgbleyFxSDnl1XjjTFhkL2EUC3+hA 7MSa/HcChn3os67wGuv8RC0uacpFQ+/9hqc6laCbobyQqardM/mMHfuQJcQxW6KZJcC/ 4u8j5GA8ZuCsuUJ7eASZ+fTpMcHpcg9/VxwcuUtMqMJK/+VGHKZw3JtjgNsILw2Vm4ub XmyxI4pRHbBtUaz6nLCzN+P/gTnuOsItSukHLWkukpDvwgzoYOz+BIoKe4/6lbxO1E1s z9qf8vEYxqU879bvDaxzHqMkJLX+/jvXXhCy6jICznJq/1TcJVyEUfDYgiswJG843jwy gfDQ== X-Gm-Message-State: APjAAAVP1x6GngBsbI9fx3J91+vnEQuyq9K5RrC3gMcFF8zwWJ8x6lz9 aJJAXwEJ2cczT1eKObCkZuizKXCb X-Google-Smtp-Source: APXvYqzIWoRSIvRDA7+0S59v6O3Ux+g7CdTsvP33rkjRtKfQjEhY8B1Zc1o5y1oC9CLq25FbGOXE/Q== X-Received: by 2002:a17:902:7086:: with SMTP id z6mr216393plk.318.1570578678500; Tue, 08 Oct 2019 16:51:18 -0700 (PDT) Received: from gizo.domain (97-115-119-26.ptld.qwest.net. [97.115.119.26]) by smtp.gmail.com with ESMTPSA id z25sm212905pfn.7.2019.10.08.16.51.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2019 16:51:17 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Tue, 8 Oct 2019 16:51:12 -0700 Message-Id: <1570578672-28261-2-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1570578672-28261-1-git-send-email-gvrose8192@gmail.com> References: <1570578672-28261-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: wenxu Subject: [ovs-dev] [PATCH 2/2] datapath: Make metadata_dst tunnel work in IP_TUNNEL_INFO_BRIDGE mode X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: wenxu Upstream commit: commit 18b6f717483a835fb98de9f0df6c724df9324e78 Author: wenxu Date: Thu Mar 28 12:43:23 2019 +0800 openvswitch: Make metadata_dst tunnel work in IP_TUNNEL_INFO_BRIDGE mode There is currently no support for the multicast/broadcast aspects of VXLAN in ovs. In the datapath flow the tun_dst must specific. But in the IP_TUNNEL_INFO_BRIDGE mode the tun_dst can not be specific. And the packet can forward through the fdb table of vxlan devcice. In this mode the broadcast/multicast packet can be sent through the following ways in ovs. ovs-vsctl add-port br0 vxlan -- set in vxlan type=vxlan \ options:key=1000 options:remote_ip=flow ovs-ofctl add-flow br0 in_port=LOCAL,dl_dst=ff:ff:ff:ff:ff:ff, \ action=output:vxlan bridge fdb append ff:ff:ff:ff:ff:ff dev vxlan_sys_4789 dst 172.168.0.1 \ src_vni 1000 vni 1000 self bridge fdb append ff:ff:ff:ff:ff:ff dev vxlan_sys_4789 dst 172.168.0.2 \ src_vni 1000 vni 1000 self Signed-off-by: wenxu Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Also fixup case statement in lib/odp-util.c to make the compiler happy. Cc: wenxu Signed-off-by: Greg Rose --- datapath/flow_netlink.c | 46 ++++++++++++++++++----- datapath/linux/compat/include/linux/openvswitch.h | 1 + lib/odp-util.c | 2 + 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index 0f7ab53..b3d1069 100644 --- a/datapath/flow_netlink.c +++ b/datapath/flow_netlink.c @@ -406,6 +406,7 @@ static const struct ovs_len_tbl ovs_tunnel_key_lens[OVS_TUNNEL_KEY_ATTR_MAX + 1] [OVS_TUNNEL_KEY_ATTR_IPV6_SRC] = { .len = sizeof(struct in6_addr) }, [OVS_TUNNEL_KEY_ATTR_IPV6_DST] = { .len = sizeof(struct in6_addr) }, [OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS] = { .len = OVS_ATTR_VARIABLE }, + [OVS_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE] = { .len = 0 }, }; static const struct ovs_len_tbl @@ -669,6 +670,7 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, bool log) { bool ttl = false, ipv4 = false, ipv6 = false; + bool info_bridge_mode = false; __be16 tun_flags = 0; int opts_type = 0; struct nlattr *a; @@ -785,6 +787,10 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, tun_flags |= TUNNEL_ERSPAN_OPT; opts_type = type; break; + case OVS_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE: + info_bridge_mode = true; + ipv4 = true; + break; default: OVS_NLERR(log, "Unknown IP tunnel attribute %d", type); @@ -815,16 +821,29 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, OVS_NLERR(log, "IP tunnel dst address not specified"); return -EINVAL; } - if (ipv4 && !match->key->tun_key.u.ipv4.dst) { - OVS_NLERR(log, "IPv4 tunnel dst address is zero"); - return -EINVAL; + if (ipv4) { + if (info_bridge_mode) { + if (match->key->tun_key.u.ipv4.src || + match->key->tun_key.u.ipv4.dst || + match->key->tun_key.tp_src || + match->key->tun_key.tp_dst || + match->key->tun_key.ttl || + match->key->tun_key.tos || + tun_flags & ~TUNNEL_KEY) { + OVS_NLERR(log, "IPv4 tun info is not correct"); + return -EINVAL; + } + } else if (!match->key->tun_key.u.ipv4.dst) { + OVS_NLERR(log, "IPv4 tunnel dst address is zero"); + return -EINVAL; + } } if (ipv6 && ipv6_addr_any(&match->key->tun_key.u.ipv6.dst)) { OVS_NLERR(log, "IPv6 tunnel dst address is zero"); return -EINVAL; } - if (!ttl) { + if (!ttl && !info_bridge_mode) { OVS_NLERR(log, "IP tunnel TTL not specified."); return -EINVAL; } @@ -853,12 +872,17 @@ static int vxlan_opt_to_nlattr(struct sk_buff *skb, static int __ip_tun_to_nlattr(struct sk_buff *skb, const struct ip_tunnel_key *output, const void *tun_opts, int swkey_tun_opts_len, - unsigned short tun_proto) + unsigned short tun_proto, u8 mode) { if (output->tun_flags & TUNNEL_KEY && nla_put_be64(skb, OVS_TUNNEL_KEY_ATTR_ID, output->tun_id, OVS_TUNNEL_KEY_ATTR_PAD)) return -EMSGSIZE; + + if (mode & IP_TUNNEL_INFO_BRIDGE) + return nla_put_flag(skb, OVS_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE) + ? -EMSGSIZE : 0; + switch (tun_proto) { case AF_INET: if (output->u.ipv4.src && @@ -921,7 +945,7 @@ static int __ip_tun_to_nlattr(struct sk_buff *skb, static int ip_tun_to_nlattr(struct sk_buff *skb, const struct ip_tunnel_key *output, const void *tun_opts, int swkey_tun_opts_len, - unsigned short tun_proto) + unsigned short tun_proto, u8 mode) { struct nlattr *nla; int err; @@ -931,7 +955,7 @@ static int ip_tun_to_nlattr(struct sk_buff *skb, return -EMSGSIZE; err = __ip_tun_to_nlattr(skb, output, tun_opts, swkey_tun_opts_len, - tun_proto); + tun_proto, mode); if (err) return err; @@ -945,7 +969,7 @@ int ovs_nla_put_tunnel_info(struct sk_buff *skb, return __ip_tun_to_nlattr(skb, &tun_info->key, ip_tunnel_info_opts(tun_info), tun_info->options_len, - ip_tunnel_info_af(tun_info)); + ip_tunnel_info_af(tun_info), tun_info->mode); } static int encode_vlan_from_nlattrs(struct sw_flow_match *match, @@ -1982,7 +2006,7 @@ static int __ovs_nla_put_key(const struct sw_flow_key *swkey, opts = TUN_METADATA_OPTS(output, swkey->tun_opts_len); if (ip_tun_to_nlattr(skb, &output->tun_key, opts, - swkey->tun_opts_len, swkey->tun_proto)) + swkey->tun_opts_len, swkey->tun_proto, 0)) goto nla_put_failure; } @@ -2610,6 +2634,8 @@ static int validate_and_copy_set_tun(const struct nlattr *attr, tun_info->mode = IP_TUNNEL_INFO_TX; if (key.tun_proto == AF_INET6) tun_info->mode |= IP_TUNNEL_INFO_IPV6; + else if (key.tun_proto == AF_INET && key.tun_key.u.ipv4.dst == 0) + tun_info->mode |= IP_TUNNEL_INFO_BRIDGE; tun_info->key = key.tun_key; /* We need to store the options in the action itself since @@ -3375,7 +3401,7 @@ static int set_action_to_attr(const struct nlattr *a, struct sk_buff *skb) err = ip_tun_to_nlattr(skb, &tun_info->key, ip_tunnel_info_opts(tun_info), tun_info->options_len, - ip_tunnel_info_af(tun_info)); + ip_tunnel_info_af(tun_info), tun_info->mode); if (err) return err; nla_nest_end(skb, start); diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h index 7b16b1d..2f781ca 100644 --- a/datapath/linux/compat/include/linux/openvswitch.h +++ b/datapath/linux/compat/include/linux/openvswitch.h @@ -400,6 +400,7 @@ enum ovs_tunnel_key_attr { OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ OVS_TUNNEL_KEY_ATTR_PAD, OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* struct erspan_metadata */ + OVS_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE, /* No argument. IPV4_INFO_BRIDGE mode.*/ __OVS_TUNNEL_KEY_ATTR_MAX }; diff --git a/lib/odp-util.c b/lib/odp-util.c index 3a574bf..949fd90 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -3892,6 +3892,8 @@ format_odp_tun_attr(const struct nlattr *attr, const struct nlattr *mask_attr, format_odp_tun_erspan_opt(a, ma, ds, verbose); ds_put_cstr(ds, "),"); break; + case OVS_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE: + break; case __OVS_TUNNEL_KEY_ATTR_MAX: default: format_unknown_key(ds, a, ma);