FD.io VPP  v16.06
Vector Packet Processing
lisp_gpe.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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 #include <vnet/lisp-gpe/lisp_gpe.h>
17 
19 
20 static int
22 {
23  u8 *rw = 0;
24  lisp_gpe_header_t * lisp0;
25  int len;
26 
27  if (ip_addr_version(&t->src) == IP4)
28  {
29  ip4_header_t * ip0;
30  ip4_udp_lisp_gpe_header_t * h0;
31  len = sizeof(*h0);
32 
34 
35  h0 = (ip4_udp_lisp_gpe_header_t *) rw;
36 
37  /* Fixed portion of the (outer) ip4 header */
38  ip0 = &h0->ip4;
39  ip0->ip_version_and_header_length = 0x45;
40  ip0->ttl = 254;
41  ip0->protocol = IP_PROTOCOL_UDP;
42 
43  /* we fix up the ip4 header length and checksum after-the-fact */
46  ip0->checksum = ip4_header_checksum (ip0);
47 
48  /* UDP header, randomize src port on something, maybe? */
49  h0->udp.src_port = clib_host_to_net_u16 (4341);
50  h0->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_lisp_gpe);
51 
52  /* LISP-gpe header */
53  lisp0 = &h0->lisp;
54  }
55  else
56  {
57  ip6_header_t * ip0;
58  ip6_udp_lisp_gpe_header_t * h0;
59  len = sizeof(*h0);
60 
62 
63  h0 = (ip6_udp_lisp_gpe_header_t *) rw;
64 
65  /* Fixed portion of the (outer) ip6 header */
66  ip0 = &h0->ip6;
68  clib_host_to_net_u32 (0x6 << 28);
69  ip0->hop_limit = 254;
70  ip0->protocol = IP_PROTOCOL_UDP;
71 
72  /* we fix up the ip6 header length after-the-fact */
75 
76  /* UDP header, randomize src port on something, maybe? */
77  h0->udp.src_port = clib_host_to_net_u16 (4341);
78  h0->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_lisp_gpe);
79 
80  /* LISP-gpe header */
81  lisp0 = &h0->lisp;
82  }
83 
84  lisp0->flags = t->flags;
85  lisp0->ver_res = t->ver_res;
86  lisp0->res = t->res;
87  lisp0->next_protocol = t->next_protocol;
88  lisp0->iid = clib_host_to_net_u32 (t->vni);
89 
90  t->rewrite = rw;
91  return 0;
92 }
93 
94 #define foreach_copy_field \
95 _(encap_fib_index) \
96 _(decap_fib_index) \
97 _(decap_next_index) \
98 _(vni)
99 
100 static u32
102  u32 * tun_index_res)
103 {
105  lisp_gpe_tunnel_t *t = 0;
106  uword * p;
107  int rv;
109 
110  /* prepare tunnel key */
111  memset(&key, 0, sizeof(key));
113  ip_address_copy(&key.dst_loc, &a->dlocator);
114  key.iid = clib_host_to_net_u32 (a->vni);
115 
116  p = mhash_get (&lgm->lisp_gpe_tunnel_by_key, &key);
117 
118  if (a->is_add)
119  {
120  /* adding a tunnel: tunnel must not already exist */
121  if (p)
122  return VNET_API_ERROR_INVALID_VALUE;
123 
125  return VNET_API_ERROR_INVALID_DECAP_NEXT;
126 
128  memset (t, 0, sizeof (*t));
129 
130  /* copy from arg structure */
131 #define _(x) t->x = a->x;
133 #undef _
134 
135  ip_address_copy(&t->src, &a->slocator);
136  ip_address_copy(&t->dst, &a->dlocator);
137 
138  t->flags |= LISP_GPE_FLAGS_P;
139  t->next_protocol = ip_prefix_version(&key.eid) == IP4 ?
141 
142  rv = lisp_gpe_rewrite (t);
143 
144  if (rv)
145  {
146  pool_put(lgm->tunnels, t);
147  return rv;
148  }
149 
150  mhash_set(&lgm->lisp_gpe_tunnel_by_key, &key, t - lgm->tunnels, 0);
151 
152  /* return tunnel index */
153  if (tun_index_res)
154  tun_index_res[0] = t - lgm->tunnels;
155  }
156  else
157  {
158  /* deleting a tunnel: tunnel must exist */
159  if (!p)
160  {
161  clib_warning("Tunnel for eid %U doesn't exist!", format_gid_address,
162  &a->deid);
163  return VNET_API_ERROR_NO_SUCH_ENTRY;
164  }
165 
166  t = pool_elt_at_index(lgm->tunnels, p[0]);
167 
168  mhash_unset(&lgm->lisp_gpe_tunnel_by_key, &key, 0);
169 
170  vec_free(t->rewrite);
171  pool_put(lgm->tunnels, t);
172  }
173 
174  return 0;
175 }
176 
177 static int
180 {
181  ip_adjacency_t adj;
182  /* setup adjacency for eid */
183  memset (&adj, 0, sizeof(adj));
184  adj.n_adj = 1;
185  adj.explicit_fib_index = ~0;
186 
187  ip_prefix_t * dpref = &gid_address_ippref(&a->deid);
188  ip_prefix_t * spref = &gid_address_ippref(&a->seid);
189 
190  switch (a->action)
191  {
192  case NO_ACTION:
193  /* TODO update timers? */
194  case FORWARD_NATIVE:
195  /* TODO check if route/next-hop for eid exists in fib and add
196  * more specific for the eid with the next-hop found */
197  case SEND_MAP_REQUEST:
198  /* TODO insert tunnel that always sends map-request */
199  case DROP:
200  /* for drop fwd entries, just add route, no need to add encap tunnel */
201  adj.lookup_next_index = (u32) (ip_prefix_version(dpref) == IP4 ?
202  LGPE_IP4_LOOKUP_NEXT_DROP : LGPE_IP6_LOOKUP_NEXT_DROP);
203 
204  /* add/delete route for prefix */
205  return ip_sd_fib_add_del_route (lgm, dpref, spref, a->table_id, &adj,
206  a->is_add);
207  break;
208  default:
209  return -1;
210  }
211 }
212 
213 int
215  u32 * hw_if_indexp)
216 {
218  ip_adjacency_t adj, * adjp;
219  u32 adj_index, rv, tun_index = ~0;
220  ip_prefix_t * dpref, * spref;
221  uword * lookup_next_index, * lgpe_sw_if_index, * lnip;
222  u8 ip_ver;
223 
224  /* treat negative fwd entries separately */
225  if (a->is_negative)
226  return add_del_negative_fwd_entry (lgm, a);
227 
228  dpref = &gid_address_ippref(&a->deid);
229  spref = &gid_address_ippref(&a->seid);
230  ip_ver = ip_prefix_version(dpref);
231 
232  /* add/del tunnel to tunnels pool and prepares rewrite */
233  rv = add_del_ip_tunnel (a, &tun_index);
234  if (rv)
235  return rv;
236 
237  /* setup adjacency for eid */
238  memset (&adj, 0, sizeof(adj));
239  adj.n_adj = 1;
240  adj.explicit_fib_index = ~0;
241 
242  if (a->is_add)
243  {
244  /* send packets that hit this adj to lisp-gpe interface output node in
245  * requested vrf. */
246  lnip = ip_ver == IP4 ?
249  lookup_next_index = hash_get(lnip, a->table_id);
250  lgpe_sw_if_index = hash_get(lgm->lisp_gpe_hw_if_index_by_table_id,
251  a->table_id);
252 
253  /* the assumption is that the interface must've been created before
254  * programming the dp */
255  ASSERT(lookup_next_index != 0);
256  ASSERT(lgpe_sw_if_index != 0);
257 
258  adj.lookup_next_index = lookup_next_index[0];
259  adj.rewrite_header.node_index = tun_index;
260  adj.rewrite_header.sw_if_index = lgpe_sw_if_index[0];
261  }
262 
263  /* add/delete route for prefix */
264  rv = ip_sd_fib_add_del_route (lgm, dpref, spref, a->table_id, &adj,
265  a->is_add);
266 
267  /* check that everything worked */
268  if (CLIB_DEBUG && a->is_add)
269  {
270  adj_index = ip_sd_fib_get_route (lgm, dpref, spref, a->table_id);
271  ASSERT(adj_index != 0);
272 
273  adjp = ip_get_adjacency ((ip_ver == IP4) ? lgm->lm4 : lgm->lm6,
274  adj_index);
275 
276  ASSERT(adjp != 0);
277  ASSERT(adjp->rewrite_header.node_index == tun_index);
278  }
279 
280  return rv;
281 }
282 
283 static clib_error_t *
285  unformat_input_t * input,
286  vlib_cli_command_t * cmd)
287 {
288  unformat_input_t _line_input, * line_input = &_line_input;
289  u8 is_add = 1;
290  ip_address_t slocator, dlocator, *slocators = 0, *dlocators = 0;
291  ip_prefix_t * prefp;
292  gid_address_t * eids = 0, eid;
293  clib_error_t * error = 0;
294  u32 i;
295 
296  prefp = &gid_address_ippref(&eid);
297 
298  /* Get a line of input. */
299  if (! unformat_user (input, unformat_line_input, line_input))
300  return 0;
301 
302  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
303  {
304  if (unformat (line_input, "del"))
305  is_add = 0;
306  else if (unformat (line_input, "add"))
307  is_add = 1;
308  else if (unformat (line_input, "eid %U slocator %U dlocator %U",
309  unformat_ip_prefix, prefp,
310  unformat_ip_address, &slocator,
311  unformat_ip_address, &dlocator))
312  {
313  vec_add1 (eids, eid);
314  vec_add1 (slocators, slocator);
315  vec_add1 (dlocators, dlocator);
316  }
317  else
318  {
319  error = unformat_parse_error (line_input);
320  goto done;
321  }
322  }
323  unformat_free (line_input);
324 
325  if (vec_len (eids) + vec_len (slocators) == 0)
326  {
327  error = clib_error_return (0, "expected ip4/ip6 eids/locators.");
328  goto done;
329  }
330 
331  if (vec_len (eids) != vec_len (slocators))
332  {
333  error = clib_error_return (0, "number of eids not equal to that of "
334  "locators.");
335  goto done;
336  }
337 
338  for (i = 0; i < vec_len(eids); i++)
339  {
341  memset (&a, 0, sizeof(a));
342 
343  a.is_add = is_add;
344  a.deid = eids[i];
345  a.slocator = slocators[i];
346  a.dlocator = dlocators[i];
348  }
349 
350  done:
351  vec_free(eids);
352  vec_free(slocators);
353  vec_free(dlocators);
354  return error;
355 }
356 
357 VLIB_CLI_COMMAND (lisp_gpe_add_del_fwd_entry_command, static) = {
358  .path = "lisp gpe maptunnel",
359  .short_help = "lisp gpe maptunnel eid <eid> sloc <src-locator> "
360  "dloc <dst-locator> [del]",
362 };
363 
364 static u8 *
365 format_decap_next (u8 * s, va_list * args)
366 {
367  u32 next_index = va_arg (*args, u32);
368 
369  switch (next_index)
370  {
371  case LISP_GPE_INPUT_NEXT_DROP:
372  return format (s, "drop");
373  case LISP_GPE_INPUT_NEXT_IP4_INPUT:
374  return format (s, "ip4");
375  case LISP_GPE_INPUT_NEXT_IP6_INPUT:
376  return format (s, "ip6");
377  default:
378  return format (s, "unknown %d", next_index);
379  }
380  return s;
381 }
382 
383 u8 *
384 format_lisp_gpe_tunnel (u8 * s, va_list * args)
385 {
386  lisp_gpe_tunnel_t * t = va_arg (*args, lisp_gpe_tunnel_t *);
388 
389  s = format (s,
390  "[%d] %U (src) %U (dst) fibs: encap %d, decap %d",
391  t - lgm->tunnels,
392  format_ip_address, &t->src,
393  format_ip_address, &t->dst,
394  t->encap_fib_index,
395  t->decap_fib_index);
396 
397  s = format (s, " decap next %U\n", format_decap_next, t->decap_next_index);
398  s = format (s, "lisp ver %d ", (t->ver_res>>6));
399 
400 #define _(n,v) if (t->flags & v) s = format (s, "%s-bit ", #n);
402 #undef _
403 
404  s = format (s, "next_protocol %d ver_res %x res %x\n",
405  t->next_protocol, t->ver_res, t->res);
406 
407  s = format (s, "iid %d (0x%x)\n", t->vni, t->vni);
408  return s;
409 }
410 
411 static clib_error_t *
413  unformat_input_t * input,
414  vlib_cli_command_t * cmd)
415 {
417  lisp_gpe_tunnel_t * t;
418 
419  if (pool_elts (lgm->tunnels) == 0)
420  vlib_cli_output (vm, "No lisp-gpe tunnels configured...");
421 
422  pool_foreach (t, lgm->tunnels,
423  ({
424  vlib_cli_output (vm, "%U", format_lisp_gpe_tunnel, t);
425  }));
426 
427  return 0;
428 }
429 
430 VLIB_CLI_COMMAND (show_lisp_gpe_tunnel_command, static) = {
431  .path = "show lisp gpe tunnel",
433 };
434 
435 u8
437 {
439 
440  return lgm->is_en;
441 }
442 
443 clib_error_t *
445 {
447  vnet_main_t * vnm = lgm->vnet_main;
448 
449  if (a->is_en)
450  {
451  /* add lgpe_ip4_lookup as possible next_node for ip4 lookup */
452  if (lgm->ip4_lookup_next_lgpe_ip4_lookup == ~0)
453  {
455  vnm->vlib_main, ip4_lookup_node.index,
456  lgpe_ip4_lookup_node.index);
457  }
458  /* add lgpe_ip6_lookup as possible next_node for ip6 lookup */
459  if (lgm->ip6_lookup_next_lgpe_ip6_lookup == ~0)
460  {
462  vnm->vlib_main, ip6_lookup_node.index,
463  lgpe_ip6_lookup_node.index);
464  }
465  else
466  {
467  /* ask cp to re-add ifaces and defaults */
468  }
469 
470  lgm->is_en = 1;
471  }
472  else
473  {
474  CLIB_UNUSED(uword * val);
475  hash_pair_t * p;
476  u32 * table_ids = 0, * table_id;
477  lisp_gpe_tunnel_key_t * tunnels = 0, * tunnel;
479  vnet_lisp_gpe_add_del_iface_args_t _ai, * ai= &_ai;
480 
481  /* remove all tunnels */
482  mhash_foreach(tunnel, val, &lgm->lisp_gpe_tunnel_by_key, ({
483  vec_add1(tunnels, tunnel[0]);
484  }));
485 
486  vec_foreach(tunnel, tunnels) {
487  memset(at, 0, sizeof(at[0]));
488  at->is_add = 0;
490  ip_prefix_copy(&gid_address_ippref(&at->deid), &tunnel->eid);
491  ip_address_copy(&at->dlocator, &tunnel->dst_loc);
493  }
494  vec_free(tunnels);
495 
496  /* disable all ifaces */
498  vec_add1(table_ids, p->key);
499  }));
500 
501  vec_foreach(table_id, table_ids) {
502  ai->is_add = 0;
503  ai->table_id = table_id[0];
504 
505  /* disables interface and removes defaults */
507  }
508  vec_free(table_ids);
509  lgm->is_en = 0;
510  }
511 
512  return 0;
513 }
514 
515 static clib_error_t *
517  vlib_cli_command_t * cmd)
518 {
519  unformat_input_t _line_input, * line_input = &_line_input;
520  u8 is_en = 1;
522 
523  /* Get a line of input. */
524  if (! unformat_user (input, unformat_line_input, line_input))
525  return 0;
526 
527  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
528  {
529  if (unformat (line_input, "enable"))
530  is_en = 1;
531  else if (unformat (line_input, "disable"))
532  is_en = 0;
533  else
534  {
535  return clib_error_return (0, "parse error: '%U'",
536  format_unformat_error, line_input);
537  }
538  }
539  a->is_en = is_en;
540  return vnet_lisp_gpe_enable_disable (a);
541 }
542 
543 VLIB_CLI_COMMAND (enable_disable_lisp_gpe_command, static) = {
544  .path = "lisp gpe",
545  .short_help = "lisp gpe [enable|disable]",
547 };
548 
549 clib_error_t *
551 {
553  clib_error_t * error = 0;
554 
555  if ((error = vlib_call_init_function (vm, ip_main_init)))
556  return error;
557 
558  if ((error = vlib_call_init_function (vm, ip4_lookup_init)))
559  return error;
560 
561  lgm->vnet_main = vnet_get_main();
562  lgm->vlib_main = vm;
563  lgm->im4 = &ip4_main;
564  lgm->im6 = &ip6_main;
565  lgm->lm4 = &ip4_main.lookup_main;
566  lgm->lm6 = &ip6_main.lookup_main;
569 
570  mhash_init (&lgm->lisp_gpe_tunnel_by_key, sizeof(uword),
571  sizeof(lisp_gpe_tunnel_key_t));
572 
573  udp_register_dst_port (vm, UDP_DST_PORT_lisp_gpe,
574  lisp_gpe_ip4_input_node.index, 1 /* is_ip4 */);
575  udp_register_dst_port (vm, UDP_DST_PORT_lisp_gpe6,
576  lisp_gpe_ip6_input_node.index, 0 /* is_ip4 */);
577  return 0;
578 }
579 
580 u8 *
581 format_vnet_lisp_gpe_status (u8 * s, va_list * args)
582 {
584  return format (s, "%s", lgm->is_en ? "enabled" : "disabled");
585 }
586 
vlib_node_registration_t lisp_gpe_ip4_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip4_input_node)
Definition: decap.c:359
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:267
u32 decap_next_index
Definition: lisp_gpe.h:62
#define gid_address_type(_a)
Definition: lisp_types.h:161
#define CLIB_UNUSED(x)
Definition: clib.h:79
uword unformat(unformat_input_t *i, char *fmt,...)
Definition: unformat.c:942
u32 ip4_lookup_next_lgpe_ip4_lookup
Definition: lisp_gpe.h:151
a
Definition: bitmap.h:393
u8 vnet_lisp_gpe_enable_disable_status(void)
Definition: lisp_gpe.c:436
ip4_address_t src_address
Definition: ip4_packet.h:138
ip_lookup_next_t lookup_next_index
Definition: lookup.h:163
int vnet_lisp_gpe_add_del_fwd_entry(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *hw_if_indexp)
Definition: lisp_gpe.c:214
always_inline void unformat_free(unformat_input_t *i)
Definition: format.h:160
#define UNFORMAT_END_OF_INPUT
Definition: format.h:142
clib_error_t * vnet_lisp_gpe_enable_disable(vnet_lisp_gpe_enable_disable_args_t *a)
Definition: lisp_gpe.c:444
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
Definition: mhash.c:350
lisp_gpe_tunnel_t * tunnels
Definition: lisp_gpe.h:131
#define mhash_foreach(k, v, mh, body)
Definition: mhash.h:147
uword unformat_ip_address(unformat_input_t *input, va_list *args)
Definition: lisp_types.c:123
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:480
static clib_error_t * show_lisp_gpe_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: lisp_gpe.c:412
always_inline uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
Definition: mhash.h:111
gid_address_t deid
Definition: lisp_gpe.h:213
ip_lookup_main_t lookup_main
Definition: ip4.h:129
static int add_del_negative_fwd_entry(lisp_gpe_main_t *lgm, vnet_lisp_gpe_add_del_fwd_entry_args_t *a)
Definition: lisp_gpe.c:178
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
Definition: vec.h:405
uword * lgpe_ip6_lookup_next_index_by_table_id
Definition: lisp_gpe.h:148
ip_address_t dlocator
Definition: lisp_gpe.h:217
ip6_address_t src_address
Definition: ip6_packet.h:293
#define ip_prefix_version(_a)
Definition: lisp_types.h:54
vlib_main_t * vlib_main
Definition: lisp_gpe.h:155
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
Definition: ip4_forward.c:1360
always_inline uword unformat_check_input(unformat_input_t *i)
Definition: format.h:168
vnet_main_t * vnet_get_main(void)
Definition: misc.c:45
#define foreach_copy_field
Definition: lisp_gpe.c:94
#define pool_foreach(VAR, POOL, BODY)
Definition: pool.h:328
ip6_main_t * im6
Definition: lisp_gpe.h:158
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:109
ip4_address_t dst_address
Definition: ip4_packet.h:138
u8 is_add
Definition: lisp_gpe.h:205
always_inline uword pool_elts(void *v)
Definition: pool.h:97
#define clib_warning(format, args...)
Definition: error.h:59
void ip_address_copy_addr(void *dst, ip_address_t *src)
Definition: lisp_types.c:425
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:953
void vnet_lisp_gpe_add_del_iface(vnet_lisp_gpe_add_del_iface_args_t *a, u32 *hw_if_indexp)
Definition: interface.c:484
#define vlib_call_init_function(vm, x)
Definition: init.h:159
Definition: lisp_gpe.h:203
ip_prefix_t eid
Definition: lisp_gpe.h:48
#define ip_addr_version(_a)
Definition: lisp_types.h:51
vlib_node_registration_t lisp_gpe_ip6_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip6_input_node)
Definition: decap.c:380
#define hash_get(h, key)
Definition: hash.h:231
#define pool_elt_at_index(p, i)
Definition: pool.h:346
mhash_t lisp_gpe_tunnel_by_key
Definition: lisp_gpe.h:134
vlib_main_t * vlib_main
Definition: vnet.h:78
u32 table_id
Definition: lisp_gpe.h:229
uword * lisp_gpe_hw_if_index_by_table_id
Definition: lisp_gpe.h:144
static int lisp_gpe_rewrite(lisp_gpe_tunnel_t *t)
Definition: lisp_gpe.c:21
#define pool_put(P, E)
Definition: pool.h:200
#define unformat_parse_error(input)
Definition: format.h:265
u32 ip6_lookup_next_lgpe_ip6_lookup
Definition: lisp_gpe.h:152
u8 * format_gid_address(u8 *s, va_list *args)
Definition: lisp_types.c:151
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:538
u32 decap_next_index
Definition: lisp_gpe.h:223
always_inline u16 ip4_header_checksum(ip4_header_t *i)
Definition: ip4_packet.h:194
#define gid_address_ippref(_a)
Definition: lisp_types.h:162
u8 is_negative
Definition: lisp_gpe.h:208
#define pool_get_aligned(P, E, A)
Definition: pool.h:155
u32 vni
Definition: lisp_gpe.h:226
clib_error_t * ip_main_init(vlib_main_t *vm)
Definition: ip_init.c:45
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
Definition: mhash.c:169
vlib_node_registration_t lgpe_ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (lgpe_ip4_lookup_node)
Definition: ip_forward.c:912
int ip_sd_fib_add_del_route(lisp_gpe_main_t *lgm, ip_prefix_t *dst_prefix, ip_prefix_t *src_prefix, u32 table_id, ip_adjacency_t *add_adj, u8 is_add)
Definition: ip_forward.c:666
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:298
u32 ip_sd_fib_get_route(lisp_gpe_main_t *lgm, ip_prefix_t *dst_prefix, ip_prefix_t *src_prefix, u32 table_id)
Definition: ip_forward.c:679
vnet_main_t * vnet_main
Definition: lisp_gpe.h:156
lisp_gpe_main_t lisp_gpe_main
Definition: lisp_gpe.c:18
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:150
vlib_node_registration_t ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (ip6_lookup_node)
Definition: ip6_forward.c:1267
struct _gid_address_t gid_address_t
u8 * format_vnet_lisp_gpe_status(u8 *s, va_list *args)
Definition: lisp_gpe.c:581
#define ASSERT(truth)
unsigned int u32
Definition: types.h:88
u8 * format_ip_address(u8 *s, va_list *args)
Definition: lisp_types.c:103
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:87
ip6_main_t ip6_main
Definition: ip6_forward.c:2490
ip_lookup_main_t lookup_main
Definition: ip6.h:135
clib_error_t * lisp_gpe_init(vlib_main_t *vm)
Definition: lisp_gpe.c:550
u8 * format(u8 *s, char *fmt,...)
Definition: format.c:405
DROP
Definition: error.def:41
ip_address_t slocator
Definition: lisp_gpe.h:216
vlib_node_registration_t lgpe_ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (lgpe_ip6_lookup_node)
Definition: ip_forward.c:1129
uword unformat_ip_prefix(unformat_input_t *input, va_list *args)
Definition: lisp_types.c:143
clib_error_t * ip4_lookup_init(vlib_main_t *vm)
Definition: ip4_forward.c:1397
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
Definition: node_funcs.h:919
always_inline ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
Definition: lookup.h:423
u64 uword
Definition: types.h:112
u32 ip_version_traffic_class_and_flow_label
Definition: ip6_packet.h:280
negative_fwd_actions_e action
Definition: lisp_gpe.h:209
static clib_error_t * lisp_gpe_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: lisp_gpe.c:516
ip_lookup_main_t * lm4
Definition: lisp_gpe.h:159
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char u8
Definition: types.h:56
ip4_main_t * im4
Definition: lisp_gpe.h:157
#define hash_foreach_pair(p, v, body)
Definition: hash.h:311
gid_address_t seid
Definition: lisp_gpe.h:212
Definition: lisp_types.h:24
static u8 * format_decap_next(u8 *s, va_list *args)
Definition: lisp_gpe.c:365
ip4_main_t ip4_main
Definition: ip4_forward.c:1394
static u32 add_del_ip_tunnel(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *tun_index_res)
Definition: lisp_gpe.c:101
#define vec_foreach(var, vec)
Vector iterator.
i16 explicit_fib_index
Definition: lookup.h:168
u8 * format_lisp_gpe_tunnel(u8 *s, va_list *args)
Definition: lisp_gpe.c:384
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
Definition: udp_local.c:374
#define clib_error_return(e, args...)
Definition: error.h:112
u8 ip_version_and_header_length
Definition: ip4_packet.h:108
struct _unformat_input_t unformat_input_t
ip_lookup_main_t * lm6
Definition: lisp_gpe.h:160
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:67
unformat_function_t unformat_line_input
Definition: format.h:279
void ip_prefix_copy(void *dst, void *src)
Definition: lisp_types.c:466
ip_address_t dst_loc
Definition: lisp_gpe.h:49
uword * lgpe_ip4_lookup_next_index_by_table_id
Definition: lisp_gpe.h:147
always_inline uword * mhash_get(mhash_t *h, void *key)
Definition: mhash.h:104
ip_address_t src
Definition: lisp_gpe.h:65
void ip_address_copy(ip_address_t *dst, ip_address_t *src)
Definition: lisp_types.c:419
ip_address_t dst
Definition: lisp_gpe.h:66
ip6_address_t dst_address
Definition: ip6_packet.h:293
static clib_error_t * lisp_gpe_add_del_fwd_entry_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: lisp_gpe.c:284