2 * gre_interface.c: gre interfaces
4 * Copyright (c) 2012 Cisco and/or its affiliates.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include <vnet/vnet.h>
20 #include <vnet/ip/format.h>
21 #include <vnet/fib/fib_table.h>
22 #include <vnet/adj/adj_midchain.h>
23 #include <vnet/adj/adj_nbr.h>
24 #include <vnet/mpls/mpls.h>
25 #include <vnet/l2/l2_input.h>
26 #include <vnet/teib/teib.h>
29 format_gre_tunnel_type (u8 *s, va_list *args)
31 gre_tunnel_type_t type = va_arg (*args, int);
36 case GRE_TUNNEL_TYPE_##n: \
37 s = format (s, "%s", v); \
39 foreach_gre_tunnel_type
47 format_gre_tunnel (u8 *s, va_list *args)
49 gre_tunnel_t *t = va_arg (*args, gre_tunnel_t *);
51 s = format (s, "[%d] instance %d src %U dst %U fib-idx %d sw-if-idx %d ",
52 t->dev_instance, t->user_instance, format_ip46_address,
53 &t->tunnel_src, IP46_TYPE_ANY, format_ip46_address,
54 &t->tunnel_dst.fp_addr, IP46_TYPE_ANY, t->outer_fib_index,
57 s = format (s, "payload %U ", format_gre_tunnel_type, t->type);
58 s = format (s, "%U ", format_tunnel_mode, t->mode);
60 if (t->type == GRE_TUNNEL_TYPE_ERSPAN)
61 s = format (s, "session %d ", t->session_id);
63 if (t->type != GRE_TUNNEL_TYPE_L3)
64 s = format (s, "l2-adj-idx %d ", t->l2_adj_index);
70 gre_tunnel_db_find (const vnet_gre_tunnel_add_del_args_t *a,
71 u32 outer_fib_index, gre_tunnel_key_t *key)
73 gre_main_t *gm = &gre_main;
78 gre_mk_key4 (a->src.ip4, a->dst.ip4, outer_fib_index, a->type, a->mode,
79 a->session_id, &key->gtk_v4);
80 p = hash_get_mem (gm->tunnel_by_key4, &key->gtk_v4);
84 gre_mk_key6 (&a->src.ip6, &a->dst.ip6, outer_fib_index, a->type, a->mode,
85 a->session_id, &key->gtk_v6);
86 p = hash_get_mem (gm->tunnel_by_key6, &key->gtk_v6);
92 return (pool_elt_at_index (gm->tunnels, p[0]));
96 gre_tunnel_db_add (gre_tunnel_t *t, gre_tunnel_key_t *key)
98 gre_main_t *gm = &gre_main;
100 if (t->tunnel_dst.fp_proto == FIB_PROTOCOL_IP6)
102 hash_set_mem_alloc (&gm->tunnel_by_key6, &key->gtk_v6, t->dev_instance);
106 hash_set_mem_alloc (&gm->tunnel_by_key4, &key->gtk_v4, t->dev_instance);
111 gre_tunnel_db_remove (gre_tunnel_t *t, gre_tunnel_key_t *key)
113 gre_main_t *gm = &gre_main;
115 if (t->tunnel_dst.fp_proto == FIB_PROTOCOL_IP6)
117 hash_unset_mem_free (&gm->tunnel_by_key6, &key->gtk_v6);
121 hash_unset_mem_free (&gm->tunnel_by_key4, &key->gtk_v4);
128 * 'stack' (resolve the recursion for) the tunnel's midchain adjacency
131 gre_tunnel_stack (adj_index_t ai)
133 gre_main_t *gm = &gre_main;
139 sw_if_index = adj->rewrite_header.sw_if_index;
141 if ((vec_len (gm->tunnel_index_by_sw_if_index) <= sw_if_index) ||
142 (~0 == gm->tunnel_index_by_sw_if_index[sw_if_index]))
145 gt = pool_elt_at_index (gm->tunnels,
146 gm->tunnel_index_by_sw_if_index[sw_if_index]);
148 if ((vnet_hw_interface_get_flags (vnet_get_main (), gt->hw_if_index) &
149 VNET_HW_INTERFACE_FLAG_LINK_UP) == 0)
151 adj_midchain_delegate_unstack (ai);
155 adj_midchain_delegate_stack (ai, gt->outer_fib_index, >->tunnel_dst);
162 * 'stack' (resolve the recursion for) the tunnel's midchain adjacency
165 mgre_tunnel_stack (adj_index_t ai)
167 gre_main_t *gm = &gre_main;
168 const ip_adjacency_t *adj;
169 const gre_tunnel_t *gt;
173 sw_if_index = adj->rewrite_header.sw_if_index;
175 if ((vec_len (gm->tunnel_index_by_sw_if_index) <= sw_if_index) ||
176 (~0 == gm->tunnel_index_by_sw_if_index[sw_if_index]))
179 gt = pool_elt_at_index (gm->tunnels,
180 gm->tunnel_index_by_sw_if_index[sw_if_index]);
182 if ((vnet_hw_interface_get_flags (vnet_get_main (), gt->hw_if_index) &
183 VNET_HW_INTERFACE_FLAG_LINK_UP) == 0)
185 adj_midchain_delegate_unstack (ai);
189 const teib_entry_t *ne;
191 ne = teib_entry_find_46 (sw_if_index, adj->ia_nh_proto,
192 &adj->sub_type.nbr.next_hop);
194 teib_entry_adj_stack (ne, ai);
199 * @brief Call back when restacking all adjacencies on a GRE interface
202 gre_adj_walk_cb (adj_index_t ai, void *ctx)
204 gre_tunnel_stack (ai);
206 return (ADJ_WALK_RC_CONTINUE);
209 mgre_adj_walk_cb (adj_index_t ai, void *ctx)
211 mgre_tunnel_stack (ai);
213 return (ADJ_WALK_RC_CONTINUE);
217 gre_tunnel_restack (gre_tunnel_t *gt)
219 fib_protocol_t proto;
222 * walk all the adjacencies on th GRE interface and restack them
224 FOR_EACH_FIB_IP_PROTOCOL (proto)
228 case TUNNEL_MODE_P2P:
229 adj_nbr_walk (gt->sw_if_index, proto, gre_adj_walk_cb, NULL);
232 adj_nbr_walk (gt->sw_if_index, proto, mgre_adj_walk_cb, NULL);
239 gre_teib_mk_key (const gre_tunnel_t *t, const teib_entry_t *ne,
240 gre_tunnel_key_t *key)
242 const fib_prefix_t *nh;
244 nh = teib_entry_get_nh (ne);
246 /* construct the key using mode P2P so it can be found in the DP */
247 if (FIB_PROTOCOL_IP4 == nh->fp_proto)
248 gre_mk_key4 (t->tunnel_src.ip4, nh->fp_addr.ip4,
249 teib_entry_get_fib_index (ne), t->type, TUNNEL_MODE_P2P, 0,
252 gre_mk_key6 (&t->tunnel_src.ip6, &nh->fp_addr.ip6,
253 teib_entry_get_fib_index (ne), t->type, TUNNEL_MODE_P2P, 0,
258 * An TEIB entry has been added
261 gre_teib_entry_added (const teib_entry_t *ne)
263 gre_main_t *gm = &gre_main;
264 const ip_address_t *nh;
265 gre_tunnel_key_t key;
270 sw_if_index = teib_entry_get_sw_if_index (ne);
271 if (vec_len (gm->tunnel_index_by_sw_if_index) < sw_if_index)
274 t_idx = gm->tunnel_index_by_sw_if_index[sw_if_index];
276 if (INDEX_INVALID == t_idx)
279 /* entry has been added on an interface for which there is a GRE tunnel */
280 t = pool_elt_at_index (gm->tunnels, t_idx);
282 if (t->mode != TUNNEL_MODE_MP)
285 /* the next-hop (underlay) of the NHRP entry will form part of the key for
286 * ingress lookup to match packets to this interface */
287 gre_teib_mk_key (t, ne, &key);
288 gre_tunnel_db_add (t, &key);
290 /* update the rewrites for each of the adjacencies for this peer (overlay)
291 * using the next-hop (underlay) */
292 mgre_walk_ctx_t ctx = { .t = t, .ne = ne };
293 nh = teib_entry_get_peer (ne);
295 teib_entry_get_sw_if_index (ne),
296 (AF_IP4 == ip_addr_version (nh) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6),
297 &ip_addr_46 (nh), mgre_mk_complete_walk, &ctx);
301 gre_teib_entry_deleted (const teib_entry_t *ne)
303 gre_main_t *gm = &gre_main;
304 const ip_address_t *nh;
305 gre_tunnel_key_t key;
310 sw_if_index = teib_entry_get_sw_if_index (ne);
311 if (vec_len (gm->tunnel_index_by_sw_if_index) < sw_if_index)
314 t_idx = gm->tunnel_index_by_sw_if_index[sw_if_index];
316 if (INDEX_INVALID == t_idx)
319 t = pool_elt_at_index (gm->tunnels, t_idx);
321 /* remove the next-hop as an ingress lookup key */
322 gre_teib_mk_key (t, ne, &key);
323 gre_tunnel_db_remove (t, &key);
325 nh = teib_entry_get_peer (ne);
327 /* make all the adjacencies incomplete */
329 teib_entry_get_sw_if_index (ne),
330 (AF_IP4 == ip_addr_version (nh) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6),
331 &ip_addr_46 (nh), mgre_mk_incomplete_walk, t);
335 gre_tunnel_delete_teib_walk (index_t nei, void *ctx)
337 gre_tunnel_t *t = ctx;
338 gre_tunnel_key_t key;
340 gre_teib_mk_key (t, teib_entry_get (nei), &key);
341 gre_tunnel_db_remove (t, &key);
343 return (WALK_CONTINUE);
347 gre_tunnel_add_teib_walk (index_t nei, void *ctx)
349 gre_tunnel_t *t = ctx;
350 gre_tunnel_key_t key = {};
352 gre_teib_mk_key (t, teib_entry_get (nei), &key);
353 gre_tunnel_db_add (t, &key);
355 return (WALK_CONTINUE);
359 vnet_gre_tunnel_add (vnet_gre_tunnel_add_del_args_t *a, u32 outer_fib_index,
362 gre_main_t *gm = &gre_main;
363 vnet_main_t *vnm = gm->vnet_main;
365 vnet_hw_interface_t *hi;
366 u32 hw_if_index, sw_if_index;
367 u8 is_ipv6 = a->is_ipv6;
368 gre_tunnel_key_t key;
370 t = gre_tunnel_db_find (a, outer_fib_index, &key);
372 return VNET_API_ERROR_IF_ALREADY_EXISTS;
374 pool_get_aligned (gm->tunnels, t, CLIB_CACHE_LINE_BYTES);
375 clib_memset (t, 0, sizeof (*t));
377 /* Reconcile the real dev_instance and a possible requested instance */
378 u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */
379 u32 u_idx = a->instance; /* user specified instance */
382 if (hash_get (gm->instance_used, u_idx))
384 pool_put (gm->tunnels, t);
385 return VNET_API_ERROR_INSTANCE_IN_USE;
387 hash_set (gm->instance_used, u_idx, 1);
389 t->dev_instance = t_idx; /* actual */
390 t->user_instance = u_idx; /* name */
395 if (t->type == GRE_TUNNEL_TYPE_ERSPAN)
396 t->session_id = a->session_id;
398 if (t->type == GRE_TUNNEL_TYPE_L3)
400 if (t->mode == TUNNEL_MODE_P2P)
402 vnet_register_interface (vnm, gre_device_class.index, t_idx,
403 gre_hw_interface_class.index, t_idx);
406 vnet_register_interface (vnm, gre_device_class.index, t_idx,
407 mgre_hw_interface_class.index, t_idx);
411 vnet_eth_interface_registration_t eir = {};
413 /* Default MAC address (d00b:eed0:0000 + sw_if_index) */
415 0xd0, 0x0b, 0xee, 0xd0, (u8) (t_idx >> 8), (u8) t_idx
418 eir.dev_class_index = gre_device_class.index;
419 eir.dev_instance = t_idx;
420 eir.address = address;
421 hw_if_index = vnet_eth_register_interface (vnm, &eir);
424 /* Set GRE tunnel interface output node (not used for L3 payload) */
425 if (GRE_TUNNEL_TYPE_ERSPAN == t->type)
426 vnet_set_interface_output_node (vnm, hw_if_index,
427 gre_erspan_encap_node.index);
429 vnet_set_interface_output_node (vnm, hw_if_index,
430 gre_teb_encap_node.index);
432 hi = vnet_get_hw_interface (vnm, hw_if_index);
433 sw_if_index = hi->sw_if_index;
435 t->hw_if_index = hw_if_index;
436 t->outer_fib_index = outer_fib_index;
437 t->sw_if_index = sw_if_index;
438 t->l2_adj_index = ADJ_INDEX_INVALID;
440 vec_validate_init_empty (gm->tunnel_index_by_sw_if_index, sw_if_index, ~0);
441 gm->tunnel_index_by_sw_if_index[sw_if_index] = t_idx;
445 hi->frame_overhead = sizeof (gre_header_t) + sizeof (ip4_header_t);
446 hi->min_frame_size = hi->frame_overhead + 64;
450 hi->frame_overhead = sizeof (gre_header_t) + sizeof (ip6_header_t);
451 hi->min_frame_size = hi->frame_overhead + 64;
454 /* Standard default gre MTU. */
455 vnet_sw_interface_set_mtu (vnm, sw_if_index, 9000);
458 * source the FIB entry for the tunnel's destination
459 * and become a child thereof. The tunnel will then get poked
460 * when the forwarding for the entry updates, and the tunnel can
461 * re-stack accordingly
464 clib_memcpy (&t->tunnel_src, &a->src, sizeof (t->tunnel_src));
465 t->tunnel_dst.fp_len = !is_ipv6 ? 32 : 128;
466 t->tunnel_dst.fp_proto = !is_ipv6 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
467 t->tunnel_dst.fp_addr = a->dst;
469 gre_tunnel_db_add (t, &key);
471 if (t->mode == TUNNEL_MODE_MP)
472 teib_walk_itf (t->sw_if_index, gre_tunnel_add_teib_walk, t);
474 if (t->type == GRE_TUNNEL_TYPE_ERSPAN)
479 gre_mk_sn_key (t, &skey);
480 gre_sn = (gre_sn_t *) hash_get_mem (gm->seq_num_by_key, &skey);
488 gre_sn = clib_mem_alloc (sizeof (gre_sn_t));
490 gre_sn->ref_count = 1;
492 hash_set_mem_alloc (&gm->seq_num_by_key, &skey, (uword) gre_sn);
496 if (t->type != GRE_TUNNEL_TYPE_L3)
498 t->l2_adj_index = adj_nbr_add_or_lock (
499 t->tunnel_dst.fp_proto, VNET_LINK_ETHERNET, &zero_addr, sw_if_index);
500 vnet_set_interface_l3_output_node (gm->vlib_main, sw_if_index,
501 (u8 *) "tunnel-output-no-count");
502 gre_update_adj (vnm, t->sw_if_index, t->l2_adj_index);
506 vnet_set_interface_l3_output_node (gm->vlib_main, sw_if_index,
507 (u8 *) "tunnel-output");
510 *sw_if_indexp = sw_if_index;
512 /* register gre46-input nodes */
513 ip4_register_protocol (IP_PROTOCOL_GRE, gre4_input_node.index);
514 ip6_register_protocol (IP_PROTOCOL_GRE, gre6_input_node.index);
520 vnet_gre_tunnel_delete (vnet_gre_tunnel_add_del_args_t *a, u32 outer_fib_index,
523 gre_main_t *gm = &gre_main;
524 vnet_main_t *vnm = gm->vnet_main;
526 gre_tunnel_key_t key;
529 t = gre_tunnel_db_find (a, outer_fib_index, &key);
531 return VNET_API_ERROR_NO_SUCH_ENTRY;
533 if (t->mode == TUNNEL_MODE_MP)
534 teib_walk_itf (t->sw_if_index, gre_tunnel_delete_teib_walk, t);
536 sw_if_index = t->sw_if_index;
537 vnet_sw_interface_set_flags (vnm, sw_if_index, 0 /* down */);
539 /* make sure tunnel is removed from l2 bd or xconnect */
540 set_int_l2_mode (gm->vlib_main, vnm, MODE_L3, sw_if_index, 0,
541 L2_BD_PORT_TYPE_NORMAL, 0, 0);
542 gm->tunnel_index_by_sw_if_index[sw_if_index] = ~0;
544 if (t->type == GRE_TUNNEL_TYPE_L3)
545 vnet_delete_hw_interface (vnm, t->hw_if_index);
547 ethernet_delete_interface (vnm, t->hw_if_index);
549 if (t->l2_adj_index != ADJ_INDEX_INVALID)
551 adj_midchain_delegate_unstack (t->l2_adj_index);
552 adj_unlock (t->l2_adj_index);
555 ASSERT ((t->type != GRE_TUNNEL_TYPE_ERSPAN) || (t->gre_sn != NULL));
556 if ((t->type == GRE_TUNNEL_TYPE_ERSPAN) && (t->gre_sn->ref_count-- == 1))
559 gre_mk_sn_key (t, &skey);
560 hash_unset_mem_free (&gm->seq_num_by_key, &skey);
561 clib_mem_free (t->gre_sn);
564 vnet_reset_interface_l3_output_node (gm->vlib_main, sw_if_index);
565 hash_unset (gm->instance_used, t->user_instance);
566 gre_tunnel_db_remove (t, &key);
567 pool_put (gm->tunnels, t);
570 *sw_if_indexp = sw_if_index;
576 vnet_gre_tunnel_add_del (vnet_gre_tunnel_add_del_args_t *a, u32 *sw_if_indexp)
580 outer_fib_index = fib_table_find (
581 (a->is_ipv6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4), a->outer_table_id);
583 if (~0 == outer_fib_index)
584 return VNET_API_ERROR_NO_SUCH_FIB;
586 if (a->session_id > GTK_SESSION_ID_MAX)
587 return VNET_API_ERROR_INVALID_SESSION_ID;
589 if (a->mode == TUNNEL_MODE_MP && !ip46_address_is_zero (&a->dst))
590 return (VNET_API_ERROR_INVALID_DST_ADDRESS);
593 return (vnet_gre_tunnel_add (a, outer_fib_index, sw_if_indexp));
595 return (vnet_gre_tunnel_delete (a, outer_fib_index, sw_if_indexp));
599 gre_interface_admin_up_down (vnet_main_t *vnm, u32 hw_if_index, u32 flags)
601 gre_main_t *gm = &gre_main;
602 vnet_hw_interface_t *hi;
606 hi = vnet_get_hw_interface (vnm, hw_if_index);
608 if (NULL == gm->tunnel_index_by_sw_if_index ||
609 hi->sw_if_index >= vec_len (gm->tunnel_index_by_sw_if_index))
612 ti = gm->tunnel_index_by_sw_if_index[hi->sw_if_index];
615 /* not one of ours */
618 t = pool_elt_at_index (gm->tunnels, ti);
620 if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
621 vnet_hw_interface_set_flags (vnm, hw_if_index,
622 VNET_HW_INTERFACE_FLAG_LINK_UP);
624 vnet_hw_interface_set_flags (vnm, hw_if_index, 0 /* down */);
626 gre_tunnel_restack (t);
628 return /* no error */ 0;
631 static clib_error_t *
632 create_gre_tunnel_command_fn (vlib_main_t *vm, unformat_input_t *input,
633 vlib_cli_command_t *cmd)
635 unformat_input_t _line_input, *line_input = &_line_input;
636 vnet_gre_tunnel_add_del_args_t _a, *a = &_a;
637 ip46_address_t src = ip46_address_initializer,
638 dst = ip46_address_initializer;
640 u32 outer_table_id = 0;
641 gre_tunnel_type_t t_type = GRE_TUNNEL_TYPE_L3;
642 tunnel_mode_t t_mode = TUNNEL_MODE_P2P;
643 tunnel_encap_decap_flags_t flags = TUNNEL_ENCAP_DECAP_FLAG_NONE;
648 clib_error_t *error = NULL;
650 /* Get a line of input. */
651 if (!unformat_user (input, unformat_line_input, line_input))
654 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
656 if (unformat (line_input, "del"))
658 else if (unformat (line_input, "instance %d", &instance))
660 else if (unformat (line_input, "src %U", unformat_ip46_address, &src))
662 else if (unformat (line_input, "dst %U", unformat_ip46_address, &dst))
664 else if (unformat (line_input, "outer-table-id %d", &outer_table_id))
666 else if (unformat (line_input, "multipoint"))
667 t_mode = TUNNEL_MODE_MP;
668 else if (unformat (line_input, "teb"))
669 t_type = GRE_TUNNEL_TYPE_TEB;
670 else if (unformat (line_input, "erspan %d", &session_id))
671 t_type = GRE_TUNNEL_TYPE_ERSPAN;
672 else if (unformat (line_input, "flags %U",
673 unformat_tunnel_encap_decap_flags, &flags))
677 error = clib_error_return (0, "unknown input `%U'",
678 format_unformat_error, line_input);
683 if (ip46_address_is_equal (&src, &dst))
685 error = clib_error_return (0, "src and dst are identical");
689 if (t_mode != TUNNEL_MODE_MP && ip46_address_is_zero (&dst))
691 error = clib_error_return (0, "destination address not specified");
695 if (ip46_address_is_zero (&src))
697 error = clib_error_return (0, "source address not specified");
701 if (ip46_address_is_ip4 (&src) != ip46_address_is_ip4 (&dst))
703 error = clib_error_return (0, "src and dst address must be the same AF");
707 clib_memset (a, 0, sizeof (*a));
709 a->outer_table_id = outer_table_id;
712 a->session_id = session_id;
713 a->is_ipv6 = !ip46_address_is_ip4 (&src);
714 a->instance = instance;
716 clib_memcpy (&a->src, &src, sizeof (a->src));
717 clib_memcpy (&a->dst, &dst, sizeof (a->dst));
719 rv = vnet_gre_tunnel_add_del (a, &sw_if_index);
724 vlib_cli_output (vm, "%U\n", format_vnet_sw_if_index_name,
725 vnet_get_main (), sw_if_index);
727 case VNET_API_ERROR_IF_ALREADY_EXISTS:
728 error = clib_error_return (0, "GRE tunnel already exists...");
730 case VNET_API_ERROR_NO_SUCH_FIB:
731 error = clib_error_return (0, "outer table ID %d doesn't exist\n",
734 case VNET_API_ERROR_NO_SUCH_ENTRY:
735 error = clib_error_return (0, "GRE tunnel doesn't exist");
737 case VNET_API_ERROR_INVALID_SESSION_ID:
739 clib_error_return (0, "session ID %d out of range\n", session_id);
741 case VNET_API_ERROR_INSTANCE_IN_USE:
742 error = clib_error_return (0, "Instance is in use");
745 error = clib_error_return (0, "vnet_gre_tunnel_add_del returned %d", rv);
750 unformat_free (line_input);
756 VLIB_CLI_COMMAND (create_gre_tunnel_command, static) = {
757 .path = "create gre tunnel",
758 .short_help = "create gre tunnel src <addr> dst <addr> [instance <n>] "
759 "[outer-fib-id <fib>] [teb | erspan <session-id>] [del] "
761 .function = create_gre_tunnel_command_fn,
765 static clib_error_t *
766 show_gre_tunnel_command_fn (vlib_main_t *vm, unformat_input_t *input,
767 vlib_cli_command_t *cmd)
769 gre_main_t *gm = &gre_main;
773 if (pool_elts (gm->tunnels) == 0)
774 vlib_cli_output (vm, "No GRE tunnels configured...");
776 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
778 if (unformat (input, "%d", &ti))
787 pool_foreach (t, gm->tunnels)
789 vlib_cli_output (vm, "%U", format_gre_tunnel, t);
795 t = pool_elt_at_index (gm->tunnels, ti);
797 vlib_cli_output (vm, "%U", format_gre_tunnel, t);
804 VLIB_CLI_COMMAND (show_gre_tunnel_command, static) = {
805 .path = "show gre tunnel",
806 .function = show_gre_tunnel_command_fn,
810 const static teib_vft_t gre_teib_vft = {
811 .nv_added = gre_teib_entry_added,
812 .nv_deleted = gre_teib_entry_deleted,
815 /* force inclusion from application's main.c */
817 gre_interface_init (vlib_main_t *vm)
819 teib_register (&gre_teib_vft);
824 VLIB_INIT_FUNCTION (gre_interface_init);
827 * fd.io coding-style-patch-verification: ON
830 * eval: (c-set-style "gnu")