FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
nat.api
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 option version = "5.2.0";
17 import "vnet/ip/ip_types.api";
18 import "vnet/interface_types.api";
19 import "plugins/nat/nat_types.api";
20 
21 /**
22  * @file nat.api
23  * @brief VPP control-plane API messages.
24  *
25  * This file defines VPP control-plane API messages which are generally
26  * called through a shared memory interface.
27  */
28 
29 /*
30  * Common NAT plugin APIs
31  */
32 
33 /** \brief Control ping from client to api server request
34  @param client_index - opaque cookie to identify the sender
35  @param context - sender context, to match reply w/ request
36 */
37 define nat_control_ping
38 {
41 };
42 
43 /** \brief Control ping from the client to the server response
44  @param client_index - opaque cookie to identify the sender
45  @param context - sender context, to match reply w/ request
46  @param retval - return code for the request
47  @param vpe_pid - the pid of the vpe, returned by the server
48 */
49 define nat_control_ping_reply
50 {
55 };
56 
57 /** \brief Show NAT plugin startup config
58  @param client_index - opaque cookie to identify the sender
59  @param context - sender context, to match reply w/ request
60 */
61 define nat_show_config
62 {
63  option deprecated;
66 };
67 
68 /** \brief DEPRECATED: Show NAT plugin startup config reply
69  @param context - sender context, to match reply w/ request
70  @param retval - return code for the request
71  @param static_mapping_only - if true dynamic translations disabled
72  @param static_mapping_connection_tracking - if true create session data
73  @param deterministic - if true deterministic mapping
74  @param endpoint_dependent - if true endpoint-dependent mode
75  @param out2in_dpo - if true out2in dpo mode
76  @param dslite_ce - if true DS-Lite is CE/B4 element, if false AFTR elemet
77  @param translation_buckets - number of translation hash buckets
78  @param translation_memory_size - translation hash memory size
79  @param user_buckets - number of user hash buckets
80  @param user_memory_size - user hash memory size
81  @param max_translations_per_user - maximum number of translations per user
82  @param outside_vrf_id - outside VRF id
83  @param inside_vrf_id - default inside VRF id
84  @param nat64_bib_buckets - number of NAT64 BIB hash buckets
85  @param nat64_bib_memory_size - memory size of NAT64 BIB hash
86  @param nat64_st_buckets - number of NAT64 session table hash buckets
87  @param nat64_st_memory_size - memory size of NAT64 session table hash
88 */
89 define nat_show_config_reply
90 {
97  bool out2in_dpo;
98  bool dslite_ce;
110 };
111 
112 /** \brief Show NAT plugin startup config
113  @param client_index - opaque cookie to identify the sender
114  @param context - sender context, to match reply w/ request
115 */
116 define nat_show_config_2
117 {
120 };
121 
122 /** \brief Show NAT plugin startup config reply
123  @param context - sender context, to match reply w/ request
124  @param retval - return code for the request
125  @param static_mapping_only - if true dynamic translations disabled
126  @param static_mapping_connection_tracking - if true create session data
127  @param deterministic - if true deterministic mapping
128  @param endpoint_dependent - if true endpoint-dependent mode
129  @param out2in_dpo - if true out2in dpo mode
130  @param dslite_ce - if true DS-Lite is CE/B4 element, if false AFTR elemet
131  @param translation_buckets - number of translation hash buckets
132  @param translation_memory_size - translation hash memory size
133  @param user_buckets - number of user hash buckets
134  @param user_memory_size - user hash memory size
135  @param max_translations_per_user - maximum number of translations per user
136  @param outside_vrf_id - outside VRF id
137  @param inside_vrf_id - default inside VRF id
138  @param nat64_bib_buckets - number of NAT64 BIB hash buckets
139  @param nat64_bib_memory_size - memory size of NAT64 BIB hash
140  @param nat64_st_buckets - number of NAT64 session table hash buckets
141  @param nat64_st_memory_size - memory size of NAT64 session table hash
142  @param max_translations_per_thread - max translations per worker thread
143  @param max_users_per_thread - max users per worker thread
144 */
145 define nat_show_config_2_reply
146 {
154  bool dslite_ce;
168 };
169 
171 {
172  NAT_LOG_NONE = 0x00,
176  NAT_LOG_INFO = 0x04,
178 };
179 
180 /** \brief Run nat44 garbage collection
181  @param client_index - opaque cookie to identify the sender
182  @param context - sender context, to match reply w/ request
183 */
184 autoreply define nat44_session_cleanup {
187 };
188 
189 /** \brief NAT44 set session limit
190  @param client_index - opaque cookie to identify the sender
191  @param context - sender context, to match reply w/ request
192  @param session_limit - session limit
193  @param vrf_id - vrf id
194 */
195 autoreply define nat44_set_session_limit {
200 };
201 
202 /** \brief Set NAT logging level
203  @param client_index - opaque cookie to identify the sender
204  @param context - sender context, to match reply w/ request
205  @param log_level - logging level
206 */
207 autoreply define nat_set_log_level {
210  vl_api_nat_log_level_t log_level;
211 };
212 
213 /** \brief Set NAT workers
214  @param client_index - opaque cookie to identify the sender
215  @param context - sender context, to match reply w/ request
216  @param worker_mask - NAT workers mask
217 */
218 autoreply define nat_set_workers {
222 };
223 
224 /** \brief Dump NAT workers
225  @param client_index - opaque cookie to identify the sender
226  @param context - sender context, to match reply w/ request
227 */
228 define nat_worker_dump {
231 };
232 
233 /** \brief NAT workers details response
234  @param context - sender context, to match reply w/ request
235  @param worker_index - worker index
236  @param lcore_id - lcore ID
237  @param name - worker name
238 */
239 define nat_worker_details {
243  string name[64];
244 };
245 
246 /** \brief Enable/disable NAT IPFIX logging
247  @param client_index - opaque cookie to identify the sender
248  @param context - sender context, to match reply w/ request
249  @param domain_id - observation domain ID
250  @param src_port - source port number
251  @param enable - true if enable, false if disable
252 */
253 autoreply define nat_ipfix_enable_disable {
258  bool enable;
259 };
260 
261 /** \brief Set values of timeouts for NAT sessions (seconds)
262  @param client_index - opaque cookie to identify the sender
263  @param context - sender context, to match reply w/ request
264  @param udp - UDP timeout (default 300sec)
265  @param tcp_established - TCP established timeout (default 7440sec)
266  @param tcp_transitory - TCP transitory timeout (default 240sec)
267  @param icmp - ICMP timeout (default 60sec)
268 */
269 autoreply define nat_set_timeouts {
276 };
277 
278 /** \brief Get values of timeouts for NAT sessions (seconds)
279  @param client_index - opaque cookie to identify the sender
280  @param context - sender context, to match reply w/ request
281 */
282 define nat_get_timeouts {
285 };
286 
287 /** \brief Get values of timeouts for NAT sessions reply
288  @param context - sender context, to match reply w/ request
289  @param retval - return code
290  @param udp - UDP timeout
291  @param tcp_established - TCP established timeout
292  @param tcp_transitory - TCP transitory timeout
293  @param icmp - ICMP timeout
294 */
295 define nat_get_timeouts_reply {
302 };
303 
304 /** \brief Set address and port assignment algorithm
305  @param client_index - opaque cookie to identify the sender
306  @param context - sender context, to match reply w/ request
307  @param alg - address and port assignment algorithm:
308  0 - default, 1 - MAP-E, 2 - port range
309  (see nat_addr_and_port_alloc_alg_t in nat.h)
310  @param psid_offset - number of offset bits (valid only for MAP-E alg)
311  @param psid_length - length of PSID (valid only for MAP-E alg)
312  @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
313  @param start_port - beginning of the port range
314  @param end_port - end of the port range
315 */
316 autoreply define nat_set_addr_and_port_alloc_alg {
325 };
326 
327 /** \brief Get address and port assignment algorithm
328  @param client_index - opaque cookie to identify the sender
329  @param context - sender context, to match reply w/ request
330 */
331 define nat_get_addr_and_port_alloc_alg {
334 };
335 
336 /** \brief Get address and port assignment algorithm reply
337  @param context - sender context, to match reply w/ request
338  @param retval - return code
339  @param alg - address and port assignment algorithm:
340  0 - default, 1 - MAP-E, 2 - port range
341  (see nat_addr_and_port_alloc_alg_t in nat.h)
342  @param psid_offset - number of offset bits (valid only for MAP-E alg)
343  @param psid_length - length of PSID (valid only for MAP-E alg)
344  @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
345  @param start_port - beginning of the port range
346  @param end_port - end of the port range
347 */
348 define nat_get_addr_and_port_alloc_alg_reply {
357 };
358 
359 /** \brief Set TCP MSS rewriting configuration
360  @param client_index - opaque cookie to identify the sender
361  @param context - sender context, to match reply w/ request
362  @param mss_value - MSS value to be used for MSS rewriting
363  @param enable - if true enable MSS rewriting feature else disable
364 */
365 autoreply define nat_set_mss_clamping {
369  bool enable;
370 };
371 
372 /** \brief Get TCP MSS rewriting configuration
373  @param client_index - opaque cookie to identify the sender
374  @param context - sender context, to match reply w/ request
375 */
376 define nat_get_mss_clamping {
379 };
380 
381 /** \brief Get TCP MSS rewriting configuration reply
382  @param context - sender context, to match reply w/ request
383  @param retval - return code
384  @param mss_value - MSS value to be used for MSS rewriting
385  @param enable - if true enable MSS rewriting feature else disable
386 */
387 define nat_get_mss_clamping_reply {
391  bool enable;
392 };
393 
394 /** \brief Set HA listener (local settings)
395  @param client_index - opaque cookie to identify the sender
396  @param context - sender context, to match reply w/ request
397  @param ip_address - local IP4 address
398  @param port - local UDP port number
399  @param path_mtu - path MTU between local and failover
400 */
401 autoreply define nat_ha_set_listener {
404  vl_api_ip4_address_t ip_address;
407 };
408 
409 /** \brief Set HA failover (remote settings)
410  @param client_index - opaque cookie to identify the sender
411  @param context - sender context, to match reply w/ request
412  @param ip_address - failover IP4 address
413  @param port - failvoer UDP port number
414  @param session_refresh_interval - number of seconds after which to send
415  session counters refresh
416 */
417 autoreply define nat_ha_set_failover {
420  vl_api_ip4_address_t ip_address;
423 };
424 
425 /** \brief Get HA listener/local configuration
426  @param client_index - opaque cookie to identify the sender
427  @param context - sender context, to match reply w/ request
428 */
432 };
433 
434 /** \brief Get HA listener/local configuration reply
435  @param context - sender context, to match reply w/ request
436  @param retval - return code
437  @param ip_address - local IP4 address
438  @param port - local UDP port number
439  @param path_mtu - Path MTU between local and failover
440 */
441 define nat_ha_get_listener_reply {
444  vl_api_ip4_address_t ip_address;
447 };
448 
449 /** \brief Get HA failover/remote settings
450  @param client_index - opaque cookie to identify the sender
451  @param context - sender context, to match reply w/ request
452 */
456 };
457 
458 /** \brief Get HA failover/remote settings reply
459  @param context - sender context, to match reply w/ request
460  @param retval - return code
461  @param ip_address - failover IP4 address
462  @param port - failvoer UDP port number
463  @param session_refresh_interval - number of seconds after which to send
464  session counters refresh
465 */
466 define nat_ha_get_failover_reply {
469  vl_api_ip4_address_t ip_address;
472 };
473 
474 /** \brief Flush the current HA data (for testing)
475  @param client_index - opaque cookie to identify the sender
476  @param context - sender context, to match reply w/ request
477 */
478 autoreply define nat_ha_flush {
481 };
482 
483 /** \brief Resync HA (resend existing sessions to new failover)
484  @param client_index - opaque cookie to identify the sender
485  @param context - sender context, to match reply w/ request
486  @param want_resync_event - resync completed event sent to the sender via
487  nat_ha_resync_completed_event API message if
488  non-zero
489  @param pid - sender's pid
490 */
491 autoreply define nat_ha_resync
492 {
497 };
498 
499 /** \brief Tell client about a HA resync completion event
500  @param client_index - opaque cookie to identify the sender
501  @param pid - client pid registered to receive notification
502  @param missed_count - number of missed (not ACKed) messages
503 */
504 define nat_ha_resync_completed_event
505 {
509 };
510 
512  rpc nat_ha_resync returns nat_ha_resync_reply events nat_ha_resync_completed_event;
513 };
514 
515 /*
516  * NAT44 APIs
517  */
518 
519 /** \brief Del NAT44 user
520  @param client_index - opaque cookie to identify the sender
521  @param context - sender context, to match reply w/ request
522  @param ip_address - IPv4 address
523  @param fib_index - FIB index
524 */
525 autoreply define nat44_del_user {
528  vl_api_ip4_address_t ip_address;
530 };
531 
532 /** \brief Add/del NAT44 address range
533  @param client_index - opaque cookie to identify the sender
534  @param context - sender context, to match reply w/ request
535  @param first_ip_address - first IPv4 address
536  @param last_ip_address - last IPv4 address
537  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
538  @param is_add - true if add, false if delete
539  @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
540 
541 */
542 autoreply define nat44_add_del_address_range {
545  vl_api_ip4_address_t first_ip_address;
546  vl_api_ip4_address_t last_ip_address;
548  bool is_add;
549  vl_api_nat_config_flags_t flags;
550 };
551 
552 /** \brief Dump NAT44 addresses
553  @param client_index - opaque cookie to identify the sender
554  @param context - sender context, to match reply w/ request
555 */
556 define nat44_address_dump {
559 };
560 
561 /** \brief NAT44 address details response
562  @param context - sender context, to match reply w/ request
563  @param ip_address - IPv4 address
564  @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
565  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
566 */
567 define nat44_address_details {
569  vl_api_ip4_address_t ip_address;
570  vl_api_nat_config_flags_t flags;
572 };
573 
574 /** \brief Enable/disable NAT44 feature on the interface
575  @param client_index - opaque cookie to identify the sender
576  @param context - sender context, to match reply w/ request
577  @param is_add - true if add, false if delete
578  @param flags - flag NAT_IS_INSIDE if interface is inside else
579  interface is outside
580  @param sw_if_index - software index of the interface
581 */
582 autoreply define nat44_interface_add_del_feature {
585  bool is_add;
586  vl_api_nat_config_flags_t flags;
587  vl_api_interface_index_t sw_if_index;
588 };
589 
590 /** \brief Dump interfaces with NAT44 feature
591  @param client_index - opaque cookie to identify the sender
592  @param context - sender context, to match reply w/ request
593 */
594 define nat44_interface_dump {
597 };
598 
599 /** \brief NAT44 interface details response
600  @param context - sender context, to match reply w/ request
601  @param sw_if_index - software index of the interface
602  @param flags - flag NAT_IS_INSIDE if interface is inside,
603  flag NAT_IS_OUTSIDE if interface is outside
604  and if both flags are set the interface is
605  both inside and outside
606 */
607 define nat44_interface_details {
609  vl_api_nat_config_flags_t flags;
610  vl_api_interface_index_t sw_if_index;
611 };
612 
613 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
614  in2out translation)
615  @param client_index - opaque cookie to identify the sender
616  @param context - sender context, to match reply w/ request
617  @param is_add - true if add, false if delete
618  @param flags - flag NAT_IS_INSIDE if interface is inside else
619  interface is outside
620  @param sw_if_index - software index of the interface
621 */
622 autoreply define nat44_interface_add_del_output_feature {
625  bool is_add;
626  vl_api_nat_config_flags_t flags;
627  vl_api_interface_index_t sw_if_index;
628 };
629 
630 /** \brief Dump interfaces with NAT44 output feature
631  @param client_index - opaque cookie to identify the sender
632  @param context - sender context, to match reply w/ request
633 */
634 define nat44_interface_output_feature_dump {
637 };
638 
639 /** \brief NAT44 interface with output feature details response
640  @param context - sender context, to match reply w/ request
641  @param flags - flag NAT_IS_INSIDE if interface is inside else
642  interface is outside
643  @param sw_if_index - software index of the interface
644 */
645 define nat44_interface_output_feature_details {
647  vl_api_nat_config_flags_t flags;
648  vl_api_interface_index_t sw_if_index;
649 };
650 
651 /** \brief Add/delete NAT44 static mapping
652  @param client_index - opaque cookie to identify the sender
653  @param context - sender context, to match reply w/ request
654  @param is_add - true if add, false if delete
655  @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
656  flag nat_is_twice_nat if nat address range for external hosts,
657  flag NAT_IS_SELF_TWICE_NAT if translate external host address
658  and port whenever external host address equals local
659  address of internal host,
660  flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
661  @param local_ip_address - local IPv4 address
662  @param external_ip_address - external IPv4 address
663  @param protocol - IP protocol, used only if addr_only=0
664  @param local_port - local port number, used only if addr_only=0
665  @param external_port - external port number, used only if addr_only=0
666  @param external_sw_if_index - external interface (if set
667  external_ip_address is ignored, ~0 means not
668  used)
669  @param vfr_id - VRF ID
670  @param tag - opaque string tag
671 */
672 autoreply define nat44_add_del_static_mapping {
675  bool is_add;
676  vl_api_nat_config_flags_t flags;
677  vl_api_ip4_address_t local_ip_address;
678  vl_api_ip4_address_t external_ip_address;
682  vl_api_interface_index_t external_sw_if_index;
684  string tag[64];
685 };
686 
687 /** \brief Add/delete NAT44 static mapping
688  @param client_index - opaque cookie to identify the sender
689  @param context - sender context, to match reply w/ request
690  @param is_add - true if add, false if delete
691  @param match_pool - true if use specific pool_ip_address
692  @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
693  flag nat_is_twice_nat if nat address range for external hosts,
694  flag NAT_IS_SELF_TWICE_NAT if translate external host address
695  and port whenever external host address equals local
696  address of internal host,
697  flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
698  @param pool_ip_address - pool IPv4 address to match with pool
699  @param local_ip_address - local IPv4 address
700  @param external_ip_address - external IPv4 address
701  @param protocol - IP protocol, used only if addr_only=0
702  @param local_port - local port number, used only if addr_only=0
703  @param external_port - external port number, used only if addr_only=0
704  @param external_sw_if_index - external interface (if set
705  external_ip_address is ignored, ~0 means not
706  used)
707  @param vfr_id - VRF ID
708  @param tag - opaque string tag
709 */
710 autoreply define nat44_add_del_static_mapping_v2 {
711  option status="in_progress";
714  bool is_add;
716  vl_api_nat_config_flags_t flags;
717  vl_api_ip4_address_t pool_ip_address;
718  vl_api_ip4_address_t local_ip_address;
719  vl_api_ip4_address_t external_ip_address;
723  vl_api_interface_index_t external_sw_if_index;
725  string tag[64];
726 };
727 
728 /** \brief Dump NAT44 static mappings
729  @param client_index - opaque cookie to identify the sender
730  @param context - sender context, to match reply w/ request
731 */
732 define nat44_static_mapping_dump {
735 };
736 
737 /** \brief NAT44 static mapping details response
738  @param context - sender context, to match reply w/ request
739  @param flags - flag NAT_ADDR_ONLY if address only mapping,
740  flag NAT_TWICE_NAT if NAT address range for external hosts,
741  flag NAT_SELF_TWICE_NAT if translate external host address
742  and port whenever external host address equals local
743  address of internal host,
744  flag NAT_OUT2IN_ONLY if rule match only out2in direction
745  @param local_ip_address - local IPv4 address
746  @param external_ip_address - external IPv4 address
747  @param protocol - IP protocol, valid only if no NAT_ADDR_ONLY flag
748  @param local_port - local port number, valid only if no NAT_ADDR_ONLY flag
749  @param external_port - external port number, valid only if no NAT_ADDR_ONLY flag
750  @param external_sw_if_index - external interface
751  @param vfr_id - VRF ID
752  @param tag - opaque string tag
753 */
754 define nat44_static_mapping_details {
756  vl_api_nat_config_flags_t flags;
757  vl_api_ip4_address_t local_ip_address;
758  vl_api_ip4_address_t external_ip_address;
762  vl_api_interface_index_t external_sw_if_index;
764  string tag[64];
765 };
766 
767 /** \brief Add/delete NAT44 identity mapping
768  @param client_index - opaque cookie to identify the sender
769  @param context - sender context, to match reply w/ request
770  @param is_add - true if add, false if delete
771  @param flags - flag NAT_ADDR_ONLY if address only mapping
772  @param ip_address - IPv4 address
773  @param protocol - IP protocol
774  @param port - port number
775  @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
776  used)
777  @param vfr_id - VRF ID (if ~0 use default VRF)
778  @param tag - opaque string tag
779 */
780 autoreply define nat44_add_del_identity_mapping {
783  bool is_add;
784  vl_api_nat_config_flags_t flags;
785  vl_api_ip4_address_t ip_address;
788  vl_api_interface_index_t sw_if_index;
790  string tag[64];
791 };
792 
793 /** \brief Dump NAT44 identity mappings
794  @param client_index - opaque cookie to identify the sender
795  @param context - sender context, to match reply w/ request
796 */
797 define nat44_identity_mapping_dump {
800 };
801 
802 /** \brief NAT44 identity mapping details response
803  @param context - sender context, to match reply w/ request
804  @param flags - flag NAT_ADDR_ONLY if address only mapping
805  @param ip_address - IPv4 address
806  @param protocol - IP protocol
807  @param port - port number
808  @param sw_if_index - interface
809  @param vfr_id - VRF ID
810  @param tag - opaque string tag
811 */
812 define nat44_identity_mapping_details {
814  vl_api_nat_config_flags_t flags;
815  vl_api_ip4_address_t ip_address;
818  vl_api_interface_index_t sw_if_index;
820  string tag[64];
821 };
822 
823 /** \brief Add/delete NAT44 pool address from specific interfce
824  @param client_index - opaque cookie to identify the sender
825  @param context - sender context, to match reply w/ request
826  @param is_add - true if add, false if delete
827  @param sw_if_index - software index of the interface
828  @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
829 */
830 autoreply define nat44_add_del_interface_addr {
833  bool is_add;
834  vl_api_interface_index_t sw_if_index;
835  vl_api_nat_config_flags_t flags;
836 };
837 
838 /** \brief Dump NAT44 pool addresses interfaces
839  @param client_index - opaque cookie to identify the sender
840  @param context - sender context, to match reply w/ request
841 */
842 define nat44_interface_addr_dump {
845 };
846 
847 /** \brief NAT44 pool addresses interfaces details response
848  @param context - sender context, to match reply w/ request
849  @param sw_if_index - software index of the interface
850  @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
851 
852 */
853 define nat44_interface_addr_details {
855  vl_api_interface_index_t sw_if_index;
856  vl_api_nat_config_flags_t flags;
857 };
858 
859 /** \brief Dump NAT44 users
860  @param client_index - opaque cookie to identify the sender
861  @param context - sender context, to match reply w/ request
862 */
863 define nat44_user_dump {
866 };
867 
868 /** \brief NAT44 users response
869  @param context - sender context, to match reply w/ request
870  @vrf_id - VRF ID
871  @param ip_address - IPv4 address
872  @param nsessions - number of dynamic sessions
873  @param nstaticsessions - number of static sessions
874 */
875 define nat44_user_details {
878  vl_api_ip4_address_t ip_address;
881 };
882 
883 /** \brief NAT44 user's sessions
884  @param client_index - opaque cookie to identify the sender
885  @param context - sender context, to match reply w/ request
886  @param ip_address - IPv4 address of the user to dump
887  @param vrf_id - VRF_ID
888 */
889 define nat44_user_session_dump {
892  vl_api_ip4_address_t ip_address;
894 };
895 
896 /** \brief NAT44 user's sessions response
897  @param context - sender context, to match reply w/ request
898  @param outside_ip_address - outside IPv4 address
899  @param outside_port - outside port
900  @param inside_ip_address - inside IPv4 address
901  @param inside_port - inside port
902  @param protocol - protocol
903  @param flags - flag NAT_IS_STATIC if session is static,
904  flag NAT_IS_TWICE_NAT if session is twice-nat,
905  flag NAT_IS_EXT_HOST_VALID if external host address
906  and port are valid
907  @param last_heard - last heard timer
908  @param total_bytes - count of bytes sent through session
909  @param total_pkts - count of pakets sent through session
910  @param ext_host_address - external host IPv4 address
911  @param ext_host_port - external host port
912  @param ext_host_nat_address - post-NAT external host IPv4 address (valid
913  only if twice-nat session)
914  @param ext_host_nat_port - post-NAT external host port (valid only if
915  twice-nat session)
916 */
917 define nat44_user_session_details {
919  vl_api_ip4_address_t outside_ip_address;
921  vl_api_ip4_address_t inside_ip_address;
924  vl_api_nat_config_flags_t flags;
928  vl_api_ip4_address_t ext_host_address;
930  vl_api_ip4_address_t ext_host_nat_address;
932 };
933 
934 /** \brief NAT44 load-balancing address and port pair
935  @param addr - IPv4 address of the internal node
936  @param port - L4 port number of the internal node
937  @param probability - probability of the internal node to be randomly matched
938  @param vrf_id - VRF id
939 */
941  vl_api_ip4_address_t addr;
945 };
946 
947 /** \brief Add/delete NAT44 load-balancing static mapping rule
948  @param client_index - opaque cookie to identify the sender
949  @param context - sender context, to match reply w/ request
950  @param is_add - true if add, false if delete
951  @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
952  flag NAT_SELF_TWICE_NAT if translate external host address
953  and port whenever external host address equals local
954  address of internal host,
955  flag NAT_OUT2IN_ONLY if rule match only out2in direction
956  @param external_addr - external IPv4 address of the service
957  @param external_port - external L4 port number of the service
958  @param protocol - IP protocol number of the service
959  @param affinity - if 0 disabled, otherwise client IP affinity sticky time
960  in seconds
961  @param local_num - number of local network nodes
962  @param locals - local network nodes
963  @param tag - opaque string tag
964 */
965 autoreply manual_endian define nat44_add_del_lb_static_mapping {
968  bool is_add;
969  vl_api_nat_config_flags_t flags;
970  vl_api_ip4_address_t external_addr;
974  string tag[64];
976  vl_api_nat44_lb_addr_port_t locals[local_num];
977 };
978 
979 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
980  @param client_index - opaque cookie to identify the sender
981  @param context - sender context, to match reply w/ request
982  @param is_add - true if add, false if delete
983  @param external_addr - external IPv4 address of the service
984  @param external_port - external L4 port number of the service
985  @param protocol - IP protocol number of the service
986  @param local - local network node
987 */
991  bool is_add;
992  vl_api_ip4_address_t external_addr;
995  vl_api_nat44_lb_addr_port_t local;
996 };
997 
998 /** \brief Dump NAT44 load-balancing static mapping rules
999  @param client_index - opaque cookie to identify the sender
1000  @param context - sender context, to match reply w/ request
1001 */
1002 define nat44_lb_static_mapping_dump {
1005 };
1006 
1007 /** \brief NAT44 load-balancing static mapping rule details response
1008  @param context - sender context, to match reply w/ request
1009  @param external_addr - external IPv4 address of the service
1010  @param external_port - external L4 port number of the service
1011  @param protocol - IP protocol number of the service
1012  @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
1013  flag NAT_SELF_TWICE_NAT if translate external host address
1014  and port whenever external host address equals local
1015  address of internal host,
1016  flag NAT_OUT2IN_ONLY if rule match only out2in direction
1017  @param affinity - if 0 disabled, otherwise client IP affinity sticky time
1018  in seconds
1019  @param local_num - number of local network nodes
1020  @param locals - local network nodes
1021  @param tag - opaque string tag
1022 */
1023 manual_endian define nat44_lb_static_mapping_details {
1025  vl_api_ip4_address_t external_addr;
1028  vl_api_nat_config_flags_t flags;
1030  string tag[64];
1032  vl_api_nat44_lb_addr_port_t locals[local_num];
1033 };
1034 
1035 /** \brief Delete NAT44 session
1036  @param client_index - opaque cookie to identify the sender
1037  @param context - sender context, to match reply w/ request
1038  @param ip_address - IPv4 address
1039  @param protocol - IP protocol
1040  @param port - port number
1041  @param vfr_id - VRF ID
1042  @param flags - flag NAT_IS_INSIDE if interface is inside or
1043  interface is outside,
1044  flag NAT_IS_EXT_HOST_VALID if external host address and
1045  port are valid
1046  @param ext_host_address - external host IPv4 address
1047  @param ext_host_port - external host port
1048 */
1049 autoreply define nat44_del_session {
1052  vl_api_ip4_address_t address;
1056  vl_api_nat_config_flags_t flags;
1057  vl_api_ip4_address_t ext_host_address;
1059 };
1060 
1061 /** \brief Enable/disable forwarding for NAT44
1062  Forward packets which don't match existing translation
1063  or static mapping instead of dropping them.
1064  @param client_index - opaque cookie to identify the sender
1065  @param context - sender context, to match reply w/ request
1066  @param enable - true for enable, false for disable
1067 */
1068 autoreply define nat44_forwarding_enable_disable {
1071  bool enable;
1072 };
1073 
1074 /** \brief Check if forwarding is enabled or disabled
1075  @param client_index - opaque cookie to identify the sender
1076  @param context - sender context, to match reply w/ request
1077 */
1078 define nat44_forwarding_is_enabled {
1081 };
1082 
1083 /** \brief Response to check if forwarding is enabled or disabled
1084  @param context - sender context, to match reply w/ request
1085  @param enabled - true if enabled, false if disabled
1086 */
1087 define nat44_forwarding_is_enabled_reply {
1089  bool enabled;
1090 };
1091 
1092 /*
1093  * NAT64 APIs
1094  */
1095 
1096 /** \brief Add/delete address range to NAT64 pool
1097  @param client_index - opaque cookie to identify the sender
1098  @param context - sender context, to match reply w/ request
1099  @param start_addr - start IPv4 address of the range
1100  @param end_addr - end IPv4 address of the range
1101  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
1102  @param is_add - true if add, false if delete
1103 */
1104 autoreply define nat64_add_del_pool_addr_range {
1107  vl_api_ip4_address_t start_addr;
1108  vl_api_ip4_address_t end_addr;
1110  bool is_add;
1111 };
1112 
1113 /** \brief Dump NAT64 pool addresses
1114  @param client_index - opaque cookie to identify the sender
1115  @param context - sender context, to match reply w/ request
1116 */
1117 define nat64_pool_addr_dump {
1120 };
1121 
1122 /** \brief NAT64 pool address details response
1123  @param context - sender context, to match reply w/ request
1124  @param address - IPv4 address
1125  @param vfr_id - VRF id of tenant, ~0 means independent of VRF
1126 */
1127 define nat64_pool_addr_details {
1129  vl_api_ip4_address_t address;
1131 };
1132 
1133 /** \brief Enable/disable NAT64 feature on the interface
1134  @param client_index - opaque cookie to identify the sender
1135  @param context - sender context, to match reply w/ request
1136  @param is_add - true if add, false if delete
1137  @param flags - flag NAT_IS_INSIDE if interface is inside else
1138  interface is outside
1139  @param sw_if_index - index of the interface
1140 */
1141 autoreply define nat64_add_del_interface {
1144  bool is_add;
1145  vl_api_nat_config_flags_t flags;
1146  vl_api_interface_index_t sw_if_index;
1147 };
1148 
1149 /** \brief Dump interfaces with NAT64 feature
1150  @param client_index - opaque cookie to identify the sender
1151  @param context - sender context, to match reply w/ request
1152 */
1153 define nat64_interface_dump {
1156 };
1157 
1158 /** \brief NAT64 interface details response
1159  @param context - sender context, to match reply w/ request
1160  @param flags - flag NAT_IS_INSIDE if interface is inside,
1161  flag NAT_IS_OUTSIDE if interface is outside
1162  and if both flags are set the interface is
1163  both inside and outside
1164  @param sw_if_index - index of the interface
1165 */
1166 define nat64_interface_details {
1168  vl_api_nat_config_flags_t flags;
1169  vl_api_interface_index_t sw_if_index;
1170 };
1171 
1172 /** \brief Add/delete NAT64 static BIB entry
1173  @param client_index - opaque cookie to identify the sender
1174  @param context - sender context, to match reply w/ request
1175  @param i_addr - inside IPv6 address
1176  @param o_addr - outside IPv4 address
1177  @param i_port - inside port number
1178  @param o_port - outside port number
1179  @param vrf_id - VRF id of tenant
1180  @param proto - protocol number
1181  @param is_add - true if add, false if delete
1182 */
1183  autoreply define nat64_add_del_static_bib {
1186  vl_api_ip6_address_t i_addr;
1187  vl_api_ip4_address_t o_addr;
1192  bool is_add;
1193 };
1194 
1195 /** \brief Dump NAT64 BIB
1196  @param client_index - opaque cookie to identify the sender
1197  @param context - sender context, to match reply w/ request
1198  @param proto - protocol of the BIB: 255 - all BIBs
1199  6 - TCP BIB
1200  17 - UDP BIB
1201  1/58 - ICMP BIB
1202  otherwise - "unknown" protocol BIB
1203 */
1204 define nat64_bib_dump {
1208 };
1209 
1210 /** \brief NAT64 BIB details response
1211  @param context - sender context, to match reply w/ request
1212  @param i_addr - inside IPv6 address
1213  @param o_addr - outside IPv4 address
1214  @param i_port - inside port number
1215  @param o_port - outside port number
1216  @param vrf_id - VRF id of tenant
1217  @param proto - protocol number
1218  @param flags - flag NAT_IS_STATIC if BIB entry is static
1219  or BIB entry is dynamic
1220  @param ses_num - number of sessions associated with the BIB entry
1221 */
1222 define nat64_bib_details {
1224  vl_api_ip6_address_t i_addr;
1225  vl_api_ip4_address_t o_addr;
1230  vl_api_nat_config_flags_t flags;
1232 };
1233 
1234 /** \brief Dump NAT64 session table
1235  @param client_index - opaque cookie to identify the sender
1236  @param context - sender context, to match reply w/ request
1237  @param proto - protocol of the session table: 255 - all STs
1238  6 - TCP ST
1239  17 - UDP ST
1240  1/58 - ICMP ST
1241  otherwise - "unknown" proto ST
1242 */
1243 define nat64_st_dump {
1247 };
1248 
1249 /** \brief NAT64 session table details response
1250  @param context - sender context, to match reply w/ request
1251  @param il_addr - inside IPv6 address of the local host
1252  @param ol_addr - outside IPv4 address of the local host
1253  @param il_port - inside port number id of the local host/inside ICMP id
1254  @param ol_port - outside port number of the local host/outside ICMP id
1255  @param ir_addr - inside IPv6 address of the remote host
1256  @param or_addr - outside IPv4 address of the remote host
1257  @param r_port - port number of the remote host (not used for ICMP)
1258  @param vrf_id - VRF id of tenant
1259  @param proto - protocol number
1260 */
1261 define nat64_st_details {
1263  vl_api_ip6_address_t il_addr;
1264  vl_api_ip4_address_t ol_addr;
1267  vl_api_ip6_address_t ir_addr;
1268  vl_api_ip4_address_t or_addr;
1272 };
1273 
1274 /** \brief Add/del NAT64 prefix
1275  @param client_index - opaque cookie to identify the sender
1276  @param context - sender context, to match reply w/ request
1277  @param prefix - NAT64 prefix
1278  @param vrf_id - VRF id of tenant
1279  @param is_add - true if add, false if delete
1280 */
1281 autoreply define nat64_add_del_prefix {
1284  vl_api_ip6_prefix_t prefix;
1286  bool is_add;
1287 };
1288 
1289 /** \brief Dump NAT64 prefix
1290  @param client_index - opaque cookie to identify the sender
1291  @param context - sender context, to match reply w/ request
1292 */
1293 define nat64_prefix_dump {
1296 };
1297 
1298 /** \brief Dump NAT64 prefix details response
1299  @param context - sender context, to match reply w/ request
1300  @param prefix - NAT64 prefix
1301  @param vrf_id - VRF id of tenant
1302 */
1303 define nat64_prefix_details {
1305  vl_api_ip6_prefix_t prefix;
1307 };
1308 
1309 /** \brief Add/delete NAT64 pool address from specific interfce
1310  @param client_index - opaque cookie to identify the sender
1311  @param context - sender context, to match reply w/ request
1312  @param is_add - true if add, false if delete
1313  @param sw_if_index - software index of the interface
1314 */
1315 autoreply define nat64_add_del_interface_addr {
1318  bool is_add;
1319  vl_api_interface_index_t sw_if_index;
1320 };
vl_api_ip4_address_t ext_host_address
Definition: nat.api:928
vl_api_interface_index_t external_sw_if_index
Definition: nat.api:723
vl_api_interface_index_t sw_if_index
Definition: nat.api:834
vl_api_ip4_address_t external_addr
Definition: nat.api:1025
int nat44_del_session(snat_main_t *sm, ip4_address_t *addr, u16 port, nat_protocol_t proto, u32 vrf_id, int is_in)
Delete NAT44 session.
Definition: nat.c:4544
vl_api_interface_index_t external_sw_if_index
Definition: nat.api:682
vl_api_interface_index_t sw_if_index
Definition: nat.api:587
vl_api_ip4_address_t external_addr
Definition: nat.api:970
unsigned long u64
Definition: types.h:89
int nat64_add_del_interface(u32 sw_if_index, u8 is_inside, u8 is_add)
Enable/disable NAT64 feature on the interface.
Definition: nat64.c:433
vl_api_nat_config_flags_t flags
Definition: nat.api:784
vl_api_nat_config_flags_t flags
Definition: nat.api:1230
vl_api_nat_config_flags_t flags
Definition: nat.api:609
vl_api_ip4_address_t local_ip_address
Definition: nat.api:677
vl_api_ip4_address_t ip_address
Definition: nat.api:469
vl_api_ip6_prefix_t prefix
Definition: nat.api:1305
vl_api_nat_config_flags_t flags
Definition: nat.api:586
vl_api_ip4_address_t first_ip_address
Definition: nat.api:545
bool static_mapping_connection_tracking
Definition: nat.api:94
vl_api_ip4_address_t or_addr
Definition: nat.api:1268
vl_api_ip4_address_t ip_address
Definition: nat.api:815
vhost_vring_addr_t addr
Definition: vhost_user.h:111
vl_api_nat_config_flags_t flags
Definition: nat.api:856
unsigned char u8
Definition: types.h:56
nat_log_level
Definition: nat.api:170
vl_api_nat_config_flags_t flags
Definition: nat.api:716
vl_api_interface_index_t sw_if_index
Definition: nat.api:1319
vl_api_nat_config_flags_t flags
Definition: nat.api:1145
vl_api_ip6_address_t ir_addr
Definition: nat.api:1267
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)
vl_api_ip4_address_t o_addr
Definition: nat.api:1187
vl_api_nat_config_flags_t flags
Definition: nat.api:814
u8 probability
Definition: nat.api:943
vl_api_ip6_address_t i_addr
Definition: nat.api:1186
option version
Definition: nat.api:16
unsigned int u32
Definition: types.h:88
vl_api_ip4_address_t ip_address
Definition: nat.api:892
vl_api_nat_config_flags_t flags
Definition: nat.api:1056
vl_api_ip4_address_t external_ip_address
Definition: nat.api:719
vl_api_nat_config_flags_t flags
Definition: nat.api:924
int nat44_set_session_limit(u32 session_limit, u32 vrf_id)
Set NAT44 session limit (session limit, vrf id)
Definition: nat.c:3933
vl_api_nat_config_flags_t flags
Definition: nat.api:549
service
Definition: nat.api:511
vl_api_nat_config_flags_t flags
Definition: nat.api:969
vl_api_nat_config_flags_t flags
Definition: nat.api:756
vl_api_nat_config_flags_t flags
Definition: nat.api:1028
unsigned short u16
Definition: types.h:57
vl_api_ip4_address_t external_ip_address
Definition: nat.api:758
void nat_ha_get_listener(ip4_address_t *addr, u16 *port, u32 *path_mtu)
Get HA listener/local configuration.
Definition: nat_ha.c:385
void nat_ha_flush(u8 is_resync)
Flush the current HA data (for testing)
Definition: nat_ha.c:682
vl_api_ip6_address_t i_addr
Definition: nat.api:1224
vl_api_ip4_address_t ext_host_nat_address
Definition: nat.api:930
vl_api_ip4_address_t outside_ip_address
Definition: nat.api:919
vl_api_ip4_address_t address
Definition: nat.api:1052
vl_api_ip4_address_t ip_address
Definition: nat.api:528
vl_api_ip6_address_t il_addr
Definition: nat.api:1263
vl_api_ip4_address_t pool_ip_address
Definition: nat.api:717
vl_api_ip4_address_t last_ip_address
Definition: nat.api:546
vl_api_interface_index_t sw_if_index
Definition: nat.api:1169
vl_api_ip4_address_t ip_address
Definition: nat.api:569
vl_api_ip4_address_t ip_address
Definition: nat.api:404
int nat64_add_del_prefix(ip6_address_t *prefix, u8 plen, u32 vrf_id, u8 is_add)
Add/delete NAT64 prefix.
Definition: nat64.c:986
u16 port
Definition: nat.api:942
vl_api_ip4_address_t ol_addr
Definition: nat.api:1264
vl_api_nat_config_flags_t flags
Definition: nat.api:835
vl_api_ip4_address_t ext_host_address
Definition: nat.api:1057
string name[64]
Definition: ip.api:44
int nat_ha_set_listener(ip4_address_t *addr, u16 port, u32 path_mtu)
Set HA listener (local settings)
Definition: nat_ha.c:352
signed int i32
Definition: types.h:77
int nat_ha_set_failover(ip4_address_t *addr, u16 port, u32 session_refresh_interval)
Set HA failover (remote settings)
Definition: nat_ha.c:395
typedef nat44_lb_addr_port
NAT44 load-balancing address and port pair.
Definition: nat.api:940
vl_api_ip4_address_t o_addr
Definition: nat.api:1225
vl_api_nat_config_flags_t flags
Definition: nat.api:676
vl_api_ip4_address_t local_ip_address
Definition: nat.api:718
vl_api_interface_index_t sw_if_index
Definition: nat.api:818
int nat44_lb_static_mapping_add_del_local(ip4_address_t e_addr, u16 e_port, ip4_address_t l_addr, u16 l_port, nat_protocol_t proto, u32 vrf_id, u8 probability, u8 is_add)
Definition: nat.c:1515
vl_api_ip4_address_t start_addr
Definition: nat.api:1107
vl_api_interface_index_t external_sw_if_index
Definition: nat.api:762
vl_api_interface_index_t sw_if_index
Definition: nat.api:610
vl_api_interface_index_t sw_if_index
Definition: nat.api:1146
vl_api_ip4_address_t ip_address
Definition: nat.api:785
vl_api_interface_index_t sw_if_index
Definition: nat.api:855
vl_api_ip4_address_t ip_address
Definition: nat.api:878
vl_api_ip4_address_t end_addr
Definition: nat.api:1108
void nat_ha_get_failover(ip4_address_t *addr, u16 *port, u32 *session_refresh_interval)
Get HA failover/remote settings.
Definition: nat_ha.c:410
vl_api_ip4_address_t ip_address
Definition: nat.api:420
vl_api_interface_index_t sw_if_index
Definition: nat.api:788
vl_api_ip4_address_t external_ip_address
Definition: nat.api:678
vl_api_ip4_address_t inside_ip_address
Definition: nat.api:921
vl_api_ip6_prefix_t prefix
Definition: nat.api:1284
vl_api_ip4_address_t address
Definition: nat.api:1129
int nat44_add_del_lb_static_mapping(ip4_address_t e_addr, u16 e_port, nat_protocol_t proto, nat44_lb_addr_port_t *locals, u8 is_add, twice_nat_type_t twice_nat, u8 out2in_only, u8 *tag, u32 affinity)
Add/delete static mapping with load-balancing (multiple backends)
Definition: nat.c:1281
vl_api_nat_config_flags_t flags
Definition: nat.api:570
u32 vrf_id
Definition: nat.api:944
vl_api_ip4_address_t local_ip_address
Definition: nat.api:757
vl_api_nat_log_level_t log_level
Definition: nat.api:210
vl_api_interface_index_t sw_if_index
Definition: nat.api:648
vl_api_interface_index_t sw_if_index
Definition: nat.api:627
vl_api_nat44_lb_addr_port_t local
Definition: nat.api:995
vl_api_nat_config_flags_t flags
Definition: nat.api:1168
vl_api_ip4_address_t ip_address
Definition: nat.api:444