};
/* *INDENT-on* */
+u8 * format_gtpu_encap_trace (u8 * s, va_list * args)
+{
+ CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
+ CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
+ gtpu_encap_trace_t * t
+ = va_arg (*args, gtpu_encap_trace_t *);
+
+ s = format (s, "GTPU encap to gtpu_tunnel%d teid %d",
+ t->tunnel_index, t->teid);
+ return s;
+}
+
static u8 *
format_decap_next (u8 * s, va_list * args)
{
hash_unset_mem_free (>pu_main.mcast_shared, dst);
}
-static inline fib_protocol_t
-fib_ip_proto (bool is_ip6)
-{
- return (is_ip6) ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4;
-}
-
int vnet_gtpu_add_del_tunnel
(vnet_gtpu_add_del_tunnel_args_t * a, u32 * sw_if_indexp)
{
return VNET_API_ERROR_INVALID_DECAP_NEXT;
pool_get_aligned (gtm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
/* copy from arg structure */
#define _(x) t->x = a->x;
else
{
/* Multicast tunnel -
- * as the same mcast group can be used for mutiple mcast tunnels
- * with different VNIs, create the output fib adjecency only if
+ * as the same mcast group can be used for multiple mcast tunnels
+ * with different VNIs, create the output adjacency only if
* it does not already exist
*/
fib_protocol_t fp = fib_ip_proto (is_ip6);
.frp_addr = zero_addr,
.frp_sw_if_index = 0xffffffff,
.frp_fib_index = ~0,
- .frp_weight = 0,
+ .frp_weight = 1,
.frp_flags = FIB_ROUTE_PATH_LOCAL,
+ .frp_mitf_flags = MFIB_ITF_FLAG_FORWARD,
};
const mfib_prefix_t mpfx = {
.fp_proto = fp,
* - the accepting interface is that from the API
*/
mfib_table_entry_path_update (t->encap_fib_index,
- &mpfx,
- MFIB_SOURCE_GTPU,
- &path, MFIB_ITF_FLAG_FORWARD);
+ &mpfx, MFIB_SOURCE_GTPU, &path);
path.frp_sw_if_index = a->mcast_sw_if_index;
path.frp_flags = FIB_ROUTE_PATH_FLAG_NONE;
+ path.frp_mitf_flags = MFIB_ITF_FLAG_ACCEPT;
mfei = mfib_table_entry_path_update (t->encap_fib_index,
&mpfx,
- MFIB_SOURCE_GTPU,
- &path,
- MFIB_ITF_FLAG_ACCEPT);
+ MFIB_SOURCE_GTPU, &path);
/*
* Create the mcast adjacency to send traffic to the group
si->flags |= VNET_SW_INTERFACE_FLAG_HIDDEN;
/* make sure tunnel is removed from l2 bd or xconnect */
- set_int_l2_mode (gtm->vlib_main, vnm, MODE_L3, t->sw_if_index, 0, 0, 0,
- 0);
+ set_int_l2_mode (gtm->vlib_main, vnm, MODE_L3, t->sw_if_index, 0,
+ L2_BD_PORT_TYPE_NORMAL, 0, 0);
vec_add1 (gtm->free_gtpu_tunnel_hw_if_indices, t->hw_if_index);
gtm->tunnel_index_by_sw_if_index[t->sw_if_index] = ~0;
if (sw_if_indexp)
*sw_if_indexp = sw_if_index;
+ if (a->is_add)
+ {
+ /* register udp ports */
+ if (!is_ip6 && !udp_is_valid_dst_port (UDP_DST_PORT_GTPU, 1))
+ udp_register_dst_port (gtm->vlib_main, UDP_DST_PORT_GTPU,
+ gtpu4_input_node.index, /* is_ip4 */ 1);
+ if (is_ip6 && !udp_is_valid_dst_port (UDP_DST_PORT_GTPU6, 0))
+ udp_register_dst_port (gtm->vlib_main, UDP_DST_PORT_GTPU6,
+ gtpu6_input_node.index, /* is_ip4 */ 0);
+ }
+
return 0;
}
clib_error_t *error = NULL;
/* Cant "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&src, 0, sizeof src);
- memset (&dst, 0, sizeof dst);
+ clib_memset (&src, 0, sizeof src);
+ clib_memset (&dst, 0, sizeof dst);
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->is_ip6 = ipv6_set;
* ip4-lookup [2]
* @cliexend
*
- * Example of how to display the feature enabed on an interface:
+ * Example of how to display the feature enabled on an interface:
* @cliexstart{show ip interface features GigabitEthernet2/0/0}
* IP feature paths configured on GigabitEthernet2/0/0...
* ...
* ip6-lookup [2]
* @cliexend
*
- * Example of how to display the feature enabed on an interface:
+ * Example of how to display the feature enabled on an interface:
* @cliexstart{show ip interface features GigabitEthernet2/0/0}
* IP feature paths configured on GigabitEthernet2/0/0...
* ...
sizeof (ip46_address_t),
sizeof (mcast_shared_t));
- udp_register_dst_port (vm, UDP_DST_PORT_GTPU,
- gtpu4_input_node.index, /* is_ip4 */ 1);
- udp_register_dst_port (vm, UDP_DST_PORT_GTPU6,
- gtpu6_input_node.index, /* is_ip4 */ 0);
-
gtm->fib_node_type = fib_node_register_new_type (>pu_vft);
return 0;
/* *INDENT-OFF* */
VLIB_PLUGIN_REGISTER () = {
.version = VPP_BUILD_VER,
- .description = "GTPv1-U",
+ .description = "GPRS Tunnelling Protocol, User Data (GTPv1-U)",
};
/* *INDENT-ON* */