FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
map_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * map_api.c - vnet map api
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <vnet/ip/ip_types_api.h>
21 #include <map/map.h>
22 #include <map/map.api_enum.h>
23 #include <map/map.api_types.h>
24 #include <vnet/ip/ip.h>
28 #include <vnet/fib/fib_table.h>
29 #include <vlibmemory/api.h>
30 
31 #define REPLY_MSG_ID_BASE mm->msg_id_base
33 
34 static void
36 {
37  map_main_t *mm = &map_main;
39  int rv = 0;
40  u32 index;
41  u8 flags = 0;
42 
43  mp->tag[ARRAY_LEN (mp->tag) - 1] = '\0';
44  rv =
45  map_create_domain ((ip4_address_t *) & mp->ip4_prefix.address,
46  mp->ip4_prefix.len,
47  (ip6_address_t *) & mp->ip6_prefix.address,
48  mp->ip6_prefix.len,
49  (ip6_address_t *) & mp->ip6_src.address,
50  mp->ip6_src.len, mp->ea_bits_len, mp->psid_offset,
51  mp->psid_length, &index, mp->mtu, flags, mp->tag);
52 
53  /* *INDENT-OFF* */
54  REPLY_MACRO2_END(VL_API_MAP_ADD_DOMAIN_REPLY,
55  ({
56  rmp->index = index;
57  }));
58 
59  /* *INDENT-ON* */
60 }
61 
62 static void
64 {
65  map_main_t *mm = &map_main;
66  vl_api_map_del_domain_reply_t *rmp;
67  int rv = 0;
68 
69  rv = map_delete_domain (ntohl (mp->index));
70 
71  REPLY_MACRO (VL_API_MAP_DEL_DOMAIN_REPLY);
72 }
73 
74 static void
76 {
77  map_main_t *mm = &map_main;
78  vl_api_map_del_domain_reply_t *rmp;
79  int rv = 0;
80 
81  rv =
82  map_add_del_psid (ntohl (mp->index), ntohs (mp->psid),
83  (ip6_address_t *) & mp->ip6_dst, mp->is_add);
84 
85  REPLY_MACRO (VL_API_MAP_ADD_DEL_RULE_REPLY);
86 }
87 
88 static void
90  u32 context)
91 {
92  map_main_t *mm = &map_main;
94  map_domain_t *d = pool_elt_at_index (mm->domains, map_domain_index);
95 
96  /* Make sure every field is initiated (or don't skip the clib_memset()) */
97  map_domain_extra_t *de =
98  vec_elt_at_index (mm->domain_extras, map_domain_index);
99  int tag_len = clib_min (ARRAY_LEN (rmp->tag), vec_len (de->tag) + 1);
100 
101  /* *INDENT-OFF* */
102  REPLY_MACRO_DETAILS4(VL_API_MAP_DOMAIN_DETAILS, rp, context,
103  ({
104  rmp->domain_index = htonl (map_domain_index);
105  clib_memcpy (&rmp->ip6_prefix.address, &d->ip6_prefix,
106  sizeof (rmp->ip6_prefix.address));
107  clib_memcpy (&rmp->ip4_prefix.address, &d->ip4_prefix,
108  sizeof (rmp->ip4_prefix.address));
109  clib_memcpy (&rmp->ip6_src.address, &d->ip6_src,
110  sizeof (rmp->ip6_src.address));
111  rmp->ip6_prefix.len = d->ip6_prefix_len;
112  rmp->ip4_prefix.len = d->ip4_prefix_len;
113  rmp->ip6_src.len = d->ip6_src_len;
114  rmp->ea_bits_len = d->ea_bits_len;
115  rmp->psid_offset = d->psid_offset;
116  rmp->psid_length = d->psid_length;
117  rmp->flags = d->flags;
118  rmp->mtu = htons (d->mtu);
119  memcpy (rmp->tag, de->tag, tag_len - 1);
120  rmp->tag[tag_len - 1] = '\0';
121  }));
122  /* *INDENT-ON* */
123 }
124 
125 static void
127 {
128  map_main_t *mm = &map_main;
129  int i;
131 
132  if (pool_elts (mm->domains) == 0)
133  return;
134 
136  if (!reg)
137  return;
138 
139  /* *INDENT-OFF* */
141  {
142  send_domain_details(i, reg, mp->context);
143  }
144  /* *INDENT-ON* */
145 }
146 
147 static void
149 {
150  map_main_t *mm = &map_main;
152 
153  i32 rv = 0;
154 
155  /* *INDENT-OFF* */
156  REPLY_AND_DETAILS_MACRO (VL_API_MAP_DOMAINS_GET_REPLY, mm->domains,
157  ({
158  send_domain_details (cursor, rp, mp->context);
159  }));
160  /* *INDENT-ON* */
161 }
162 
163 static void
165 {
167  u16 i;
168  ip6_address_t dst;
170  map_main_t *mm = &map_main;
171  u32 domain_index = ntohl (mp->domain_index);
172  map_domain_t *d;
173 
174  if (pool_elts (mm->domains) == 0)
175  return;
176 
177  d = pool_elt_at_index (mm->domains, domain_index);
178  if (!d || !d->rules)
179  {
180  return;
181  }
182 
184  if (!reg)
185  return;
186 
187  for (i = 0; i < (0x1 << d->psid_length); i++)
188  {
189  dst = d->rules[i];
190  if (dst.as_u64[0] == 0 && dst.as_u64[1] == 0)
191  {
192  continue;
193  }
194  rmp = vl_msg_api_alloc (sizeof (*rmp));
195  clib_memset (rmp, 0, sizeof (*rmp));
196  rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS + mm->msg_id_base);
197  rmp->psid = htons (i);
198  clib_memcpy (&rmp->ip6_dst, &dst, sizeof (rmp->ip6_dst));
199  rmp->context = mp->context;
200  vl_api_send_msg (reg, (u8 *) rmp);
201  }
202 }
203 
204 static void
206 {
209  vlib_counter_t v;
210  int i, which;
211  u64 total_pkts[VLIB_N_RX_TX];
212  u64 total_bytes[VLIB_N_RX_TX];
213  map_main_t *mm = &map_main;
215 
217  if (!reg)
218  return;
219 
220  rmp = vl_msg_api_alloc (sizeof (*rmp));
221  rmp->_vl_msg_id = htons (VL_API_MAP_SUMMARY_STATS_REPLY + mm->msg_id_base);
222  rmp->context = mp->context;
223  rmp->retval = 0;
224 
225  if (pool_elts (mm->domains) == 0)
226  {
227  rmp->retval = -1;
228  goto out;
229  }
230 
231  clib_memset (total_pkts, 0, sizeof (total_pkts));
232  clib_memset (total_bytes, 0, sizeof (total_bytes));
233 
236  {
237  which = cm - mm->domain_counters;
238 
239  for (i = 0; i < vlib_combined_counter_n_counters (cm); i++)
240  {
242  total_pkts[which] += v.packets;
243  total_bytes[which] += v.bytes;
244  }
245  }
246 
248 
249  /* Note: in network byte order! */
251  clib_host_to_net_u64 (total_pkts[MAP_DOMAIN_COUNTER_RX]);
253  clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_RX]);
255  clib_host_to_net_u64 (total_pkts[MAP_DOMAIN_COUNTER_TX]);
257  clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_TX]);
258  rmp->total_bindings = clib_host_to_net_u64 (pool_elts (mm->domains));
259  rmp->total_ip4_fragments = 0; // Not yet implemented. Should be a simple counter.
261  clib_host_to_net_u64 (map_error_counter_get
262  (ip4_map_node.index, MAP_ERROR_ENCAP_SEC_CHECK));
264  clib_host_to_net_u64 (map_error_counter_get
265  (ip4_map_node.index, MAP_ERROR_DECAP_SEC_CHECK));
266 
267 out:
268  vl_api_send_msg (reg, (u8 *) rmp);
269 }
270 
271 
272 int
273 map_param_set_fragmentation (bool inner, bool ignore_df)
274 {
275  map_main_t *mm = &map_main;
276 
277  mm->frag_inner = ! !inner;
278  mm->frag_ignore_df = ! !ignore_df;
279 
280  return 0;
281 }
282 
283 static void
286 {
287  map_main_t *mm = &map_main;
288  vl_api_map_param_set_fragmentation_reply_t *rmp;
289  int rv = 0;
290 
292 
293  REPLY_MACRO (VL_API_MAP_PARAM_SET_FRAGMENTATION_REPLY);
294 }
295 
296 
297 int
298 map_param_set_icmp (ip4_address_t * icmp_src_address)
299 {
300  map_main_t *mm = &map_main;
301 
302  if (icmp_src_address == 0)
303  return -1;
304 
305  mm->icmp4_src_address = *icmp_src_address;
306 
307  return 0;
308 }
309 
310 
311 static void
313 {
314  map_main_t *mm = &map_main;
315  vl_api_map_param_set_icmp_reply_t *rmp;
316  int rv;
317 
319 
320  REPLY_MACRO (VL_API_MAP_PARAM_SET_ICMP_REPLY);
321 }
322 
323 
324 int
325 map_param_set_icmp6 (u8 enable_unreachable)
326 {
327  map_main_t *mm = &map_main;
328 
329  mm->icmp6_enabled = ! !enable_unreachable;
330 
331  return 0;
332 }
333 
334 static void
336 {
337  map_main_t *mm = &map_main;
338  vl_api_map_param_set_icmp6_reply_t *rmp;
339  int rv;
340 
342 
343  REPLY_MACRO (VL_API_MAP_PARAM_SET_ICMP6_REPLY);
344 }
345 
346 
347 static void
350 {
351  map_main_t *mm = &map_main;
352  vl_api_map_param_add_del_pre_resolve_reply_t *rmp;
353  int rv = 0;
354 
356  (ip6_address_t *) & mp->ip6_nh_address, !mp->is_add);
357 
358  REPLY_MACRO (VL_API_MAP_PARAM_ADD_DEL_PRE_RESOLVE_REPLY);
359 }
360 
361 int
362 map_param_set_security_check (bool enable, bool fragments)
363 {
364  map_main_t *mm = &map_main;
365 
366  mm->sec_check = ! !enable;
367  mm->sec_check_frag = ! !fragments;
368 
369  return 0;
370 }
371 
372 static void
375 {
376  map_main_t *mm = &map_main;
377  vl_api_map_param_set_security_check_reply_t *rmp;
378  int rv;
379 
381 
382  REPLY_MACRO (VL_API_MAP_PARAM_SET_SECURITY_CHECK_REPLY);
383 }
384 
385 
386 int
388 {
389  map_main_t *mm = &map_main;
390 
391  mm->tc_copy = ! !copy;
392  mm->tc = tc;
393 
394  return 0;
395 }
396 
397 static void
400 {
401  map_main_t *mm = &map_main;
402  vl_api_map_param_set_traffic_class_reply_t *rmp;
403  int rv;
404 
406 
407  REPLY_MACRO (VL_API_MAP_PARAM_SET_TRAFFIC_CLASS_REPLY);
408 }
409 
410 
411 int
413 {
414  map_main_t *mm = &map_main;
415 
416  mm->tcp_mss = tcp_mss;
417 
418  return 0;
419 }
420 
421 
422 static void
424 {
425  map_main_t *mm = &map_main;
426  vl_api_map_param_set_tcp_reply_t *rmp;
427  int rv = 0;
428 
430  REPLY_MACRO (VL_API_MAP_PARAM_SET_TCP_REPLY);
431 }
432 
433 
434 static void
436 {
437  map_main_t *mm = &map_main;
440 
442  if (!reg)
443  return;
444 
445  rmp = vl_msg_api_alloc (sizeof (*rmp));
446  rmp->_vl_msg_id = htons (VL_API_MAP_PARAM_GET_REPLY + mm->msg_id_base);
447  rmp->context = mp->context;
448  rmp->retval = 0;
449 
450  rmp->frag_inner = mm->frag_inner;
451  rmp->frag_ignore_df = mm->frag_ignore_df;
452 
454  &mm->icmp4_src_address, sizeof (rmp->icmp_ip4_err_relay_src));
455 
457 
458  /*
459  * FIXME: How are these addresses re-extracted from the FIB?
460  * Or should a local map_main copy be kept?
461  */
462  clib_memset (&rmp->ip4_nh_address, 0, sizeof (rmp->ip4_nh_address));
463  clib_memset (&rmp->ip6_nh_address, 0, sizeof (rmp->ip6_nh_address));
464 
465  rmp->sec_check_enable = mm->sec_check;
467 
468  rmp->tc_copy = mm->tc_copy;
469  rmp->tc_class = mm->tc;
470 
471  vl_api_send_msg (reg, (u8 *) rmp);
472 }
473 
474 
475 int
476 map_if_enable_disable (bool is_enable, u32 sw_if_index, bool is_translation)
477 {
478  map_main_t *mm = &map_main;
479 
481  sw_if_index))
482  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
483 
484  is_enable = ! !is_enable;
485 
486  if (is_translation)
487  {
489  == is_enable)
490  return 0;
491  }
492  else
493  {
495  == is_enable)
496  return 0;
497  }
498 
499  if (is_translation == false)
500  {
503  vnet_feature_enable_disable ("ip4-unicast", "ip4-map", sw_if_index,
504  is_enable ? 1 : 0, 0, 0);
505  vnet_feature_enable_disable ("ip6-unicast", "ip6-map", sw_if_index,
506  is_enable ? 1 : 0, 0, 0);
509  is_enable);
510  }
511  else
512  {
515  vnet_feature_enable_disable ("ip4-unicast", "ip4-map-t", sw_if_index,
516  is_enable ? 1 : 0, 0, 0);
517  vnet_feature_enable_disable ("ip6-unicast", "ip6-map-t", sw_if_index,
518  is_enable ? 1 : 0, 0, 0);
521  is_enable);
522  }
523 
524  return 0;
525 }
526 
527 
528 static void
530 {
531  map_main_t *mm = &map_main;
532  vl_api_map_if_enable_disable_reply_t *rmp;
533  int rv = 0;
534 
536 
537  rv =
538  map_if_enable_disable (mp->is_enable, htonl (mp->sw_if_index),
539  mp->is_translation);
540 
542  REPLY_MACRO (VL_API_MAP_IF_ENABLE_DISABLE_REPLY);
543 }
544 
545 /* API definitions */
546 #include <vnet/format_fns.h>
547 #include <map/map.api.c>
548 
549 /* Set up the API message handling tables */
550 clib_error_t *
552 {
553  map_main_t *mm = &map_main;
554 
556 
557  return 0;
558 }
559 
560 /*
561  * fd.io coding-style-patch-verification: ON
562  *
563  * Local Variables:
564  * eval: (c-set-style "gnu")
565  * End:
566  */
vl_api_map_param_set_icmp6_t::enable_unreachable
bool enable_unreachable
Definition: map.api:245
vl_api_map_domain_details_t::domain_index
u32 domain_index
Definition: map.api:136
vl_api_map_param_get_reply_t::frag_ignore_df
u8 frag_ignore_df
Definition: map.api:338
vl_api_map_add_domain_t::ea_bits_len
u8 ea_bits_len
Definition: map.api:40
vl_api_map_del_domain_t::index
u32 index
Definition: map.api:68
map_main_t::domain_extras
map_domain_extra_t * domain_extras
Definition: map.h:169
vl_api_map_param_set_tcp_t::tcp_mss
u16 tcp_mss
Definition: map.api:304
map_domain_t::rules
ip6_address_t * rules
Definition: map.h:82
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
vl_api_map_add_del_rule_t::ip6_dst
vl_api_ip6_address_t ip6_dst
Definition: map.api:86
api.h
vl_api_map_param_set_security_check_t::fragments
bool fragments
Definition: map.api:276
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
map_main_t::frag_inner
bool frag_inner
Definition: map.h:197
ip6_full_reass.h
IPv6 Reassembly.
REPLY_MACRO2_END
#define REPLY_MACRO2_END(t, body)
Definition: api_helper_macros.h:81
map_domain_t::ip4_prefix_len
u8 ip4_prefix_len
Definition: map.h:100
vl_api_map_param_get_t::context
u32 context
Definition: map.api:315
vl_api_map_add_domain_t_handler
static void vl_api_map_add_domain_t_handler(vl_api_map_add_domain_t *mp)
Definition: map_api.c:35
vl_api_map_add_del_rule_t::is_add
bool is_add
Definition: map.api:85
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_map_add_domain_t::psid_length
u8 psid_length
Definition: map.api:42
vl_api_map_param_get_t
Request for a single block of MAP parameters.
Definition: map.api:312
vl_api_map_param_get_reply_t::context
u32 context
Definition: map.api:335
map_domain_extra_t::tag
u8 * tag
Definition: map.h:113
map_main_t::icmp4_src_address
ip4_address_t icmp4_src_address
Definition: map.h:190
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
vl_api_map_domain_details_t::ip6_src
vl_api_ip6_prefix_t ip6_src
Definition: map.api:139
map_domain_t::mtu
u16 mtu
Definition: map.h:86
vl_api_map_rule_dump_t_handler
static void vl_api_map_rule_dump_t_handler(vl_api_map_rule_dump_t *mp)
Definition: map_api.c:164
map_main_t::icmp6_enabled
bool icmp6_enabled
Definition: map.h:185
vl_api_map_domain_details_t::ip6_prefix
vl_api_ip6_prefix_t ip6_prefix
Definition: map.api:137
MAP_DOMAIN_COUNTER_RX
@ MAP_DOMAIN_COUNTER_RX
Definition: map.h:126
vl_api_map_param_set_traffic_class_t::copy
bool copy
Definition: map.api:290
vl_api_map_add_domain_t::tag
string tag[64]
Definition: map.api:44
map_param_set_traffic_class
int map_param_set_traffic_class(bool copy, u8 tc)
Definition: map_api.c:387
vl_api_map_if_enable_disable_t
Enable or disable a MAP interface.
Definition: map.api:169
vl_api_map_summary_stats_reply_t
Reply for map_summary_stats request.
Definition: map.api:196
vl_api_map_param_set_icmp6_t_handler
static void vl_api_map_param_set_icmp6_t_handler(vl_api_map_param_set_icmp6_t *mp)
Definition: map_api.c:335
vl_api_map_add_domain_reply_t::index
u32 index
Definition: map.api:55
fib_table.h
map_param_set_icmp
int map_param_set_icmp(ip4_address_t *icmp_src_address)
Definition: map_api.c:298
u16
unsigned short u16
Definition: types.h:57
vl_api_map_param_get_reply_t::icmp6_enable_unreachable
bool icmp6_enable_unreachable
Definition: map.api:340
vl_api_map_domain_details_t::ip4_prefix
vl_api_ip4_prefix_t ip4_prefix
Definition: map.api:138
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
map_main_t::bm_encap_enabled_by_sw_if
uword * bm_encap_enabled_by_sw_if
Definition: map.h:202
vl_api_map_add_del_rule_t_handler
static void vl_api_map_add_del_rule_t_handler(vl_api_map_add_del_rule_t *mp)
Definition: map_api.c:75
map_plugin_api_hookup
clib_error_t * map_plugin_api_hookup(vlib_main_t *vm)
Definition: map_api.c:551
ip6_sv_reass_enable_disable_with_refcnt
int ip6_sv_reass_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
Definition: ip6_sv_reass.c:1301
map_main_t::sec_check
bool sec_check
Definition: map.h:183
map_main_t::sec_check_frag
bool sec_check_frag
Definition: map.h:184
map_param_set_icmp6
int map_param_set_icmp6(u8 enable_unreachable)
Definition: map_api.c:325
vl_api_map_domain_details_t::mtu
u16 mtu
Definition: map.api:144
vl_api_map_if_enable_disable_t::is_translation
bool is_translation
Definition: map.api:175
map_add_del_psid
int map_add_del_psid(u32 map_domain_index, u16 psid, ip6_address_t *tep, bool is_add)
Definition: map.c:235
vl_api_map_domain_dump_t
Definition: map.api:113
ip4_sv_reass_enable_disable_with_refcnt
int ip4_sv_reass_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
Definition: pnat_test_stubs.h:43
vl_api_map_summary_stats_reply_t::total_bytes
u64 total_bytes[2]
Definition: map.api:202
vl_api_map_if_enable_disable_t_handler
static void vl_api_map_if_enable_disable_t_handler(vl_api_map_if_enable_disable_t *mp)
Definition: map_api.c:529
vl_api_map_summary_stats_t::context
u32 context
Definition: map.api:185
map_main_t::tc_copy
bool tc_copy
Definition: map.h:181
map_pre_resolve
void map_pre_resolve(ip4_address_t *ip4, ip6_address_t *ip6, bool is_del)
Definition: map.c:407
vl_api_map_summary_stats_t
Request for a single block of summary stats.
Definition: map.api:182
map_delete_domain
int map_delete_domain(u32 map_domain_index)
Definition: map.c:204
vl_api_map_param_get_reply_t::sec_check_fragments
bool sec_check_fragments
Definition: map.api:348
vl_api_map_param_set_fragmentation_t
Set MAP fragmentation parameters.
Definition: map.api:214
map_main
map_main_t map_main
Definition: map.c:27
vl_api_map_param_get_reply_t::sec_check_enable
bool sec_check_enable
Definition: map.api:347
vl_api_map_rule_details_t
Definition: map.api:155
i32
signed int i32
Definition: types.h:77
map_domain_counter_lock
static void map_domain_counter_lock(map_main_t *mm)
Definition: map.h:378
map_domain_t
Definition: map.h:76
vl_api_map_rule_details_t::ip6_dst
vl_api_ip6_address_t ip6_dst
Definition: map.api:158
map_domain_extra_t
Definition: map.h:111
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
vl_api_map_rule_dump_t::context
u32 context
Definition: map.api:151
vl_api_map_param_set_traffic_class_t_handler
static void vl_api_map_param_set_traffic_class_t_handler(vl_api_map_param_set_traffic_class_t *mp)
Definition: map_api.c:399
vl_api_map_domains_get_t_handler
static void vl_api_map_domains_get_t_handler(vl_api_map_domains_get_t *mp)
Definition: map_api.c:148
which
int which
Definition: cJSON.h:234
vl_api_map_param_set_security_check_t_handler
static void vl_api_map_param_set_security_check_t_handler(vl_api_map_param_set_security_check_t *mp)
Definition: map_api.c:374
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
map_domain_counter_unlock
static void map_domain_counter_unlock(map_main_t *mm)
Definition: map.h:386
ip6_sv_reass.h
IPv6 shallow virtual reassembly.
clib_bitmap_get
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
Definition: bitmap.h:197
ip4_sv_reass.h
IPv4 shallow virtual reassembly.
map_main_t::tcp_mss
u16 tcp_mss
Definition: map.h:187
vl_api_map_summary_stats_reply_t::retval
i32 retval
Definition: map.api:199
map_domain_t::flags
map_domain_flags_e flags
Definition: map.h:87
vl_api_map_domain_dump_t_handler
static void vl_api_map_domain_dump_t_handler(vl_api_map_domain_dump_t *mp)
Definition: map_api.c:126
vec_elt_at_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Definition: vec_bootstrap.h:203
vl_api_map_param_set_tcp_t
Set MAP TCP parameters.
Definition: map.api:300
map_main_t
Definition: map.h:165
vlib_counter_t
Combined counter to hold both packets and byte differences.
Definition: counter_types.h:26
vl_api_map_add_domain_t::ip4_prefix
vl_api_ip4_prefix_t ip4_prefix
Definition: map.api:38
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: sr_mpls_api.c:174
ip6_full_reass_enable_disable_with_refcnt
int ip6_full_reass_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
Definition: ip6_full_reass.c:1829
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
map_domain_t::ip6_src
ip6_address_t ip6_src
Definition: map.h:80
vl_api_map_domain_dump_t::context
u32 context
Definition: map.api:117
vl_api_map_param_set_fragmentation_t::inner
bool inner
Definition: map.api:218
map_domain_t::psid_offset
u8 psid_offset
Definition: map.h:91
vl_api_map_param_set_icmp_t
Set MAP ICMP parameters.
Definition: map.api:228
vl_api_map_rule_dump_t::client_index
u32 client_index
Definition: map.api:150
vl_api_map_param_add_del_pre_resolve_t_handler
static void vl_api_map_param_add_del_pre_resolve_t_handler(vl_api_map_param_add_del_pre_resolve_t *mp)
Definition: map_api.c:349
vl_api_map_rule_details_t::context
u32 context
Definition: map.api:157
REPLY_MACRO_DETAILS4
#define REPLY_MACRO_DETAILS4(t, rp, context, body)
Definition: api_helper_macros.h:132
vl_api_map_param_get_t_handler
static void vl_api_map_param_get_t_handler(vl_api_map_param_get_t *mp)
Definition: map_api.c:435
vl_api_map_del_domain_t
Delete MAP domain.
Definition: map.api:64
send_domain_details
static void send_domain_details(u32 map_domain_index, vl_api_registration_t *rp, u32 context)
Definition: map_api.c:89
vl_api_map_summary_stats_reply_t::context
u32 context
Definition: map.api:198
map_error_counter_get
u64 map_error_counter_get(u32 node_index, map_error_t map_error)
Definition: map.c:1036
map_main_t::msg_id_base
u16 msg_id_base
Definition: map.h:177
vl_api_map_param_set_traffic_class_t::tc_class
u8 tc_class
Definition: map.api:291
map_main_t::domain_counters
vlib_combined_counter_main_t * domain_counters
Definition: map.h:173
vl_api_map_param_get_reply_t::frag_inner
u8 frag_inner
Definition: map.api:337
vl_api_map_domain_details_t::flags
u8 flags
Definition: map.api:143
vl_api_map_param_get_reply_t::icmp_ip4_err_relay_src
vl_api_ip4_address_t icmp_ip4_err_relay_src
Definition: map.api:339
vl_api_map_domain_details_t
Details about a single MAP domain.
Definition: map.api:133
vl_api_map_rule_details_t::psid
u16 psid
Definition: map.api:159
cm
vnet_feature_config_main_t * cm
Definition: nat44_ei_hairpinning.c:594
REPLY_AND_DETAILS_MACRO
#define REPLY_AND_DETAILS_MACRO(t, p, body)
Definition: api_helper_macros.h:204
vl_api_map_param_get_reply_t::tc_class
u8 tc_class
Definition: map.api:350
vl_api_map_param_add_del_pre_resolve_t::ip4_nh_address
vl_api_ip4_address_t ip4_nh_address
Definition: map.api:261
map_domain_t::ip6_prefix
ip6_address_t ip6_prefix
Definition: map.h:81
map_create_domain
int map_create_domain(ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip6_address_t *ip6_src, u8 ip6_src_len, u8 ea_bits_len, u8 psid_offset, u8 psid_length, u32 *map_domain_index, u16 mtu, u8 flags, u8 *tag)
Definition: map.c:105
ip4_address_t
Definition: ip4_packet.h:50
vl_api_map_domains_get_t
Definition: map.api:99
map_param_set_fragmentation
int map_param_set_fragmentation(bool inner, bool ignore_df)
Definition: map_api.c:273
vl_api_map_param_add_del_pre_resolve_t
Add/delete MAP pre-resolve IP addresses parameters.
Definition: map.api:256
clib_bitmap_set
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
Definition: bitmap.h:167
vl_api_map_param_set_fragmentation_t_handler
static void vl_api_map_param_set_fragmentation_t_handler(vl_api_map_param_set_fragmentation_t *mp)
Definition: map_api.c:285
clib_min
#define clib_min(x, y)
Definition: clib.h:342
vlib_counter_t::packets
counter_t packets
packet counter
Definition: counter_types.h:28
vnet_interface_main_t::sw_interfaces
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:1015
map.h
vl_api_map_domain_dump_t::client_index
u32 client_index
Definition: map.api:116
vl_api_map_param_set_icmp_t_handler
static void vl_api_map_param_set_icmp_t_handler(vl_api_map_param_set_icmp_t *mp)
Definition: map_api.c:312
vl_api_map_summary_stats_reply_t::total_bindings
u64 total_bindings
Definition: map.api:200
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
vl_api_map_add_del_rule_t
Add or Delete MAP rule from a domain (Only used for shared IPv4 per subscriber)
Definition: map.api:80
VLIB_N_RX_TX
@ VLIB_N_RX_TX
Definition: defs.h:48
vl_api_map_domain_details_t::tag
string tag[64]
Definition: map.api:145
vlib_combined_counter_n_counters
u32 vlib_combined_counter_n_counters(const vlib_combined_counter_main_t *cm)
The number of counters (not the number of per-thread counters)
Definition: counter.c:191
vl_api_map_summary_stats_reply_t::total_ip4_fragments
u64 total_ip4_fragments
Definition: map.api:203
vlib_get_combined_counter
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
Definition: counter.h:272
vl_api_map_param_add_del_pre_resolve_t::ip6_nh_address
vl_api_ip6_address_t ip6_nh_address
Definition: map.api:262
map_if_enable_disable
int map_if_enable_disable(bool is_enable, u32 sw_if_index, bool is_translation)
Definition: map_api.c:476
index
u32 index
Definition: flow_types.api:221
map_domain_t::ip4_prefix
ip4_address_t ip4_prefix
Definition: map.h:84
vl_api_map_param_set_security_check_t
Set MAP security-check parameters.
Definition: map.api:271
vl_api_map_param_get_reply_t::retval
i32 retval
Definition: map.api:336
pool_foreach_index
#define pool_foreach_index(i, v)
Definition: pool.h:572
vl_api_map_rule_dump_t
Definition: map.api:148
format_fns.h
u64
unsigned long u64
Definition: types.h:89
vlib_combined_counter_main_t
A collection of combined counters.
Definition: counter.h:203
vl_api_map_if_enable_disable_t::is_enable
bool is_enable
Definition: map.api:174
map_main_t::frag_ignore_df
bool frag_ignore_df
Definition: map.h:198
vl_api_map_add_del_rule_t::index
u32 index
Definition: map.api:84
vl_api_map_add_del_rule_t::psid
u16 psid
Definition: map.api:87
ip.h
u32
unsigned int u32
Definition: types.h:88
MAP_DOMAIN_COUNTER_TX
@ MAP_DOMAIN_COUNTER_TX
Definition: map.h:127
map_domain_t::ip6_prefix_len
u8 ip6_prefix_len
Definition: map.h:88
vlib_counter_t::bytes
counter_t bytes
byte counter
Definition: counter_types.h:29
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
api_helper_macros.h
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
vl_api_map_param_set_security_check_t::enable
bool enable
Definition: map.api:275
ip4_map_node
vlib_node_registration_t ip4_map_node
(constructor) VLIB_REGISTER_NODE (ip4_map_node)
Definition: ip4_map.c:337
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
vl_api_map_param_get_reply_t::ip6_nh_address
vl_api_ip6_address_t ip6_nh_address
Definition: map.api:342
vl_api_map_domain_details_t::psid_offset
u8 psid_offset
Definition: map.api:141
vl_api_map_param_add_del_pre_resolve_t::is_add
bool is_add
Definition: map.api:260
vl_api_map_param_get_reply_t
Reply for map_param_get request.
Definition: map.api:333
map_main_t::bm_trans_enabled_by_sw_if
uword * bm_trans_enabled_by_sw_if
Definition: map.h:201
vnet_feature_enable_disable
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
Definition: pnat_test_stubs.h:50
map_domain_t::psid_length
u8 psid_length
Definition: map.h:92
vl_api_map_summary_stats_t::client_index
u32 client_index
Definition: map.api:184
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_map_add_domain_reply_t
Reply for MAP domain add.
Definition: map.api:52
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vl_api_map_domain_details_t::ea_bits_len
u8 ea_bits_len
Definition: map.api:140
i
int i
Definition: flowhash_template.h:376
vl_api_map_summary_stats_t_handler
static void vl_api_map_summary_stats_t_handler(vl_api_map_summary_stats_t *mp)
Definition: map_api.c:205
map_main_t::domains
map_domain_t * domains
Definition: map.h:168
map_param_set_tcp
int map_param_set_tcp(u16 tcp_mss)
Definition: map_api.c:412
context
u32 context
Definition: ip.api:852
map_param_set_security_check
int map_param_set_security_check(bool enable, bool fragments)
Definition: map_api.c:362
map_domain_t::ea_bits_len
u8 ea_bits_len
Definition: map.h:90
rv
int __clib_unused rv
Definition: application.c:491
vl_api_map_domains_get_reply_t
Definition: map.api:106
vl_api_map_add_domain_t::mtu
u16 mtu[default=1280]
Definition: map.api:43
vl_api_map_add_domain_t
Add MAP domains.
Definition: map.api:33
vl_api_map_param_get_t::client_index
u32 client_index
Definition: map.api:314
vl_api_map_summary_stats_reply_t::total_pkts
u64 total_pkts[2]
Definition: map.api:201
vl_api_map_domain_details_t::psid_length
u8 psid_length
Definition: map.api:142
vl_api_map_param_get_reply_t::ip4_nh_address
vl_api_ip4_address_t ip4_nh_address
Definition: map.api:341
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
vl_api_map_summary_stats_reply_t::total_security_check
u64 total_security_check[2]
Definition: map.api:204
ip_types_api.h
vl_api_map_param_set_traffic_class_t
Set MAP traffic class parameters.
Definition: map.api:286
vl_api_map_rule_dump_t::domain_index
u32 domain_index
Definition: map.api:152
vl_api_map_if_enable_disable_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: map.api:173
vl_api_map_param_get_reply_t::tc_copy
bool tc_copy
Definition: map.api:349
vl_api_map_param_set_tcp_t_handler
static void vl_api_map_param_set_tcp_t_handler(vl_api_map_param_set_tcp_t *mp)
Definition: map_api.c:423
vnet_main_t::interface_main
vnet_interface_main_t interface_main
Definition: vnet.h:81
vl_api_map_del_domain_t_handler
static void vl_api_map_del_domain_t_handler(vl_api_map_del_domain_t *mp)
Definition: map_api.c:63
vl_api_map_add_domain_t::psid_offset
u8 psid_offset
Definition: map.api:41
map_domain_t::ip6_src_len
u8 ip6_src_len
Definition: map.h:89
map_main_t::vnet_main
vnet_main_t * vnet_main
Definition: map.h:195
vl_api_map_param_set_icmp6_t
Set MAP ICMP6 parameters.
Definition: map.api:241
vl_api_map_add_domain_t::ip6_src
vl_api_ip6_prefix_t ip6_src
Definition: map.api:39
vl_api_map_param_set_fragmentation_t::ignore_df
bool ignore_df
Definition: map.api:219
map_main_t::tc
u8 tc
Definition: map.h:180
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
vl_api_map_param_set_icmp_t::ip4_err_relay_src
vl_api_ip4_address_t ip4_err_relay_src
Definition: map.api:232
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
vl_api_map_add_domain_t::ip6_prefix
vl_api_ip6_prefix_t ip6_prefix
Definition: map.api:37