a2b8978241a82486e97bd70437a4df3b063eaa28
[vpp.git] / vnet / vnet / vxlan-gpe / vxlan_gpe.c
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /**
16  *  @file
17  *  @brief Common utility functions for IPv4 and IPv6 VXLAN GPE tunnels
18  *
19 */
20 #include <vnet/vxlan-gpe/vxlan_gpe.h>
21 #include <vnet/ip/format.h>
22
23 vxlan_gpe_main_t vxlan_gpe_main;
24
25 /**
26  * @brief Tracing function for VXLAN GPE tunnel packets
27  *
28  * @param *s formatting string
29  * @param *args
30  *
31  * @return *s formatted string
32  *
33  */
34 u8 * format_vxlan_gpe_tunnel (u8 * s, va_list * args)
35 {
36   vxlan_gpe_tunnel_t * t = va_arg (*args, vxlan_gpe_tunnel_t *);
37   vxlan_gpe_main_t * gm = &vxlan_gpe_main;
38
39   s = format (s, "[%d] local: %U remote: %U ",
40               t - gm->tunnels,
41               format_ip46_address, &t->local, IP46_TYPE_ANY,
42               format_ip46_address, &t->remote, IP46_TYPE_ANY);
43
44   s = format (s, "  vxlan VNI %d ", t->vni);
45
46   switch (t->protocol)
47     {
48     case VXLAN_GPE_PROTOCOL_IP4:
49       s = format (s, "next-protocol ip4");
50       break;
51     case VXLAN_GPE_PROTOCOL_IP6:
52       s = format (s, "next-protocol ip6");
53       break;
54     case VXLAN_GPE_PROTOCOL_ETHERNET:
55       s = format (s, "next-protocol ethernet");
56       break;
57     case VXLAN_GPE_PROTOCOL_NSH:
58       s = format (s, "next-protocol nsh");
59       break;
60     default:
61       s = format (s, "next-protocol unknown %d", t->protocol);
62     }
63
64   s = format (s, " fibs: (encap %d, decap %d)",
65               t->encap_fib_index,
66               t->decap_fib_index);
67
68   return s;
69 }
70
71 /**
72  * @brief Naming for VXLAN GPE tunnel
73  *
74  * @param *s formatting string
75  * @param *args
76  *
77  * @return *s formatted string
78  *
79  */
80 static u8 * format_vxlan_gpe_name (u8 * s, va_list * args)
81 {
82   u32 dev_instance = va_arg (*args, u32);
83   return format (s, "vxlan_gpe_tunnel%d", dev_instance);
84 }
85
86 static uword dummy_interface_tx (vlib_main_t * vm,
87                                  vlib_node_runtime_t * node,
88                                  vlib_frame_t * frame)
89 {
90   clib_warning ("you shouldn't be here, leaking buffers...");
91   return frame->n_vectors;
92 }
93
94 /**
95  * @brief CLI function for VXLAN GPE admin up/down
96  *
97  * @param *vnm
98  * @param hw_if_index
99  * @param flag
100  *
101  * @return *rc
102  *
103  */
104 static clib_error_t *
105 vxlan_gpe_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
106 {
107   if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
108     vnet_hw_interface_set_flags (vnm, hw_if_index, VNET_HW_INTERFACE_FLAG_LINK_UP);
109   else
110     vnet_hw_interface_set_flags (vnm, hw_if_index, 0);
111
112   return 0;
113 }
114
115 VNET_DEVICE_CLASS (vxlan_gpe_device_class,static) = {
116   .name = "VXLAN_GPE",
117   .format_device_name = format_vxlan_gpe_name,
118   .format_tx_trace = format_vxlan_gpe_encap_trace,
119   .tx_function = dummy_interface_tx,
120   .admin_up_down_function = vxlan_gpe_interface_admin_up_down,
121 };
122
123 static uword dummy_set_rewrite (vnet_main_t * vnm,
124                                 u32 sw_if_index,
125                                 u32 l3_type,
126                                 void * dst_address,
127                                 void * rewrite,
128                                 uword max_rewrite_bytes)
129 {
130   return 0;
131 }
132
133
134 /**
135  * @brief Formatting function for tracing VXLAN GPE with length
136  *
137  * @param *s
138  * @param *args
139  *
140  * @return *s
141  *
142  */
143 static u8 * format_vxlan_gpe_header_with_length (u8 * s, va_list * args)
144 {
145   u32 dev_instance = va_arg (*args, u32);
146   s = format (s, "unimplemented dev %u", dev_instance);
147   return s;
148 }
149
150 VNET_HW_INTERFACE_CLASS (vxlan_gpe_hw_class) = {
151   .name = "VXLAN_GPE",
152   .format_header = format_vxlan_gpe_header_with_length,
153   .set_rewrite = dummy_set_rewrite,
154 };
155
156
157 #define foreach_gpe_copy_field                  \
158 _(vni)                                          \
159 _(protocol)                                \
160 _(encap_fib_index)                              \
161 _(decap_fib_index)
162
163 #define foreach_copy_ipv4 {                     \
164   _(local.ip4.as_u32)                           \
165   _(remote.ip4.as_u32)                          \
166 }
167
168 #define foreach_copy_ipv6 {                     \
169   _(local.ip6.as_u64[0])                        \
170   _(local.ip6.as_u64[1])                        \
171   _(remote.ip6.as_u64[0])                       \
172   _(remote.ip6.as_u64[1])                       \
173 }
174
175
176 /**
177  * @brief Calculate IPv4 VXLAN GPE rewrite header
178  *
179  * @param *t
180  *
181  * @return rc
182  *
183  */
184 static int vxlan4_gpe_rewrite (vxlan_gpe_tunnel_t * t)
185 {
186   u8 *rw = 0;
187   ip4_header_t * ip0;
188   ip4_vxlan_gpe_header_t * h0;
189   int len;
190
191   len = sizeof (*h0);
192
193   vec_validate_aligned (rw, len-1, CLIB_CACHE_LINE_BYTES);
194
195   h0 = (ip4_vxlan_gpe_header_t *) rw;
196
197   /* Fixed portion of the (outer) ip4 header */
198   ip0 = &h0->ip4;
199   ip0->ip_version_and_header_length = 0x45;
200   ip0->ttl = 254;
201   ip0->protocol = IP_PROTOCOL_UDP;
202
203   /* we fix up the ip4 header length and checksum after-the-fact */
204   ip0->src_address.as_u32 = t->local.ip4.as_u32;
205   ip0->dst_address.as_u32 = t->remote.ip4.as_u32;
206   ip0->checksum = ip4_header_checksum (ip0);
207
208   /* UDP header, randomize src port on something, maybe? */
209   h0->udp.src_port = clib_host_to_net_u16 (4790);
210   h0->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gpe);
211
212   /* VXLAN header. Are we having fun yet? */
213   h0->vxlan.flags = VXLAN_GPE_FLAGS_I | VXLAN_GPE_FLAGS_P;
214   h0->vxlan.ver_res = VXLAN_GPE_VERSION;
215   h0->vxlan.protocol = t->protocol;
216   h0->vxlan.vni_res = clib_host_to_net_u32 (t->vni<<8);
217
218   t->rewrite = rw;
219   return (0);
220 }
221
222 /**
223  * @brief Calculate IPv6 VXLAN GPE rewrite header
224  *
225  * @param *t
226  *
227  * @return rc
228  *
229  */
230 static int vxlan6_gpe_rewrite (vxlan_gpe_tunnel_t * t)
231 {
232   u8 *rw = 0;
233   ip6_header_t * ip0;
234   ip6_vxlan_gpe_header_t * h0;
235   int len;
236
237   len = sizeof (*h0);
238
239   vec_validate_aligned (rw, len-1, CLIB_CACHE_LINE_BYTES);
240
241   h0 = (ip6_vxlan_gpe_header_t *) rw;
242
243   /* Fixed portion of the (outer) ip4 header */
244   ip0 = &h0->ip6;
245   ip0->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32(6 << 28);
246   ip0->hop_limit = 255;
247   ip0->protocol = IP_PROTOCOL_UDP;
248
249   ip0->src_address.as_u64[0] = t->local.ip6.as_u64[0];
250   ip0->src_address.as_u64[1] = t->local.ip6.as_u64[1];
251   ip0->dst_address.as_u64[0] = t->remote.ip6.as_u64[0];
252   ip0->dst_address.as_u64[1] = t->remote.ip6.as_u64[1];
253
254   /* UDP header, randomize src port on something, maybe? */
255   h0->udp.src_port = clib_host_to_net_u16 (4790);
256   h0->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gpe);
257
258   /* VXLAN header. Are we having fun yet? */
259   h0->vxlan.flags = VXLAN_GPE_FLAGS_I | VXLAN_GPE_FLAGS_P;
260   h0->vxlan.ver_res = VXLAN_GPE_VERSION;
261   h0->vxlan.protocol = t->protocol;
262   h0->vxlan.vni_res = clib_host_to_net_u32 (t->vni<<8);
263
264   t->rewrite = rw;
265   return (0);
266 }
267
268 /**
269  * @brief Add or Del a VXLAN GPE tunnel
270  *
271  * @param *a
272  * @param *sw_if_index
273  *
274  * @return rc
275  *
276  */
277 int vnet_vxlan_gpe_add_del_tunnel
278 (vnet_vxlan_gpe_add_del_tunnel_args_t *a, u32 * sw_if_indexp)
279 {
280   vxlan_gpe_main_t * gm = &vxlan_gpe_main;
281   vxlan_gpe_tunnel_t *t = 0;
282   vnet_main_t * vnm = gm->vnet_main;
283   vnet_hw_interface_t * hi;
284   uword * p;
285   u32 hw_if_index = ~0;
286   u32 sw_if_index = ~0;
287   int rv;
288   vxlan4_gpe_tunnel_key_t key4, *key4_copy;
289   vxlan6_gpe_tunnel_key_t key6, *key6_copy;
290   hash_pair_t *hp;
291
292   if (!a->is_ip6)
293   {
294     key4.local = a->local.ip4.as_u32;
295     key4.remote = a->remote.ip4.as_u32;
296     key4.vni = clib_host_to_net_u32 (a->vni << 8);
297     key4.pad = 0;
298
299     p = hash_get_mem(gm->vxlan4_gpe_tunnel_by_key, &key4);
300   }
301   else
302   {
303     key6.local.as_u64[0] = a->local.ip6.as_u64[0];
304     key6.local.as_u64[1] = a->local.ip6.as_u64[1];
305     key6.remote.as_u64[0] = a->remote.ip6.as_u64[0];
306     key6.remote.as_u64[1] = a->remote.ip6.as_u64[1];
307     key6.vni = clib_host_to_net_u32 (a->vni << 8);
308
309     p = hash_get_mem(gm->vxlan6_gpe_tunnel_by_key, &key6);
310   }
311
312   if (a->is_add)
313     {
314       /* adding a tunnel: tunnel must not already exist */
315       if (p)
316         return VNET_API_ERROR_INVALID_VALUE;
317
318       pool_get_aligned (gm->tunnels, t, CLIB_CACHE_LINE_BYTES);
319       memset (t, 0, sizeof (*t));
320
321       /* copy from arg structure */
322 #define _(x) t->x = a->x;
323       foreach_gpe_copy_field;
324       if (!a->is_ip6) foreach_copy_ipv4
325       else            foreach_copy_ipv6
326 #undef _
327
328       if (!a->is_ip6) t->flags |= VXLAN_GPE_TUNNEL_IS_IPV4;
329
330       if (!a->is_ip6) {
331         rv = vxlan4_gpe_rewrite (t);
332       } else {
333         rv = vxlan6_gpe_rewrite (t);
334       }
335
336       if (rv)
337       {
338           pool_put (gm->tunnels, t);
339           return rv;
340       }
341
342       if (!a->is_ip6)
343       {
344         key4_copy = clib_mem_alloc (sizeof (*key4_copy));
345         clib_memcpy (key4_copy, &key4, sizeof (*key4_copy));
346         hash_set_mem (gm->vxlan4_gpe_tunnel_by_key, key4_copy,
347                       t - gm->tunnels);
348       }
349       else
350       {
351           key6_copy = clib_mem_alloc (sizeof (*key6_copy));
352           clib_memcpy (key6_copy, &key6, sizeof (*key6_copy));
353           hash_set_mem (gm->vxlan6_gpe_tunnel_by_key, key6_copy,
354                         t - gm->tunnels);
355       }
356
357       if (vec_len (gm->free_vxlan_gpe_tunnel_hw_if_indices) > 0)
358         {
359           hw_if_index = gm->free_vxlan_gpe_tunnel_hw_if_indices
360             [vec_len (gm->free_vxlan_gpe_tunnel_hw_if_indices)-1];
361           _vec_len (gm->free_vxlan_gpe_tunnel_hw_if_indices) -= 1;
362
363           hi = vnet_get_hw_interface (vnm, hw_if_index);
364           hi->dev_instance = t - gm->tunnels;
365           hi->hw_instance = hi->dev_instance;
366         }
367       else
368         {
369           hw_if_index = vnet_register_interface
370             (vnm, vxlan_gpe_device_class.index, t - gm->tunnels,
371              vxlan_gpe_hw_class.index, t - gm->tunnels);
372           hi = vnet_get_hw_interface (vnm, hw_if_index);
373           hi->output_node_index = vxlan_gpe_encap_node.index;
374         }
375
376       t->hw_if_index = hw_if_index;
377       t->sw_if_index = sw_if_index = hi->sw_if_index;
378       vec_validate_init_empty (gm->tunnel_index_by_sw_if_index, sw_if_index, ~0);
379       gm->tunnel_index_by_sw_if_index[sw_if_index] = t - gm->tunnels;
380
381       vnet_sw_interface_set_flags (vnm, hi->sw_if_index,
382                                    VNET_SW_INTERFACE_FLAG_ADMIN_UP);
383     }
384   else
385     {
386       /* deleting a tunnel: tunnel must exist */
387       if (!p)
388         return VNET_API_ERROR_NO_SUCH_ENTRY;
389
390       t = pool_elt_at_index (gm->tunnels, p[0]);
391
392       vnet_sw_interface_set_flags (vnm, t->sw_if_index, 0 /* down */);
393       vec_add1 (gm->free_vxlan_gpe_tunnel_hw_if_indices, t->hw_if_index);
394
395       gm->tunnel_index_by_sw_if_index[t->sw_if_index] = ~0;
396
397       if (!a->is_ip6)
398       {
399         hp = hash_get_pair (gm->vxlan4_gpe_tunnel_by_key, &key4);
400         key4_copy = (void *)(hp->key);
401         hash_unset_mem (gm->vxlan4_gpe_tunnel_by_key, &key4);
402         clib_mem_free (key4_copy);
403       }
404       else
405       {
406         hp = hash_get_pair (gm->vxlan6_gpe_tunnel_by_key, &key6);
407         key6_copy = (void *)(hp->key);
408         hash_unset_mem (gm->vxlan4_gpe_tunnel_by_key, &key6);
409         clib_mem_free (key6_copy);
410       }
411
412       vec_free (t->rewrite);
413       pool_put (gm->tunnels, t);
414     }
415
416   if (sw_if_indexp)
417       *sw_if_indexp = sw_if_index;
418
419   return 0;
420 }
421
422 /**
423  * @brief Find the IPv4 FIB index from the FIB ID
424  *
425  * @param fib_id
426  *
427  * @return fib_index
428  *
429  */
430 static u32 fib4_index_from_fib_id (u32 fib_id)
431 {
432   ip4_main_t * im = &ip4_main;
433   uword * p;
434
435   p = hash_get (im->fib_index_by_table_id, fib_id);
436   if (!p)
437     return ~0;
438
439   return p[0];
440 }
441
442 /**
443  * @brief Find the IPv4 FIB index from the FIB ID
444  *
445  * @param fib_id
446  *
447  * @return fib_index
448  *
449  */
450 static u32 fib6_index_from_fib_id (u32 fib_id)
451 {
452   ip6_main_t * im = &ip6_main;
453   uword * p;
454
455   p = hash_get (im->fib_index_by_table_id, fib_id);
456   if (!p)
457     return ~0;
458
459   return p[0];
460 }
461
462 /**
463  * @brief CLI function for Add/Del of IPv4/IPv6 VXLAN GPE tunnel
464  *
465  * @param *vm
466  * @param *input
467  * @param *cmd
468  *
469  * @return error
470  *
471  */
472 static clib_error_t *
473 vxlan_gpe_add_del_tunnel_command_fn (vlib_main_t * vm,
474                                    unformat_input_t * input,
475                                    vlib_cli_command_t * cmd)
476 {
477   unformat_input_t _line_input, * line_input = &_line_input;
478   u8 is_add = 1;
479   ip46_address_t local, remote;
480   u8 local_set = 0;
481   u8 remote_set = 0;
482   u8 ipv4_set = 0;
483   u8 ipv6_set = 0;
484   u32 encap_fib_index = 0;
485   u32 decap_fib_index = 0;
486   u8 protocol = VXLAN_GPE_PROTOCOL_IP4;
487   u32 vni;
488   u8 vni_set = 0;
489   int rv;
490   u32 tmp;
491   vnet_vxlan_gpe_add_del_tunnel_args_t _a, * a = &_a;
492   u32 sw_if_index;
493
494   /* Get a line of input. */
495   if (! unformat_user (input, unformat_line_input, line_input))
496     return 0;
497
498   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) {
499     if (unformat (line_input, "del"))
500       is_add = 0;
501     else if (unformat (line_input, "local %U",
502                        unformat_ip4_address, &local.ip4))
503     {
504       local_set = 1;
505       ipv4_set = 1;
506     }
507     else if (unformat (line_input, "remote %U",
508                        unformat_ip4_address, &remote.ip4))
509     {
510       remote_set = 1;
511       ipv4_set = 1;
512     }
513     else if (unformat (line_input, "local %U",
514                        unformat_ip6_address, &local.ip6))
515     {
516       local_set = 1;
517       ipv6_set = 1;
518     }
519     else if (unformat (line_input, "remote %U",
520                        unformat_ip6_address, &remote.ip6))
521     {
522       remote_set = 1;
523       ipv6_set = 1;
524     }
525     else if (unformat (line_input, "encap-vrf-id %d", &tmp))
526       {
527         if (ipv6_set)
528           encap_fib_index = fib6_index_from_fib_id (tmp);
529         else
530           encap_fib_index = fib4_index_from_fib_id (tmp);
531
532         if (encap_fib_index == ~0)
533           return clib_error_return (0, "nonexistent encap fib id %d", tmp);
534       }
535     else if (unformat (line_input, "decap-vrf-id %d", &tmp))
536       {
537
538         if (ipv6_set)
539           decap_fib_index = fib6_index_from_fib_id (tmp);
540         else
541           decap_fib_index = fib4_index_from_fib_id (tmp);
542
543         if (decap_fib_index == ~0)
544           return clib_error_return (0, "nonexistent decap fib id %d", tmp);
545       }
546     else if (unformat (line_input, "vni %d", &vni))
547       vni_set = 1;
548     else if (unformat(line_input, "next-ip4"))
549       protocol = VXLAN_GPE_PROTOCOL_IP4;
550     else if (unformat(line_input, "next-ip6"))
551       protocol = VXLAN_GPE_PROTOCOL_IP6;
552     else if (unformat(line_input, "next-ethernet"))
553       protocol = VXLAN_GPE_PROTOCOL_ETHERNET;
554     else if (unformat(line_input, "next-nsh"))
555       protocol = VXLAN_GPE_PROTOCOL_NSH;
556     else
557       return clib_error_return (0, "parse error: '%U'",
558                                 format_unformat_error, line_input);
559   }
560
561   unformat_free (line_input);
562
563   if (local_set == 0)
564     return clib_error_return (0, "tunnel local address not specified");
565
566   if (remote_set == 0)
567     return clib_error_return (0, "tunnel remote address not specified");
568
569   if (ipv4_set && ipv6_set)
570     return clib_error_return (0, "both IPv4 and IPv6 addresses specified");
571
572   if ((ipv4_set && memcmp(&local.ip4, &remote.ip4, sizeof(local.ip4)) == 0) ||
573       (ipv6_set && memcmp(&local.ip6, &remote.ip6, sizeof(local.ip6)) == 0))
574     return clib_error_return (0, "src and dst addresses are identical");
575
576   if (vni_set == 0)
577     return clib_error_return (0, "vni not specified");
578
579   memset (a, 0, sizeof (*a));
580
581   a->is_add = is_add;
582   a->is_ip6 = ipv6_set;
583
584 #define _(x) a->x = x;
585   foreach_gpe_copy_field;
586   if (ipv4_set) foreach_copy_ipv4
587   else          foreach_copy_ipv6
588 #undef _
589
590   rv = vnet_vxlan_gpe_add_del_tunnel (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_DECAP_NEXT:
598       return clib_error_return (0, "invalid decap-next...");
599
600     case VNET_API_ERROR_TUNNEL_EXIST:
601       return clib_error_return (0, "tunnel already exists...");
602
603     case VNET_API_ERROR_NO_SUCH_ENTRY:
604       return clib_error_return (0, "tunnel does not exist...");
605
606     default:
607       return clib_error_return
608         (0, "vnet_vxlan_gpe_add_del_tunnel returned %d", rv);
609     }
610
611   return 0;
612 }
613
614 VLIB_CLI_COMMAND (create_vxlan_gpe_tunnel_command, static) = {
615   .path = "create vxlan-gpe tunnel",
616   .short_help =
617   "create vxlan-gpe tunnel local <local-addr> remote <remote-addr>"
618   " vni <nn> [next-ip4][next-ip6][next-ethernet][next-nsh]"
619   " [encap-vrf-id <nn>] [decap-vrf-id <nn>]"
620   " [del]\n",
621   .function = vxlan_gpe_add_del_tunnel_command_fn,
622 };
623
624 /**
625  * @brief CLI function for showing VXLAN GPE tunnels
626  *
627  * @param *vm
628  * @param *input
629  * @param *cmd
630  *
631  * @return error
632  *
633  */
634 static clib_error_t *
635 show_vxlan_gpe_tunnel_command_fn (vlib_main_t * vm,
636                                 unformat_input_t * input,
637                                 vlib_cli_command_t * cmd)
638 {
639   vxlan_gpe_main_t * gm = &vxlan_gpe_main;
640   vxlan_gpe_tunnel_t * t;
641
642   if (pool_elts (gm->tunnels) == 0)
643     vlib_cli_output (vm, "No vxlan-gpe tunnels configured.");
644
645   pool_foreach (t, gm->tunnels,
646   ({
647     vlib_cli_output (vm, "%U", format_vxlan_gpe_tunnel, t);
648   }));
649
650   return 0;
651 }
652
653 VLIB_CLI_COMMAND (show_vxlan_gpe_tunnel_command, static) = {
654     .path = "show vxlan-gpe",
655     .function = show_vxlan_gpe_tunnel_command_fn,
656 };
657
658 /**
659  * @brief Feature init function for VXLAN GPE
660  *
661  * @param *vm
662  *
663  * @return error
664  *
665  */
666 clib_error_t *vxlan_gpe_init (vlib_main_t *vm)
667 {
668   vxlan_gpe_main_t *gm = &vxlan_gpe_main;
669
670   gm->vnet_main = vnet_get_main();
671   gm->vlib_main = vm;
672
673   gm->vxlan4_gpe_tunnel_by_key
674     = hash_create_mem (0, sizeof(vxlan4_gpe_tunnel_key_t), sizeof (uword));
675
676   gm->vxlan6_gpe_tunnel_by_key
677     = hash_create_mem (0, sizeof(vxlan6_gpe_tunnel_key_t), sizeof (uword));
678
679
680   udp_register_dst_port (vm, UDP_DST_PORT_vxlan_gpe,
681                          vxlan4_gpe_input_node.index, 1 /* is_ip4 */);
682   udp_register_dst_port (vm, UDP_DST_PORT_vxlan6_gpe,
683                          vxlan6_gpe_input_node.index, 0 /* is_ip4 */);
684   return 0;
685 }
686
687 VLIB_INIT_FUNCTION(vxlan_gpe_init);
688