aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/gbp_vxlan.c
blob: 643089eeb1b8e85437e735354564fe3501dc878c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
/*
 * Copyright (c) 2018 Cisco 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:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <plugins/gbp/gbp_vxlan.h>
#include <plugins/gbp/gbp_learn.h>
#include <plugins/gbp/gbp_bridge_domain.h>
#include <plugins/gbp/gbp_route_domain.h>

#include <vnet/vxlan-gbp/vxlan_gbp.h>
#include <vlibmemory/api.h>
#include <vnet/fib/fib_table.h>
#include <vlib/punt.h>

/**
 * A reference to a VXLAN-GBP tunnel created as a child/dependent tunnel
 * of the tempplate GBP-VXLAN tunnel
 */
typedef struct vxlan_tunnel_ref_t_
{
  gbp_itf_hdl_t vxr_itf;
  u32 vxr_sw_if_index;
  index_t vxr_parent;
  gbp_vxlan_tunnel_layer_t vxr_layer;
} vxlan_tunnel_ref_t;

/**
 * DB of added tunnels
 */
uword *gv_db;

/**
 * Logger
 */
static vlib_log_class_t gt_logger;

/**
 * Pool of template tunnels
 */
static gbp_vxlan_tunnel_t *gbp_vxlan_tunnel_pool;

/**
 * Pool of child tunnels
 */
static vxlan_tunnel_ref_t *vxlan_tunnel_ref_pool;

/**
 * DB of template interfaces by SW interface index
 */
static index_t *gbp_vxlan_tunnel_db;

/**
 * DB of child interfaces by SW interface index
 */
static index_t *vxlan_tunnel_ref_db;

/**
 * handle registered with the ;unt infra
 */
static vlib_punt_hdl_t punt_hdl;

static char *gbp_vxlan_tunnel_layer_strings[] = {
#define _(n,s) [GBP_VXLAN_TUN_##n] = s,
  forecah_gbp_vxlan_tunnel_layer
#undef _
};

#define GBP_VXLAN_TUN_DBG(...)                          \
    vlib_log_debug (gt_logger, __VA_ARGS__);


gbp_vxlan_tunnel_t *
gbp_vxlan_tunnel_get (index_t gti)
{
  return (pool_elt_at_index (gbp_vxlan_tunnel_pool, gti));
}

static vxlan_tunnel_ref_t *
vxlan_tunnel_ref_get (index_t vxri)
{
  return (pool_elt_at_index (vxlan_tunnel_ref_pool, vxri));
}

static u8 *
format_vxlan_tunnel_ref (u8 * s, va_list * args)
{
  index_t vxri = va_arg (*args, u32);
  vxlan_tunnel_ref_t *vxr;

  vxr = vxlan_tunnel_ref_get (vxri);

  s = format (s, "[%U]", format_gbp_itf_hdl, vxr->vxr_itf);

  return (s);
}

static void
gdb_vxlan_dep_del (u32 sw_if_index)
{
  vxlan_tunnel_ref_t *vxr;
  gbp_vxlan_tunnel_t *gt;
  index_t vxri;
  u32 pos;

  vxr = vxlan_tunnel_ref_get (vxlan_tunnel_ref_db[sw_if_index]);
  vxri = vxr - vxlan_tunnel_ref_pool;
  gt = gbp_vxlan_tunnel_get (vxr->vxr_parent);

  GBP_VXLAN_TUN_DBG ("del-dep:%U", format_vxlan_tunnel_ref, vxri);

  vxlan_tunnel_ref_db[vxr->vxr_sw_if_index] = INDEX_INVALID;
  pos = vec_search (gt->gt_tuns, vxri);

  ASSERT (~0 != pos);
  vec_del1 (gt->gt_tuns, pos);

  vnet_vxlan_gbp_tunnel_del (vxr->vxr_sw_if_index);

  pool_put (vxlan_tunnel_ref_pool, vxr);
}

