From ef486b1545d892f9f0e0d35e7e57cb0ca04d7ff7 Mon Sep 17 00:00:00 2001
From: Hongjun Ni <hongjun.ni@intel.com>
Date: Wed, 12 Apr 2017 19:21:16 +0800
Subject: Add GTP-U plugin. VPP-694

Basic GTP-U feature

Change-Id: I31226f890a92c5303ac06e112ed7820cae52d9bd
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
---
 src/plugins/gtpu/gtpu_error.def | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 src/plugins/gtpu/gtpu_error.def

(limited to 'src/plugins/gtpu/gtpu_error.def')

diff --git a/src/plugins/gtpu/gtpu_error.def b/src/plugins/gtpu/gtpu_error.def
new file mode 100644
index 00000000..a55b2026
--- /dev/null
+++ b/src/plugins/gtpu/gtpu_error.def
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+gtpu_error (DECAPSULATED, "good packets decapsulated")
+gtpu_error (NO_SUCH_TUNNEL, "no such tunnel packets")
+gtpu_error (BAD_VER, "packets with bad version in gtpu header")
+gtpu_error (BAD_FLAGS, "packets with bad flags field in gtpu header")
-- 
cgit 1.2.3-korg


From ccd4a6588c6f486f7616286b054a5ac123f5c502 Mon Sep 17 00:00:00 2001
From: Hongjun Ni <hongjun.ni@intel.com>
Date: Thu, 1 Jun 2017 00:24:12 +0800
Subject: Add l3 routing for GTP-U decap

Change-Id: Ic3c8cd58cb2b02622299cf74c9efcabd2ef2b513
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
---
 src/plugins/gtpu/gtpu.api         |  6 +++---
 src/plugins/gtpu/gtpu.c           | 13 +++++++++++--
 src/plugins/gtpu/gtpu.h           |  6 ++++--
 src/plugins/gtpu/gtpu_all_api_h.h |  2 +-
 src/plugins/gtpu/gtpu_api.c       |  2 +-
 src/plugins/gtpu/gtpu_decap.c     |  2 +-
 src/plugins/gtpu/gtpu_encap.c     |  2 +-
 src/plugins/gtpu/gtpu_error.def   |  2 +-
 src/plugins/gtpu/gtpu_msg_enum.h  |  2 +-
 src/plugins/gtpu/gtpu_test.c      |  2 +-
 10 files changed, 25 insertions(+), 14 deletions(-)

(limited to 'src/plugins/gtpu/gtpu_error.def')

diff --git a/src/plugins/gtpu/gtpu.api b/src/plugins/gtpu/gtpu.api
index b11670b3..55ba0390 100644
--- a/src/plugins/gtpu/gtpu.api
+++ b/src/plugins/gtpu/gtpu.api
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
@@ -13,7 +13,7 @@
  * limitations under the License.
  */
 
-/** \brief /** \brief Set or delete an GTPU tunnel
+/** \brief Set or delete an GTPU tunnel
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
     @param is_add - add address if non-zero, else delete
@@ -63,7 +63,7 @@ define gtpu_tunnel_dump
   u32 sw_if_index;
 };
 
-/** \brief /** \brief dump details of an GTPU tunnel
+/** \brief dump details of an GTPU tunnel
     @param context - sender context, to match reply w/ request
     @param sw_if_index - software index of the interface
     @param is_ipv6 - src_address and dst_address is ipv6 or not
diff --git a/src/plugins/gtpu/gtpu.c b/src/plugins/gtpu/gtpu.c
index 6a5c5a34..c91612ef 100644
--- a/src/plugins/gtpu/gtpu.c
+++ b/src/plugins/gtpu/gtpu.c
@@ -1,6 +1,6 @@
 /*
  *------------------------------------------------------------------
- * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
@@ -45,6 +45,10 @@ format_decap_next (u8 * s, va_list * args)
       return format (s, "drop");
     case GTPU_INPUT_NEXT_L2_INPUT:
       return format (s, "l2");
+    case GTPU_INPUT_NEXT_IP4_INPUT:
+      return format (s, "ip4");
+    case GTPU_INPUT_NEXT_IP6_INPUT:
+      return format (s, "ip6");
     default:
       return format (s, "index %d", next_index);
     }
@@ -649,12 +653,17 @@ unformat_decap_next (unformat_input_t * input, va_list * args)
 
   if (unformat (input, "l2"))
     *result = GTPU_INPUT_NEXT_L2_INPUT;
+  else if (unformat (input, "ip4"))
+    *result = GTPU_INPUT_NEXT_IP4_INPUT;
+  else if (unformat (input, "ip6"))
+    *result = GTPU_INPUT_NEXT_IP6_INPUT;
   else if (unformat (input, "node %U", unformat_vlib_node, vm, &node_index))
     *result = get_decap_next_for_node (node_index, ipv4_set);
   else if (unformat (input, "%d", &tmp))
     *result = tmp;
   else
     return 0;
+
   return 1;
 }
 
@@ -871,7 +880,7 @@ VLIB_CLI_COMMAND (create_gtpu_tunnel_command, static) = {
   .short_help =
   "create gtpu tunnel src <local-vtep-addr>"
   " {dst <remote-vtep-addr>|group <mcast-vtep-addr> <intf-name>} teid <nn>"
-  " [encap-vrf-id <nn>] [decap-next [l2|node <name>]] [del]",
+  " [encap-vrf-id <nn>] [decap-next [l2|ip4|ip6|node <name>]] [del]",
   .function = gtpu_add_del_tunnel_command_fn,
 };
 /* *INDENT-ON* */
