FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
nat44_ei_api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Cisco and/or its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <vnet/ip/ip_types_api.h>
18 #include <vlibmemory/api.h>
19 
20 #include <vnet/fib/fib_table.h>
21 
22 #include <nat/lib/nat_inlines.h>
23 #include <nat/lib/ipfix_logging.h>
24 
25 #include <nat/nat44-ei/nat44_ei.api_enum.h>
26 #include <nat/nat44-ei/nat44_ei.api_types.h>
27 
29 #include <nat/nat44-ei/nat44_ei.h>
30 
31 #define REPLY_MSG_ID_BASE nm->msg_id_base
33 
34 static void
37 {
41  int rv = 0;
42 
44  VL_API_NAT44_EI_SHOW_RUNNING_CONFIG_REPLY, ({
45  rmp->inside_vrf = htonl (rc->inside_vrf);
46  rmp->outside_vrf = htonl (rc->outside_vrf);
47  rmp->users = htonl (rc->users);
48  rmp->sessions = htonl (rc->sessions);
49  rmp->user_sessions = htonl (rc->user_sessions);
50 
51  rmp->user_buckets = htonl (nm->user_buckets);
53 
54  rmp->timeouts.udp = htonl (nm->timeouts.udp);
55  rmp->timeouts.tcp_established = htonl (nm->timeouts.tcp.established);
56  rmp->timeouts.tcp_transitory = htonl (nm->timeouts.tcp.transitory);
57  rmp->timeouts.icmp = htonl (nm->timeouts.icmp);
58 
60  // consider how to split functionality between subplugins
62 
63  if (rc->static_mapping_only)
65  if (rc->connection_tracking)
67  if (rc->out2in_dpo)
68  rmp->flags |= NAT44_EI_OUT2IN_DPO;
69  }));
70 }
71 
72 static void
74 {
76  vl_api_nat44_ei_set_workers_reply_t *rmp;
77  int rv = 0;
78  uword *bitmap = 0;
79  u64 mask;
80 
81  mask = clib_net_to_host_u64 (mp->worker_mask);
82 
83  if (nm->num_workers < 2)
84  {
85  rv = VNET_API_ERROR_FEATURE_DISABLED;
86  goto send_reply;
87  }
88 
89  bitmap = clib_bitmap_set_multiple (bitmap, 0, mask, BITS (mask));
90  rv = nat44_ei_set_workers (bitmap);
91  clib_bitmap_free (bitmap);
92 
93 send_reply:
94  REPLY_MACRO (VL_API_NAT44_EI_SET_WORKERS_REPLY);
95 }
96 
97 static void
99  u32 context)
100 {
104  vlib_worker_threads + worker_index + nm->first_worker_index;
105 
106  rmp = vl_msg_api_alloc (sizeof (*rmp));
107  clib_memset (rmp, 0, sizeof (*rmp));
108  rmp->_vl_msg_id = ntohs (VL_API_NAT44_EI_WORKER_DETAILS + nm->msg_id_base);
109  rmp->context = context;
110  rmp->worker_index = htonl (worker_index);
111  rmp->lcore_id = htonl (w->cpu_id);
112  strncpy ((char *) rmp->name, (char *) w->name, ARRAY_LEN (rmp->name) - 1);
113 
114  vl_api_send_msg (reg, (u8 *) rmp);
115 }
116 
117 static void
119 {
122  u32 *worker_index;
123 
125  if (!reg)
126  return;
127 
128  vec_foreach (worker_index, nm->workers)
129  {
130  send_nat_worker_details (*worker_index, reg, mp->context);
131  }
132 }
133 
134 static void
136 {
138  vl_api_nat44_ei_set_log_level_reply_t *rmp;
139  int rv = 0;
140 
141  if (nm->log_level > NAT_LOG_DEBUG)
142  rv = VNET_API_ERROR_UNSUPPORTED;
143  else
144  nm->log_level = mp->log_level;
145 
146  REPLY_MACRO (VL_API_NAT44_EI_SET_LOG_LEVEL_REPLY);
147 }
148 
149 static void
152 {
154  nat44_ei_config_t c = { 0 };
155  vl_api_nat44_ei_plugin_enable_disable_reply_t *rmp;
156  int rv = 0;
157 
158  if (mp->enable)
159  {
160  c.static_mapping_only = mp->flags & NAT44_EI_STATIC_MAPPING_ONLY;
161  c.connection_tracking = mp->flags & NAT44_EI_CONNECTION_TRACKING;
162  c.out2in_dpo = mp->flags & NAT44_EI_OUT2IN_DPO;
163 
164  c.inside_vrf = ntohl (mp->inside_vrf);
165  c.outside_vrf = ntohl (mp->outside_vrf);
166 
167  c.users = ntohl (mp->users);
168 
169  c.sessions = ntohl (mp->sessions);
170 
171  c.user_sessions = ntohl (mp->user_sessions);
172 
174  }
175  else
177 
178  REPLY_MACRO (VL_API_NAT44_EI_PLUGIN_ENABLE_DISABLE_REPLY);
179 }
180 
181 static void
184 {
186  vl_api_nat44_ei_ipfix_enable_disable_reply_t *rmp;
187  int rv = 0;
188 
190  clib_host_to_net_u32 (mp->domain_id),
191  clib_host_to_net_u16 (mp->src_port));
192 
193  REPLY_MACRO (VL_API_NAT44_EI_IPFIX_ENABLE_DISABLE_REPLY);
194 }
195 
196 static void
198 {
200  vl_api_nat44_ei_set_timeouts_reply_t *rmp;
201  int rv = 0;
202 
203  nm->timeouts.udp = ntohl (mp->udp);
204  nm->timeouts.tcp.established = ntohl (mp->tcp_established);
205  nm->timeouts.tcp.transitory = ntohl (mp->tcp_transitory);
206  nm->timeouts.icmp = ntohl (mp->icmp);
207 
208  REPLY_MACRO (VL_API_NAT44_EI_SET_TIMEOUTS_REPLY);
209 }
210 
211 static void
214 {
216  vl_api_nat44_ei_set_addr_and_port_alloc_alg_reply_t *rmp;
217  int rv = 0;
218  u16 port_start, port_end;
219 
220  switch (mp->alg)
221  {
222  case NAT44_EI_ADDR_AND_PORT_ALLOC_ALG_DEFAULT:
224  break;
225  case NAT44_EI_ADDR_AND_PORT_ALLOC_ALG_MAPE:
227  mp->psid_length);
228  break;
229  case NAT44_EI_ADDR_AND_PORT_ALLOC_ALG_RANGE:
230  port_start = ntohs (mp->start_port);
231  port_end = ntohs (mp->end_port);
232  if (port_end <= port_start)
233  {
234  rv = VNET_API_ERROR_INVALID_VALUE;
235  goto send_reply;
236  }
237  nat44_ei_set_alloc_range (port_start, port_end);
238  break;
239  default:
240  rv = VNET_API_ERROR_INVALID_VALUE;
241  break;
242  }
243 
244 send_reply:
245  REPLY_MACRO (VL_API_NAT44_EI_SET_ADDR_AND_PORT_ALLOC_ALG_REPLY);
246 }
247 
248 static void
251 {
254  int rv = 0;
255 
256  REPLY_MACRO2 (VL_API_NAT44_EI_GET_ADDR_AND_PORT_ALLOC_ALG_REPLY, ({
258  rmp->psid_offset = nm->psid_offset;
259  rmp->psid_length = nm->psid_length;
260  rmp->psid = htons (nm->psid);
261  rmp->start_port = htons (nm->start_port);
262  rmp->end_port = htons (nm->end_port);
263  }))
264 }
265 
266 static void
269 {
271  vl_api_nat44_ei_set_mss_clamping_reply_t *rmp;
272  int rv = 0;
273 
274  if (mp->enable)
275  nm->mss_clamping = ntohs (mp->mss_value);
276  else
277  nm->mss_clamping = 0;
278 
279  REPLY_MACRO (VL_API_NAT44_EI_SET_MSS_CLAMPING_REPLY);
280 }
281 
282 static void
285 {
288  int rv = 0;
289 
290  REPLY_MACRO2 (VL_API_NAT44_EI_GET_MSS_CLAMPING_REPLY, ({
291  rmp->enable = nm->mss_clamping ? 1 : 0;
292  rmp->mss_value = htons (nm->mss_clamping);
293  }))
294 }
295 
296 static void
299 {
301  vl_api_nat44_ei_ha_set_listener_reply_t *rmp;
303  int rv;
304 
305  memcpy (&addr, &mp->ip_address, sizeof (addr));
307  clib_net_to_host_u16 (mp->port),
308  clib_net_to_host_u32 (mp->path_mtu));
309 
310  REPLY_MACRO (VL_API_NAT44_EI_HA_SET_LISTENER_REPLY);
311 }
312 
313 static void
316 {
319  int rv = 0;
321  u16 port;
322  u32 path_mtu;
323 
325 
326  REPLY_MACRO2 (VL_API_NAT44_EI_HA_GET_LISTENER_REPLY, ({
327  clib_memcpy (rmp->ip_address, &addr, sizeof (ip4_address_t));
328  rmp->port = clib_host_to_net_u16 (port);
329  rmp->path_mtu = clib_host_to_net_u32 (path_mtu);
330  }))
331 }
332 
333 static void
336 {
338  vl_api_nat44_ei_ha_set_failover_reply_t *rmp;
340  int rv;
341 
342  memcpy (&addr, &mp->ip_address, sizeof (addr));
344  vlib_get_main (), &addr, clib_net_to_host_u16 (mp->port),
345  clib_net_to_host_u32 (mp->session_refresh_interval));
346 
347  REPLY_MACRO (VL_API_NAT44_EI_HA_SET_FAILOVER_REPLY);
348 }
349 
350 static void
353 {
356  int rv = 0;
358  u16 port;
359  u32 session_refresh_interval;
360 
361  nat_ha_get_failover (&addr, &port, &session_refresh_interval);
362 
363  REPLY_MACRO2 (VL_API_NAT44_EI_HA_GET_FAILOVER_REPLY, ({
364  clib_memcpy (rmp->ip_address, &addr, sizeof (ip4_address_t));
365  rmp->port = clib_host_to_net_u16 (port);
367  clib_host_to_net_u32 (session_refresh_interval);
368  }))
369 }
370 
371 static void
373 {
375  vl_api_nat44_ei_ha_flush_reply_t *rmp;
376  int rv = 0;
377 
378  nat_ha_flush (0);
379 
380  REPLY_MACRO (VL_API_NAT44_EI_HA_FLUSH_REPLY);
381 }
382 
383 static void
384 nat_ha_resync_completed_event_cb (u32 client_index, u32 pid, u32 missed_count)
385 {
389 
390  reg = vl_api_client_index_to_registration (client_index);
391  if (!reg)
392  return;
393 
394  mp = vl_msg_api_alloc (sizeof (*mp));
395  clib_memset (mp, 0, sizeof (*mp));
396  mp->client_index = client_index;
397  mp->pid = pid;
398  mp->missed_count = clib_host_to_net_u32 (missed_count);
399  mp->_vl_msg_id =
400  ntohs (VL_API_NAT44_EI_HA_RESYNC_COMPLETED_EVENT + nm->msg_id_base);
401 
402  vl_api_send_msg (reg, (u8 *) mp);
403 }
404 
405 static void
407 {
409  vl_api_nat44_ei_ha_resync_reply_t *rmp;
410  int rv;
411 
412  rv = nat_ha_resync (
413  mp->client_index, mp->pid,
415 
416  REPLY_MACRO (VL_API_NAT44_EI_HA_RESYNC_REPLY);
417 }
418 
419 static void
421 {
423  vl_api_nat44_ei_del_user_reply_t *rmp;
425  int rv;
426  memcpy (&addr.as_u8, mp->ip_address, 4);
427  rv = nat44_ei_user_del (&addr, ntohl (mp->fib_index));
428  REPLY_MACRO (VL_API_NAT44_EI_DEL_USER_REPLY);
429 }
430 
431 static void
434 {
436  vl_api_nat44_ei_add_del_address_range_reply_t *rmp;
437  ip4_address_t this_addr;
438  u8 is_add;
439  u32 start_host_order, end_host_order;
440  u32 vrf_id;
441  int i, count;
442  int rv = 0;
443  u32 *tmp;
444 
445  if (nm->static_mapping_only)
446  {
447  rv = VNET_API_ERROR_FEATURE_DISABLED;
448  goto send_reply;
449  }
450 
451  is_add = mp->is_add;
452 
453  tmp = (u32 *) mp->first_ip_address;
454  start_host_order = clib_host_to_net_u32 (tmp[0]);
455  tmp = (u32 *) mp->last_ip_address;
456  end_host_order = clib_host_to_net_u32 (tmp[0]);
457 
458  count = (end_host_order - start_host_order) + 1;
459 
460  vrf_id = clib_host_to_net_u32 (mp->vrf_id);
461 
462  if (count > 1024)
463  nat44_ei_log_info ("%U - %U, %d addresses...", format_ip4_address,
465  mp->last_ip_address, count);
466 
467  memcpy (&this_addr.as_u8, mp->first_ip_address, 4);
468 
469  for (i = 0; i < count; i++)
470  {
471  if (is_add)
472  rv = nat44_ei_add_address (nm, &this_addr, vrf_id);
473  else
474  rv = nat44_ei_del_address (nm, this_addr, 0);
475 
476  if (rv)
477  goto send_reply;
478 
479  if (nm->out2in_dpo)
480  nat44_ei_add_del_address_dpo (this_addr, is_add);
481 
482  increment_v4_address (&this_addr);
483  }
484 
485 send_reply:
486  REPLY_MACRO (VL_API_NAT44_EI_ADD_DEL_ADDRESS_RANGE_REPLY);
487 }
488 
489 static void
492 {
495 
496  rmp = vl_msg_api_alloc (sizeof (*rmp));
497  clib_memset (rmp, 0, sizeof (*rmp));
498  rmp->_vl_msg_id = ntohs (VL_API_NAT44_EI_ADDRESS_DETAILS + nm->msg_id_base);
499  clib_memcpy (rmp->ip_address, &(a->addr), 4);
500  if (a->fib_index != ~0)
501  {
502  fib_table_t *fib = fib_table_get (a->fib_index, FIB_PROTOCOL_IP4);
503  rmp->vrf_id = ntohl (fib->ft_table_id);
504  }
505  else
506  rmp->vrf_id = ~0;
507  rmp->context = context;
508 
509  vl_api_send_msg (reg, (u8 *) rmp);
510 }
511 
512 static void
514 {
518 
520  if (!reg)
521  return;
522 
524  {
526  }
527 }
528 
529 static void
532 {
534  vl_api_nat44_ei_interface_add_del_feature_reply_t *rmp;
535  u32 sw_if_index = ntohl (mp->sw_if_index);
536  u8 is_del;
537  int rv = 0;
538 
539  is_del = !mp->is_add;
540 
542 
544  is_del);
545 
547 
548  REPLY_MACRO (VL_API_NAT44_EI_INTERFACE_ADD_DEL_FEATURE_REPLY);
549 }
550 
551 static void
554 {
557 
558  rmp = vl_msg_api_alloc (sizeof (*rmp));
559  clib_memset (rmp, 0, sizeof (*rmp));
560  rmp->_vl_msg_id =
561  ntohs (VL_API_NAT44_EI_INTERFACE_DETAILS + nm->msg_id_base);
562  rmp->sw_if_index = ntohl (i->sw_if_index);
563 
565  rmp->flags |= NAT44_EI_IF_INSIDE;
567  rmp->flags |= NAT44_EI_IF_OUTSIDE;
568 
569  rmp->context = context;
570 
571  vl_api_send_msg (reg, (u8 *) rmp);
572 }
573 
574 static void
576 {
580 
582  if (!reg)
583  return;
584 
586  {
588  }
589 }
590 
591 static void
594 {
596  vl_api_nat44_ei_interface_add_del_output_feature_reply_t *rmp;
597  u32 sw_if_index = ntohl (mp->sw_if_index);
598  int rv = 0;
599 
601 
604 
606  REPLY_MACRO (VL_API_NAT44_EI_INTERFACE_ADD_DEL_OUTPUT_FEATURE_REPLY);
607 }
608 
609 static void
612  u32 context)
613 {
616 
617  rmp = vl_msg_api_alloc (sizeof (*rmp));
618  clib_memset (rmp, 0, sizeof (*rmp));
619  rmp->_vl_msg_id =
620  ntohs (VL_API_NAT44_EI_INTERFACE_OUTPUT_FEATURE_DETAILS + nm->msg_id_base);
621  rmp->sw_if_index = ntohl (i->sw_if_index);
622  rmp->context = context;
623 
625  rmp->flags |= NAT44_EI_IF_INSIDE;
626 
627  vl_api_send_msg (reg, (u8 *) rmp);
628 }
629 
630 static void
633 {
637 
639  if (!reg)
640  return;
641 
643  {
645  }
646 }
647 
648 static void
651 {
653  vl_api_nat44_ei_add_del_static_mapping_reply_t *rmp;
654  ip4_address_t local_addr, external_addr;
655  u16 local_port = 0, external_port = 0;
656  u32 vrf_id, external_sw_if_index;
657  int rv = 0;
659  u8 *tag = 0;
660 
661  memcpy (&local_addr.as_u8, mp->local_ip_address, 4);
662  memcpy (&external_addr.as_u8, mp->external_ip_address, 4);
663 
664  if (!(mp->flags & NAT44_EI_ADDR_ONLY_MAPPING))
665  {
666  local_port = mp->local_port;
667  external_port = mp->external_port;
668  }
669 
670  vrf_id = clib_net_to_host_u32 (mp->vrf_id);
671  external_sw_if_index = clib_net_to_host_u32 (mp->external_sw_if_index);
673 
674  mp->tag[sizeof (mp->tag) - 1] = 0;
675  tag = format (0, "%s", mp->tag);
677 
679  local_addr, external_addr, local_port, external_port, proto,
680  external_sw_if_index, vrf_id, mp->flags & NAT44_EI_ADDR_ONLY_MAPPING, 0,
681  tag, mp->is_add);
682 
683  vec_free (tag);
684 
685  REPLY_MACRO (VL_API_NAT44_EI_ADD_DEL_STATIC_MAPPING_REPLY);
686 }
687 
688 static void
691 {
694  u32 len = sizeof (*rmp);
695 
696  rmp = vl_msg_api_alloc (len);
697  clib_memset (rmp, 0, len);
698  rmp->_vl_msg_id =
699  ntohs (VL_API_NAT44_EI_STATIC_MAPPING_DETAILS + nm->msg_id_base);
700 
701  clib_memcpy (rmp->local_ip_address, &(m->local_addr), 4);
703  rmp->external_sw_if_index = ~0;
704  rmp->vrf_id = htonl (m->vrf_id);
705  rmp->context = context;
706 
708  {
710  }
711  else
712  {
714  rmp->external_port = m->external_port;
715  rmp->local_port = m->local_port;
716  }
717 
718  if (m->tag)
719  strncpy ((char *) rmp->tag, (char *) m->tag, vec_len (m->tag));
720 
721  vl_api_send_msg (reg, (u8 *) rmp);
722 }
723 
724 static void
727  u32 context)
728 {
731 
732  rmp = vl_msg_api_alloc (sizeof (*rmp));
733  clib_memset (rmp, 0, sizeof (*rmp));
734  rmp->_vl_msg_id =
735  ntohs (VL_API_NAT44_EI_STATIC_MAPPING_DETAILS + nm->msg_id_base);
736  clib_memcpy (rmp->local_ip_address, &(m->l_addr), 4);
737  rmp->external_sw_if_index = htonl (m->sw_if_index);
738  rmp->vrf_id = htonl (m->vrf_id);
739  rmp->context = context;
740 
741  if (m->addr_only)
742  {
744  }
745  else
746  {
748  rmp->external_port = m->e_port;
749  rmp->local_port = m->l_port;
750  }
751  if (m->tag)
752  strncpy ((char *) rmp->tag, (char *) m->tag, vec_len (m->tag));
753 
754  vl_api_send_msg (reg, (u8 *) rmp);
755 }
756 
757 static void
760 {
765  int j;
766 
768  if (!reg)
769  return;
770 
772  {
775  }
776 
777  for (j = 0; j < vec_len (nm->to_resolve); j++)
778  {
779  rp = nm->to_resolve + j;
780  if (!rp->identity_nat)
782  }
783 }
784 
785 static void
788 {
790  vl_api_nat44_ei_add_del_identity_mapping_reply_t *rmp;
792  u16 port = 0;
794  int rv = 0;
795  nat_protocol_t proto = NAT_PROTOCOL_OTHER;
796  u8 *tag = 0;
797 
798  if (!(mp->flags & NAT44_EI_ADDR_ONLY_MAPPING))
799  {
800  port = mp->port;
802  }
803  vrf_id = clib_net_to_host_u32 (mp->vrf_id);
804  sw_if_index = clib_net_to_host_u32 (mp->sw_if_index);
805  if (sw_if_index != ~0)
806  addr.as_u32 = 0;
807  else
808  memcpy (&addr.as_u8, mp->ip_address, 4);
809  mp->tag[sizeof (mp->tag) - 1] = 0;
810  tag = format (0, "%s", mp->tag);
812 
815  mp->flags & NAT44_EI_ADDR_ONLY_MAPPING, 1, tag, mp->is_add);
816 
817  vec_free (tag);
818 
819  REPLY_MACRO (VL_API_NAT44_EI_ADD_DEL_IDENTITY_MAPPING_REPLY);
820 }
821 
822 static void
824  int index, vl_api_registration_t *reg,
825  u32 context)
826 {
830 
831  rmp = vl_msg_api_alloc (sizeof (*rmp));
832  clib_memset (rmp, 0, sizeof (*rmp));
833  rmp->_vl_msg_id =
834  ntohs (VL_API_NAT44_EI_IDENTITY_MAPPING_DETAILS + nm->msg_id_base);
835 
838 
839  clib_memcpy (rmp->ip_address, &(m->local_addr), 4);
840  rmp->port = m->local_port;
841  rmp->sw_if_index = ~0;
842  rmp->vrf_id = htonl (local->vrf_id);
844  rmp->context = context;
845  if (m->tag)
846  strncpy ((char *) rmp->tag, (char *) m->tag, vec_len (m->tag));
847 
848  vl_api_send_msg (reg, (u8 *) rmp);
849 }
850 
851 static void
854  u32 context)
855 {
858  rmp = vl_msg_api_alloc (sizeof (*rmp));
859  clib_memset (rmp, 0, sizeof (*rmp));
860  rmp->_vl_msg_id =
861  ntohs (VL_API_NAT44_EI_IDENTITY_MAPPING_DETAILS + nm->msg_id_base);
862 
863  if (m->addr_only)
864  rmp->flags = (vl_api_nat44_ei_config_flags_t) NAT44_EI_ADDR_ONLY_MAPPING;
865 
866  rmp->port = m->l_port;
867  rmp->sw_if_index = htonl (m->sw_if_index);
868  rmp->vrf_id = htonl (m->vrf_id);
870  rmp->context = context;
871  if (m->tag)
872  strncpy ((char *) rmp->tag, (char *) m->tag, vec_len (m->tag));
873 
874  vl_api_send_msg (reg, (u8 *) rmp);
875 }
876 
877 static void
880 {
885  int j;
886 
888  if (!reg)
889  return;
890 
892  {
894  {
895  pool_foreach_index (j, m->locals)
896  {
898  }
899  }
900  }
901 
902  for (j = 0; j < vec_len (nm->to_resolve); j++)
903  {
904  rp = nm->to_resolve + j;
905  if (rp->identity_nat)
907  }
908 }
909 
910 static void
913 {
915  vl_api_nat44_ei_add_del_interface_addr_reply_t *rmp;
916  u32 sw_if_index = ntohl (mp->sw_if_index);
917  int rv = 0;
918  u8 is_del;
919 
920  is_del = !mp->is_add;
921 
923 
925 
927  REPLY_MACRO (VL_API_NAT44_EI_ADD_DEL_INTERFACE_ADDR_REPLY);
928 }
929 
930 static void
933 {
936 
937  rmp = vl_msg_api_alloc (sizeof (*rmp));
938  clib_memset (rmp, 0, sizeof (*rmp));
939  rmp->_vl_msg_id =
940  ntohs (VL_API_NAT44_EI_INTERFACE_ADDR_DETAILS + nm->msg_id_base);
941  rmp->sw_if_index = ntohl (sw_if_index);
942  rmp->context = context;
943 
944  vl_api_send_msg (reg, (u8 *) rmp);
945 }
946 
947 static void
950 {
953  u32 *i;
954 
956  if (!reg)
957  return;
958 
961 }
962 
963 static void
965  u32 context)
966 {
969  ip4_main_t *im = &ip4_main;
970 
971  rmp = vl_msg_api_alloc (sizeof (*rmp));
972  clib_memset (rmp, 0, sizeof (*rmp));
973  rmp->_vl_msg_id = ntohs (VL_API_NAT44_EI_USER_DETAILS + nm->msg_id_base);
974 
975  if (!pool_is_free_index (im->fibs, u->fib_index))
976  {
977  fib_table_t *fib = fib_table_get (u->fib_index, FIB_PROTOCOL_IP4);
978  rmp->vrf_id = ntohl (fib->ft_table_id);
979  }
980 
981  clib_memcpy (rmp->ip_address, &(u->addr), 4);
982  rmp->nsessions = ntohl (u->nsessions);
983  rmp->nstaticsessions = ntohl (u->nstaticsessions);
984  rmp->context = context;
985 
986  vl_api_send_msg (reg, (u8 *) rmp);
987 }
988 
989 static void
991 {
995  nat44_ei_user_t *u;
996 
998  if (!reg)
999  return;
1000 
1002  {
1003  pool_foreach (u, tnm->users)
1004  {
1005  send_nat44_ei_user_details (u, reg, mp->context);
1006  }
1007  }
1008 }
1009 
1010 static void
1011 send_nat44_ei_user_session_details (nat44_ei_session_t *s,
1013 {
1016 
1017  rmp = vl_msg_api_alloc (sizeof (*rmp));
1018  clib_memset (rmp, 0, sizeof (*rmp));
1019  rmp->_vl_msg_id =
1020  ntohs (VL_API_NAT44_EI_USER_SESSION_DETAILS + nm->msg_id_base);
1021  clib_memcpy (rmp->outside_ip_address, (&s->out2in.addr), 4);
1022  clib_memcpy (rmp->inside_ip_address, (&s->in2out.addr), 4);
1023 
1026 
1027  rmp->last_heard = clib_host_to_net_u64 ((u64) s->last_heard);
1028  rmp->total_bytes = clib_host_to_net_u64 (s->total_bytes);
1029  rmp->total_pkts = ntohl (s->total_pkts);
1030  rmp->context = context;
1032  {
1033  rmp->outside_port = 0;
1034  rmp->inside_port = 0;
1035  rmp->protocol = ntohs (s->in2out.port);
1036  }
1037  else
1038  {
1039  rmp->outside_port = s->out2in.port;
1040  rmp->inside_port = s->in2out.port;
1041  rmp->protocol = ntohs (nat_proto_to_ip_proto (s->nat_proto));
1042  }
1043  vl_api_send_msg (reg, (u8 *) rmp);
1044 }
1045 
1046 static void
1049 {
1050  vl_api_registration_t *reg;
1053  nat44_ei_session_t *s;
1055  nat44_ei_user_key_t ukey;
1056  nat44_ei_user_t *u;
1057  u32 session_index, head_index, elt_index;
1058  dlist_elt_t *head, *elt;
1059  ip4_header_t ip;
1060 
1062  if (!reg)
1063  return;
1064 
1065  clib_memcpy (&ukey.addr, mp->ip_address, 4);
1066  ip.src_address.as_u32 = ukey.addr.as_u32;
1067  ukey.fib_index = fib_table_find (FIB_PROTOCOL_IP4, ntohl (mp->vrf_id));
1068  key.key = ukey.as_u64;
1069  if (nm->num_workers > 1)
1070  tnm = vec_elt_at_index (
1073  else
1075 
1076  if (clib_bihash_search_8_8 (&tnm->user_hash, &key, &value))
1077  return;
1078  u = pool_elt_at_index (tnm->users, value.value);
1079  if (!u->nsessions && !u->nstaticsessions)
1080  return;
1081 
1082  head_index = u->sessions_per_user_list_head_index;
1083  head = pool_elt_at_index (tnm->list_pool, head_index);
1084  elt_index = head->next;
1085  elt = pool_elt_at_index (tnm->list_pool, elt_index);
1086  session_index = elt->value;
1087  while (session_index != ~0)
1088  {
1089  s = pool_elt_at_index (tnm->sessions, session_index);
1090 
1092 
1093  elt_index = elt->next;
1094  elt = pool_elt_at_index (tnm->list_pool, elt_index);
1095  session_index = elt->value;
1096  }
1097 }
1098 
1099 static void
1101 {
1103  vl_api_nat44_ei_del_session_reply_t *rmp;
1104  ip4_address_t addr, eh_addr;
1105  u16 port;
1106  u32 vrf_id;
1107  int rv = 0;
1108  u8 is_in;
1110 
1111  memcpy (&addr.as_u8, mp->address, 4);
1112  port = mp->port;
1113  vrf_id = clib_net_to_host_u32 (mp->vrf_id);
1115  memcpy (&eh_addr.as_u8, mp->ext_host_address, 4);
1116 
1117  // is session inside ?
1118  is_in = mp->flags & NAT44_EI_IF_INSIDE;
1119 
1120  rv = nat44_ei_del_session (nm, &addr, port, proto, vrf_id, is_in);
1121 
1122  REPLY_MACRO (VL_API_NAT44_EI_DEL_SESSION_REPLY);
1123 }
1124 
1125 static void
1128 {
1130  vl_api_nat44_ei_forwarding_enable_disable_reply_t *rmp;
1131  int rv = 0;
1132  u32 *ses_to_be_removed = 0, *ses_index;
1134  nat44_ei_session_t *s;
1135 
1136  nm->forwarding_enabled = mp->enable != 0;
1137 
1138  if (mp->enable == 0)
1139  {
1141  {
1142  vec_foreach (ses_index, ses_to_be_removed)
1143  {
1144  s = pool_elt_at_index (tnm->sessions, ses_index[0]);
1147  }
1148 
1149  vec_free (ses_to_be_removed);
1150  }
1151  }
1152 
1153  REPLY_MACRO (VL_API_NAT44_EI_FORWARDING_ENABLE_DISABLE_REPLY);
1154 }
1155 
1156 static void
1158 {
1160  vl_api_nat44_ei_set_fq_options_reply_t *rmp;
1161  int rv = 0;
1162  u32 frame_queue_nelts = ntohl (mp->frame_queue_nelts);
1163  rv = nat44_ei_set_frame_queue_nelts (frame_queue_nelts);
1164  REPLY_MACRO (VL_API_NAT44_EI_SET_FQ_OPTIONS_REPLY);
1165 }
1166 
1167 static void
1170 {
1173  int rv = 0;
1174  /* clang-format off */
1175  REPLY_MACRO2_ZERO (VL_API_NAT44_EI_SHOW_FQ_OPTIONS_REPLY,
1176  ({
1177  rmp->frame_queue_nelts = htonl (nm->frame_queue_nelts);
1178  }));
1179  /* clang-format on */
1180 }
1181 
1182 /* API definitions */
1183 #include <vnet/format_fns.h>
1184 #include <nat/nat44-ei/nat44_ei.api.c>
1185 
1186 /* Set up the API message handling tables */
1187 clib_error_t *
1189 {
1192  return 0;
1193 }
1194 
1195 /*
1196  * fd.io coding-style-patch-verification: ON
1197  *
1198  * Local Variables:
1199  * eval: (c-set-style "gnu")
1200  * End:
1201  */
NAT44_EI_STATIC_MAPPING_ONLY
@ NAT44_EI_STATIC_MAPPING_ONLY
Definition: nat44_ei.api:24
vl_api_nat44_ei_static_mapping_details_t::context
u32 context
Definition: nat44_ei.api:609
nat44_ei_main_s::timeouts
nat_timeouts_t timeouts
Definition: nat44_ei.h:405
vl_api_nat44_ei_interface_dump_t
Dump interfaces with NAT44 feature.
Definition: nat44_ei.api:491
nat44_ei_add_del_address_dpo
void nat44_ei_add_del_address_dpo(ip4_address_t addr, u8 is_add)
Definition: nat44_ei.c:1019
tmp
u32 * tmp
Definition: interface_output.c:1078
nat_ipfix_logging_enabled
int nat_ipfix_logging_enabled()
Definition: ipfix_logging.c:1269
vl_api_nat44_ei_static_mapping_details_t::tag
string tag[64]
Definition: nat44_ei.api:618
tnm
nat44_ei_main_per_thread_data_t * tnm
Definition: nat44_ei_out2in.c:712
vl_api_nat44_ei_add_del_static_mapping_t::local_ip_address
vl_api_ip4_address_t local_ip_address
Definition: nat44_ei.api:575
NAT44_EI_ADDR_ONLY_MAPPING
@ NAT44_EI_ADDR_ONLY_MAPPING
Definition: nat44_ei.api:27
nat44_ei_main_s::psid_offset
u8 psid_offset
Definition: nat44_ei.h:375
vl_api_nat44_ei_identity_mapping_details_t::vrf_id
u32 vrf_id
Definition: nat44_ei.api:676
vl_api_nat44_ei_show_running_config_reply_t::outside_vrf
u32 outside_vrf
Definition: nat44_ei.api:94
nat44_ei_api_hookup
clib_error_t * nat44_ei_api_hookup(vlib_main_t *vm)
Definition: nat44_ei_api.c:1188
vl_api_nat44_ei_add_del_identity_mapping_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:640
vl_api_nat44_ei_interface_output_feature_details_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:549
im
vnet_interface_main_t * im
Definition: interface_output.c:395
vl_api_nat44_ei_show_running_config_reply_t::user_buckets
u32 user_buckets
Definition: nat44_ei.api:98
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_nat44_ei_static_mapping_details_t::external_sw_if_index
vl_api_interface_index_t external_sw_if_index
Definition: nat44_ei.api:616
NAT44_EI_STATIC_MAPPING
@ NAT44_EI_STATIC_MAPPING
Definition: nat44_ei.api:30
vl_api_nat44_ei_set_addr_and_port_alloc_alg_t::psid
u16 psid
Definition: nat44_ei.api:208
nat44_ei_main_s::rconfig
nat44_ei_config_t rconfig
Definition: nat44_ei.h:472
vl_api_nat44_ei_interface_details_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:508
vl_api_nat44_ei_show_running_config_reply_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:104
api.h
nat_timeouts_t::udp
u32 udp
Definition: lib.h:84
vl_api_nat44_ei_add_del_interface_addr_t
Add/delete NAT44 pool address from specific interfce.
Definition: nat44_ei.api:687
vl_api_nat44_ei_interface_add_del_feature_t_handler
static void vl_api_nat44_ei_interface_add_del_feature_t_handler(vl_api_nat44_ei_interface_add_del_feature_t *mp)
Definition: nat44_ei_api.c:530
nat_timeouts_t::icmp
u32 icmp
Definition: lib.h:85
vl_api_nat44_ei_worker_dump_t::context
u32 context
Definition: nat44_ei.api:138
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
nat44_ei_address_t
Definition: nat44_ei.h:67
vl_api_nat44_ei_user_details_t::nstaticsessions
u32 nstaticsessions
Definition: nat44_ei.api:740
app_rx_mq_elt_::next
struct app_rx_mq_elt_ * next
Definition: application.h:100
vl_api_nat44_ei_add_del_static_mapping_t::is_add
bool is_add
Definition: nat44_ei.api:573
vl_api_nat44_ei_show_running_config_reply_t
Show NAT44 plugin running config reply.
Definition: nat44_ei.api:88
nat44_ei_user_key_t::fib_index
u32 fib_index
Definition: nat44_ei.h:105
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
nat44_ei_static_mapping_t::external_port
u16 external_port
Definition: nat44_ei.h:172
format_ip4_address
format_function_t format_ip4_address
Definition: format.h:73
vl_api_nat44_ei_get_mss_clamping_t
Get TCP MSS rewriting configuration.
Definition: nat44_ei.api:265
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
nat_timeouts_t::tcp
struct nat_timeouts_t::@732 tcp
vl_api_nat44_ei_add_del_static_mapping_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:574
vl_api_nat44_ei_del_user_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:425
nat44_ei_user_key_t::addr
ip4_address_t addr
Definition: nat44_ei.h:104
nat44_ei_main_s::user_buckets
u32 user_buckets
Definition: nat44_ei.h:320
vl_api_nat44_ei_interface_output_feature_details_t
NAT44 interface with output feature details response.
Definition: nat44_ei.api:546
send_nat44_ei_address_details
static void send_nat44_ei_address_details(nat44_ei_address_t *a, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:490
vl_api_nat44_ei_plugin_enable_disable_t::enable
bool enable
Definition: nat44_ei.api:59
ip4_main
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1105
nat_inlines.h
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_nat44_ei_set_mss_clamping_t
Set TCP MSS rewriting configuration.
Definition: nat44_ei.api:253
nat44_ei_main_s::static_mappings
nat44_ei_static_mapping_t * static_mappings
Definition: nat44_ei.h:336
nat44_ei_delete_session
void nat44_ei_delete_session(nat44_ei_main_t *nm, nat44_ei_session_t *ses, u32 thread_index)
Definition: nat44_ei.c:1753
nat_ha_get_listener
void nat_ha_get_listener(ip4_address_t *addr, u16 *port, u32 *path_mtu)
Get HA listener/local configuration.
Definition: nat44_ei_ha.c:530
vl_api_nat44_ei_interface_output_feature_dump_t::client_index
u32 client_index
Definition: nat44_ei.api:536
nat44_ei_main_s::end_port
u16 end_port
Definition: nat44_ei.h:380
nat_ha_flush
void nat_ha_flush(u8 is_resync)
Flush the current HA data (for testing)
Definition: nat44_ei_ha.c:827
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
vl_api_nat44_ei_get_addr_and_port_alloc_alg_t_handler
static void vl_api_nat44_ei_get_addr_and_port_alloc_alg_t_handler(vl_api_nat44_ei_get_addr_and_port_alloc_alg_t *mp)
Definition: nat44_ei_api.c:249
vl_api_nat44_ei_plugin_enable_disable_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:60
vl_api_nat44_ei_ha_get_failover_t_handler
static void vl_api_nat44_ei_ha_get_failover_t_handler(vl_api_nat44_ei_ha_get_failover_t *mp)
Definition: nat44_ei_api.c:351
vl_api_nat44_ei_set_workers_t
Set NAT workers.
Definition: nat44_ei.api:124
vl_api_nat44_ei_show_running_config_reply_t::users
u32 users
Definition: nat44_ei.api:95
vl_api_nat44_ei_set_fq_options_t::frame_queue_nelts
u32 frame_queue_nelts
Definition: nat44_ei.api:837
vl_api_nat44_ei_identity_mapping_dump_t_handler
static void vl_api_nat44_ei_identity_mapping_dump_t_handler(vl_api_nat44_ei_identity_mapping_dump_t *mp)
Definition: nat44_ei_api.c:878
nat44_ei_main_s::interfaces
nat44_ei_interface_t * interfaces
Definition: nat44_ei.h:339
NAT44_EI_IF_INSIDE
@ NAT44_EI_IF_INSIDE
Definition: nat44_ei.api:28
ip_proto_to_nat_proto
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
Definition: inlines.h:24
vl_api_nat44_ei_add_del_identity_mapping_t::is_add
bool is_add
Definition: nat44_ei.api:638
nat_protocol_t
nat_protocol_t
Definition: lib.h:63
REPLY_MACRO2_ZERO
#define REPLY_MACRO2_ZERO(t, body)
Definition: api_helper_macros.h:101
vl_api_nat44_ei_ha_get_listener_t
Get HA listener/local configuration.
Definition: nat44_ei.api:322
nat44_ei_interface_is_outside
#define nat44_ei_interface_is_outside(ip)
Definition: nat44_ei.h:673
vl_api_nat44_ei_user_details_t::context
u32 context
Definition: nat44_ei.api:736
vl_api_nat44_ei_add_del_static_mapping_t::local_port
u16 local_port
Definition: nat44_ei.api:578
vl_api_nat44_ei_get_addr_and_port_alloc_alg_reply_t::alg
u8 alg
Definition: nat44_ei.api:239
vl_api_nat44_ei_user_session_details_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:779
vl_api_nat44_ei_static_mapping_details_t::protocol
u8 protocol
Definition: nat44_ei.api:613
ip4_address_t::as_u32
u32 as_u32
Definition: ip4_packet.h:57
vl_api_nat44_ei_del_user_t::fib_index
u32 fib_index
Definition: nat44_ei.api:426
vl_api_nat44_ei_worker_dump_t
Dump NAT workers.
Definition: nat44_ei.api:135
vl_api_nat44_ei_user_session_details_t::protocol
u16 protocol
Definition: nat44_ei.api:778
vl_api_nat44_ei_user_session_dump_t::client_index
u32 client_index
Definition: nat44_ei.api:751
vl_api_nat44_ei_forwarding_enable_disable_t_handler
static void vl_api_nat44_ei_forwarding_enable_disable_t_handler(vl_api_nat44_ei_forwarding_enable_disable_t *mp)
Definition: nat44_ei_api.c:1126
fib_table.h
vl_api_nat44_ei_static_mapping_details_t::vrf_id
u32 vrf_id
Definition: nat44_ei.api:617
vl_api_nat44_ei_get_addr_and_port_alloc_alg_reply_t::psid_offset
u8 psid_offset
Definition: nat44_ei.api:240
vl_api_nat44_ei_ha_get_failover_reply_t::port
u16 port
Definition: nat44_ei.api:367
vl_api_nat44_ei_user_session_details_t::outside_port
u16 outside_port
Definition: nat44_ei.api:775
u16
unsigned short u16
Definition: types.h:57
vl_api_nat44_ei_user_dump_t_handler
static void vl_api_nat44_ei_user_dump_t_handler(vl_api_nat44_ei_user_dump_t *mp)
Definition: nat44_ei_api.c:990
nat44_ei_main_s::psid_length
u8 psid_length
Definition: nat44_ei.h:376
nat44_ei_plugin_enable
int nat44_ei_plugin_enable(nat44_ei_config_t c)
Definition: nat44_ei.c:419
nat44_ei_interface_t
Definition: nat44_ei.h:188
nat44_ei_static_mapping_t::tag
u8 * tag
Definition: nat44_ei.h:181
vl_api_nat44_ei_ha_get_listener_reply_t::port
u16 port
Definition: nat44_ei.api:340
vl_api_nat44_ei_user_details_t::nsessions
u32 nsessions
Definition: nat44_ei.api:739
NAT44_EI_OUT2IN_DPO
@ NAT44_EI_OUT2IN_DPO
Definition: nat44_ei.api:26
vl_api_nat44_ei_ha_resync_completed_event_t::client_index
u32 client_index
Definition: nat44_ei.api:406
vl_api_nat44_ei_set_addr_and_port_alloc_alg_t::psid_length
u8 psid_length
Definition: nat44_ei.api:207
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vl_api_nat44_ei_user_session_dump_t_handler
static void vl_api_nat44_ei_user_session_dump_t_handler(vl_api_nat44_ei_user_session_dump_t *mp)
Definition: nat44_ei_api.c:1047
vl_api_nat44_ei_set_mss_clamping_t::mss_value
u16 mss_value
Definition: nat44_ei.api:257
nat44_ei_main_per_thread_data_t::list_pool
dlist_elt_t * list_pool
Definition: nat44_ei.h:286
vl_api_nat44_ei_set_log_level_t
Set NAT44 logging level.
Definition: nat44_ei.api:112
port
u16 port
Definition: lb_types.api:73
vl_api_nat44_ei_add_del_identity_mapping_t::protocol
u8 protocol
Definition: nat44_ei.api:641
vl_api_nat44_ei_identity_mapping_dump_t::context
u32 context
Definition: nat44_ei.api:655
vl_api_nat44_ei_add_del_static_mapping_t::external_ip_address
vl_api_ip4_address_t external_ip_address
Definition: nat44_ei.api:576
vl_api_nat44_ei_user_session_details_t::inside_port
u16 inside_port
Definition: nat44_ei.api:777
nat44_ei_set_frame_queue_nelts
int nat44_ei_set_frame_queue_nelts(u32 frame_queue_nelts)
Definition: nat44_ei.c:2874
send_nat44_ei_identity_mapping_details
static void send_nat44_ei_identity_mapping_details(nat44_ei_static_mapping_t *m, int index, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:823
nat44_ei_lb_addr_port_t
Definition: nat44_ei.h:147
nat44_ei_main_s::addr_and_port_alloc_alg
nat44_ei_addr_and_port_alloc_alg_t addr_and_port_alloc_alg
Definition: nat44_ei.h:373
vl_api_nat44_ei_plugin_enable_disable_t::sessions
u32 sessions
Definition: nat44_ei.api:56
nat44_ei_main_s::addresses
nat44_ei_address_t * addresses
Definition: nat44_ei.h:369
vl_api_nat44_ei_show_running_config_reply_t::translation_buckets
u32 translation_buckets
Definition: nat44_ei.api:99
vl_api_nat44_ei_interface_output_feature_details_t::context
u32 context
Definition: nat44_ei.api:548
nat_timeouts_t::transitory
u32 transitory
Definition: lib.h:81
vl_api_nat44_ei_user_dump_t::context
u32 context
Definition: nat44_ei.api:724
vl_api_nat44_ei_get_addr_and_port_alloc_alg_t
Get address and port assignment algorithm.
Definition: nat44_ei.api:217
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
vl_api_nat44_ei_ha_set_listener_t
Set HA listener (local settings)
Definition: nat44_ei.api:292
vl_api_nat44_ei_interface_output_feature_dump_t
Dump interfaces with NAT44 output feature.
Definition: nat44_ei.api:534
vlib_worker_threads
vlib_worker_thread_t * vlib_worker_threads
Definition: threads.c:35
vl_api_nat44_ei_interface_addr_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat44_ei.api:714
vl_api_nat44_ei_forwarding_enable_disable_t::enable
bool enable
Definition: nat44_ei.api:825
vl_api_nat44_ei_set_addr_and_port_alloc_alg_t
Set address and port assignment algorithm.
Definition: nat44_ei.api:201
vl_api_nat44_ei_set_addr_and_port_alloc_alg_t_handler
static void vl_api_nat44_ei_set_addr_and_port_alloc_alg_t_handler(vl_api_nat44_ei_set_addr_and_port_alloc_alg_t *mp)
Definition: nat44_ei_api.c:212
vl_api_nat44_ei_add_del_static_mapping_t::vrf_id
u32 vrf_id
Definition: nat44_ei.api:581
vl_api_nat44_ei_set_addr_and_port_alloc_alg_t::start_port
u16 start_port
Definition: nat44_ei.api:209
ip4_header_t
Definition: ip4_packet.h:87
vl_api_nat44_ei_del_session_t::vrf_id
u32 vrf_id
Definition: nat44_ei.api:808
vl_api_nat44_ei_identity_mapping_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat44_ei.api:675
vl_api_nat44_ei_show_running_config_t
Show NAT44 plugin running config.
Definition: nat44_ei.api:67
send_nat44_ei_static_map_resolve_details
static void send_nat44_ei_static_map_resolve_details(nat44_ei_static_map_resolve_t *m, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:725
send_nat_worker_details
static void send_nat_worker_details(u32 worker_index, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:98
key
typedef key
Definition: ipsec_types.api:88
nat44_ei_config_t::sessions
u32 sessions
Definition: nat44_ei.h:116
vl_api_nat44_ei_set_log_level_t::log_level
vl_api_nat_log_level_t log_level
Definition: nat44_ei.api:116
nat44_ei_main_per_thread_data_t::sessions
nat44_ei_session_t * sessions
Definition: nat44_ei.h:283
nat44_ei_main_s
Definition: nat44_ei.h:316
vl_api_nat44_ei_add_del_static_mapping_t::protocol
u8 protocol
Definition: nat44_ei.api:577
vl_api_nat44_ei_interface_output_feature_dump_t::context
u32 context
Definition: nat44_ei.api:537
vl_api_nat44_ei_user_session_details_t::inside_ip_address
vl_api_ip4_address_t inside_ip_address
Definition: nat44_ei.api:776
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_nat44_ei_ha_resync_t::want_resync_event
u8 want_resync_event
Definition: nat44_ei.api:394
vl_api_nat44_ei_del_session_t_handler
static void vl_api_nat44_ei_del_session_t_handler(vl_api_nat44_ei_del_session_t *mp)
Definition: nat44_ei_api.c:1100
vl_api_nat44_ei_interface_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat44_ei.api:509
vl_api_nat44_ei_interface_addr_dump_t
Dump NAT44 pool addresses interfaces.
Definition: nat44_ei.api:700
vl_api_nat44_ei_address_dump_t_handler
static void vl_api_nat44_ei_address_dump_t_handler(vl_api_nat44_ei_address_dump_t *mp)
Definition: nat44_ei_api.c:513
vl_api_nat44_ei_get_addr_and_port_alloc_alg_reply_t::end_port
u16 end_port
Definition: nat44_ei.api:244
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: bfd_api.c:451
vl_api_nat44_ei_add_del_identity_mapping_t
Add/delete NAT44 identity mapping.
Definition: nat44_ei.api:634
vl_api_nat44_ei_address_details_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:466
fib_table_t_
A protocol Independent FIB table.
Definition: fib_table.h:71
vl_api_nat44_ei_ha_flush_t
Flush the current HA data (for testing)
Definition: nat44_ei.api:375
vl_api_nat44_ei_ha_get_failover_reply_t::session_refresh_interval
u32 session_refresh_interval
Definition: nat44_ei.api:368
vl_api_nat44_ei_ha_resync_t_handler
static void vl_api_nat44_ei_ha_resync_t_handler(vl_api_nat44_ei_ha_resync_t *mp)
Definition: nat44_ei_api.c:406
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
vl_api_nat44_ei_add_del_static_mapping_t
Add/delete NAT44 static mapping.
Definition: nat44_ei.api:569
vl_api_nat44_ei_ipfix_enable_disable_t::enable
bool enable
Definition: nat44_ei.api:168
vl_api_nat44_ei_identity_mapping_details_t::protocol
u8 protocol
Definition: nat44_ei.api:673
nat44_ei_config_t::out2in_dpo
u8 out2in_dpo
Definition: nat44_ei.h:123
nat44_ei_is_session_static
#define nat44_ei_is_session_static(sp)
Definition: nat44_ei.h:666
vl_api_nat44_ei_add_del_address_range_t::last_ip_address
vl_api_ip4_address_t last_ip_address
Definition: nat44_ei.api:443
count
u8 count
Definition: dhcp.api:208
nat44_ei_config_t::user_sessions
u32 user_sessions
Definition: nat44_ei.h:118
pid
u32 pid
Definition: dhcp.api:164
nat44_ei_main_s::to_resolve
nat44_ei_static_map_resolve_t * to_resolve
Definition: nat44_ei.h:392
vl_api_nat44_ei_static_mapping_dump_t
Dump NAT44 static mappings.
Definition: nat44_ei.api:589
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
nat44_ei_get_in2out_worker_index
u32 nat44_ei_get_in2out_worker_index(ip4_header_t *ip0, u32 rx_fib_index0, u8 is_output)
Definition: nat44_ei.c:1408
vl_api_nat44_ei_set_addr_and_port_alloc_alg_t::alg
u8 alg
Definition: nat44_ei.api:205
len
u8 len
Definition: ip_types.api:103
vl_api_nat44_ei_user_details_t::vrf_id
u32 vrf_id
Definition: nat44_ei.api:737
vl_api_nat44_ei_user_details_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:738
nat_timeouts_t::established
u32 established
Definition: lib.h:80
vl_api_nat44_ei_user_session_details_t::outside_ip_address
vl_api_ip4_address_t outside_ip_address
Definition: nat44_ei.api:774
vl_api_nat44_ei_worker_details_t::lcore_id
u32 lcore_id
Definition: nat44_ei.api:151
vl_api_nat44_ei_static_mapping_details_t::local_port
u16 local_port
Definition: nat44_ei.api:614
nat44_ei_add_address
int nat44_ei_add_address(nat44_ei_main_t *nm, ip4_address_t *addr, u32 vrf_id)
Definition: nat44_ei.c:2575
nat44_ei_main
nat44_ei_main_t nat44_ei_main
Definition: nat44_ei.c:40
nat44_ei_user_key_t
Definition: nat44_ei.h:98
nat44_ei_main_s::static_mapping_only
u8 static_mapping_only
Definition: nat44_ei.h:324
vl_api_nat44_ei_set_addr_and_port_alloc_alg_t::end_port
u16 end_port
Definition: nat44_ei.api:210
vl_api_nat44_ei_user_session_dump_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:753
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_nat44_ei_ha_set_failover_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:313
vl_api_nat44_ei_show_fq_options_t_handler
static void vl_api_nat44_ei_show_fq_options_t_handler(vl_api_nat44_ei_show_fq_options_t *mp)
Definition: nat44_ei_api.c:1168
fib_table_t_::ft_table_id
u32 ft_table_id
Table ID (hash key) for this FIB.
Definition: fib_table.h:92
vl_api_nat44_ei_ha_resync_t::pid
u32 pid
Definition: nat44_ei.api:395
vl_api_nat44_ei_set_mss_clamping_t_handler
static void vl_api_nat44_ei_set_mss_clamping_t_handler(vl_api_nat44_ei_set_mss_clamping_t *mp)
Definition: nat44_ei_api.c:267
vl_api_nat44_ei_add_del_static_mapping_t::tag
string tag[64]
Definition: nat44_ei.api:582
nat44_ei_static_map_resolve_t::proto
nat_protocol_t proto
Definition: nat44_ei.h:139
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
nat44_ei_user_del
int nat44_ei_user_del(ip4_address_t *addr, u32 fib_index)
Delete specific NAT44 EI user and his sessions.
Definition: nat44_ei.c:1314
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
BITS
#define BITS(x)
Definition: clib.h:69
vl_api_nat44_ei_interface_dump_t::context
u32 context
Definition: nat44_ei.api:494
vl_api_nat44_ei_ha_get_listener_reply_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:339
nat_proto_to_ip_proto
static_always_inline u8 nat_proto_to_ip_proto(nat_protocol_t nat_proto)
Definition: inlines.h:37
c
svmdb_client_t * c
Definition: vpp_get_metrics.c:48
vl_api_nat44_ei_get_addr_and_port_alloc_alg_reply_t::start_port
u16 start_port
Definition: nat44_ei.api:243
nat44_ei_config_t::users
u32 users
Definition: nat44_ei.h:114
nat44_ei_free_session_data
void nat44_ei_free_session_data(nat44_ei_main_t *nm, nat44_ei_session_t *s, u32 thread_index, u8 is_ha)
Definition: nat44_ei.c:1252
vl_api_nat44_ei_static_mapping_details_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:610
nat44_ei_main_s::translation_buckets
u32 translation_buckets
Definition: nat44_ei.h:319
vl_api_nat44_ei_interface_details_t::context
u32 context
Definition: nat44_ei.api:507
clib_bitmap_free
#define clib_bitmap_free(v)
Free a bitmap.
Definition: bitmap.h:92
nat44_ei_static_map_resolve_t::tag
u8 * tag
Definition: nat44_ei.h:143
uword
u64 uword
Definition: types.h:112
vl_api_nat44_ei_interface_details_t
NAT44 interface details response.
Definition: nat44_ei.api:505
vl_api_nat44_ei_show_running_config_reply_t::user_sessions
u32 user_sessions
Definition: nat44_ei.api:97
vl_api_nat44_ei_identity_mapping_dump_t
Dump NAT44 identity mappings.
Definition: nat44_ei.api:652
vlib_worker_thread_t::cpu_id
int cpu_id
Definition: threads.h:110
vl_api_nat44_ei_identity_mapping_details_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:671
vl_api_nat44_ei_del_session_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:809
vl_api_nat44_ei_plugin_enable_disable_t_handler
static void vl_api_nat44_ei_plugin_enable_disable_t_handler(vl_api_nat44_ei_plugin_enable_disable_t *mp)
Definition: nat44_ei_api.c:150
NAT44_EI_CONNECTION_TRACKING
@ NAT44_EI_CONNECTION_TRACKING
Definition: nat44_ei.api:25
nat44_ei_add_del_static_mapping
int nat44_ei_add_del_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr, u16 l_port, u16 e_port, nat_protocol_t proto, u32 sw_if_index, u32 vrf_id, u8 addr_only, u8 identity_nat, u8 *tag, u8 is_add)
Add/delete NAT44-EI static mapping.
Definition: nat44_ei.c:1853
vl_api_nat44_ei_add_del_address_range_t::vrf_id
u32 vrf_id
Definition: nat44_ei.api:444
ipfix_logging.h
nat44_ei_add_interface_address
int nat44_ei_add_interface_address(nat44_ei_main_t *nm, u32 sw_if_index, int is_del)
Definition: nat44_ei.c:2632
nat44_ei_config_t::static_mapping_only
u8 static_mapping_only
Definition: nat44_ei.h:121
vl_api_nat44_ei_ha_get_failover_reply_t
Get HA failover/remote settings reply.
Definition: nat44_ei.api:362
NAT44_EI_IF_OUTSIDE
@ NAT44_EI_IF_OUTSIDE
Definition: nat44_ei.api:29
vl_api_nat44_ei_ha_resync_completed_event_t
Tell client about a HA resync completion event.
Definition: nat44_ei.api:403
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
nat44_ei_main_s::workers
u32 * workers
Definition: nat44_ei.h:358
vl_api_nat44_ei_interface_add_del_feature_t::is_add
bool is_add
Definition: nat44_ei.api:482
vl_api_nat44_ei_set_log_level_t_handler
static void vl_api_nat44_ei_set_log_level_t_handler(vl_api_nat44_ei_set_log_level_t *mp)
Definition: nat44_ei_api.c:135
vl_api_nat44_ei_identity_mapping_details_t::port
u16 port
Definition: nat44_ei.api:674
nat44_ei_main_s::per_thread_data
nat44_ei_main_per_thread_data_t * per_thread_data
Definition: nat44_ei.h:366
mask
vl_api_pnat_mask_t mask
Definition: pnat.api:45
dlist_elt_t::next
u32 next
Definition: dlist.h:30
vl_api_nat44_ei_ha_set_failover_t
Set HA failover (remote settings)
Definition: nat44_ei.api:309
dlist_elt_t
Definition: dlist.h:28
vl_api_nat44_ei_show_running_config_reply_t::ipfix_logging_enabled
bool ipfix_logging_enabled
Definition: nat44_ei.api:101
vl_api_nat44_ei_user_details_t
NAT44 users response.
Definition: nat44_ei.api:734
nat44_ei_static_mapping_t
Definition: nat44_ei.h:161
vl_api_nat44_ei_del_session_t::ext_host_address
vl_api_ip4_address_t ext_host_address
Definition: nat44_ei.api:810
send_nat44_ei_static_mapping_details
static void send_nat44_ei_static_mapping_details(nat44_ei_static_mapping_t *m, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:689
vl_api_nat44_ei_static_mapping_details_t
NAT44 static mapping details response.
Definition: nat44_ei.api:607
nat44_ei_set_alloc_mape
void nat44_ei_set_alloc_mape(u16 psid, u16 psid_offset, u16 psid_length)
Set address and port assignment algorithm for MAP-E CE.
Definition: nat44_ei.c:1717
vl_api_nat44_ei_identity_mapping_details_t::tag
string tag[64]
Definition: nat44_ei.api:677
ip4_address_t
Definition: ip4_packet.h:50
nat44_ei_set_alloc_range
void nat44_ei_set_alloc_range(u16 start_port, u16 end_port)
Set address and port assignment algorithm for port range.
Definition: nat44_ei.c:1706
NAT_LOG_DEBUG
@ NAT_LOG_DEBUG
Definition: nat_types.api:33
nat44_ei_del_session
int nat44_ei_del_session(nat44_ei_main_t *nm, ip4_address_t *addr, u16 port, nat_protocol_t proto, u32 vrf_id, int is_in)
Delete NAT44-EI session.
Definition: nat44_ei.c:1785
nat44_ei_static_mapping_t::external_addr
ip4_address_t external_addr
Definition: nat44_ei.h:168
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
vl_api_nat44_ei_static_mapping_details_t::external_ip_address
vl_api_ip4_address_t external_ip_address
Definition: nat44_ei.api:612
vl_api_nat44_ei_show_running_config_reply_t::sessions
u32 sessions
Definition: nat44_ei.api:96
vl_api_nat44_ei_set_workers_t_handler
static void vl_api_nat44_ei_set_workers_t_handler(vl_api_nat44_ei_set_workers_t *mp)
Definition: nat44_ei_api.c:73
vl_api_nat44_ei_del_session_t::port
u16 port
Definition: nat44_ei.api:807
vl_api_nat44_ei_set_fq_options_t_handler
static void vl_api_nat44_ei_set_fq_options_t_handler(vl_api_nat44_ei_set_fq_options_t *mp)
Definition: nat44_ei_api.c:1157
vl_api_nat44_ei_interface_add_del_feature_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat44_ei.api:484
nat44_ei_interface_is_inside
#define nat44_ei_interface_is_inside(ip)
Definition: nat44_ei.h:671
vl_api_nat44_ei_ipfix_enable_disable_t::domain_id
u32 domain_id
Definition: nat44_ei.api:166
vl_api_nat44_ei_interface_addr_details_t
NAT44 pool addresses interfaces details response.
Definition: nat44_ei.api:711
vl_api_nat44_ei_del_user_t
Del NAT44 user.
Definition: nat44_ei.api:421
vl_api_nat44_ei_ha_set_failover_t::port
u16 port
Definition: nat44_ei.api:314
vl_api_nat44_ei_get_addr_and_port_alloc_alg_reply_t
Get address and port assignment algorithm reply.
Definition: nat44_ei.api:235
vl_api_nat44_ei_interface_add_del_output_feature_t::is_add
bool is_add
Definition: nat44_ei.api:525
nat44_ei_main_s::msg_id_base
u16 msg_id_base
Definition: nat44_ei.h:447
vl_api_nat44_ei_get_mss_clamping_reply_t
Get TCP MSS rewriting configuration reply.
Definition: nat44_ei.api:277
vl_api_nat44_ei_show_fq_options_t
Show NAT handoff frame queue options.
Definition: nat44_ei.api:844
vl_api_nat44_ei_address_dump_t::context
u32 context
Definition: nat44_ei.api:455
vl_api_nat44_ei_set_timeouts_t::icmp
u32 icmp
Definition: nat44_ei.api:186
nat44_ei_config_t
Definition: nat44_ei.h:111
nat44_ei_main_s::output_feature_interfaces
nat44_ei_interface_t * output_feature_interfaces
Definition: nat44_ei.h:340
increment_v4_address
static void increment_v4_address(ip4_address_t *a)
Definition: nat_inlines.h:23
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
vl_api_nat44_ei_show_running_config_reply_t::timeouts
vl_api_nat_timeouts_t timeouts
Definition: nat44_ei.api:102
nat44_ei.h
vl_api_nat44_ei_ha_get_listener_reply_t
Get HA listener/local configuration reply.
Definition: nat44_ei.api:335
vl_api_nat44_ei_ipfix_enable_disable_t
Enable/disable NAT IPFIX logging.
Definition: nat44_ei.api:162
nat44_ei_static_mapping_t::local_addr
ip4_address_t local_addr
Definition: nat44_ei.h:166
vl_api_nat44_ei_worker_dump_t::client_index
u32 client_index
Definition: nat44_ei.api:137
vl_api_nat44_ei_user_session_dump_t::vrf_id
u32 vrf_id
Definition: nat44_ei.api:754
ip4_address_t::as_u8
u8 as_u8[4]
Definition: ip4_packet.h:55
vl_api_nat44_ei_interface_add_del_output_feature_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat44_ei.api:527
vl_api_nat44_ei_add_del_interface_addr_t_handler
static void vl_api_nat44_ei_add_del_interface_addr_t_handler(vl_api_nat44_ei_add_del_interface_addr_t *mp)
Definition: nat44_ei_api.c:911
send_nat44_ei_user_session_details
static void send_nat44_ei_user_session_details(nat44_ei_session_t *s, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:1011
nat44_ei_static_map_resolve_t::e_port
u16 e_port
Definition: nat44_ei.h:135
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
nat44_ei_main_s::first_worker_index
u32 first_worker_index
Definition: nat44_ei.h:357
vl_api_nat44_ei_show_running_config_reply_t::forwarding_enabled
bool forwarding_enabled
Definition: nat44_ei.api:100
index
u32 index
Definition: flow_types.api:221
vl_api_nat44_ei_interface_add_del_feature_t
Enable/disable NAT44 feature on the interface.
Definition: nat44_ei.api:478
vl_api_nat44_ei_add_del_static_mapping_t::external_sw_if_index
vl_api_interface_index_t external_sw_if_index
Definition: nat44_ei.api:580
nat44_ei_config_t::connection_tracking
u8 connection_tracking
Definition: nat44_ei.h:122
nat44_ei_main_per_thread_data_t::user_hash
clib_bihash_8_8_t user_hash
Definition: nat44_ei.h:277
vl_api_nat44_ei_ha_set_listener_t_handler
static void vl_api_nat44_ei_ha_set_listener_t_handler(vl_api_nat44_ei_ha_set_listener_t *mp)
Definition: nat44_ei_api.c:297
nat_ipfix_logging_enable_disable
int nat_ipfix_logging_enable_disable(int enable, u32 domain_id, u16 src_port)
Enable/disable NAT plugin IPFIX logging.
Definition: ipfix_logging.c:1524
vl_api_nat44_ei_add_del_identity_mapping_t::port
u16 port
Definition: nat44_ei.api:642
nat44_ei_user_key_t::as_u64
u64 as_u64
Definition: nat44_ei.h:107
pool_foreach_index
#define pool_foreach_index(i, v)
Definition: pool.h:576
nat44_ei_plugin_disable
int nat44_ei_plugin_disable()
Definition: nat44_ei.c:920
vl_api_nat44_ei_add_del_identity_mapping_t_handler
static void vl_api_nat44_ei_add_del_identity_mapping_t_handler(vl_api_nat44_ei_add_del_identity_mapping_t *mp)
Definition: nat44_ei_api.c:786
vl_api_nat44_ei_add_del_identity_mapping_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat44_ei.api:643
format_fns.h
u64
unsigned long u64
Definition: types.h:89
nat44_ei_main_per_thread_data_t::users
nat44_ei_user_t * users
Definition: nat44_ei.h:280
vl_api_nat44_ei_show_running_config_reply_t::inside_vrf
u32 inside_vrf
Definition: nat44_ei.api:93
vl_api_nat44_ei_identity_mapping_details_t::context
u32 context
Definition: nat44_ei.api:670
format
description fragment has unexpected format
Definition: map.api:433
nat44_ei_main_s::frame_queue_nelts
u32 frame_queue_nelts
Definition: nat44_ei.h:467
vl_api_nat44_ei_add_del_interface_addr_t::is_add
bool is_add
Definition: nat44_ei.api:691
nat44_ei_interface_add_del
int nat44_ei_interface_add_del(u32 sw_if_index, u8 is_inside, int is_del)
Definition: nat44_ei.c:496
fib_table_get
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
Definition: fib_table.c:29
vl_api_nat44_ei_set_timeouts_t::tcp_transitory
u32 tcp_transitory
Definition: nat44_ei.api:185
vl_api_nat44_ei_interface_addr_dump_t::context
u32 context
Definition: nat44_ei.api:703
vl_api_nat44_ei_user_session_details_t
NAT44 user's sessions response.
Definition: nat44_ei.api:771
vl_api_nat44_ei_add_del_address_range_t::is_add
bool is_add
Definition: nat44_ei.api:445
vl_api_nat44_ei_set_fq_options_t
Set NAT handoff frame queue options.
Definition: nat44_ei.api:833
u32
unsigned int u32
Definition: types.h:88
vl_api_nat44_ei_identity_mapping_dump_t::client_index
u32 client_index
Definition: nat44_ei.api:654
vl_api_nat44_ei_user_dump_t
Dump NAT44 users.
Definition: nat44_ei.api:721
vl_api_nat44_ei_forwarding_enable_disable_t
Enable/disable forwarding for NAT44 Forward packets which don't match existing translation or static ...
Definition: nat44_ei.api:821
vl_api_nat44_ei_interface_output_feature_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat44_ei.api:550
vl_api_nat44_ei_user_session_details_t::total_pkts
u32 total_pkts
Definition: nat44_ei.api:782
vl_api_nat44_ei_ha_resync_t::client_index
u32 client_index
Definition: nat44_ei.api:392
nat44_ei_main_s::start_port
u16 start_port
Definition: nat44_ei.h:379
vl_api_nat44_ei_worker_dump_t_handler
static void vl_api_nat44_ei_worker_dump_t_handler(vl_api_nat44_ei_worker_dump_t *mp)
Definition: nat44_ei_api.c:118
vl_api_nat44_ei_set_timeouts_t_handler
static void vl_api_nat44_ei_set_timeouts_t_handler(vl_api_nat44_ei_set_timeouts_t *mp)
Definition: nat44_ei_api.c:197
api_helper_macros.h
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
vl_api_nat44_ei_interface_addr_details_t::context
u32 context
Definition: nat44_ei.api:713
nat44_ei_interface_add_del_output_feature
int nat44_ei_interface_add_del_output_feature(u32 sw_if_index, u8 is_inside, int is_del)
Definition: nat44_ei.c:747
clib_bihash_kv_8_8_t
8 octet key, 8 octet key value pair
Definition: bihash_8_8.h:41
vlib_worker_thread_t
Definition: threads.h:85
nat44_ei_config_t::outside_vrf
u32 outside_vrf
Definition: nat44_ei.h:126
vl_api_nat44_ei_ipfix_enable_disable_t_handler
static void vl_api_nat44_ei_ipfix_enable_disable_t_handler(vl_api_nat44_ei_ipfix_enable_disable_t *mp)
Definition: nat44_ei_api.c:182
nat44_ei_static_mapping_t::proto
nat_protocol_t proto
Definition: nat44_ei.h:177
nat44_ei_set_workers
int nat44_ei_set_workers(uword *bitmap)
Definition: nat44_ei.c:252
vl_api_nat44_ei_interface_add_del_output_feature_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:526
vl_api_nat44_ei_worker_details_t::name
string name[64]
Definition: nat44_ei.api:152
send_nat44_ei_interface_output_feature_details
static void send_nat44_ei_interface_output_feature_details(nat44_ei_interface_t *i, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:610
nat44_ei_static_mapping_t::vrf_id
u32 vrf_id
Definition: nat44_ei.h:174
vl_api_nat44_ei_ha_set_failover_t::session_refresh_interval
u32 session_refresh_interval
Definition: nat44_ei.api:315
nm
nat44_ei_main_t * nm
Definition: nat44_ei_hairpinning.c:413
value
u8 value
Definition: qos.api:54
vl_api_nat44_ei_static_mapping_dump_t_handler
static void vl_api_nat44_ei_static_mapping_dump_t_handler(vl_api_nat44_ei_static_mapping_dump_t *mp)
Definition: nat44_ei_api.c:758
elt
app_rx_mq_elt_t * elt
Definition: application.c:488
vl_api_nat44_ei_user_session_details_t::total_bytes
u64 total_bytes
Definition: nat44_ei.api:781
nat_ha_resync_completed_event_cb
static void nat_ha_resync_completed_event_cb(u32 client_index, u32 pid, u32 missed_count)
Definition: nat44_ei_api.c:384
vl_api_nat44_ei_ipfix_enable_disable_t::src_port
u16 src_port
Definition: nat44_ei.api:167
vl_api_nat44_ei_del_user_t_handler
static void vl_api_nat44_ei_del_user_t_handler(vl_api_nat44_ei_del_user_t *mp)
Definition: nat44_ei_api.c:420
vl_api_nat44_ei_get_mss_clamping_t_handler
static void vl_api_nat44_ei_get_mss_clamping_t_handler(vl_api_nat44_ei_get_mss_clamping_t *mp)
Definition: nat44_ei_api.c:283
vl_api_nat44_ei_ha_get_listener_reply_t::path_mtu
u32 path_mtu
Definition: nat44_ei.api:341
vl_api_nat44_ei_address_dump_t::client_index
u32 client_index
Definition: nat44_ei.api:454
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vl_api_nat44_ei_show_running_config_t_handler
static void vl_api_nat44_ei_show_running_config_t_handler(vl_api_nat44_ei_show_running_config_t *mp)
Definition: nat44_ei_api.c:35
vlib_main_t
Definition: main.h:102
vl_api_nat44_ei_worker_details_t::context
u32 context
Definition: nat44_ei.api:149
vl_api_nat44_ei_address_details_t::vrf_id
u32 vrf_id
Definition: nat44_ei.api:467
vl_api_nat44_ei_ha_resync_completed_event_t::pid
u32 pid
Definition: nat44_ei.api:407
vl_api_nat44_ei_get_addr_and_port_alloc_alg_reply_t::psid_length
u8 psid_length
Definition: nat44_ei.api:241
vl_api_nat44_ei_worker_details_t::worker_index
u32 worker_index
Definition: nat44_ei.api:150
nat44_ei_main_s::out2in_dpo
u8 out2in_dpo
Definition: nat44_ei.h:322
vl_api_nat44_ei_get_addr_and_port_alloc_alg_reply_t::psid
u16 psid
Definition: nat44_ei.api:242
vl_api_nat44_ei_get_mss_clamping_reply_t::mss_value
u16 mss_value
Definition: nat44_ei.api:281
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
nat44_ei_is_identity_static_mapping
#define nat44_ei_is_identity_static_mapping(mp)
Definition: nat44_ei.h:678
vl_api_nat44_ei_set_mss_clamping_t::enable
bool enable
Definition: nat44_ei.api:258
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
a
a
Definition: bitmap.h:544
vl_api_nat44_ei_ha_resync_completed_event_t::missed_count
u32 missed_count
Definition: nat44_ei.api:408
ip
vl_api_address_t ip
Definition: l2.api:558
nat_ha_set_failover
int nat_ha_set_failover(vlib_main_t *vm, ip4_address_t *addr, u16 port, u32 session_refresh_interval)
Set HA failover (remote settings)
Definition: nat44_ei_ha.c:540
vl_api_nat44_ei_ha_get_listener_t_handler
static void vl_api_nat44_ei_ha_get_listener_t_handler(vl_api_nat44_ei_ha_get_listener_t *mp)
Definition: nat44_ei_api.c:314
vl_api_nat44_ei_interface_add_del_output_feature_t
Enable/disbale NAT44 as an interface output feature (postrouting in2out translation)
Definition: nat44_ei.api:521
vl_api_nat44_ei_worker_details_t
NAT workers details response.
Definition: nat44_ei.api:147
nat_ha_resync
int nat_ha_resync(u32 client_index, u32 pid, nat_ha_resync_event_cb_t event_callback)
Resync HA (resend existing sessions to new failover)
Definition: nat44_ei_ha.c:1283
vec_terminate_c_string
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
Definition: vec.h:1132
vl_api_nat44_ei_get_mss_clamping_reply_t::enable
bool enable
Definition: nat44_ei.api:282
vl_api_nat44_ei_plugin_enable_disable_t
Enable/disable NAT44 plugin.
Definition: nat44_ei.api:48
vl_api_nat44_ei_interface_dump_t::client_index
u32 client_index
Definition: nat44_ei.api:493
nat44_ei_main_s::log_level
u8 log_level
Definition: nat44_ei.h:452
vl_api_nat44_ei_ha_set_failover_t_handler
static void vl_api_nat44_ei_ha_set_failover_t_handler(vl_api_nat44_ei_ha_set_failover_t *mp)
Definition: nat44_ei_api.c:334
vl_api_nat44_ei_interface_output_feature_dump_t_handler
static void vl_api_nat44_ei_interface_output_feature_dump_t_handler(vl_api_nat44_ei_interface_output_feature_dump_t *mp)
Definition: nat44_ei_api.c:631
vl_api_nat44_ei_ha_flush_t_handler
static void vl_api_nat44_ei_ha_flush_t_handler(vl_api_nat44_ei_ha_flush_t *mp)
Definition: nat44_ei_api.c:372
vl_api_nat44_ei_interface_addr_dump_t_handler
static void vl_api_nat44_ei_interface_addr_dump_t_handler(vl_api_nat44_ei_interface_addr_dump_t *mp)
Definition: nat44_ei_api.c:948
vl_api_nat44_ei_set_workers_t::worker_mask
u64 worker_mask
Definition: nat44_ei.api:128
vl_api_nat44_ei_user_session_details_t::last_heard
u64 last_heard
Definition: nat44_ei.api:780
vl_api_nat44_ei_ha_get_failover_reply_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:366
vl_api_nat44_ei_static_mapping_dump_t::client_index
u32 client_index
Definition: nat44_ei.api:591
vl_api_nat44_ei_ha_resync_t
Resync HA (resend existing sessions to new failover)
Definition: nat44_ei.api:389
vlib_worker_thread_t::name
u8 * name
Definition: threads.h:102
vl_api_nat44_ei_interface_dump_t_handler
static void vl_api_nat44_ei_interface_dump_t_handler(vl_api_nat44_ei_interface_dump_t *mp)
Definition: nat44_ei_api.c:575
send_nat44_ei_identity_map_resolve_details
static void send_nat44_ei_identity_map_resolve_details(nat44_ei_static_map_resolve_t *m, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:852
nat44_ei_static_map_resolve_t
Definition: nat44_ei.h:130
vl_api_nat44_ei_del_session_t
Delete NAT44 session.
Definition: nat44_ei.api:801
vl_api_nat44_ei_ha_get_failover_t
Get HA failover/remote settings.
Definition: nat44_ei.api:348
nat_ha_set_listener
int nat_ha_set_listener(vlib_main_t *vm, ip4_address_t *addr, u16 port, u32 path_mtu)
Set HA listener (local settings)
Definition: nat44_ei_ha.c:495
vl_api_nat44_ei_static_mapping_details_t::local_ip_address
vl_api_ip4_address_t local_ip_address
Definition: nat44_ei.api:611
nat44_ei_main_s::psid
u16 psid
Definition: nat44_ei.h:377
context
u32 context
Definition: ip.api:780
vl_api_nat44_ei_set_timeouts_t::udp
u32 udp
Definition: nat44_ei.api:183
nat44_ei_static_map_resolve_t::l_port
u16 l_port
Definition: nat44_ei.h:134
nat44_ei_static_map_resolve_t::identity_nat
u8 identity_nat
Definition: nat44_ei.h:141
nat44_ei_main_s::auto_add_sw_if_indices
u32 * auto_add_sw_if_indices
Definition: nat44_ei.h:389
rv
int __clib_unused rv
Definition: application.c:491
nat44_ei_log_info
#define nat44_ei_log_info(...)
Definition: nat44_ei.h:688
vl_api_nat44_ei_interface_addr_dump_t::client_index
u32 client_index
Definition: nat44_ei.api:702
vl_api_nat44_ei_add_del_address_range_t::first_ip_address
vl_api_ip4_address_t first_ip_address
Definition: nat44_ei.api:442
vrf_id
u32 vrf_id
Definition: nat44_ed.api:1053
vl_api_nat44_ei_plugin_enable_disable_t::outside_vrf
u32 outside_vrf
Definition: nat44_ei.api:53
send_nat44_ei_interface_addr_details
static void send_nat44_ei_interface_addr_details(u32 sw_if_index, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:931
nat44_ei_config_t::inside_vrf
u32 inside_vrf
Definition: nat44_ei.h:125
nat44_ei_is_unk_proto_session
#define nat44_ei_is_unk_proto_session(sp)
Definition: nat44_ei.h:668
vl_api_nat44_ei_add_del_interface_addr_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat44_ei.api:692
vl_api_nat44_ei_user_dump_t::client_index
u32 client_index
Definition: nat44_ei.api:723
nat44_ei_main_s::mss_clamping
u16 mss_clamping
Definition: nat44_ei.h:327
nat44_ei_static_map_resolve_t::addr_only
u8 addr_only
Definition: nat44_ei.h:140
nat44_ei_main_s::forwarding_enabled
u8 forwarding_enabled
Definition: nat44_ei.h:323
vl_api_nat44_ei_add_del_identity_mapping_t::vrf_id
u32 vrf_id
Definition: nat44_ei.api:644
nat44_ei_is_addr_only_static_mapping
#define nat44_ei_is_addr_only_static_mapping(mp)
Definition: nat44_ei.h:676
vl_api_nat44_ei_set_timeouts_t::tcp_established
u32 tcp_established
Definition: nat44_ei.api:184
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
nat44_ei_lb_addr_port_t::vrf_id
u32 vrf_id
Definition: nat44_ei.h:157
path_mtu
u16 path_mtu
Definition: ip.api:783
vl_api_nat44_ei_show_fq_options_reply_t
Show NAT handoff frame queue options reply.
Definition: nat44_ei.api:856
vl_api_nat44_ei_del_session_t::address
vl_api_ip4_address_t address
Definition: nat44_ei.api:805
ip4_main_t
IPv4 main type.
Definition: ip4.h:107
fib_table_find
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1106
vl_api_nat44_ei_user_session_dump_t
NAT44 user's sessions.
Definition: nat44_ei.api:749
vl_api_nat44_ei_ha_set_listener_t::port
u16 port
Definition: nat44_ei.api:297
vl_api_nat44_ei_add_del_static_mapping_t::external_port
u16 external_port
Definition: nat44_ei.api:579
vl_api_nat44_ei_add_del_identity_mapping_t::tag
string tag[64]
Definition: nat44_ei.api:645
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
nat44_ei_del_address
int nat44_ei_del_address(nat44_ei_main_t *nm, ip4_address_t addr, u8 delete_sm)
Definition: nat44_ei.c:2708
vl_api_nat44_ei_del_session_t::protocol
u8 protocol
Definition: nat44_ei.api:806
vl_api_nat44_ei_interface_add_del_output_feature_t_handler
static void vl_api_nat44_ei_interface_add_del_output_feature_t_handler(vl_api_nat44_ei_interface_add_del_output_feature_t *mp)
Definition: nat44_ei_api.c:592
vl_api_nat44_ei_identity_mapping_details_t
NAT44 identity mapping details response.
Definition: nat44_ei.api:668
vl_api_nat44_ei_plugin_enable_disable_t::inside_vrf
u32 inside_vrf
Definition: nat44_ei.api:52
ip_types_api.h
vl_api_nat44_ei_interface_add_del_feature_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:483
vl_api_nat44_ei_show_fq_options_reply_t::frame_queue_nelts
u32 frame_queue_nelts
Definition: nat44_ei.api:861
vl_api_nat44_ei_ha_set_listener_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:296
nat_ha_get_failover
void nat_ha_get_failover(ip4_address_t *addr, u16 *port, u32 *session_refresh_interval)
Get HA failover/remote settings.
Definition: nat44_ei_ha.c:555
nat44_ei_static_map_resolve_t::vrf_id
u32 vrf_id
Definition: nat44_ei.h:137
vl_api_nat44_ei_user_session_dump_t::context
u32 context
Definition: nat44_ei.api:752
nat44_ei_set_alloc_default
void nat44_ei_set_alloc_default()
Set address and port assignment algorithm to default/standard.
Definition: nat44_ei.c:1697
nat44_ei_static_mapping_t::local_port
u16 local_port
Definition: nat44_ei.h:170
nat44_ei_static_map_resolve_t::sw_if_index
u32 sw_if_index
Definition: nat44_ei.h:136
vl_api_nat44_ei_add_del_address_range_t
Add/del NAT44 address range.
Definition: nat44_ei.api:438
nat44_ei_main_s::num_workers
u32 num_workers
Definition: nat44_ei.h:356
vl_api_nat44_ei_add_del_identity_mapping_t::flags
vl_api_nat44_ei_config_flags_t flags
Definition: nat44_ei.api:639
vl_api_nat44_ei_static_mapping_details_t::external_port
u16 external_port
Definition: nat44_ei.api:615
send_nat44_ei_interface_details
static void send_nat44_ei_interface_details(nat44_ei_interface_t *i, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:552
vl_api_nat44_ei_address_details_t::context
u32 context
Definition: nat44_ei.api:465
vl_api_nat44_ei_address_details_t
NAT44 address details response.
Definition: nat44_ei.api:463
send_nat44_ei_user_details
static void send_nat44_ei_user_details(nat44_ei_user_t *u, vl_api_registration_t *reg, u32 context)
Definition: nat44_ei_api.c:964
vl_api_nat44_ei_plugin_enable_disable_t::user_sessions
u32 user_sessions
Definition: nat44_ei.api:58
vl_api_nat44_ei_identity_mapping_details_t::ip_address
vl_api_ip4_address_t ip_address
Definition: nat44_ei.api:672
vl_api_nat44_ei_add_del_static_mapping_t_handler
static void vl_api_nat44_ei_add_del_static_mapping_t_handler(vl_api_nat44_ei_add_del_static_mapping_t *mp)
Definition: nat44_ei_api.c:649
clib_bitmap_set_multiple
static uword * clib_bitmap_set_multiple(uword *bitmap, uword i, uword value, uword n_bits)
sets the ith through ith + n_bits bits in a bitmap
Definition: bitmap.h:275
vl_api_nat44_ei_plugin_enable_disable_t::users
u32 users
Definition: nat44_ei.api:54
nat44_ei_ha.h
NAT active-passive HA.
vl_api_nat44_ei_add_del_address_range_t_handler
static void vl_api_nat44_ei_add_del_address_range_t_handler(vl_api_nat44_ei_add_del_address_range_t *mp)
Definition: nat44_ei_api.c:432
nat44_ei_static_map_resolve_t::l_addr
ip4_address_t l_addr
Definition: nat44_ei.h:132
nat44_ei_static_mapping_t::locals
nat44_ei_lb_addr_port_t * locals
Definition: nat44_ei.h:183
vl_api_nat44_ei_set_addr_and_port_alloc_alg_t::psid_offset
u8 psid_offset
Definition: nat44_ei.api:206
vl_api_nat44_ei_address_dump_t
Dump NAT44 addresses.
Definition: nat44_ei.api:452
vl_api_nat44_ei_ha_set_listener_t::path_mtu
u32 path_mtu
Definition: nat44_ei.api:298
vl_api_nat44_ei_set_timeouts_t
Set values of timeouts for NAT sessions (seconds)
Definition: nat44_ei.api:179
vl_api_nat44_ei_user_session_details_t::context
u32 context
Definition: nat44_ei.api:773
nat44_ei_main_per_thread_data_t
Definition: nat44_ei.h:274
vl_api_nat44_ei_static_mapping_dump_t::context
u32 context
Definition: nat44_ei.api:592
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199