L2 over LISP and GRE (VPP-457)
[vpp.git] / vnet / vnet / gre / interface.c
1 /*
2  * gre_interface.c: gre interfaces
3  *
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:
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #include <vnet/vnet.h>
19 #include <vnet/pg/pg.h>
20 #include <vnet/gre/gre.h>
21 #include <vnet/ip/format.h>
22 #include <vnet/fib/ip4_fib.h>
23 #include <vnet/adj/adj_midchain.h>
24 #include <vnet/mpls/mpls.h>
25
26 static inline u64
27 gre_mk_key (const ip4_address_t *src,
28             const ip4_address_t *dst,
29             u32 out_fib_index)
30 {
31   // FIXME. the fib index should be part of the key
32   return ((u64)src->as_u32 << 32 | (u64)dst->as_u32);
33 }
34
35 static u8 *
36 format_gre_tunnel (u8 * s, va_list * args)
37 {
38   gre_tunnel_t * t = va_arg (*args, gre_tunnel_t *);
39   int detail = va_arg (*args, int);
40   gre_main_t * gm = &gre_main;
41
42   s = format (s,
43               "[%d] %U (src) %U (dst) payload %s outer_fib_index %d",
44               t - gm->tunnels,
45               format_ip4_address, &t->tunnel_src,
46               format_ip4_address, &t->tunnel_dst,
47               (t->teb ? "teb" : "ip"),
48               t->outer_fib_index);
49   if (detail)
50   {
51       s = format (s, "\n  fib-entry:%d adj-ip4:%d adj-ip6:%d adj-mpls:%d",
52                   t->fib_entry_index,
53                   t->adj_index[FIB_LINK_IP4],
54                   t->adj_index[FIB_LINK_IP6],
55                   t->adj_index[FIB_LINK_MPLS]);
56   }
57
58   return s;
59 }
60
61 static gre_tunnel_t *
62 gre_tunnel_db_find (const ip4_address_t *src,
63                     const ip4_address_t *dst,
64                     u32 out_fib_index)
65 {
66   gre_main_t * gm = &gre_main;
67   uword * p;
68   u64 key;
69
70   key = gre_mk_key(src, dst, out_fib_index);
71
72   p = hash_get (gm->tunnel_by_key, key);
73
74   if (NULL == p)
75     return (NULL);
76
77   return (pool_elt_at_index (gm->tunnels, p[0]));
78 }
79
80 static void
81 gre_tunnel_db_add (const gre_tunnel_t *t)
82 {
83   gre_main_t * gm = &gre_main;
84   u64 key;
85
86   key = gre_mk_key(&t->tunnel_src, &t->tunnel_dst, t->outer_fib_index);
87   hash_set (gm->tunnel_by_key, key, t - gm->tunnels);
88 }
89
90 static void
91 gre_tunnel_db_remove (const gre_tunnel_t *t)
92 {
93   gre_main_t * gm = &gre_main;
94   u64 key;
95
96   key = gre_mk_key(&t->tunnel_src, &t->tunnel_dst, t->outer_fib_index);
97   hash_unset (gm->tunnel_by_key, key);
98 }
99
100 static gre_tunnel_t *
101 gre_tunnel_from_fib_node (fib_node_t *node)
102 {
103 #if (CLIB_DEBUG > 0)
104     ASSERT(FIB_NODE_TYPE_GRE_TUNNEL == node->fn_type);
105 #endif
106     return ((gre_tunnel_t*) (((char*)node) -
107                              STRUCT_OFFSET_OF(gre_tunnel_t, node)));
108 }
109
110 /**
111  * gre_tunnel_stack
112  *
113  * 'stack' (resolve the recursion for) the tunnel's midchain adjacency
114  */
115 void
116 gre_tunnel_stack (gre_tunnel_t *gt)
117 {
118     fib_link_t linkt;
119
120     /*
121      * find the adjacency that is contributed by the FIB entry
122      * that this tunnel resovles via, and use it as the next adj
123      * in the midchain
124      */
125     FOR_EACH_FIB_LINK(linkt)
126     {
127         if (ADJ_INDEX_INVALID != gt->adj_index[linkt])
128         {
129             if (vnet_hw_interface_get_flags(vnet_get_main(),
130                                             gt->hw_if_index) &
131                 VNET_HW_INTERFACE_FLAG_LINK_UP)
132             {
133                 adj_nbr_midchain_stack(
134                     gt->adj_index[linkt],
135                     fib_entry_contribute_ip_forwarding(gt->fib_entry_index));
136             }
137             else
138             {
139                 adj_nbr_midchain_unstack(gt->adj_index[linkt]);
140             }
141         }
142     }
143 }
144
145 /**
146  * Function definition to backwalk a FIB node
147  */
148 static fib_node_back_walk_rc_t
149 gre_tunnel_back_walk (fib_node_t *node,
150                            fib_node_back_walk_ctx_t *ctx)
151 {
152     gre_tunnel_stack(gre_tunnel_from_fib_node(node));
153
154     return (FIB_NODE_BACK_WALK_CONTINUE);
155 }
156
157 /**
158  * Function definition to get a FIB node from its index
159  */
160 static fib_node_t*
161 gre_tunnel_fib_node_get (fib_node_index_t index)
162 {
163     gre_tunnel_t * gt;
164     gre_main_t * gm;
165
166     gm  = &gre_main;
167     gt = pool_elt_at_index(gm->tunnels, index);
168
169     return (&gt->node);
170 }
171
172 /**
173  * Function definition to inform the FIB node that its last lock has gone.
174  */
175 static void
176 gre_tunnel_last_lock_gone (fib_node_t *node)
177 {
178     /*
179      * The MPLS GRE tunnel is a root of the graph. As such
180      * it never has children and thus is never locked.
181      */
182     ASSERT(0);
183 }
184
185 /*
186  * Virtual function table registered by MPLS GRE tunnels
187  * for participation in the FIB object graph.
188  */
189 const static fib_node_vft_t gre_vft = {
190     .fnv_get = gre_tunnel_fib_node_get,
191     .fnv_last_lock = gre_tunnel_last_lock_gone,
192     .fnv_back_walk = gre_tunnel_back_walk,
193 };
194
195 static int
196 gre_proto_from_fib_link (fib_link_t link)
197 {
198     switch (link)
199     {
200     case FIB_LINK_IP4:
201         return (GRE_PROTOCOL_ip4);
202     case FIB_LINK_IP6:
203         return (GRE_PROTOCOL_ip6);
204     case FIB_LINK_MPLS:
205         return (GRE_PROTOCOL_mpls_unicast);
206     case FIB_LINK_ETHERNET:
207         return (GRE_PROTOCOL_teb);
208     }
209     ASSERT(0);
210     return (GRE_PROTOCOL_ip4);
211 }
212
213 static u8 *
214 gre_rewrite (gre_tunnel_t * t,
215              fib_link_t link)
216 {
217   ip4_and_gre_header_t * h0;
218   u8 * rewrite_data = 0;
219
220   vec_validate_init_empty (rewrite_data, sizeof (*h0) - 1, 0);
221
222   h0 = (ip4_and_gre_header_t *) rewrite_data;
223
224   h0->gre.protocol = clib_host_to_net_u16(gre_proto_from_fib_link(link));
225
226   h0->ip4.ip_version_and_header_length = 0x45;
227   h0->ip4.ttl = 254;
228   h0->ip4.protocol = IP_PROTOCOL_GRE;
229   /* $$$ fixup ip4 header length and checksum after-the-fact */
230   h0->ip4.src_address.as_u32 = t->tunnel_src.as_u32;
231   h0->ip4.dst_address.as_u32 = t->tunnel_dst.as_u32;
232   h0->ip4.checksum = ip4_header_checksum (&h0->ip4);
233
234   return (rewrite_data);
235 }
236
237 static void
238 gre_fixup (vlib_main_t *vm,
239            ip_adjacency_t *adj,
240            vlib_buffer_t *b0)
241 {
242     ip4_header_t * ip0;
243
244     ip0 = vlib_buffer_get_current (b0);
245
246     /* Fixup the checksum and len fields in the GRE tunnel encap
247      * that was applied at the midchain node */
248     ip0->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0));
249     ip0->checksum = ip4_header_checksum (ip0);
250 }
251
252 static int 
253 vnet_gre_tunnel_add (vnet_gre_add_del_tunnel_args_t *a,
254                      u32 * sw_if_indexp)
255 {
256   gre_main_t * gm = &gre_main;
257   vnet_main_t * vnm = gm->vnet_main;
258   ip4_main_t * im = &ip4_main;
259   gre_tunnel_t * t;
260   vnet_hw_interface_t * hi;
261   u32 hw_if_index, sw_if_index;
262   u32 outer_fib_index;
263   u8 address[6];
264   clib_error_t *error;
265   fib_link_t linkt;
266   u8 *rewrite;
267
268   outer_fib_index = ip4_fib_index_from_table_id(a->outer_fib_id);
269
270   if (~0 == outer_fib_index)
271     return VNET_API_ERROR_NO_SUCH_FIB;
272
273   t = gre_tunnel_db_find(&a->src, &a->dst, a->outer_fib_id);
274
275   if (NULL != t)
276     return VNET_API_ERROR_INVALID_VALUE;
277
278   pool_get_aligned (gm->tunnels, t, CLIB_CACHE_LINE_BYTES);
279   memset (t, 0, sizeof (*t));
280   fib_node_init(&t->node, FIB_NODE_TYPE_GRE_TUNNEL);
281   FOR_EACH_FIB_LINK(linkt)
282   {
283       t->adj_index[linkt] = ADJ_INDEX_INVALID;
284   }
285
286   if (vec_len (gm->free_gre_tunnel_hw_if_indices) > 0) {
287       vnet_interface_main_t * im = &vnm->interface_main;
288
289       hw_if_index = gm->free_gre_tunnel_hw_if_indices
290           [vec_len (gm->free_gre_tunnel_hw_if_indices)-1];
291       _vec_len (gm->free_gre_tunnel_hw_if_indices) -= 1;
292
293       hi = vnet_get_hw_interface (vnm, hw_if_index);
294       hi->dev_instance = t - gm->tunnels;
295       hi->hw_instance = hi->dev_instance;
296
297       /* clear old stats of freed tunnel before reuse */
298       sw_if_index = hi->sw_if_index;
299       vnet_interface_counter_lock(im);
300       vlib_zero_combined_counter
301           (&im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX], sw_if_index);
302       vlib_zero_combined_counter
303           (&im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX], sw_if_index);
304       vlib_zero_simple_counter
305           (&im->sw_if_counters[VNET_INTERFACE_COUNTER_DROP], sw_if_index);
306         vnet_interface_counter_unlock(im);
307       if (a->teb)
308       {
309         t->l2_tx_arc = vlib_node_add_named_next(vlib_get_main(),
310                                                 hi->tx_node_index,
311                                                 "adj-l2-midchain");
312       }
313     } else {
314       if (a->teb)
315       {
316         /* Default MAC address (d00b:eed0:0000 + sw_if_index) */
317         memset (address, 0, sizeof (address));
318         address[0] = 0xd0;
319         address[1] = 0x0b;
320         address[2] = 0xee;
321         address[3] = 0xd0;
322         address[4] = t - gm->tunnels;
323
324         error = ethernet_register_interface
325           (vnm,
326            gre_l2_device_class.index, t - gm->tunnels, address, &hw_if_index,
327            0);
328
329         if (error)
330         {
331           clib_error_report (error);
332           return VNET_API_ERROR_INVALID_REGISTRATION;
333         }
334         hi = vnet_get_hw_interface (vnm, hw_if_index);
335
336         t->l2_tx_arc = vlib_node_add_named_next(vlib_get_main(),
337                                                 hi->tx_node_index,
338                                                 "adj-l2-midchain");
339       } else {
340         hw_if_index = vnet_register_interface
341             (vnm, gre_device_class.index, t - gm->tunnels,
342              gre_hw_interface_class.index,
343              t - gm->tunnels);
344       }
345       hi = vnet_get_hw_interface (vnm, hw_if_index);
346       sw_if_index = hi->sw_if_index;
347     }
348
349   t->hw_if_index = hw_if_index;
350   t->outer_fib_index = outer_fib_index;
351   t->sw_if_index = sw_if_index;
352   t->teb = a->teb;
353
354   vec_validate_init_empty (gm->tunnel_index_by_sw_if_index, sw_if_index, ~0);
355   gm->tunnel_index_by_sw_if_index[sw_if_index] = t - gm->tunnels;
356
357   vec_validate (im->fib_index_by_sw_if_index, sw_if_index);
358   im->fib_index_by_sw_if_index[sw_if_index] = t->outer_fib_index;
359   ip4_sw_interface_enable_disable(sw_if_index, 1);
360
361   hi->min_packet_bytes = 64 + sizeof (gre_header_t) + sizeof (ip4_header_t);
362   hi->per_packet_overhead_bytes =
363       /* preamble */ 8 + /* inter frame gap */ 12;
364
365   /* Standard default gre MTU. */
366   hi->max_l3_packet_bytes[VLIB_RX] = hi->max_l3_packet_bytes[VLIB_TX] = 9000;
367
368   clib_memcpy (&t->tunnel_src, &a->src, sizeof (t->tunnel_src));
369   clib_memcpy (&t->tunnel_dst, &a->dst, sizeof (t->tunnel_dst));
370
371   gre_tunnel_db_add(t);
372
373   /*
374    * source the FIB entry for the tunnel's destination
375    * and become a child thereof. The tunnel will then get poked
376    * when the forwarding for the entry updates, and the tunnel can
377    * re-stack accordingly
378    */
379   const fib_prefix_t tun_dst_pfx = {
380       .fp_len = 32,
381       .fp_proto = FIB_PROTOCOL_IP4,
382       .fp_addr = {
383           .ip4 = t->tunnel_dst,
384       }
385   };
386
387   t->fib_entry_index =
388       fib_table_entry_special_add(outer_fib_index,
389                                   &tun_dst_pfx,
390                                   FIB_SOURCE_RR,
391                                   FIB_ENTRY_FLAG_NONE,
392                                   ADJ_INDEX_INVALID);
393   t->sibling_index =
394       fib_entry_child_add(t->fib_entry_index,
395                           FIB_NODE_TYPE_GRE_TUNNEL,
396                           t - gm->tunnels);
397
398   /*
399    * create and update the midchain adj this tunnel sources.
400    * We could be smarter here and trigger this on an interface proto enable,
401    * like we do for MPLS.
402    */
403   if (t->teb)
404   {
405       t->adj_index[FIB_LINK_ETHERNET] = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
406                                                             FIB_LINK_ETHERNET,
407                                                             &zero_addr,
408                                                             sw_if_index);
409
410       rewrite = gre_rewrite(t, FIB_LINK_ETHERNET);
411       adj_nbr_midchain_update_rewrite(t->adj_index[FIB_LINK_ETHERNET],
412                                       gre_fixup,
413                                       ADJ_MIDCHAIN_FLAG_NO_COUNT,
414                                       rewrite);
415       vec_free(rewrite);
416   }
417   else
418   {
419       FOR_EACH_FIB_IP_LINK (linkt)
420       {
421           t->adj_index[linkt] = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
422                                                     linkt,
423                                                     &zero_addr,
424                                                     sw_if_index);
425
426           rewrite = gre_rewrite(t, linkt);
427           adj_nbr_midchain_update_rewrite(t->adj_index[linkt],
428                                           gre_fixup,
429                                           ADJ_MIDCHAIN_FLAG_NONE,
430                                           rewrite);
431           vec_free(rewrite);
432       }
433   }
434
435   t->adj_index[FIB_LINK_MPLS] = ADJ_INDEX_INVALID;
436
437   clib_memcpy (&t->tunnel_src, &a->src, sizeof (t->tunnel_src));
438   clib_memcpy (&t->tunnel_dst, &a->dst, sizeof (t->tunnel_dst));
439   gre_tunnel_stack(t);
440
441   if (sw_if_indexp)
442     *sw_if_indexp = sw_if_index;
443
444   return 0;
445 }
446
447 static int 
448 vnet_gre_tunnel_delete (vnet_gre_add_del_tunnel_args_t *a,
449                         u32 * sw_if_indexp)
450 {
451   gre_main_t * gm = &gre_main;
452   vnet_main_t * vnm = gm->vnet_main;
453   gre_tunnel_t * t;
454   fib_link_t linkt;
455   u32 sw_if_index;
456
457   t = gre_tunnel_db_find(&a->src, &a->dst, a->outer_fib_id);
458
459   if (NULL == t)
460     return VNET_API_ERROR_NO_SUCH_ENTRY;
461
462   sw_if_index = t->sw_if_index;
463   vnet_sw_interface_set_flags (vnm, sw_if_index, 0 /* down */);
464   /* make sure tunnel is removed from l2 bd or xconnect */
465   set_int_l2_mode(gm->vlib_main, vnm, MODE_L3, sw_if_index, 0, 0, 0, 0);
466   vec_add1 (gm->free_gre_tunnel_hw_if_indices, t->hw_if_index);
467   gm->tunnel_index_by_sw_if_index[sw_if_index] = ~0;
468   ip4_sw_interface_enable_disable(sw_if_index, 0);
469
470   fib_entry_child_remove(t->fib_entry_index,
471                          t->sibling_index);
472   fib_table_entry_delete_index(t->fib_entry_index,
473                                FIB_SOURCE_RR);
474
475   FOR_EACH_FIB_LINK(linkt)
476   {
477       adj_unlock(t->adj_index[linkt]);
478   }
479
480   gre_tunnel_db_remove(t);
481   fib_node_deinit(&t->node);
482   pool_put (gm->tunnels, t);
483
484   if (sw_if_indexp)
485     *sw_if_indexp = sw_if_index;
486
487   return 0;
488 }
489
490 int
491 vnet_gre_add_del_tunnel (vnet_gre_add_del_tunnel_args_t *a,
492                          u32 * sw_if_indexp)
493 {
494   if (a->is_add)
495     return (vnet_gre_tunnel_add(a, sw_if_indexp));
496   else
497     return (vnet_gre_tunnel_delete(a, sw_if_indexp));
498 }
499
500 static void
501 gre_sw_interface_mpls_state_change (u32 sw_if_index,
502                                     u32 is_enable)
503 {
504   gre_main_t *gm = &gre_main;
505   gre_tunnel_t *t;
506   u8 *rewrite;
507
508   if ((vec_len(gm->tunnel_index_by_sw_if_index) < sw_if_index) ||
509       (~0 == gm->tunnel_index_by_sw_if_index[sw_if_index]))
510       return;
511
512   t = pool_elt_at_index(gm->tunnels,
513                         gm->tunnel_index_by_sw_if_index[sw_if_index]);
514
515   if (is_enable)
516     {
517       t->adj_index[FIB_LINK_MPLS] =
518           adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
519                               FIB_LINK_MPLS,
520                               &zero_addr,
521                               sw_if_index);
522
523       rewrite = gre_rewrite(t, FIB_LINK_MPLS);
524       adj_nbr_midchain_update_rewrite(t->adj_index[FIB_LINK_MPLS],
525                                       gre_fixup,
526                                       ADJ_MIDCHAIN_FLAG_NONE,
527                                       rewrite);
528       vec_free(rewrite);
529     }
530   else
531     {
532       adj_unlock(t->adj_index[FIB_LINK_MPLS]);
533       t->adj_index[FIB_LINK_MPLS] = ADJ_INDEX_INVALID;
534     }
535
536   gre_tunnel_stack(t);
537 }
538
539 static clib_error_t *
540 create_gre_tunnel_command_fn (vlib_main_t * vm,
541                  unformat_input_t * input,
542                  vlib_cli_command_t * cmd)
543 {
544   unformat_input_t _line_input, * line_input = &_line_input;
545   vnet_gre_add_del_tunnel_args_t _a, * a = &_a;
546   ip4_address_t src, dst;
547   u32 outer_fib_id = 0;
548   u8 teb = 0;
549   int rv;
550   u32 num_m_args = 0;
551   u8 is_add = 1;
552   u32 sw_if_index;
553
554   /* Get a line of input. */
555   if (! unformat_user (input, unformat_line_input, line_input))
556     return 0;
557
558   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) {
559     if (unformat (line_input, "del"))
560       is_add = 0;
561     else if (unformat (line_input, "src %U", unformat_ip4_address, &src))
562       num_m_args++;
563     else if (unformat (line_input, "dst %U", unformat_ip4_address, &dst))
564       num_m_args++;
565     else if (unformat (line_input, "outer-fib-id %d", &outer_fib_id))
566       ;
567     else if (unformat (line_input, "teb"))
568       teb = 1;
569     else
570       return clib_error_return (0, "unknown input `%U'",
571                                 format_unformat_error, input);
572   }
573   unformat_free (line_input);
574
575   if (num_m_args < 2)
576       return clib_error_return (0, "mandatory argument(s) missing");
577
578   if (memcmp (&src, &dst, sizeof(src)) == 0)
579       return clib_error_return (0, "src and dst are identical");
580
581   memset (a, 0, sizeof (*a));
582   a->outer_fib_id = outer_fib_id;
583   a->teb = teb;
584   clib_memcpy(&a->src, &src, sizeof(src));
585   clib_memcpy(&a->dst, &dst, sizeof(dst));
586
587   if (is_add)
588     rv = vnet_gre_tunnel_add(a, &sw_if_index);
589   else
590     rv = vnet_gre_tunnel_delete(a, &sw_if_index);
591
592   switch(rv)
593     {
594     case 0:
595       vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
596       break;
597     case VNET_API_ERROR_INVALID_VALUE:
598       return clib_error_return (0, "GRE tunnel already exists...");
599     case VNET_API_ERROR_NO_SUCH_FIB:
600       return clib_error_return (0, "outer fib ID %d doesn't exist\n",
601                                 outer_fib_id);
602     default:
603       return clib_error_return (0, "vnet_gre_add_del_tunnel returned %d", rv);
604     }
605
606   return 0;
607 }
608
609 VLIB_CLI_COMMAND (create_gre_tunnel_command, static) = {
610   .path = "create gre tunnel",
611   .short_help = "create gre tunnel src <addr> dst <addr> "
612                 "[outer-fib-id <fib>] [teb] [del]",
613   .function = create_gre_tunnel_command_fn,
614 };
615
616 static clib_error_t *
617 show_gre_tunnel_command_fn (vlib_main_t * vm,
618                             unformat_input_t * input,
619                             vlib_cli_command_t * cmd)
620 {
621   gre_main_t * gm = &gre_main;
622   gre_tunnel_t * t;
623   u32 ti = ~0;
624
625   if (pool_elts (gm->tunnels) == 0)
626     vlib_cli_output (vm, "No GRE tunnels configured...");
627
628   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
629     {
630       if (unformat (input, "%d", &ti))
631         ;
632       else
633         break;
634     }
635
636   if (~0 == ti)
637     {
638       pool_foreach (t, gm->tunnels,
639       ({
640           vlib_cli_output (vm, "%U", format_gre_tunnel, t, 0);
641       }));
642     }
643   else
644   {
645       t = pool_elt_at_index(gm->tunnels, ti);
646
647       vlib_cli_output (vm, "%U", format_gre_tunnel, t, 1);
648   }
649
650   return 0;
651 }
652
653 VLIB_CLI_COMMAND (show_gre_tunnel_command, static) = {
654     .path = "show gre tunnel",
655     .function = show_gre_tunnel_command_fn,
656 };
657
658 /* force inclusion from application's main.c */
659 clib_error_t *gre_interface_init (vlib_main_t *vm)
660 {
661   vec_add1(mpls_main.mpls_interface_state_change_callbacks,
662            gre_sw_interface_mpls_state_change);
663
664   fib_node_register_type(FIB_NODE_TYPE_GRE_TUNNEL, &gre_vft);
665
666   return 0;
667 }
668 VLIB_INIT_FUNCTION(gre_interface_init);