diff --git a/src/plugins/gtpu/gtpu.h b/src/plugins/gtpu/gtpu.h
index 86861974..744d21d4 100644
--- a/src/plugins/gtpu/gtpu.h
+++ b/src/plugins/gtpu/gtpu.h
@@ -1,6 +1,6 @@
 /*
  *------------------------------------------------------------------
- * Copyright (c) 2016 Intel and/or its affiliates.
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
@@ -172,7 +172,9 @@ typedef struct
 
 #define foreach_gtpu_input_next        \
 _(DROP, "error-drop")                  \
-_(L2_INPUT, "l2-input")
+_(L2_INPUT, "l2-input")                \
+_(IP4_INPUT,  "ip4-input")             \
+_(IP6_INPUT, "ip6-input" )
 
 typedef enum
 {
diff --git a/src/plugins/gtpu/gtpu_all_api_h.h b/src/plugins/gtpu/gtpu_all_api_h.h
index a4181ae3..dbfe0397 100644
--- a/src/plugins/gtpu/gtpu_all_api_h.h
+++ b/src/plugins/gtpu/gtpu_all_api_h.h
@@ -1,7 +1,7 @@
 /*
  * gtpu_all_api_h.h - plug-in api #include file
  *
- * Copyright (c) Intel and/or its affiliates.
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
diff --git a/src/plugins/gtpu/gtpu_api.c b/src/plugins/gtpu/gtpu_api.c
index 58f48c71..49a5053d 100644
--- a/src/plugins/gtpu/gtpu_api.c
+++ b/src/plugins/gtpu/gtpu_api.c
@@ -2,7 +2,7 @@
  *------------------------------------------------------------------
  * gtpu_api.c - gtpu api
  *
- * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
diff --git a/src/plugins/gtpu/gtpu_decap.c b/src/plugins/gtpu/gtpu_decap.c
index b0be32ec..fc74e7cb 100644
--- a/src/plugins/gtpu/gtpu_decap.c
+++ b/src/plugins/gtpu/gtpu_decap.c
@@ -1,7 +1,7 @@
 /*
  * decap.c: gtpu tunnel decap packet processing
  *
- * Copyright (c) 2013 Cisco and/or its affiliates.
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
diff --git a/src/plugins/gtpu/gtpu_encap.c b/src/plugins/gtpu/gtpu_encap.c
index ef109c66..adacf4c9 100644
--- a/src/plugins/gtpu/gtpu_encap.c
+++ b/src/plugins/gtpu/gtpu_encap.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Cisco and/or its affiliates.
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
diff --git a/src/plugins/gtpu/gtpu_error.def b/src/plugins/gtpu/gtpu_error.def
index a55b2026..093a886f 100644
--- a/src/plugins/gtpu/gtpu_error.def
+++ b/src/plugins/gtpu/gtpu_error.def
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Cisco and/or its affiliates.
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
diff --git a/src/plugins/gtpu/gtpu_msg_enum.h b/src/plugins/gtpu/gtpu_msg_enum.h
index 6a2ea448..358a220a 100644
--- a/src/plugins/gtpu/gtpu_msg_enum.h
+++ b/src/plugins/gtpu/gtpu_msg_enum.h
@@ -1,7 +1,7 @@
 /*
  * gtpu_msg_enum.h - vpp engine plug-in message enumeration
  *
- * Copyright (c) <current-year> <your-organization>
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
diff --git a/src/plugins/gtpu/gtpu_test.c b/src/plugins/gtpu/gtpu_test.c
index 91c5c616..e7fd0d54 100644
--- a/src/plugins/gtpu/gtpu_test.c
+++ b/src/plugins/gtpu/gtpu_test.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Intel and/or its affiliates.
+ * Copyright (c) 2017 Intel and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
-- 
cgit 1.2.3-korg

