Add l3 routing for GTP-U decap 48/6948/3
authorHongjun Ni <hongjun.ni@intel.com>
Wed, 31 May 2017 16:24:12 +0000 (00:24 +0800)
committerDamjan Marion <dmarion.lists@gmail.com>
Fri, 2 Jun 2017 09:11:20 +0000 (09:11 +0000)
Change-Id: Ic3c8cd58cb2b02622299cf74c9efcabd2ef2b513
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
src/plugins/gtpu/gtpu.api
src/plugins/gtpu/gtpu.c
src/plugins/gtpu/gtpu.h
src/plugins/gtpu/gtpu_all_api_h.h
src/plugins/gtpu/gtpu_api.c
src/plugins/gtpu/gtpu_decap.c
src/plugins/gtpu/gtpu_encap.c
src/plugins/gtpu/gtpu_error.def
src/plugins/gtpu/gtpu_msg_enum.h
src/plugins/gtpu/gtpu_test.c

index b11670b..55ba039 100644 (file)
@@ -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
index 6a5c5a3..c91612e 100644 (file)
@@ -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* */
index 8686197..744d21d 100644 (file)
@@ -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
 {
index a4181ae..dbfe039 100644 (file)
@@ -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:
index 58f48c7..49a5053 100644 (file)
@@ -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:
index b0be32e..fc74e7c 100644 (file)
@@ -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:
index ef109c6..adacf4c 100644 (file)
@@ -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:
index a55b202..093a886 100644 (file)
@@ -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:
index 6a2ea44..358a220 100644 (file)
@@ -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:
index 91c5c61..e7fd0d5 100644 (file)
@@ -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: