FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
nat64_api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vnet/ip/ip_types_api.h>
17 #include <vlibmemory/api.h>
18 #include <nat/nat64/nat64.h>
19 #include <nat/nat64/nat64.api_enum.h>
20 #include <nat/nat64/nat64.api_types.h>
21 #include <vnet/fib/fib_table.h>
22 #include <vnet/ip/ip.h>
23 
24 #define REPLY_MSG_ID_BASE nm->msg_id_base
26 
27 static void
30 {
32  vl_api_nat64_plugin_enable_disable_reply_t *rmp;
33  nat64_config_t c = { 0 };
34  int rv = 0;
35  if (mp->enable)
36  {
37  c.bib_buckets = ntohl (mp->bib_buckets);
38  c.bib_memory_size = ntohl (mp->bib_memory_size);
39  c.st_buckets = ntohl (mp->st_buckets);
40  c.st_memory_size = ntohl (mp->st_memory_size);
42  }
43  else
44  {
46  }
47  REPLY_MACRO (VL_API_NAT64_PLUGIN_ENABLE_DISABLE_REPLY);
48 }
49 
50 static void
52 {
54  vl_api_nat64_set_timeouts_reply_t *rmp;
55  int rv = 0;
56 
57  nm->udp_timeout = ntohl (mp->udp);
58  nm->tcp_est_timeout = ntohl (mp->tcp_established);
59  nm->tcp_trans_timeout = ntohl (mp->tcp_transitory);
60  nm->icmp_timeout = ntohl (mp->icmp);
61 
62  REPLY_MACRO (VL_API_NAT64_SET_TIMEOUTS_REPLY);
63 }
64 
65 static void
67 {
70  int rv = 0;
71 
72  /* *INDENT-OFF* */
73  REPLY_MACRO2 (VL_API_NAT64_GET_TIMEOUTS_REPLY,
74  ({
75  rmp->udp = htonl (nm->udp_timeout);
76  rmp->tcp_established = htonl (nm->tcp_est_timeout);
77  rmp->tcp_transitory = htonl (nm->tcp_trans_timeout);
78  rmp->icmp = htonl (nm->icmp_timeout);
79  }))
80  /* *INDENT-ON* */
81 }
82 
83 static void
86 {
88  vl_api_nat64_add_del_pool_addr_range_reply_t *rmp;
89  int rv = 0;
90  ip4_address_t this_addr;
91  u32 start_host_order, end_host_order;
92  u32 vrf_id;
93  int i, count;
94  u32 *tmp;
95 
96  tmp = (u32 *) mp->start_addr;
97  start_host_order = clib_host_to_net_u32 (tmp[0]);
98  tmp = (u32 *) mp->end_addr;
99  end_host_order = clib_host_to_net_u32 (tmp[0]);
100 
101  count = (end_host_order - start_host_order) + 1;
102 
103  vrf_id = clib_host_to_net_u32 (mp->vrf_id);
104 
105  memcpy (&this_addr.as_u8, mp->start_addr, 4);
106 
107  for (i = 0; i < count; i++)
108  {
109  if ((rv = nat64_add_del_pool_addr (0, &this_addr, vrf_id, mp->is_add)))
110  goto send_reply;
111 
112  increment_v4_address (&this_addr);
113  }
114 
115 send_reply:
116  REPLY_MACRO (VL_API_NAT64_ADD_DEL_POOL_ADDR_RANGE_REPLY);
117 }
118 
119 typedef struct nat64_api_walk_ctx_t_
120 {
125 
126 static int
128 {
131  nat64_api_walk_ctx_t *ctx = arg;
132 
133  rmp = vl_msg_api_alloc (sizeof (*rmp));
134  clib_memset (rmp, 0, sizeof (*rmp));
135  rmp->_vl_msg_id = ntohs (VL_API_NAT64_POOL_ADDR_DETAILS + nm->msg_id_base);
136  clib_memcpy (rmp->address, &(a->addr), 4);
137  if (a->fib_index != ~0)
138  {
139  fib_table_t *fib = fib_table_get (a->fib_index, FIB_PROTOCOL_IP6);
140  if (!fib)
141  return -1;
142  rmp->vrf_id = ntohl (fib->ft_table_id);
143  }
144  else
145  rmp->vrf_id = ~0;
146  rmp->context = ctx->context;
147 
148  vl_api_send_msg (ctx->reg, (u8 *) rmp);
149 
150  return 0;
151 }
152 
153 static void
155 {
157 
159  if (!reg)
160  return;
161 
163  .reg = reg,
164  .context = mp->context,
165  };
166 
168 }
169 
170 static void
172  mp)
173 {
175  vl_api_nat64_add_del_interface_reply_t *rmp;
176  int rv = 0;
177 
179 
180  rv =
182  mp->flags & NAT_API_IS_INSIDE, mp->is_add);
183 
185 
186  REPLY_MACRO (VL_API_NAT64_ADD_DEL_INTERFACE_REPLY);
187 }
188 
189 static int
191 {
194  nat64_api_walk_ctx_t *ctx = arg;
195 
196  rmp = vl_msg_api_alloc (sizeof (*rmp));
197  clib_memset (rmp, 0, sizeof (*rmp));
198  rmp->_vl_msg_id = ntohs (VL_API_NAT64_INTERFACE_DETAILS + nm->msg_id_base);
199  rmp->sw_if_index = ntohl (i->sw_if_index);
200 
202  rmp->flags |= NAT_API_IS_INSIDE;
204  rmp->flags |= NAT_API_IS_OUTSIDE;
205 
206  rmp->context = ctx->context;
207 
208  vl_api_send_msg (ctx->reg, (u8 *) rmp);
209 
210  return 0;
211 }
212 
213 static void
215 {
217 
219  if (!reg)
220  return;
221 
223  .reg = reg,
224  .context = mp->context,
225  };
226 
228 }
229 
230 static void
233 {
235  vl_api_nat64_add_del_static_bib_reply_t *rmp;
236  ip6_address_t in_addr;
237  ip4_address_t out_addr;
238  int rv = 0;
239 
240  memcpy (&in_addr.as_u8, mp->i_addr, 16);
241  memcpy (&out_addr.as_u8, mp->o_addr, 4);
242 
243  rv =
244  nat64_add_del_static_bib_entry (&in_addr, &out_addr,
245  clib_net_to_host_u16 (mp->i_port),
246  clib_net_to_host_u16 (mp->o_port),
247  mp->proto,
248  clib_net_to_host_u32 (mp->vrf_id),
249  mp->is_add);
250 
251  REPLY_MACRO (VL_API_NAT64_ADD_DEL_STATIC_BIB_REPLY);
252 }
253 
254 static int
255 nat64_api_bib_walk (nat64_db_bib_entry_t * bibe, void *arg)
256 {
259  nat64_api_walk_ctx_t *ctx = arg;
260  fib_table_t *fib;
261 
262  fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
263  if (!fib)
264  return -1;
265 
266  rmp = vl_msg_api_alloc (sizeof (*rmp));
267  clib_memset (rmp, 0, sizeof (*rmp));
268  rmp->_vl_msg_id = ntohs (VL_API_NAT64_BIB_DETAILS + nm->msg_id_base);
269  rmp->context = ctx->context;
270  clib_memcpy (rmp->i_addr, &(bibe->in_addr), 16);
271  clib_memcpy (rmp->o_addr, &(bibe->out_addr), 4);
272  rmp->i_port = bibe->in_port;
273  rmp->o_port = bibe->out_port;
274  rmp->vrf_id = ntohl (fib->ft_table_id);
275  rmp->proto = bibe->proto;
276  if (bibe->is_static)
277  rmp->flags |= NAT_API_IS_STATIC;
278  rmp->ses_num = ntohl (bibe->ses_num);
279 
280  vl_api_send_msg (ctx->reg, (u8 *) rmp);
281 
282  return 0;
283 }
284 
285 static void
287 {
290  nat64_db_t *db;
291 
293  if (!reg)
294  return;
295 
297  .reg = reg,
298  .context = mp->context,
299  };
300 
301  /* *INDENT-OFF* */
302  vec_foreach (db, nm->db)
304  /* *INDENT-ON* */
305 }
306 
307 static int
308 nat64_api_st_walk (nat64_db_st_entry_t * ste, void *arg)
309 {
312  nat64_api_walk_ctx_t *ctx = arg;
313  nat64_db_bib_entry_t *bibe;
314  fib_table_t *fib;
315 
316  bibe = nat64_db_bib_entry_by_index (ctx->db, ste->proto, ste->bibe_index);
317  if (!bibe)
318  return -1;
319 
320  fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
321  if (!fib)
322  return -1;
323 
324  rmp = vl_msg_api_alloc (sizeof (*rmp));
325  clib_memset (rmp, 0, sizeof (*rmp));
326  rmp->_vl_msg_id = ntohs (VL_API_NAT64_ST_DETAILS + nm->msg_id_base);
327  rmp->context = ctx->context;
328  clib_memcpy (rmp->il_addr, &(bibe->in_addr), 16);
329  clib_memcpy (rmp->ol_addr, &(bibe->out_addr), 4);
330  rmp->il_port = bibe->in_port;
331  rmp->ol_port = bibe->out_port;
332  clib_memcpy (rmp->ir_addr, &(ste->in_r_addr), 16);
333  clib_memcpy (rmp->or_addr, &(ste->out_r_addr), 4);
334  rmp->il_port = ste->r_port;
335  rmp->vrf_id = ntohl (fib->ft_table_id);
336  rmp->proto = ste->proto;
337 
338  vl_api_send_msg (ctx->reg, (u8 *) rmp);
339 
340  return 0;
341 }
342 
343 static void
345 {
348  nat64_db_t *db;
349 
351  if (!reg)
352  return;
353 
355  .reg = reg,
356  .context = mp->context,
357  };
358 
359  /* *INDENT-OFF* */
360  vec_foreach (db, nm->db)
361  {
362  ctx.db = db;
364  }
365  /* *INDENT-ON* */
366 }
367 
368 static void
370 {
372  vl_api_nat64_add_del_prefix_reply_t *rmp;
373  ip6_address_t prefix;
374  int rv = 0;
375 
376  memcpy (&prefix.as_u8, mp->prefix.address, 16);
377 
378  rv =
380  clib_net_to_host_u32 (mp->vrf_id), mp->is_add);
381  REPLY_MACRO (VL_API_NAT64_ADD_DEL_PREFIX_REPLY);
382 }
383 
384 static int
386 {
389  nat64_api_walk_ctx_t *ctx = arg;
390 
391  rmp = vl_msg_api_alloc (sizeof (*rmp));
392  clib_memset (rmp, 0, sizeof (*rmp));
393  rmp->_vl_msg_id = ntohs (VL_API_NAT64_PREFIX_DETAILS + nm->msg_id_base);
394  clib_memcpy (rmp->prefix.address, &(p->prefix), 16);
395  rmp->prefix.len = p->plen;
396  rmp->vrf_id = ntohl (p->vrf_id);
397  rmp->context = ctx->context;
398 
399  vl_api_send_msg (ctx->reg, (u8 *) rmp);
400 
401  return 0;
402 }
403 
404 static void
406 {
408 
410  if (!reg)
411  return;
412 
414  .reg = reg,
415  .context = mp->context,
416  };
417 
419 }
420 
421 static void
424 {
426  vl_api_nat64_add_del_interface_addr_reply_t *rmp;
427  u32 sw_if_index = ntohl (mp->sw_if_index);
428  int rv = 0;
429 
431 
433 
435 
436  REPLY_MACRO (VL_API_NAT64_ADD_DEL_INTERFACE_ADDR_REPLY);
437 }
438 
439 /* API definitions */
440 #include <vnet/format_fns.h>
441 #include <nat/nat64/nat64.api.c>
442 
443 /* Set up the API message handling tables */
444 clib_error_t *
446 {
449  return 0;
450 }
451 
452 /*
453  * fd.io coding-style-patch-verification: ON
454  *
455  * Local Variables:
456  * eval: (c-set-style "gnu")
457  * End:
458  */
nat64_add_del_prefix
int nat64_add_del_prefix(ip6_address_t *prefix, u8 plen, u32 vrf_id, u8 is_add)
Add/delete NAT64 prefix.
Definition: nat64.c:1206
nat64_add_del_static_bib_entry
int nat64_add_del_static_bib_entry(ip6_address_t *in_addr, ip4_address_t *out_addr, u16 in_port, u16 out_port, u8 proto, u32 vrf_id, u8 is_add)
Add/delete static NAT64 BIB entry.
Definition: nat64.c:879
vl_api_nat64_pool_addr_details_t::vrf_id
u32 vrf_id
Definition: nat64.api:126
tmp
u32 * tmp
Definition: interface_output.c:1078
vl_api_nat64_bib_details_t::i_addr
vl_api_ip6_address_t i_addr
Definition: nat64.api:220
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
vl_api_nat64_add_del_static_bib_t::proto
u8 proto
Definition: nat64.api:187
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
api.h
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
vl_api_nat64_plugin_enable_disable_t_handler
static void vl_api_nat64_plugin_enable_disable_t_handler(vl_api_nat64_plugin_enable_disable_t *mp)
Definition: nat64_api.c:29
vl_api_nat64_add_del_prefix_t
Add/del NAT64 prefix.
Definition: nat64.api:277
vl_api_nat64_get_timeouts_reply_t::tcp_established
u32 tcp_established
Definition: nat64.api:87
vl_api_nat64_interface_details_t::context
u32 context
Definition: nat64.api:163
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
vl_api_nat64_add_del_static_bib_t::o_port
u16 o_port
Definition: nat64.api:185
nat64_api_bib_walk
static int nat64_api_bib_walk(nat64_db_bib_entry_t *bibe, void *arg)
Definition: nat64_api.c:255
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
nat64_api_interface_walk
static int nat64_api_interface_walk(nat64_interface_t *i, void *arg)
Definition: nat64_api.c:190
vl_api_nat64_st_dump_t::client_index
u32 client_index
Definition: nat64.api:240
nat64_api_walk_ctx_t_::db
nat64_db_t * db
Definition: nat64_api.c:123
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_nat64_bib_details_t::i_port
u16 i_port
Definition: nat64.api:222
vl_api_nat64_prefix_details_t
Dump NAT64 prefix details response.
Definition: nat64.api:299
vl_api_nat64_plugin_enable_disable_t::bib_memory_size
u32 bib_memory_size
Definition: nat64.api:42
vl_api_nat64_prefix_dump_t::context
u32 context
Definition: nat64.api:291
nat64_prefix_walk
void nat64_prefix_walk(nat64_prefix_walk_fn_t fn, void *ctx)
Walk NAT64 prefixes.
Definition: nat64.c:1256
nat64_main
nat64_main_t nat64_main
Definition: nat64.c:27
nat64_api_walk_ctx_t_::context
u32 context
Definition: nat64_api.c:122
nat64_prefix_t::prefix
ip6_address_t prefix
Definition: nat64.h:73
vl_api_nat64_add_del_interface_addr_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat64.api:315
vl_api_nat64_add_del_static_bib_t::o_addr
vl_api_ip4_address_t o_addr
Definition: nat64.api:183
nat64_api_walk_ctx_t_
Definition: nat64_api.c:119
vl_api_nat64_add_del_pool_addr_range_t_handler
static void vl_api_nat64_add_del_pool_addr_range_t_handler(vl_api_nat64_add_del_pool_addr_range_t *mp)
Definition: nat64_api.c:85
vl_api_nat64_set_timeouts_t::tcp_established
u32 tcp_established
Definition: nat64.api:61
fib_table.h
vl_api_nat64_bib_details_t::ses_num
u32 ses_num
Definition: nat64.api:227
vl_api_nat64_st_dump_t_handler
static void vl_api_nat64_st_dump_t_handler(vl_api_nat64_st_dump_t *mp)
Definition: nat64_api.c:344
vl_api_nat64_add_del_pool_addr_range_t::is_add
bool is_add
Definition: nat64.api:106
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vl_api_nat64_st_details_t::context
u32 context
Definition: nat64.api:258
nat64_db_st_walk
void nat64_db_st_walk(nat64_db_t *db, u8 proto, nat64_db_st_walk_fn_t fn, void *ctx)
Walk NAT64 session table.
Definition: nat64_db.c:341
vl_api_nat64_add_del_pool_addr_range_t
Add/delete address range to NAT64 pool.
Definition: nat64.api:100
nat64_api_st_walk
static int nat64_api_st_walk(nat64_db_st_entry_t *ste, void *arg)
Definition: nat64_api.c:308
vl_api_nat64_get_timeouts_t
Get values of timeouts for NAT64 sessions (seconds)
Definition: nat64.api:70
vl_api_nat64_prefix_details_t::prefix
vl_api_ip6_prefix_t prefix
Definition: nat64.api:301
vl_api_nat64_pool_addr_details_t::context
u32 context
Definition: nat64.api:124
vl_api_nat64_add_del_static_bib_t::i_addr
vl_api_ip6_address_t i_addr
Definition: nat64.api:182
vl_api_nat64_get_timeouts_reply_t::tcp_transitory
u32 tcp_transitory
Definition: nat64.api:88
vl_api_nat64_bib_dump_t
Dump NAT64 BIB.
Definition: nat64.api:200
nat64_api_walk_ctx_t
struct nat64_api_walk_ctx_t_ nat64_api_walk_ctx_t
vl_api_nat64_add_del_static_bib_t
Add/delete NAT64 static BIB entry.
Definition: nat64.api:179
vl_api_nat64_set_timeouts_t::tcp_transitory
u32 tcp_transitory
Definition: nat64.api:62
vl_api_nat64_set_timeouts_t::udp
u32 udp
Definition: nat64.api:60
nat64_db_bib_walk
void nat64_db_bib_walk(nat64_db_t *db, u8 proto, nat64_db_bib_walk_fn_t fn, void *ctx)
Walk NAT64 BIB.
Definition: nat64_db.c:267
vl_api_nat64_set_timeouts_t_handler
static void vl_api_nat64_set_timeouts_t_handler(vl_api_nat64_set_timeouts_t *mp)
Definition: nat64_api.c:51
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: bfd_api.c:451
fib_table_t_
A protocol Independent FIB table.
Definition: fib_table.h:71
vl_api_nat64_plugin_enable_disable_t::st_buckets
u32 st_buckets
Definition: nat64.api:43
count
u8 count
Definition: dhcp.api:208
vl_api_nat64_add_del_interface_t
Enable/disable NAT64 feature on the interface.
Definition: nat64.api:137
vl_api_nat64_interface_dump_t::context
u32 context
Definition: nat64.api:151
vl_api_nat64_pool_addr_dump_t_handler
static void vl_api_nat64_pool_addr_dump_t_handler(vl_api_nat64_pool_addr_dump_t *mp)
Definition: nat64_api.c:154
nat64_plugin_enable
int nat64_plugin_enable(nat64_config_t c)
Definition: nat64.c:1516
vl_api_nat64_bib_details_t::o_addr
vl_api_ip4_address_t o_addr
Definition: nat64.api:221
vl_api_nat64_bib_dump_t::context
u32 context
Definition: nat64.api:202
vl_api_nat64_get_timeouts_reply_t::udp
u32 udp
Definition: nat64.api:86
vl_api_nat64_add_del_interface_addr_t
Add/delete NAT64 pool address from specific interfce.
Definition: nat64.api:311
fib_table_t_::ft_table_id
u32 ft_table_id
Table ID (hash key) for this FIB.
Definition: fib_table.h:92
nat64_api_walk_ctx_t_::reg
vl_api_registration_t * reg
Definition: nat64_api.c:121
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
vl_api_nat64_st_details_t::or_addr
vl_api_ip4_address_t or_addr
Definition: nat64.api:264
c
svmdb_client_t * c
Definition: vpp_get_metrics.c:48
vl_api_nat64_st_dump_t::proto
u8 proto
Definition: nat64.api:242
nat64_pool_addr_walk
void nat64_pool_addr_walk(nat64_pool_addr_walk_fn_t fn, void *ctx)
Walk NAT64 pool.
Definition: nat64.c:440
nat64_interfaces_walk
void nat64_interfaces_walk(nat64_interface_walk_fn_t fn, void *ctx)
Walk NAT64 interfaces.
Definition: nat64.c:639
vl_api_nat64_bib_details_t::context
u32 context
Definition: nat64.api:219
vl_api_nat64_st_details_t::vrf_id
u32 vrf_id
Definition: nat64.api:266
vl_api_nat64_plugin_enable_disable_t::enable
bool enable
Definition: nat64.api:45
vl_api_nat64_add_del_static_bib_t::i_port
u16 i_port
Definition: nat64.api:184
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
vl_api_nat64_bib_details_t::flags
vl_api_nat_config_flags_t flags
Definition: nat64.api:226
vl_api_nat64_add_del_prefix_t::vrf_id
u32 vrf_id
Definition: nat64.api:281
nat64_api_hookup
clib_error_t * nat64_api_hookup(vlib_main_t *vm)
Definition: nat64_api.c:445
vl_api_nat64_interface_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat64.api:165
ip4_address_t
Definition: ip4_packet.h:50
nat64_interface_is_inside
#define nat64_interface_is_inside(i)
Check if NAT64 interface is inside.
Definition: nat64.h:483
vl_api_nat64_prefix_details_t::vrf_id
u32 vrf_id
Definition: nat64.api:302
vl_api_nat64_add_del_interface_addr_t_handler
static void vl_api_nat64_add_del_interface_addr_t_handler(vl_api_nat64_add_del_interface_addr_t *mp)
Definition: nat64_api.c:423
vl_api_nat64_plugin_enable_disable_t::st_memory_size
u32 st_memory_size
Definition: nat64.api:44
vl_api_nat64_bib_details_t::o_port
u16 o_port
Definition: nat64.api:223
nat64_prefix_t::plen
u8 plen
Definition: nat64.h:74
nat64_interface_is_outside
#define nat64_interface_is_outside(i)
Check if NAT64 interface is outside.
Definition: nat64.h:489
vl_api_nat64_add_del_prefix_t::prefix
vl_api_ip6_prefix_t prefix
Definition: nat64.api:280
nat44_ei_main_s::msg_id_base
u16 msg_id_base
Definition: nat44_ei.h:447
vl_api_nat64_interface_dump_t_handler
static void vl_api_nat64_interface_dump_t_handler(vl_api_nat64_interface_dump_t *mp)
Definition: nat64_api.c:214
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_nat64_plugin_enable_disable_t
Enable/disable NAT64 plugin.
Definition: nat64.api:38
vl_api_nat64_add_del_interface_t::flags
vl_api_nat_config_flags_t flags
Definition: nat64.api:141
ip4_address_t::as_u8
u8 as_u8[4]
Definition: ip4_packet.h:55
nat64.h
vl_api_nat64_add_del_static_bib_t_handler
static void vl_api_nat64_add_del_static_bib_t_handler(vl_api_nat64_add_del_static_bib_t *mp)
Definition: nat64_api.c:232
vl_api_nat64_interface_dump_t::client_index
u32 client_index
Definition: nat64.api:150
nat64_config_t
Definition: nat64_db.h:25
nat64_add_del_pool_addr
int nat64_add_del_pool_addr(u32 thread_index, ip4_address_t *addr, u32 vrf_id, u8 is_add)
Add/delete address to NAT64 pool.
Definition: nat64.c:364
vl_api_nat64_st_details_t::il_port
u16 il_port
Definition: nat64.api:261
vl_api_nat64_interface_details_t::flags
vl_api_nat_config_flags_t flags
Definition: nat64.api:164
vl_api_nat64_st_details_t::il_addr
vl_api_ip6_address_t il_addr
Definition: nat64.api:259
vl_api_nat64_bib_details_t::proto
u8 proto
Definition: nat64.api:225
format_fns.h
nat64_prefix_t
Definition: nat64.h:71
vl_api_nat64_interface_dump_t
Dump interfaces with NAT64 feature.
Definition: nat64.api:149
nat64_main_t
Definition: nat64.h:112
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
ip.h
u32
unsigned int u32
Definition: types.h:88
nat64_prefix_t::vrf_id
u32 vrf_id
Definition: nat64.h:75
vl_api_nat64_prefix_dump_t::client_index
u32 client_index
Definition: nat64.api:290
vl_api_nat64_add_del_interface_t::is_add
bool is_add
Definition: nat64.api:140
vl_api_nat64_bib_details_t::vrf_id
u32 vrf_id
Definition: nat64.api:224
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
vl_api_nat64_bib_dump_t_handler
static void vl_api_nat64_bib_dump_t_handler(vl_api_nat64_bib_dump_t *mp)
Definition: nat64_api.c:286
vl_api_nat64_bib_dump_t::proto
u8 proto
Definition: nat64.api:203
vl_api_nat64_add_del_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat64.api:142
api_helper_macros.h
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
vl_api_nat64_pool_addr_dump_t::client_index
u32 client_index
Definition: nat64.api:114
vl_api_nat64_add_del_pool_addr_range_t::start_addr
vl_api_ip4_address_t start_addr
Definition: nat64.api:103
vl_api_nat64_pool_addr_details_t::address
vl_api_ip4_address_t address
Definition: nat64.api:125
vl_api_nat64_pool_addr_details_t
NAT64 pool address details response.
Definition: nat64.api:123
vl_api_nat64_get_timeouts_t_handler
static void vl_api_nat64_get_timeouts_t_handler(vl_api_nat64_get_timeouts_t *mp)
Definition: nat64_api.c:66
vl_api_nat64_bib_dump_t::client_index
u32 client_index
Definition: nat64.api:201
vl_api_nat64_set_timeouts_t::icmp
u32 icmp
Definition: nat64.api:63
nm
nat44_ei_main_t * nm
Definition: nat44_ei_hairpinning.c:413
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_nat64_add_del_interface_t_handler
static void vl_api_nat64_add_del_interface_t_handler(vl_api_nat64_add_del_interface_t *mp)
Definition: nat64_api.c:171
vl_api_nat64_get_timeouts_reply_t::icmp
u32 icmp
Definition: nat64.api:89
vl_api_nat64_add_del_prefix_t::is_add
bool is_add
Definition: nat64.api:282
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
a
a
Definition: bitmap.h:544
vl_api_nat64_pool_addr_dump_t
Dump NAT64 pool addresses.
Definition: nat64.api:113
vl_api_nat64_add_del_static_bib_t::vrf_id
u32 vrf_id
Definition: nat64.api:186
vl_api_nat64_st_details_t::ol_port
u16 ol_port
Definition: nat64.api:262
vl_api_nat64_st_details_t::ol_addr
vl_api_ip4_address_t ol_addr
Definition: nat64.api:260
vl_api_nat64_st_details_t
NAT64 session table details response.
Definition: nat64.api:257
vl_api_nat64_st_dump_t
Dump NAT64 session table.
Definition: nat64.api:239
nat64_api_pool_walk
static int nat64_api_pool_walk(nat64_address_t *a, void *arg)
Definition: nat64_api.c:127
rv
int __clib_unused rv
Definition: application.c:491
vrf_id
u32 vrf_id
Definition: nat44_ed.api:1053
vl_api_nat64_add_del_pool_addr_range_t::end_addr
vl_api_ip4_address_t end_addr
Definition: nat64.api:104
vl_api_nat64_prefix_details_t::context
u32 context
Definition: nat64.api:300
vl_api_nat64_st_details_t::ir_addr
vl_api_ip6_address_t ir_addr
Definition: nat64.api:263
nat64_db_bib_entry_by_index
nat64_db_bib_entry_t * nat64_db_bib_entry_by_index(nat64_db_t *db, u8 proto, u32 bibe_index)
Get BIB entry by index and protocol.
Definition: nat64_db.c:318
nat64_api_prefix_walk
static int nat64_api_prefix_walk(nat64_prefix_t *p, void *arg)
Definition: nat64_api.c:385
nat64_interface_t
Definition: nat64.h:106
nat64_add_interface_address
int nat64_add_interface_address(u32 sw_if_index, int is_add)
NAT64 pool address from specific (DHCP addressed) interface.
Definition: nat64.c:455
nat64_plugin_disable
int nat64_plugin_disable()
Definition: nat64.c:1553
vl_api_nat64_prefix_dump_t_handler
static void vl_api_nat64_prefix_dump_t_handler(vl_api_nat64_prefix_dump_t *mp)
Definition: nat64_api.c:405
vl_api_nat64_prefix_dump_t
Dump NAT64 prefix.
Definition: nat64.api:289
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
nat64_interface_add_del
int nat64_interface_add_del(u32 sw_if_index, u8 is_inside, u8 is_add)
Enable/disable NAT64 feature on the interface.
Definition: nat64.c:538
vl_api_nat64_pool_addr_dump_t::context
u32 context
Definition: nat64.api:115
ip_types_api.h
vl_api_nat64_plugin_enable_disable_t::bib_buckets
u32 bib_buckets
Definition: nat64.api:41
vl_api_nat64_add_del_pool_addr_range_t::vrf_id
u32 vrf_id
Definition: nat64.api:105
vl_api_nat64_st_dump_t::context
u32 context
Definition: nat64.api:241
vl_api_nat64_bib_details_t
NAT64 BIB details response.
Definition: nat64.api:218
nat64_db_s
Definition: nat64_db.h:142
vl_api_nat64_add_del_prefix_t_handler
static void vl_api_nat64_add_del_prefix_t_handler(vl_api_nat64_add_del_prefix_t *mp)
Definition: nat64_api.c:369
vl_api_nat64_set_timeouts_t
Set values of timeouts for NAT64 sessions (seconds)
Definition: nat64.api:57
vl_api_nat64_st_details_t::proto
u8 proto
Definition: nat64.api:267
vl_api_nat64_get_timeouts_reply_t
Get values of timeouts for NAT64 sessions reply.
Definition: nat64.api:83
prefix
vl_api_prefix_t prefix
Definition: ip.api:146
nat64_address_t
Definition: nat64.h:92
vl_api_nat64_add_del_static_bib_t::is_add
bool is_add
Definition: nat64.api:188
vl_api_nat64_add_del_interface_addr_t::is_add
bool is_add
Definition: nat64.api:314
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
vl_api_nat64_interface_details_t
NAT64 interface details response.
Definition: nat64.api:162