From patchwork Fri Mar 2 12:32:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang, Yi" X-Patchwork-Id: 880493 X-Patchwork-Delegate: ian.stokes@intel.com 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=none (p=none dis=none) header.from=intel.com 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 3zt84j0VL1z9s5c for ; Fri, 2 Mar 2018 23:39:15 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 121E110A7; Fri, 2 Mar 2018 12:38:50 +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 A118F1090 for ; Fri, 2 Mar 2018 12:38:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9F38A13E for ; Fri, 2 Mar 2018 12:38:46 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2018 04:38:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,412,1515484800"; d="scan'208";a="34131837" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.224.185]) by fmsmga004.fm.intel.com with ESMTP; 02 Mar 2018 04:38:44 -0800 From: Yi Yang To: dev@openvswitch.org Date: Fri, 2 Mar 2018 20:32:00 +0800 Message-Id: <1519993921-120968-2-git-send-email-yi.y.yang@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1519993921-120968-1-git-send-email-yi.y.yang@intel.com> References: <1519993921-120968-1-git-send-email-yi.y.yang@intel.com> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Feng Yang Subject: [ovs-dev] [PATCH v1 1/2] userspace datapath: Add GTP-U tunnel support 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: Feng Yang GPRS Tunneling Protocol (GTP) is a group of IP-based communications protocols used to carry general packet radio service (GPRS) within GSM, UMTS and LTE networks. GTP can be decomposed into separate protocols, GTP-C, GTP-U and GTP'. GTP-U is used for carrying user data within the GPRS core network and between the radio access network and the core network. The user data transported can be packets in any of IPv4, IPv6, or PPP formats. GTP-U is user plane communication protocol between Serving-Gateway (S-GW) and PDN-Gateway (P-GW) as well as Multi-access Edge Computing (MEC). This patch added a new tunnel type 'gtpu' into userspace datapath and two new match fields tun_gtpu_flags and tun_gtpu_msgtype, tun_id is reused for GTP Tunnel Endpoint ID (TEID). The below are commands for gtpu tunnel add: $ sudo ovs-vsctl add-br br-int -- set bridge br-int datapath_type=netdev protocols=OpenFlow13 $ sudo ovs-vsctl add-port br-int gtpu1 -- set interface gtpu1 type=gtpu options:packet_type=legacy_l3 options:remote_ip=flow options:key=flow options:dst_port=2152 test-flows-gtpu.txt is openflow table for gtpu tunnel test: $ cat test-flows-gtpu.txt table=0,icmp,in_port=4 actions=load:0xc0a83249->NXM_NX_TUN_IPV4_DST[],load:0x9->NXM_NX_TUN_ID[0..31],output:2 table=0,tcp,tp_dst=80,in_port=4 actions=load:0xc0a83249->NXM_NX_TUN_IPV4_DST[],load:0x9->NXM_NX_TUN_ID[0..31],output:2 table=0,in_port=2,tun_id=0x10,tun_gtpu_flags=0x30,tun_gtpu_msgtype=255 actions=set_field:00:00:22:22:22:22->eth_src,set_field:00:00:11:11:11:11->eth_dst,output:4 table=0,actions=NORMAL Signed-off-by: Feng Yang Signed-off-by: Yi Yang --- build-aux/extract-ofp-fields | 1 + datapath/linux/compat/include/linux/openvswitch.h | 3 + include/openvswitch/match.h | 4 + include/openvswitch/meta-flow.h | 28 ++++ include/openvswitch/packets.h | 4 +- lib/dpif-netlink-rtnl.c | 5 + lib/dpif-netlink.c | 3 + lib/flow.c | 5 + lib/match.c | 29 +++++ lib/meta-flow.c | 38 ++++++ lib/meta-flow.xml | 76 +++++++++++ lib/netdev-native-tnl.c | 150 +++++++++++++++++++++- lib/netdev-native-tnl.h | 12 ++ lib/netdev-vport.c | 15 ++- lib/nx-match.c | 4 + lib/odp-util.c | 32 +++++ lib/packets.h | 17 +++ lib/tnl-ports.c | 3 + ofproto/ofproto-dpif-xlate.c | 1 + ofproto/tunnel.c | 6 + 20 files changed, 433 insertions(+), 3 deletions(-) diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields index 184b75e..944f095 100755 --- a/build-aux/extract-ofp-fields +++ b/build-aux/extract-ofp-fields @@ -68,6 +68,7 @@ PREREQS = {"none": "MFP_NONE", OXM_CLASSES = {"NXM_OF_": (0, 0x0000), "NXM_NX_": (0, 0x0001), "NXOXM_NSH_": (0x005ad650, 0xffff), + "NXOXM_GTPU_": (0x005ad651, 0xffff), "OXM_OF_": (0, 0x8000), "OXM_OF_PKT_REG": (0, 0x8001), "ONFOXM_ET_": (0x4f4e4600, 0xffff), diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h index 84ebcaf..ad6ea64 100644 --- a/datapath/linux/compat/include/linux/openvswitch.h +++ b/datapath/linux/compat/include/linux/openvswitch.h @@ -236,6 +236,7 @@ enum ovs_vport_type { OVS_VPORT_TYPE_GRE, /* GRE tunnel. */ OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */ OVS_VPORT_TYPE_GENEVE, /* Geneve tunnel. */ + OVS_VPORT_TYPE_GTPU, /* GTPU tunnel. */ OVS_VPORT_TYPE_LISP = 105, /* LISP tunnel */ OVS_VPORT_TYPE_STT = 106, /* STT tunnel */ __OVS_VPORT_TYPE_MAX @@ -394,6 +395,8 @@ enum ovs_tunnel_key_attr { OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS, /* Nested OVS_VXLAN_EXT_* */ OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ + OVS_TUNNEL_KEY_ATTR_GTPU_FLAGS, /* u8 GTP-U FLAGS. */ + OVS_TUNNEL_KEY_ATTR_GTPU_MSGTYPE, /* u8 GTP-U MSGTYPE. */ OVS_TUNNEL_KEY_ATTR_PAD, __OVS_TUNNEL_KEY_ATTR_MAX }; diff --git a/include/openvswitch/match.h b/include/openvswitch/match.h index 61a67de..fb41736 100644 --- a/include/openvswitch/match.h +++ b/include/openvswitch/match.h @@ -109,6 +109,10 @@ void match_set_tun_gbp_id_masked(struct match *match, ovs_be16 gbp_id, ovs_be16 void match_set_tun_gbp_id(struct match *match, ovs_be16 gbp_id); void match_set_tun_gbp_flags_masked(struct match *match, uint8_t flags, uint8_t mask); void match_set_tun_gbp_flags(struct match *match, uint8_t flags); +void match_set_tun_gtpu_flags(struct match *match, uint8_t gtpu_flags); +void match_set_tun_gtpu_flags_masked(struct match *match, uint8_t gtpu_flags, + uint8_t mask); +void match_set_tun_gtpu_msgtype(struct match *match, uint8_t gtpu_msgtype); void match_set_in_port(struct match *, ofp_port_t ofp_port); void match_set_pkt_mark(struct match *, uint32_t pkt_mark); void match_set_pkt_mark_masked(struct match *, uint32_t pkt_mark, uint32_t mask); diff --git a/include/openvswitch/meta-flow.h b/include/openvswitch/meta-flow.h index 98c9e1c..884a2f6 100644 --- a/include/openvswitch/meta-flow.h +++ b/include/openvswitch/meta-flow.h @@ -1848,6 +1848,34 @@ enum OVS_PACKED_ENUM mf_field_id { */ MFF_NSH_TTL, + /* "tun_gtpu_flags". + * + * The flags in a GTP-U tunnel header. + * + * Type: u8. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: none. + * Access: read/write. + * NXM: none. + * OXM: NXOXM_GTPU_FLAGS(1) since OF1.3 and v2.10. + */ + MFF_TUN_GTPU_FLAGS, + + /* "tun_gtpu_msgtype". + * + * The message type in a GTP-U tunnel header. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: none. + * Access: read/write. + * NXM: none. + * OXM: NXOXM_GTPU_MSGTYPE(2) since OF1.3 and v2.10. + */ + MFF_TUN_GTPU_MSGTYPE, + MFF_N_IDS }; diff --git a/include/openvswitch/packets.h b/include/openvswitch/packets.h index fef756b..1f3b499 100644 --- a/include/openvswitch/packets.h +++ b/include/openvswitch/packets.h @@ -39,7 +39,9 @@ struct flow_tnl { ovs_be16 tp_dst; ovs_be16 gbp_id; uint8_t gbp_flags; - uint8_t pad1[5]; /* Pad to 64 bits. */ + uint8_t gtpu_flags; + uint8_t gtpu_msgtype; + uint8_t pad1[3]; /* Pad to 64 bits. */ struct tun_metadata metadata; }; diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c index 40c4569..a628b72 100644 --- a/lib/dpif-netlink-rtnl.c +++ b/lib/dpif-netlink-rtnl.c @@ -99,6 +99,8 @@ vport_type_to_kind(enum ovs_vport_type type, } case OVS_VPORT_TYPE_GENEVE: return "geneve"; + case OVS_VPORT_TYPE_GTPU: + return "gtpu"; case OVS_VPORT_TYPE_NETDEV: case OVS_VPORT_TYPE_INTERNAL: case OVS_VPORT_TYPE_LISP: @@ -262,6 +264,7 @@ dpif_netlink_rtnl_verify(const struct netdev_tunnel_config *tnl_cfg, case OVS_VPORT_TYPE_INTERNAL: case OVS_VPORT_TYPE_LISP: case OVS_VPORT_TYPE_STT: + case OVS_VPORT_TYPE_GTPU: case OVS_VPORT_TYPE_UNSPEC: case __OVS_VPORT_TYPE_MAX: default: @@ -327,6 +330,7 @@ dpif_netlink_rtnl_create(const struct netdev_tunnel_config *tnl_cfg, case OVS_VPORT_TYPE_INTERNAL: case OVS_VPORT_TYPE_LISP: case OVS_VPORT_TYPE_STT: + case OVS_VPORT_TYPE_GTPU: case OVS_VPORT_TYPE_UNSPEC: case __OVS_VPORT_TYPE_MAX: default: @@ -438,6 +442,7 @@ dpif_netlink_rtnl_port_destroy(const char *name, const char *type) case OVS_VPORT_TYPE_INTERNAL: case OVS_VPORT_TYPE_LISP: case OVS_VPORT_TYPE_STT: + case OVS_VPORT_TYPE_GTPU: case OVS_VPORT_TYPE_UNSPEC: case __OVS_VPORT_TYPE_MAX: default: diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index 8543a2b..19ed182 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -786,6 +786,9 @@ get_vport_type(const struct dpif_netlink_vport *vport) case OVS_VPORT_TYPE_STT: return "stt"; + case OVS_VPORT_TYPE_GTPU: + return "gtpu"; + case OVS_VPORT_TYPE_UNSPEC: case __OVS_VPORT_TYPE_MAX: break; diff --git a/lib/flow.c b/lib/flow.c index 38ff29c..1648667 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -695,6 +695,11 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst) miniflow_push_be32(mf, packet_type, packet_type); } + /* It won't be parsed if the packet is GTP-U message but not GTP-U PDU */ + if (packet_type == htonl(PT_UNKNOWN)) { + goto out; + } + /* Initialize packet's layer pointer and offsets. */ frame = data; dp_packet_reset_offsets(packet); diff --git a/lib/match.c b/lib/match.c index 97a5282..5c845ed 100644 --- a/lib/match.c +++ b/lib/match.c @@ -320,6 +320,27 @@ match_set_tun_gbp_flags(struct match *match, uint8_t flags) } void +match_set_tun_gtpu_flags(struct match *match, uint8_t gtpu_flags) +{ + match_set_tun_gtpu_flags_masked(match, gtpu_flags, UINT8_MAX); +} + +void +match_set_tun_gtpu_flags_masked(struct match *match, uint8_t gtpu_flags, + uint8_t mask) +{ + match->wc.masks.tunnel.gtpu_flags = mask; + match->flow.tunnel.gtpu_flags = gtpu_flags & mask; +} + +void +match_set_tun_gtpu_msgtype(struct match *match, uint8_t gtpu_msgtype) +{ + match->flow.tunnel.gtpu_msgtype = gtpu_msgtype; + match->wc.masks.tunnel.gtpu_msgtype = UINT8_MAX; +} + +void match_set_in_port(struct match *match, ofp_port_t ofp_port) { match->wc.masks.in_port.ofp_port = u16_to_ofp(UINT16_MAX); @@ -1239,6 +1260,14 @@ format_flow_tunnel(struct ds *s, const struct match *match) FLOW_TNL_F_MASK); ds_put_char(s, ','); } + + if (wc->masks.tunnel.gtpu_flags) { + ds_put_format(s, "tun_gtpu_flags=%"PRIx8",", tnl->gtpu_flags); + } + if (wc->masks.tunnel.gtpu_msgtype) { + ds_put_format(s, "tun_gtpu_msgtype=%"PRIu8",", tnl->gtpu_msgtype); + } + tun_metadata_match_format(s, match); } diff --git a/lib/meta-flow.c b/lib/meta-flow.c index aa2ec01..2ea5f63 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -231,6 +231,10 @@ mf_is_all_wild(const struct mf_field *mf, const struct flow_wildcards *wc) return !wc->masks.tunnel.gbp_id; case MFF_TUN_GBP_FLAGS: return !wc->masks.tunnel.gbp_flags; + case MFF_TUN_GTPU_FLAGS: + return !wc->masks.tunnel.gtpu_flags; + case MFF_TUN_GTPU_MSGTYPE: + return !wc->masks.tunnel.gtpu_msgtype; CASE_MFF_TUN_METADATA: return !ULLONG_GET(wc->masks.tunnel.metadata.present.map, mf->id - MFF_TUN_METADATA0); @@ -513,6 +517,8 @@ mf_is_value_valid(const struct mf_field *mf, const union mf_value *value) case MFF_TUN_TTL: case MFF_TUN_GBP_ID: case MFF_TUN_GBP_FLAGS: + case MFF_TUN_GTPU_FLAGS: + case MFF_TUN_GTPU_MSGTYPE: CASE_MFF_TUN_METADATA: case MFF_METADATA: case MFF_IN_PORT: @@ -674,6 +680,12 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow, case MFF_TUN_GBP_FLAGS: value->u8 = flow->tunnel.gbp_flags; break; + case MFF_TUN_GTPU_FLAGS: + value->u8 = flow->tunnel.gtpu_flags; + break; + case MFF_TUN_GTPU_MSGTYPE: + value->u8 = flow->tunnel.gtpu_msgtype; + break; case MFF_TUN_TTL: value->u8 = flow->tunnel.ip_ttl; break; @@ -988,6 +1000,12 @@ mf_set_value(const struct mf_field *mf, case MFF_TUN_GBP_FLAGS: match_set_tun_gbp_flags(match, value->u8); break; + case MFF_TUN_GTPU_FLAGS: + match_set_tun_gtpu_flags(match, value->u8); + break; + case MFF_TUN_GTPU_MSGTYPE: + match_set_tun_gtpu_msgtype(match, value->u8); + break; case MFF_TUN_TOS: match_set_tun_tos(match, value->u8); break; @@ -1385,6 +1403,12 @@ mf_set_flow_value(const struct mf_field *mf, case MFF_TUN_GBP_FLAGS: flow->tunnel.gbp_flags = value->u8; break; + case MFF_TUN_GTPU_FLAGS: + flow->tunnel.gtpu_flags = value->u8; + break; + case MFF_TUN_GTPU_MSGTYPE: + flow->tunnel.gtpu_msgtype = value->u8; + break; case MFF_TUN_TOS: flow->tunnel.ip_tos = value->u8; break; @@ -1700,6 +1724,8 @@ mf_is_pipeline_field(const struct mf_field *mf) case MFF_TUN_FLAGS: case MFF_TUN_GBP_ID: case MFF_TUN_GBP_FLAGS: + case MFF_TUN_GTPU_FLAGS: + case MFF_TUN_GTPU_MSGTYPE: CASE_MFF_TUN_METADATA: case MFF_METADATA: case MFF_IN_PORT: @@ -1870,6 +1896,14 @@ mf_set_wild(const struct mf_field *mf, struct match *match, char **err_str) case MFF_TUN_GBP_FLAGS: match_set_tun_gbp_flags_masked(match, 0, 0); break; + case MFF_TUN_GTPU_FLAGS: + match->wc.masks.tunnel.gtpu_flags = 0; + match->flow.tunnel.gtpu_flags = 0; + break; + case MFF_TUN_GTPU_MSGTYPE: + match->wc.masks.tunnel.gtpu_msgtype = 0; + match->flow.tunnel.gtpu_msgtype = 0; + break; case MFF_TUN_TOS: match_set_tun_tos_masked(match, 0, 0); break; @@ -2221,6 +2255,7 @@ mf_set(const struct mf_field *mf, case MFF_ICMPV4_CODE: case MFF_ICMPV6_TYPE: case MFF_ICMPV6_CODE: + case MFF_TUN_GTPU_MSGTYPE: return OFPUTIL_P_NONE; case MFF_DP_HASH: @@ -2250,6 +2285,9 @@ mf_set(const struct mf_field *mf, case MFF_TUN_GBP_FLAGS: match_set_tun_gbp_flags_masked(match, value->u8, mask->u8); break; + case MFF_TUN_GTPU_FLAGS: + match_set_tun_gtpu_flags_masked(match, value->u8, mask->u8); + break; case MFF_TUN_TTL: match_set_tun_ttl_masked(match, value->u8, mask->u8); break; diff --git a/lib/meta-flow.xml b/lib/meta-flow.xml index 933d4b8..d169772 100644 --- a/lib/meta-flow.xml +++ b/lib/meta-flow.xml @@ -731,6 +731,12 @@ tcp,tp_src=0x07c0/0xfff0 Used by Open vSwitch for NSH extensions, in the absence of an official ONF-assigned class. (This OUI is randomly generated.) + +
0x005ad651 (NXOXM_GTPU)
+
+ Used by Open vSwitch for GTP-U extensions, in the absence of an official + ONF-assigned class. (This OUI is randomly generated.) +

@@ -1899,6 +1905,68 @@ ovs-ofctl add-flow br0 tun_metadata0=1234,actions=controller

+

GTP-U Fields

+ +

+ The GTP-U (v1) header is defined as follows [3GPP TS 29.281]. +

+ + +
+ + + + + + +
+ +
+ + + + +
+
+ +

+ where +

+
    +
  • V: version fields, used to determine the version of the + GTP-U protocol, which should be set to '1'.
  • +
  • PT: Packet Type, used as a protocol discriminator + between GTP (when PT is '1') and GTP' (when PT is '0').
  • +
  • E: Extension Header flag, indicating the presence of a + meaningful value of the Next Extension Header field.
  • +
  • S: Sequence number flag, indicating the presence of a + meaningful value of the Sequence Number field.
  • +
  • PN: N-PDU Number flag, indicating the presence of a + meaningful value of the N-PDU Number field.
  • +
  • Message Type: indicating the type of GTP-U message. +
  • +
  • Length: indicating the length in octets of the payload. +
  • +
  • TEID: Tunnel Endpoint Identifier,unambiguously + identifying a tunnel endpoint in the receiving GTP-U protocol entity. + Open vSwitch makes TEID availabe via .
  • +
+ +

+ For a packet tunneled over GTP-U, this field indicates the presence of + optional headers. +

+
+ + +

+ For a packet tunneled over GTP-U, this field indicates whether it's a + signalling message used for path management, or a user plane message + which carries the original packet. The complete range of message types + can be referred to [3GPP TS 29.281]. +

+
+ @@ -4662,6 +4730,14 @@ r r c c c. . +
3GPP TS 29.281
+
+ 3GPP, + ``General Packet Radio System (GPRS) Tunnelling Protocol User Plane + (GTPv1-U),'' + . +
+
Srinivasan
V. Srinivasan, S. Suriy, and G. Varghese, ``Packet diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c index fb5eab0..bcf599d 100644 --- a/lib/netdev-native-tnl.c +++ b/lib/netdev-native-tnl.c @@ -55,6 +55,9 @@ static struct vlog_rate_limit err_rl = VLOG_RATE_LIMIT_INIT(60, 5); #define GENEVE_BASE_HLEN (sizeof(struct udp_header) + \ sizeof(struct genevehdr)) +#define GTPU_HLEN (sizeof(struct udp_header) + \ + sizeof(struct gtpuhdr)) + uint16_t tnl_udp_port_min = 32768; uint16_t tnl_udp_port_max = 61000; @@ -715,7 +718,152 @@ netdev_geneve_build_header(const struct netdev *netdev, return 0; } - +void +netdev_gtpu_push_header(struct dp_packet *packet, + const struct ovs_action_push_tnl *data) +{ + struct udp_header *udp; + struct gtpuhdr *gtph; + int gtpu_len; + int ip_tot_size; + + gtpu_len = dp_packet_size(packet); + + udp = netdev_tnl_push_ip_header(packet, data->header, data->header_len, + &ip_tot_size); + udp->udp_len = htons(ip_tot_size); + + gtph = (struct gtpuhdr *)(udp + 1); + gtph->len = htons(gtpu_len); + + if (udp->udp_csum) { + uint32_t csum; + if (netdev_tnl_is_header_ipv6(dp_packet_data(packet))) { + csum = packet_csum_pseudoheader6( + netdev_tnl_ipv6_hdr(dp_packet_data(packet))); + } else { + csum = packet_csum_pseudoheader( + netdev_tnl_ip_hdr(dp_packet_data(packet))); + } + + csum = csum_continue(csum, udp, ip_tot_size); + udp->udp_csum = csum_finish(csum); + + if (!udp->udp_csum) { + udp->udp_csum = htons(0xffff); + } + } + + packet->packet_type = htonl(PT_ETH); +} + + +int +netdev_gtpu_build_header(const struct netdev *netdev, + struct ovs_action_push_tnl *data, + const struct netdev_tnl_build_header_params *params) +{ + struct netdev_vport *dev = netdev_vport_cast(netdev); + struct netdev_tunnel_config *tnl_cfg; + struct gtpuhdr *gtph; + struct udp_header *udp; + + /* XXX: RCUfy tnl_cfg. */ + ovs_mutex_lock(&dev->mutex); + + tnl_cfg = &dev->tnl_cfg; + udp = netdev_tnl_ip_build_header(data, params, IPPROTO_UDP); + udp->udp_dst = tnl_cfg->dst_port; + udp->udp_src = htons(GTPU_DST_PORT); + + if (params->is_ipv6 || params->flow->tunnel.flags & FLOW_TNL_F_CSUM) { + /* Write a value in now to mark that we should compute the checksum + * later. 0xffff is handy because it is transparent to the + * calculation. */ + udp->udp_csum = htons(0xffff); + } + + ovs_mutex_unlock(&dev->mutex); + data->header_len += sizeof *udp; + + gtph = (struct gtpuhdr *)(udp + 1); + gtph->flags = GTPU_FLAGS_DEFAULT; + gtph->msgtype = GTPU_MSGTYPE_GPDU; + if (params->flow->tunnel.gtpu_flags != 0) { + gtph->flags = params->flow->tunnel.gtpu_flags; + } + if (params->flow->tunnel.gtpu_msgtype != 0) { + gtph->msgtype = params->flow->tunnel.gtpu_msgtype; + } + put_16aligned_be32(>ph->teid, + htonl(ntohll(params->flow->tunnel.tun_id))); + data->header_len += sizeof *gtph; + data->tnl_type = OVS_VPORT_TYPE_GTPU; + return 0; +} + +struct dp_packet * +netdev_gtpu_pop_header(struct dp_packet *packet) +{ + struct pkt_metadata *md = &packet->md; + struct flow_tnl *tnl = &md->tunnel; + struct gtpuhdr *gtph; + unsigned int hlen; + + pkt_metadata_init_tnl(md); + if (GTPU_HLEN > dp_packet_l4_size(packet)) { + VLOG_WARN_RL(&err_rl, "GTP-U packet too small: min header=%u " + "packet size=%"PRIuSIZE"\n", + (unsigned int)GTPU_HLEN, dp_packet_l4_size(packet)); + goto err; + } + + gtph = udp_extract_tnl_md(packet, tnl, &hlen); + if (!gtph) { + goto err; + } + + if (gtph->flags == 0x30) { + /* Only GTP-U v1 packets without optional fileds are processed, i.e. + * 8 7 6 5 4 3 2 1 + * | ver | PT | 0 | E | S | PN | + * 0 0 1 1 0 0 0 0 + */ + tnl->gtpu_flags = gtph->flags; + } else { + goto err; + } + tnl->gtpu_msgtype = gtph->msgtype; + tnl->tun_id = htonll(ntohl(get_16aligned_be32(>ph->teid))); + + /*Figure out whether the inner packet is IPv4, IPv6 or a GTP-U message.*/ + if (tnl->gtpu_msgtype == GTPU_MSGTYPE_GPDU) { + struct ip_header *ip; + + ip = (struct ip_header *)(gtph + 1); + if (IP_VER(ip->ip_ihl_ver) == 4) { + packet->packet_type = htonl(PT_IPV4); + } else if (IP_VER(ip->ip_ihl_ver) == 6) { + packet->packet_type = htonl(PT_IPV6); + } else { + goto err; + } + } else { + /* tnl->gtpu_msgtype can identify if it is GTP-U message, + * miniflow_extract won't parse it if tnl->gtpu_msgtype + * isn't equal to GTPU_MSGTYPE_GPDU. + */ + packet->packet_type = htonl(PT_UNKNOWN); + } + + dp_packet_reset_packet(packet, hlen + GTPU_HLEN); + + return packet; +err: + dp_packet_delete(packet); + return NULL; +} + void netdev_tnl_egress_port_range(struct unixctl_conn *conn, int argc, const char *argv[], void *aux OVS_UNUSED) diff --git a/lib/netdev-native-tnl.h b/lib/netdev-native-tnl.h index a912ce9..9c4cc66 100644 --- a/lib/netdev-native-tnl.h +++ b/lib/netdev-native-tnl.h @@ -58,6 +58,18 @@ netdev_vxlan_build_header(const struct netdev *netdev, struct dp_packet * netdev_vxlan_pop_header(struct dp_packet *packet); +void +netdev_gtpu_push_header(struct dp_packet *packet, + const struct ovs_action_push_tnl *data); + +int +netdev_gtpu_build_header(const struct netdev *netdev, + struct ovs_action_push_tnl *data, + const struct netdev_tnl_build_header_params *params); + +struct dp_packet * +netdev_gtpu_pop_header(struct dp_packet *packet); + static inline bool netdev_tnl_is_header_ipv6(const void *header) { diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 52aa12d..a10b2f1 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -107,7 +107,10 @@ netdev_vport_needs_dst_port(const struct netdev *dev) return (class->get_config == get_tunnel_config && (!strcmp("geneve", type) || !strcmp("vxlan", type) || - !strcmp("lisp", type) || !strcmp("stt", type)) ); + !strcmp("lisp", type) || !strcmp("stt", type) || + !strcmp("gtpu", type) + ) + ); } const char * @@ -408,6 +411,8 @@ tunnel_supported_layers(const char *type, return TNL_L3; } else if (!strcmp(type, "gre")) { return TNL_L2 | TNL_L3; + } else if (!strcmp(type, "gtpu")) { + return TNL_L3; } else if (!strcmp(type, "vxlan") && tnl_cfg->exts & (1 << OVS_VXLAN_EXT_GPE)) { return TNL_L2 | TNL_L3; @@ -455,6 +460,10 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args, char **errp) tnl_cfg.dst_port = htons(STT_DST_PORT); } + if (!strcmp(type, "gtpu")) { + tnl_cfg.dst_port = htons(GTPU_DST_PORT); + } + needs_dst_port = netdev_vport_needs_dst_port(dev_); tnl_cfg.dont_fragment = true; @@ -979,6 +988,10 @@ netdev_vport_tunnel_register(void) NETDEV_VPORT_GET_IFINDEX), TUNNEL_CLASS("lisp", "lisp_sys", NULL, NULL, NULL, NULL), TUNNEL_CLASS("stt", "stt_sys", NULL, NULL, NULL, NULL), + TUNNEL_CLASS("gtpu", "gptu_sys", netdev_gtpu_build_header, + netdev_gtpu_push_header, + netdev_gtpu_pop_header, + NULL), }; static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; diff --git a/lib/nx-match.c b/lib/nx-match.c index a8edb2e..c7f6c27 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -1153,6 +1153,10 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match, flow->tunnel.gbp_id, match->wc.masks.tunnel.gbp_id); nxm_put_8m(&ctx, MFF_TUN_GBP_FLAGS, oxm, flow->tunnel.gbp_flags, match->wc.masks.tunnel.gbp_flags); + nxm_put_8m(&ctx, MFF_TUN_GTPU_FLAGS, oxm, flow->tunnel.gtpu_flags, + match->wc.masks.tunnel.gtpu_flags); + nxm_put_8m(&ctx, MFF_TUN_GTPU_MSGTYPE, oxm, flow->tunnel.gtpu_msgtype, + match->wc.masks.tunnel.gtpu_msgtype); tun_metadata_to_nx_match(b, oxm, match); /* Network Service Header */ diff --git a/lib/odp-util.c b/lib/odp-util.c index 5da83b4..f200d90 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -712,6 +712,15 @@ format_odp_tnl_push_header(struct ds *ds, struct ovs_action_push_tnl *data) options++; } ds_put_format(ds, ")"); + } else if (data->tnl_type == OVS_VPORT_TYPE_GTPU) { + const struct gtpuhdr *gtph; + + gtph = format_udp_tnl_push_header(ds, udp); + + ds_put_format(ds, "gtpu(flags=0x%"PRIx32 + ",msgtype=0x%"PRIx32",teid=0x%"PRIx32")", + gtph->flags, gtph->msgtype, + ntohl(get_16aligned_be32(>ph->teid))); } ds_put_format(ds, ")"); } @@ -2373,6 +2382,8 @@ static const struct attr_len_tbl ovs_tun_key_attr_lens[OVS_TUNNEL_KEY_ATTR_MAX + [OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS] = { .len = ATTR_LEN_NESTED, .next = ovs_vxlan_ext_attr_lens , .next_max = OVS_VXLAN_EXT_MAX}, + [OVS_TUNNEL_KEY_ATTR_GTPU_FLAGS] = { .len = 1 }, + [OVS_TUNNEL_KEY_ATTR_GTPU_MSGTYPE] = { .len = 1 }, [OVS_TUNNEL_KEY_ATTR_IPV6_SRC] = { .len = 16 }, [OVS_TUNNEL_KEY_ATTR_IPV6_DST] = { .len = 16 }, }; @@ -2698,6 +2709,12 @@ odp_tun_key_from_attr__(const struct nlattr *attr, bool is_mask, case OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS: tun_metadata_from_geneve_nlattr(a, is_mask, tun); break; + case OVS_TUNNEL_KEY_ATTR_GTPU_FLAGS: + tun->gtpu_flags = nl_attr_get_u8(a); + break; + case OVS_TUNNEL_KEY_ATTR_GTPU_MSGTYPE: + tun->gtpu_msgtype = nl_attr_get_u8(a); + break; default: /* Allow this to show up as unexpected, if there are unknown @@ -2775,6 +2792,13 @@ tun_key_to_attr(struct ofpbuf *a, const struct flow_tnl *tun_key, (tun_key->gbp_flags << 16) | ntohs(tun_key->gbp_id)); nl_msg_end_nested(a, vxlan_opts_ofs); } + if (tun_key->gtpu_flags) { + nl_msg_put_u8(a, OVS_TUNNEL_KEY_ATTR_GTPU_FLAGS, tun_key->gtpu_flags); + } + if (tun_key->gtpu_msgtype) { + nl_msg_put_u8(a, OVS_TUNNEL_KEY_ATTR_GTPU_MSGTYPE, + tun_key->gtpu_msgtype); + } tun_metadata_to_geneve_nlattr(tun_key, tun_flow_key, key_buf, a); nl_msg_end_nested(a, tun_key_ofs); @@ -3477,6 +3501,14 @@ format_odp_tun_attr(const struct nlattr *attr, const struct nlattr *mask_attr, format_odp_tun_geneve(a, ma, ds, verbose); ds_put_cstr(ds, "),"); break; + case OVS_TUNNEL_KEY_ATTR_GTPU_FLAGS: + format_u8x(ds, "gtpu_flags", nl_attr_get_u8(a), + ma ? nl_attr_get(ma) : NULL, verbose); + break; + case OVS_TUNNEL_KEY_ATTR_GTPU_MSGTYPE: + format_u8x(ds, "gtpu_msgtype", nl_attr_get_u8(a), + ma ? nl_attr_get(ma) : NULL, verbose); + break; case OVS_TUNNEL_KEY_ATTR_PAD: break; case __OVS_TUNNEL_KEY_ATTR_MAX: diff --git a/lib/packets.h b/lib/packets.h index 9a71aa3..709e9cb 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -1306,6 +1306,23 @@ BUILD_ASSERT_DECL(sizeof(struct vxlanhdr) == 8); #define VXLAN_F_GPE 0x4000 #define VXLAN_HF_GPE 0x04000000 +/* GTP-U protocol header */ +struct gtpuhdr { + uint8_t flags; + uint8_t msgtype; + ovs_be16 len; + ovs_16aligned_be32 teid; +}; + +/* GTP-U UDP port */ +#define GTPU_DST_PORT 2152 + +/* Default GTP-U flags */ +#define GTPU_FLAGS_DEFAULT 0x30 + +/* GTP-U message type for normal user plane PDU */ +#define GTPU_MSGTYPE_GPDU 255 + /* Input values for PACKET_TYPE macros have to be in host byte order. * The _BE postfix indicates result is in network byte order. Otherwise result * is in host byte order. */ diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c index b814f7a..cb8fab8 100644 --- a/lib/tnl-ports.c +++ b/lib/tnl-ports.c @@ -177,6 +177,9 @@ tnl_type_to_nw_proto(const char type[]) if (!strcmp(type, "vxlan")) { return IPPROTO_UDP; } + if (!strcmp(type, "gtpu")) { + return IPPROTO_UDP; + } return 0; } diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index cc450a8..9438d8b 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3270,6 +3270,7 @@ propagate_tunnel_data_to_flow(struct xlate_ctx *ctx, struct eth_addr dmac, break; case OVS_VPORT_TYPE_VXLAN: case OVS_VPORT_TYPE_GENEVE: + case OVS_VPORT_TYPE_GTPU: nw_proto = IPPROTO_UDP; break; case OVS_VPORT_TYPE_LISP: diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c index e0214ce..becb752 100644 --- a/ofproto/tunnel.c +++ b/ofproto/tunnel.c @@ -384,6 +384,12 @@ tnl_wc_init(struct flow *flow, struct flow_wildcards *wc) wc->masks.tunnel.tp_src = 0; wc->masks.tunnel.tp_dst = 0; + /* GTP-U header are set to be always unwildcarded for GTP-U packets*/ + if (flow->tunnel.gtpu_flags || flow->tunnel.gtpu_msgtype) { + wc->masks.tunnel.gtpu_flags = UINT8_MAX; + wc->masks.tunnel.gtpu_msgtype = UINT8_MAX; + } + if (is_ip_any(flow) && IP_ECN_is_ce(flow->tunnel.ip_tos)) { wc->masks.nw_tos |= IP_ECN_MASK; From patchwork Fri Mar 2 12:32:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang, Yi" X-Patchwork-Id: 880494 X-Patchwork-Delegate: ian.stokes@intel.com 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=none (p=none dis=none) header.from=intel.com 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 3zt85b0bqYz9sW5 for ; Fri, 2 Mar 2018 23:40:03 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 3621C10BD; Fri, 2 Mar 2018 12:38:51 +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 4967D10A0 for ; Fri, 2 Mar 2018 12:38:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B5909466 for ; Fri, 2 Mar 2018 12:38:48 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2018 04:38:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,412,1515484800"; d="scan'208";a="34131842" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.224.185]) by fmsmga004.fm.intel.com with ESMTP; 02 Mar 2018 04:38:47 -0800 From: Yi Yang To: dev@openvswitch.org Date: Fri, 2 Mar 2018 20:32:01 +0800 Message-Id: <1519993921-120968-3-git-send-email-yi.y.yang@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1519993921-120968-1-git-send-email-yi.y.yang@intel.com> References: <1519993921-120968-1-git-send-email-yi.y.yang@intel.com> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Feng Yang Subject: [ovs-dev] [PATCH v1 2/2] Add GTP-U unit test cases 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: Feng Yang This patch adds a basic GTP-U test case to tests/tunnel.at, GTP-U pop and push test cases to tests/tunnel-push-pop.at. Signed-off-by: Feng Yang Signed-off-by: Yi Yang --- tests/tunnel-push-pop.at | 19 +++++++++++++++++++ tests/tunnel.at | 13 +++++++++++++ 2 files changed, 32 insertions(+) diff --git a/tests/tunnel-push-pop.at b/tests/tunnel-push-pop.at index cc8b1b5..cc836c3 100644 --- a/tests/tunnel-push-pop.at +++ b/tests/tunnel-push-pop.at @@ -18,6 +18,8 @@ AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \ options:remote_ip=1.1.2.92 options:key=456 options:packet_type=legacy_l3 ofport_request=7\ -- add-port int-br t7 -- set Interface t7 type=vxlan \ options:remote_ip=1.1.2.92 options:key=345 options:exts=gpe ofport_request=8\ + -- add-port int-br t8 -- set Interface t8 type=gtpu \ + options:remote_ip=1.1.2.92 options:key=123 ofport_request=9\ ], [0]) AT_CHECK([ovs-appctl dpif/show], [0], [dnl @@ -34,6 +36,7 @@ dummy@ovs-dummy: hit:0 missed:0 t5 6/6081: (geneve: egress_pkt_mark=1234, out_key=flow, remote_ip=1.1.2.93) t6 7/3: (gre: key=456, packet_type=legacy_l3, remote_ip=1.1.2.92) t7 8/4789: (vxlan: key=345, remote_ip=1.1.2.92) + t8 9/2152: (gtpu: key=123, remote_ip=1.1.2.92) ]) dnl First setup dummy interface IP address, then add the route @@ -81,6 +84,7 @@ AT_CHECK([ovs-appctl tnl/neigh/show | tail -n+3 | sort], [0], [dnl AT_CHECK([ovs-appctl tnl/ports/show |sort], [0], [dnl Listening ports: genev_sys_6081 (6081) ref_cnt=2 +gptu_sys_2152 (2152) ref_cnt=1 gre_sys (3) ref_cnt=2 vxlan_sys_4789 (4789) ref_cnt=3 ]) @@ -109,6 +113,12 @@ AT_CHECK([tail -1 stdout], [0], [Datapath actions: tnl_pop(6081) ]) +dnl Check GTP-U tunnel pop +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=2152)'], [0], [stdout]) +AT_CHECK([tail -1 stdout], [0], + [Datapath actions: tnl_pop(2152) +]) + dnl Check VXLAN tunnel push AT_CHECK([ovs-ofctl add-flow int-br action=2]) AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) @@ -166,6 +176,13 @@ AT_CHECK([tail -1 stdout], [0], [Datapath actions: tnl_push(tnl_port(6081),header(size=58,type=5,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=6081,csum=0x0),geneve(crit,vni=0x7b,options({class=0xffff,type=0x80,len=4,0xa}))),out_port(100)) ]) +dnl Check GTP-U tunnel push +AT_CHECK([ovs-ofctl add-flow int-br action=9]) +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) +AT_CHECK([tail -1 stdout], [0], + [Datapath actions: pop_eth,tnl_push(tnl_port(2152),header(size=50,type=6,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=2152,dst=2152,csum=0x0),gtpu(flags=0x30,msgtype=0xff,teid=0x7b)),out_port(100)) +]) + dnl Check decapsulation of GRE packet AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab6408004500007e79464000402fba550101025c0101025820006558000001c8fe71d883724fbeb6f4e1494a080045000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637']) AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab6408004500007e79464000402fba550101025c0101025820006558000001c8fe71d883724fbeb6f4e1494a080045000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637']) @@ -230,6 +247,7 @@ dnl Check tunnel lookup entries after deleting/reconfiguring some ports AT_CHECK([ovs-appctl tnl/ports/show |sort], [0], [dnl Listening ports: genev_sys_6081 (6081) ref_cnt=1 +gptu_sys_2152 (2152) ref_cnt=1 gre_sys (3) ref_cnt=1 vxlan_sys_4789 (4789) ref_cnt=2 vxlan_sys_4790 (4790) ref_cnt=1 @@ -240,6 +258,7 @@ AT_CHECK([ovs-vsctl del-port int-br t1 \ -- del-port int-br t4 \ -- del-port int-br t6 \ -- del-port int-br t7 \ + -- del-port int-br t8 \ ], [0]) dnl Check tunnel lookup entries after deleting all remaining tunnel ports diff --git a/tests/tunnel.at b/tests/tunnel.at index 3c217b3..5eaef84 100644 --- a/tests/tunnel.at +++ b/tests/tunnel.at @@ -406,6 +406,19 @@ AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl OVS_VSWITCHD_STOP AT_CLEANUP + +AT_SETUP([tunnel - GTP-U]) +OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gtpu \ + options:remote_ip=1.1.1.1 ofport_request=1]) + +AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl + br0 65534/100: (dummy-internal) + p1 1/2152: (gtpu: remote_ip=1.1.1.1) +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([tunnel - different VXLAN UDP port]) OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \ options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=4341])