static gbp_itf_hdl_t
gdb_vxlan_dep_add (gbp_vxlan_tunnel_t * gt,
		   const ip46_address_t * src, const ip46_address_t * dst)
{
  vnet_vxlan_gbp_tunnel_add_del_args_t args = {
    .is_add = 1,
    .is_ip6 = !ip46_address_is_ip4 (src),
    .vni = gt->gt_vni,
    .src = *src,
    .dst = *dst,
    .instance = ~0,
    .mode = (GBP_VXLAN_TUN_L2 == gt->gt_layer ?
	     VXLAN_GBP_TUNNEL_MODE_L2 : VXLAN_GBP_TUNNEL_MODE_L3),
  };
  vxlan_tunnel_ref_t *vxr;
  u32 sw_if_index;
  index_t vxri;
  int rv;

  sw_if_index = ~0;
  rv = vnet_vxlan_gbp_tunnel_add_del (&args, &sw_if_index);

  if (VNET_API_ERROR_TUNNEL_EXIST == rv)
    {
      vxri = vxlan_tunnel_ref_db[sw_if_index];

      vxr = vxlan_tunnel_ref_get (vxri);
      gbp_itf_lock (vxr->vxr_itf);
    }
  else if (0 == rv)
    {
      ASSERT (~0 != sw_if_index);
      GBP_VXLAN_TUN_DBG ("add-dep:%U %U %U %d", format_vnet_sw_if_index_name,
			 vnet_get_main (), sw_if_index,
			 format_ip46_address, src, IP46_TYPE_ANY,
			 format_ip46_address, dst, IP46_TYPE_ANY, gt->gt_vni);

      pool_get_zero (vxlan_tunnel_ref_pool, vxr);

      vxri = (vxr - vxlan_tunnel_ref_pool);
      vxr->vxr_parent = gt - gbp_vxlan_tunnel_pool;
      vxr->vxr_sw_if_index = sw_if_index;
      vxr->vxr_layer = gt->gt_layer;

      /*
       * store the child both on the parent's list and the global DB
       */
      vec_add1 (gt->gt_tuns, vxri);

      vec_validate_init_empty (vxlan_tunnel_ref_db,
			       vxr->vxr_sw_if_index, INDEX_INVALID);
      vxlan_tunnel_ref_db[vxr->vxr_sw_if_index] = vxri;

      if (GBP_VXLAN_TUN_L2 == vxr->vxr_layer)
	{
	  l2output_feat_masks_t ofeat;
	  l2input_feat_masks_t ifeat;
	  gbp_bridge_domain_t *gbd;

	  gbd = gbp_bridge_domain_get (gt->gt_gbd);
	  vxr->vxr_itf = gbp_itf_l2_add_and_lock_w_free
	    (vxr->vxr_sw_if_index, gt->gt_gbd, gdb_vxlan_dep_del);

	  ofeat = L2OUTPUT_FEAT_GBP_POLICY_MAC;
	  ifeat = L2INPUT_FEAT_NONE;

	  if (!(gbd->gb_flags & GBP_BD_FLAG_DO_NOT_LEARN))
	    ifeat |= L2INPUT_FEAT_GBP_LEARN;

	  gbp_itf_l2_set_output_feature (vxr->vxr_itf, ofeat);
	  gbp_itf_l2_set_input_feature (vxr->vxr_itf, ifeat);
	}
      else
	{
	  vxr->vxr_itf = gbp_itf_l3_add_and_lock_w_free
	    (vxr->vxr_sw_if_index, gt->gt_grd, gdb_vxlan_dep_del);

	  gbp_itf_l3_set_input_feature (vxr->vxr_itf, GBP_ITF_L3_FEAT_LEARN);
	}
    }
  else
    {
      return (GBP_ITF_HDL_INVALID);
    }

  return (vxr->vxr_itf);
}

u32
vxlan_gbp_tunnel_get_parent (u32 sw_if_index)
{
  ASSERT ((sw_if_index < vec_len (vxlan_tunnel_ref_db)) &&
	  (INDEX_INVALID != vxlan_tunnel_ref_db[sw_if_index]));

  gbp_vxlan_tunnel_t *gt;
  vxlan_tunnel_ref_t *vxr;

  vxr = vxlan_tunnel_ref_get (vxlan_tunnel_ref_db[sw_if_index]);
  gt = gbp_vxlan_tunnel_get (vxr->vxr_parent);

  return (gt->gt_sw_if_index);
}

gbp_itf_hdl_t
vxlan_gbp_tunnel_lock_itf (u32 sw_if_index)
{
  ASSERT ((sw_if_index < vec_len (vxlan_tunnel_ref_db)) &&
	  (INDEX_INVALID != vxlan_tunnel_ref_db[sw_if_index]));

  vxlan_tunnel_ref_t *vxr;

  vxr = vxlan_tunnel_ref_get (vxlan_tunnel_ref_db[sw_if_index]);

  gbp_itf_lock (vxr->vxr_itf);

  return (vxr->vxr_itf);
}


gbp_vxlan_tunnel_type_t
gbp_vxlan_tunnel_get_type (u32 sw_if_index)
{
  if (sw_if_index < vec_len (vxlan_tunnel_ref_db) &&
      INDEX_INVALID != vxlan_tunnel_ref_db[sw_if_index])
    {
      return (VXLAN_GBP_TUNNEL);
    }
  else if (sw_if_index < vec_len (gbp_vxlan_tunnel_db) &&
	   INDEX_INVALID != gbp_vxlan_tunnel_db[sw_if_index])
    {
      return (GBP_VXLAN_TEMPLATE_TUNNEL);
    }

  ASSERT (0);
  return (GBP_VXLAN_TEMPLATE_TUNNEL);
}

gbp_itf_hdl_t
gbp_vxlan_tunnel_clone_and_lock (u32 sw_if_index,
				 const ip46_address_t * src,
				 const ip46_address_t * dst)
{
  gbp_vxlan_tunnel_t *gt;
  index_t gti;

  gti = gbp_vxlan_tunnel_db[sw_if_index];

  if (INDEX_INVALID == gti)
    return (GBP_ITF_HDL_INVALID);

  gt = pool_elt_at_index (gbp_vxlan_tunnel_pool, gti);

  return (gdb_vxlan_dep_add (gt, src, dst));
}

void
vxlan_gbp_tunnel_unlock (u32 sw_if_index)
{
  /* vxlan_tunnel_ref_t *vxr; */
  /* index_t vxri; */

  /* vxri = vxlan_tunnel_ref_db[sw_if_index]; */

  /* ASSERT (vxri != INDEX_INVALID); */

  /* vxr = vxlan_tunnel_ref_get (vxri); */

  /* gdb_vxlan_dep_del (vxri); */
}

void
gbp_vxlan_walk (gbp_vxlan_cb_t cb, void *ctx)
{
  gbp_vxlan_tunnel_t *gt;

  /* *INDENT-OFF* */
  pool_foreach (gt, gbp_vxlan_tunnel_pool,
    ({
      if (WALK_CONTINUE != cb(gt, ctx))
        break;
    }));
  /* *INDENT-ON* */
}

static walk_rc_t
gbp_vxlan_tunnel_show_one (gbp_vxlan_tunnel_t * gt, void *ctx)
{
  vlib_cli_output (ctx, "%U", format_gbp_vxlan_tunnel,
		   gt - gbp_vxlan_tunnel_pool);

  return (WALK_CONTINUE);
}

static u8 *
format_gbp_vxlan_tunnel_name (u8 * s, va_list * args)
{
  u32 dev_instance = va_arg (*args, u32);

  return format (s, "gbp-vxlan-%d", dev_instance);
}

u8 *
format_gbp_vxlan_tunnel_layer (u8 * s, va_list * args)
{
  gbp_vxlan_tunnel_layer_t gl = va_arg (*args, gbp_vxlan_tunnel_layer_t);
  s = format (s, "%s", gbp_vxlan_tunnel_layer_strings[gl]);

  return (s);
}

u8 *
format_gbp_vxlan_tunnel (u8 * s, va_list * args)
{
  u32 dev_instance = va_arg (*args, u32);
  CLIB_UNUSED (int verbose) = va_arg (*args, int);
  gbp_vxlan_tunnel_t *gt = gbp_vxlan_tunnel_get (dev_instance);
  index_t *vxri;

  s = format (s, " [%d] gbp-vxlan-tunnel: hw:%d sw:%d vni:%d %U",
	      dev_instance, gt->gt_hw_if_index,
	      gt->gt_sw_if_index, gt->gt_vni,
	      format_gbp_vxlan_tunnel_layer, gt->gt_layer);
  if (GBP_VXLAN_TUN_L2 == gt->gt_layer)
    s = format (s, " BD:%d gbd-index:%d", gt->gt_bd_rd_id, gt->gt_gbd);
  else
    s = format (s, " RD:%d grd-index:%d", gt->gt_bd_rd_id, gt->gt_grd);

  s = format (s, "   dependents:");
  vec_foreach (vxri, gt->gt_tuns)
  {
    s = format (s, "\n    %U, ", format_vxlan_tunnel_ref, *vxri);
  }

  return s;
}

typedef struct gbp_vxlan_tx_trace_t_
{
  u32 vni;
} gbp_vxlan_tx_trace_t;

u8 *
format_gbp_vxlan_tx_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 *);
  gbp_vxlan_tx_trace_t *t = va_arg (*args, gbp_vxlan_tx_trace_t *);

  s = format (s, "GBP-VXLAN: vni:%d", t->vni);

  return (s);
}

clib_error_t *
gbp_vxlan_interface_admin_up_down (vnet_main_t * vnm,
				   u32 hw_if_index, u32 flags)
{
  vnet_hw_interface_t *hi;
  u32 ti;

  hi = vnet_get_hw_interface (vnm, hw_if_index);

  if (NULL == gbp_vxlan_tunnel_db ||
      hi->sw_if_index >= vec_len (gbp_vxlan_tunnel_db))
    return (NULL);

  ti = gbp_vxlan_tunnel_db[hi->sw_if_index];

  if (~0 == ti)
    /* not one of ours */
    return (NULL);

  if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
    vnet_hw_interface_set_flags (vnm, hw_if_index,
				 VNET_HW_INTERFACE_FLAG_LINK_UP);
  else
    vnet_hw_interface_set_flags (vnm, hw_if_index, 0);

  return (NULL);
}

static uword
gbp_vxlan_interface_tx (vlib_main_t * vm,
			vlib_node_runtime_t * node, vlib_frame_t * frame)
{
  clib_warning ("you shouldn't be here, leaking buffers...");
  return frame->n_vectors;
}

/* *INDENT-OFF* */
VNET_DEVICE_CLASS (gbp_vxlan_device_class) = {
  .name = "GBP VXLAN tunnel-template",
  .format_device_name = format_gbp_vxlan_tunnel_name,
  .format_device = format_gbp_vxlan_tunnel,
  .format_tx_trace = format_gbp_vxlan_tx_trace,
  .admin_up_down_function = gbp_vxlan_interface_admin_up_down,
  .tx_function = gbp_vxlan_interface_tx,
};

VNET_HW_INTERFACE_CLASS (gbp_vxlan_hw_interface_class) = {
  .name = "GBP-VXLAN",
  .flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P,
};
/* *INDENT-ON* */

int
gbp_vxlan_tunnel_add (u32 vni, gbp_vxlan_tunnel_layer_t layer,
		      u32 bd_rd_id,
		      const ip4_address_t * src, u32 * sw_if_indexp)
{
  gbp_vxlan_tunnel_t *gt;
  index_t gti;
  uword *p;
  int rv;

  rv = 0;
  p = hash_get (gv_db, vni);

  GBP_VXLAN_TUN_DBG ("add: %d %d %d", vni, layer, bd_rd_id);

  if (NULL == p)
    {
      vnet_sw_interface_t *si;
      vnet_hw_interface_t *hi;
      index_t gbi, grdi;
      vnet_main_t *vnm;

      gbi = grdi = INDEX_INVALID;

      if (layer == GBP_VXLAN_TUN_L2)
	{
	  gbi = gbp_bridge_domain_find_and_lock (bd_rd_id);

	  if (INDEX_INVALID == gbi)
	    {
	      return (VNET_API_ERROR_BD_NOT_MODIFIABLE);
	    }
	}
      else
	{
	  grdi = gbp_route_domain_find_and_lock (bd_rd_id);

	  if (INDEX_INVALID == grdi)
	    {
	      return (VNET_API_ERROR_NO_SUCH_FIB);
	    }
	}

      vnm = vnet_get_main ();
      pool_get (gbp_vxlan_tunnel_pool, gt);
      gti = gt - gbp_vxlan_tunnel_pool;

      gt->gt_vni = vni;
      gt->gt_layer = layer;
      gt->gt_bd_rd_id = bd_rd_id;
      gt->gt_src.ip4.as_u32 = src->as_u32;
      gt->gt_hw_if_index = vnet_register_interface (vnm,
						    gbp_vxlan_device_class.index,
						    gti,
						    gbp_vxlan_hw_interface_class.index,
						    gti);

      hi = vnet_get_hw_interface (vnm, gt->gt_hw_if_index);

      gt->gt_sw_if_index = hi->sw_if_index;

      /* don't flood packets in a BD to these interfaces */
      si = vnet_get_sw_interface (vnm, gt->gt_sw_if_index);
      si->flood_class = VNET_FLOOD_CLASS_NO_FLOOD;

      if (layer == GBP_VXLAN_TUN_L2)
	{
	  gbp_bridge_domain_t *gb;

	  gb = gbp_bridge_domain_get (gbi);

	  gt->gt_gbd = gbi;
	  gb->gb_vni = gti;
	  /* set it up as a GBP interface */
	  gt->gt_itf = gbp_itf_l2_add_and_lock (gt->gt_sw_if_index,
						gt->gt_gbd);
	  gbp_itf_l2_set_input_feature (gt->gt_itf, L2INPUT_FEAT_GBP_LEARN);
	}
      else
	{
	  gt->gt_grd = grdi;
	  gt->gt_itf = gbp_itf_l3_add_and_lock (gt->gt_sw_if_index,
						gt->gt_grd);
	  gbp_itf_l3_set_input_feature (gt->gt_itf, GBP_ITF_L3_FEAT_LEARN);
	}

      /*
       * save the tunnel by VNI and by sw_if_index
       */
      hash_set (gv_db, vni, gti);

      vec_validate_init_empty (gbp_vxlan_tunnel_db,
			       gt->gt_sw_if_index, INDEX_INVALID);
      gbp_vxlan_tunnel_db[gt->gt_sw_if_index] = gti;

      if (sw_if_indexp)
	*sw_if_indexp = gt->gt_sw_if_index;

      vxlan_gbp_register_udp_ports ();
    }
  else
    {
      gti = p[0];
      rv = VNET_API_ERROR_IF_ALREADY_EXISTS;
    }

  GBP_VXLAN_TUN_DBG ("add: %U", format_gbp_vxlan_tunnel, gti);

  return (rv);
}

int
gbp_vxlan_tunnel_del (u32 vni)
{
  gbp_vxlan_tunnel_t *gt;
  uword *p;

  p = hash_get (gv_db, vni);

  if (NULL != p)
    {
      vnet_main_t *vnm;

      vnm = vnet_get_main ();
      gt = gbp_vxlan_tunnel_get (p[0]);

      vxlan_gbp_unregister_udp_ports ();

      GBP_VXLAN_TUN_DBG ("del: %U", format_gbp_vxlan_tunnel,
			 gt - gbp_vxlan_tunnel_pool);

      gbp_endpoint_flush (GBP_ENDPOINT_SRC_DP, gt->gt_sw_if_index);
      ASSERT (0 == vec_len (gt->gt_tuns));
      vec_free (gt->gt_tuns);

      gbp_itf_unlock (&gt->gt_itf);

      if (GBP_VXLAN_TUN_L2 == gt->gt_layer)
	{
	  gbp_bridge_domain_unlock (gt->gt_gbd);
	}
      else
	{
	  gbp_route_domain_unlock (gt->gt_grd);
	}

      vnet_sw_interface_set_flags (vnm, gt->gt_sw_if_index, 0);
      vnet_delete_hw_interface (vnm, gt->gt_hw_if_index);

      hash_unset (gv_db, vni);
      gbp_vxlan_tunnel_db[gt->gt_sw_if_index] = INDEX_INVALID;

      pool_put (gbp_vxlan_tunnel_pool, gt);
    }
  else
    return VNET_API_ERROR_NO_SUCH_ENTRY;

  return (0);
}

static clib_error_t *
gbp_vxlan_show (vlib_main_t * vm,
		unformat_input_t * input, vlib_cli_command_t * cmd)
{

  vlib_cli_output (vm, "GBP-VXLAN Interfaces:");

  gbp_vxlan_walk (gbp_vxlan_tunnel_show_one, vm);

  return (NULL);
}

/*?
 * Show Group Based Policy VXLAN tunnels
 *
 * @cliexpar
 * @cliexstart{show gbp vxlan}
 * @cliexend
 ?*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (gbp_vxlan_show_node, static) = {
  .path = "show gbp vxlan",
  .short_help = "show gbp vxlan\n",
  .function = gbp_vxlan_show,
};
/* *INDENT-ON* */

static clib_error_t *
gbp_vxlan_init (vlib_main_t * vm)
{
  vxlan_gbp_main_t *vxm = &vxlan_gbp_main;

  gt_logger = vlib_log_register_class ("gbp", "tun");

  punt_hdl = vlib_punt_client_register ("gbp-vxlan");

  vlib_punt_register (punt_hdl,
		      vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP4],
		      "gbp-vxlan4");

  return (0);
}

/* *INDENT-OFF* */
VLIB_INIT_FUNCTION (gbp_vxlan_init) =
{
  .runs_after = VLIB_INITS("punt_init", "vxlan_gbp_init"),
};
/* *INDENT-ON* */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
42'>2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122