FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vnet/vnet.h>
17 #include <vnet/plugin/plugin.h>
18 #include <lb/lb.h>
19 
20 #include <vppinfra/byte_order.h>
21 #include <vppinfra/string.h>
22 #include <vpp/api/types.h>
23 #include <vlibapi/api.h>
24 #include <vlibmemory/api.h>
25 #include <vpp/app/version.h>
26 #include <vnet/format_fns.h>
27 #include <vnet/ip/ip_types_api.h>
28 
29 /* define message IDs */
30 #include <lb/lb.api_enum.h>
31 #include <lb/lb.api_types.h>
32 
33 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
34 
35 #define REPLY_MSG_ID_BASE lbm->msg_id_base
37 
38 /* Macro to finish up custom dump fns */
39 #define FINISH \
40  vec_add1 (s, 0); \
41  vl_print (handle, (char *)s); \
42  vec_free (s); \
43  return handle;
44 
45 static void
48 {
49  lb_main_t *lbm = &lb_main;
50  vl_api_lb_conf_reply_t * rmp;
51  u32 sticky_buckets_per_core, flow_timeout;
52  int rv = 0;
53 
54  sticky_buckets_per_core = mp->sticky_buckets_per_core == ~0
56  : ntohl(mp->sticky_buckets_per_core);
57  flow_timeout = mp->flow_timeout == ~0
58  ? lbm->flow_timeout
59  : ntohl(mp->flow_timeout);
60 
62  (ip6_address_t *)&mp->ip6_src_address,
63  sticky_buckets_per_core, flow_timeout);
64 
65  REPLY_MACRO (VL_API_LB_CONF_REPLY);
66 }
67 
68 static void
71 {
72  lb_main_t *lbm = &lb_main;
73  vl_api_lb_conf_reply_t * rmp;
74  int rv = 0;
75  lb_vip_add_args_t args;
76 
77  /* if port == 0, it means all-port VIP */
78  if (mp->port == 0)
79  {
80  mp->protocol = ~0;
81  }
82 
83  ip_address_decode (&mp->pfx.address, &(args.prefix));
84 
85  if (mp->is_del) {
86  u32 vip_index;
87  if (!(rv = lb_vip_find_index(&(args.prefix), mp->pfx.len,
88  mp->protocol, ntohs(mp->port), &vip_index)))
89  rv = lb_vip_del(vip_index);
90  } else {
91  u32 vip_index;
92  lb_vip_type_t type = 0;
93 
94  if (ip46_prefix_is_ip4(&(args.prefix), mp->pfx.len)) {
95  if (mp->encap == LB_API_ENCAP_TYPE_GRE4)
97  else if (mp->encap == LB_API_ENCAP_TYPE_GRE6)
99  else if (mp->encap == LB_API_ENCAP_TYPE_L3DSR)
101  else if (mp->encap == LB_API_ENCAP_TYPE_NAT4)
103  } else {
104  if (mp->encap == LB_API_ENCAP_TYPE_GRE4)
106  else if (mp->encap == LB_API_ENCAP_TYPE_GRE6)
108  else if (mp->encap == LB_API_ENCAP_TYPE_NAT6)
110  }
111 
112  args.plen = mp->pfx.len;
113  args.protocol = mp->protocol;
114  args.port = ntohs(mp->port);
115  args.type = type;
116  args.new_length = ntohl(mp->new_flows_table_length);
117 
118  if (mp->encap == LB_API_ENCAP_TYPE_L3DSR) {
119  args.encap_args.dscp = (u8)(mp->dscp & 0x3F);
120  }
121  else if ((mp->encap == LB_API_ENCAP_TYPE_NAT4)
122  ||(mp->encap == LB_API_ENCAP_TYPE_NAT6)) {
123  args.encap_args.srv_type = mp->type;
125  }
126 
127  rv = lb_vip_add(args, &vip_index);
128  }
129  REPLY_MACRO (VL_API_LB_ADD_DEL_VIP_REPLY);
130 }
131 
132 static void
135 {
136  lb_main_t *lbm = &lb_main;
137  vl_api_lb_conf_reply_t * rmp;
138  int rv = 0;
139  u32 vip_index;
140  ip46_address_t vip_ip_prefix;
141  ip46_address_t as_address;
142 
143  /* if port == 0, it means all-port VIP */
144  if (mp->port == 0)
145  {
146  mp->protocol = ~0;
147  }
148  ip_address_decode (&mp->pfx.address, &vip_ip_prefix);
149  ip_address_decode (&mp->as_address, &as_address);
150 
151  if ((rv = lb_vip_find_index(&vip_ip_prefix, mp->pfx.len,
152  mp->protocol, ntohs(mp->port), &vip_index)))
153  goto done;
154 
155  if (mp->is_del)
156  rv = lb_vip_del_ass(vip_index, &as_address, 1, mp->is_flush);
157  else
158  rv = lb_vip_add_ass(vip_index, &as_address, 1);
159 
160 done:
161  REPLY_MACRO (VL_API_LB_ADD_DEL_AS_REPLY);
162 }
163 
164 static void
166 (vl_api_lb_vip_dump_t * mp)
167 {
168 
170  reg = vl_api_client_index_to_registration (mp->client_index);
171  if (!reg)
172  return;
173 
174  lb_main_t *lbm = &lb_main;
176  int msg_size = 0;
177  lb_vip_t *vip = 0;
178 
179  /* construct vip list */
180  pool_foreach (vip, lbm->vips) {
181  /* Hide placeholder VIP */
182  if (vip != lbm->vips) {
183  msg_size = sizeof (*rmp);
184  rmp = vl_msg_api_alloc (msg_size);
185  memset (rmp, 0, msg_size);
186  rmp->_vl_msg_id =
187  htons (VL_API_LB_VIP_DETAILS + lbm->msg_id_base);
188  rmp->context = mp->context;
189 
190  ip_address_encode(&vip->prefix, IP46_TYPE_ANY, &rmp->vip.pfx.address);
191  rmp->vip.pfx.len = vip->plen;
192  rmp->vip.protocol = htonl (vip->protocol);
193  rmp->vip.port = htons(vip->port);
194  rmp->encap = htonl(vip->type);
195  rmp->dscp = vip->encap_args.dscp;
196  rmp->srv_type = vip->encap_args.srv_type;
197  rmp->target_port = htons(vip->encap_args.target_port);
198  rmp->flow_table_length = htonl(vip->new_flow_table_mask + 1);
199 
200  vl_api_send_msg (reg, (u8 *) rmp);
201  }
202  }
203 
204 
205 }
206 
207 static void send_lb_as_details
209 {
211  lb_main_t *lbm = &lb_main;
212  int msg_size = 0;
213  u32 *as_index;
214  u32 asindex = 0;
215 
216  /* construct as list under this vip */
217  lb_as_t *as;
218 
219  pool_foreach (as_index, vip->as_indexes) {
220  /* Hide placeholder As for specific VIP */
221  if (*as_index != 0) {
222  as = &lbm->ass[*as_index];
223  msg_size = sizeof (*rmp);
224  rmp = vl_msg_api_alloc (msg_size);
225  memset (rmp, 0, msg_size);
226  rmp->_vl_msg_id =
227  htons (VL_API_LB_AS_DETAILS + lbm->msg_id_base);
228  rmp->context = context;
229  ip_address_encode(&vip->prefix, IP46_TYPE_ANY, (vl_api_address_t *)&rmp->vip.pfx.address);
230  rmp->vip.pfx.len = vip->plen;
231  rmp->vip.protocol = htonl (vip->protocol);
232  rmp->vip.port = htons(vip->port);
234  rmp->flags = as->flags;
235  rmp->in_use_since = htonl(as->last_used);
236 
237  vl_api_send_msg (reg, (u8 *) rmp);
238  asindex++;
239  }
240  }
241 
242 
243 }
244 
245 static void
247 (vl_api_lb_as_dump_t * mp)
248 {
249  lb_main_t *lbm = &lb_main;
250  lb_vip_t *vip = 0;
251  u8 dump_all = 0;
252  ip46_address_t prefix;
253 
255  reg = vl_api_client_index_to_registration (mp->client_index);
256  if (!reg)
257  return;
258 
259  clib_memcpy(&prefix.ip6, mp->pfx.address.un.ip6, sizeof(mp->pfx.address.un.ip6));
260 
261  dump_all = (prefix.ip6.as_u64[0] == 0) && (prefix.ip6.as_u64[1] == 0);
262 
263  /* *INDENT-OFF* */
264  pool_foreach (vip, lbm->vips)
265  {
266  if ( dump_all
267  || ((prefix.as_u64[0] == vip->prefix.as_u64[0])
268  && (prefix.as_u64[1] == vip->prefix.as_u64[1])
269  && (mp->protocol == vip->protocol)
270  && (mp->port == vip->port)) )
271  {
272  send_lb_as_details(reg, mp->context, vip);
273  }
274  }
275  /* *INDENT-ON* */
276 }
277 
278 static void
281 {
282  lb_main_t *lbm = &lb_main;
283  int rv = 0;
284  ip46_address_t vip_prefix;
285  u8 vip_plen;
286  u32 vip_index;
287  vl_api_lb_flush_vip_reply_t * rmp;
288 
289  if (mp->port == 0)
290  {
291  mp->protocol = ~0;
292  }
293 
294  memcpy (&(vip_prefix.ip6), mp->pfx.address.un.ip6, sizeof(vip_prefix.ip6));
295 
296  vip_plen = mp->pfx.len;
297 
298  rv = lb_vip_find_index(&vip_prefix, vip_plen, mp->protocol,
299  ntohs(mp->port), &vip_index);
300 
301  rv = lb_flush_vip_as(vip_index, ~0);
302 
303  REPLY_MACRO (VL_API_LB_FLUSH_VIP_REPLY);
304 }
305 
308 {
309  lb_main_t *lbm = &lb_main;
310  vl_api_lb_add_del_intf_nat4_reply_t *rmp;
311  u32 sw_if_index = ntohl (mp->sw_if_index);
312  u8 is_del;
313  int rv = 0;
314 
315  is_del = !mp->is_add;
316 
318 
320 
322 
323  REPLY_MACRO (VL_API_LB_ADD_DEL_INTF_NAT4_REPLY);
324 }
325 
328 {
329  lb_main_t *lbm = &lb_main;
330  vl_api_lb_add_del_intf_nat6_reply_t *rmp;
331  u32 sw_if_index = ntohl (mp->sw_if_index);
332  u8 is_del;
333  int rv = 0;
334 
335  is_del = !mp->is_add;
336 
338 
340 
342 
343  REPLY_MACRO (VL_API_LB_ADD_DEL_INTF_NAT6_REPLY);
344 }
345 
346 #include <lb/lb.api.c>
348 {
349  lb_main_t * lbm = &lb_main;
350 
351  lbm->vlib_main = vm;
352  lbm->vnet_main = vnet_get_main();
353 
354  /* Ask for a correctly-sized block of API message decode slots */
356 
357  return 0;
358 }
359 
lb_main_t
Definition: lb.h:470
lb_main_t::vlib_main
vlib_main_t * vlib_main
Definition: lb.h:568
vl_api_lb_vip_details_t::context
u32 context
Definition: lb.api:113
lb_main_t::msg_id_base
u16 msg_id_base
API dynamically registered base ID.
Definition: lb.h:563
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
lb_vip_t::prefix
ip46_address_t prefix
A Virtual IP represents a given service delivered by a set of application servers.
Definition: lb.h:292
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
vl_api_lb_add_del_intf_nat4_t::is_add
bool is_add
Definition: lb.api:160
vl_api_lb_vip_details_t::dscp
vl_api_ip_dscp_t dscp
Definition: lb.api:116
vl_api_lb_conf_t::ip4_src_address
vl_api_ip4_address_t ip4_src_address
Definition: lb.api:19
lb_as_t
Each VIP is configured with a set of application server.
Definition: lb.h:108
lb_main_t::per_cpu_sticky_buckets
u32 per_cpu_sticky_buckets
Number of buckets in the per-cpu sticky hash table.
Definition: lb.h:522
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
vl_api_lb_add_del_intf_nat4_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: lb.api:161
vl_api_lb_add_del_as_t
Add an application server for a given VIP.
Definition: lb.api:67
vl_api_lb_add_del_vip_t
Add a virtual address (or prefix)
Definition: lb.api:41
vl_api_lb_add_del_vip_t::target_port
u16 target_port
Definition: lb.api:50
vl_api_lb_vip_details_t::flow_table_length
u16 flow_table_length
Definition: lb.api:119
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_lb_as_details_t::flags
u8 flags
Definition: lb.api:147
lb_main
lb_main_t lb_main
Definition: lb.c:32
lb_main_t::vips
lb_vip_t * vips
Pool of all Virtual IPs.
Definition: lb.h:474
string.h
lb_api_init
static clib_error_t * lb_api_init(vlib_main_t *vm)
Definition: api.c:347
LB_VIP_TYPE_IP6_GRE4
@ LB_VIP_TYPE_IP6_GRE4
Definition: lb.h:210
u8
#define u8
Padding.
Definition: clib.h:121
vl_api_lb_as_details_t::app_srv
vl_api_address_t app_srv
Definition: lb.api:146
lb_as_t::address
ip46_address_t address
Destination address used to tunnel traffic towards that application server.
Definition: lb.h:120
send_lb_as_details
static void send_lb_as_details(vl_api_registration_t *reg, u32 context, lb_vip_t *vip)
Definition: api.c:208
vl_api_lb_vip_details_t::srv_type
vl_api_lb_srv_type_t srv_type
Definition: lb.api:117
vl_api_lb_add_del_as_t_handler
static void vl_api_lb_add_del_as_t_handler(vl_api_lb_add_del_as_t *mp)
Definition: api.c:134
lb_nat6_interface_add_del
int lb_nat6_interface_add_del(u32 sw_if_index, int is_del)
Definition: lb.c:1346
lb_vip_del_ass
int lb_vip_del_ass(u32 vip_index, ip46_address_t *addresses, u32 n, u8 flush)
Definition: lb.c:853
vl_api_lb_vip_dump_t_handler
static void vl_api_lb_vip_dump_t_handler(vl_api_lb_vip_dump_t *mp)
Definition: api.c:166
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
api.h
lb_as_t::last_used
u32 last_used
Rotating timestamp of when LB_AS_FLAGS_USED flag was last set.
Definition: lb.h:146
lb_vip_t::plen
u8 plen
The VIP prefix length.
Definition: lb.h:298
byte_order.h
vl_api_lb_add_del_vip_t::dscp
u8 dscp
Definition: lb.api:48
lb_nat4_interface_add_del
int lb_nat4_interface_add_del(u32 sw_if_index, int is_del)
Definition: lb.c:1330
lb_vip_add_args_t::plen
u8 plen
Definition: lb.h:575
lb_vip_t::protocol
u8 protocol
Definition: lb.h:301
LB_API_ENCAP_TYPE_GRE6
@ LB_API_ENCAP_TYPE_GRE6
Definition: lb_types.api:29
lb_vip_t::port
u16 port
Definition: lb.h:304
lb_vip_del
int lb_vip_del(u32 vip_index)
Definition: lb.c:1202
vl_api_lb_add_del_vip_t::encap
vl_api_lb_encap_type_t encap
Definition: lb.api:47
lb_vip_add_args_t::port
u16 port
Definition: lb.h:577
LB_VIP_TYPE_IP4_L3DSR
@ LB_VIP_TYPE_IP4_L3DSR
Definition: lb.h:213
vl_api_lb_add_del_vip_t::pfx
vl_api_address_with_prefix_t pfx
Definition: lb.api:44
ip_address_decode
ip46_type_t ip_address_decode(const vl_api_address_t *in, ip46_address_t *out)
Decode/Encode for struct/union types.
Definition: ip_types_api.c:186
lb_vip_add_ass
int lb_vip_add_ass(u32 vip_index, ip46_address_t *addresses, u32 n)
Definition: lb.c:585
vl_api_lb_as_details_t
lb_as_details
Definition: lb.api:143
vl_api_lb_add_del_intf_nat4_t_handler
static void vl_api_lb_add_del_intf_nat4_t_handler(vl_api_lb_add_del_intf_nat4_t *mp)
Definition: api.c:307
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
vl_api_lb_flush_vip_t
Flush a given vip.
Definition: lb.api:86
vl_api_lb_as_details_t::vip
vl_api_lb_vip_t vip
Definition: lb.api:145
vl_api_lb_add_del_vip_t::port
u16 port
Definition: lb.api:46
vl_api_lb_conf_t::flow_timeout
u32 flow_timeout[default=0xffffffff]
Definition: lb.api:22
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
LB_API_ENCAP_TYPE_GRE4
@ LB_API_ENCAP_TYPE_GRE4
Definition: lb_types.api:28
vl_api_lb_vip_details_t::vip
vl_api_lb_vip_t vip
Definition: lb.api:114
vl_api_lb_add_del_as_t::is_del
bool is_del
Definition: lb.api:74
vl_api_lb_add_del_vip_t::type
vl_api_lb_srv_type_t type
Definition: lb.api:49
vl_api_lb_vip_details_t::encap
vl_api_lb_encap_type_t encap
Definition: lb.api:115
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_lb_add_del_vip_t::protocol
u8 protocol[default=255]
Definition: lb.api:45
lb_vip_add_args_t::new_length
u32 new_length
Definition: lb.h:579
vl_api_lb_add_del_vip_t::new_flows_table_length
u32 new_flows_table_length[default=1024]
Definition: lb.api:52
vl_api_lb_conf_t::ip6_src_address
vl_api_ip6_address_t ip6_src_address
Definition: lb.api:20
vl_api_lb_add_del_intf_nat6_t_handler
static void vl_api_lb_add_del_intf_nat6_t_handler(vl_api_lb_add_del_intf_nat6_t *mp)
Definition: api.c:327
vl_api_lb_add_del_as_t::port
u16 port
Definition: lb.api:72
vl_api_lb_vip_details_t::target_port
u16 target_port
Definition: lb.api:118
vl_api_lb_conf_t
Configure Load-Balancer global parameters (unlike the CLI, both ip4_src_address and ip6_src_address n...
Definition: lb.api:15
lb_vip_t::type
lb_vip_type_t type
The type of traffic for this.
Definition: lb.h:313
lb_vip_t::encap_args
lb_vip_encap_args_t encap_args
Definition: lb.h:316
vl_api_lb_as_details_t::context
u32 context
Definition: lb.api:144
vl_api_lb_flush_vip_t::port
u16 port
Definition: lb.api:91
LB_VIP_TYPE_IP4_GRE4
@ LB_VIP_TYPE_IP4_GRE4
Definition: lb.h:212
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: api.c:799
lb_vip_add_args_t::prefix
ip46_address_t prefix
Definition: lb.h:574
ip4_address_t
Definition: ip4_packet.h:50
LB_VIP_TYPE_IP4_NAT4
@ LB_VIP_TYPE_IP4_NAT4
Definition: lb.h:214
lb_vip_encap_args_t::target_port
u16 target_port
Definition: lb.h:233
lb_vip_t
Load balancing service is provided per VIP+protocol+port.
Definition: lb.h:262
lb_vip_add_args_t::encap_args
lb_vip_encap_args_t encap_args
Definition: lb.h:580
vl_api_lb_add_del_intf_nat6_t::is_add
bool is_add
Definition: lb.api:173
vl_api_lb_as_details_t::in_use_since
u32 in_use_since
Definition: lb.api:148
LB_VIP_TYPE_IP6_NAT6
@ LB_VIP_TYPE_IP6_NAT6
Definition: lb.h:215
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
lb_vip_add
int lb_vip_add(lb_vip_add_args_t args, u32 *vip_index)
Definition: lb.c:1048
plugin.h
lb_vip_add_args_t::protocol
u8 protocol
Definition: lb.h:576
LB_VIP_TYPE_IP4_GRE6
@ LB_VIP_TYPE_IP4_GRE6
Definition: lb.h:211
lb.h
vl_api_lb_flush_vip_t_handler
static void vl_api_lb_flush_vip_t_handler(vl_api_lb_flush_vip_t *mp)
Definition: api.c:280
vl_api_lb_add_del_as_t::protocol
u8 protocol[default=255]
Definition: lb.api:71
lb_vip_encap_args_t::srv_type
u8 srv_type
Definition: lb.h:230
vl_api_lb_conf_t::sticky_buckets_per_core
u32 sticky_buckets_per_core[default=0xffffffff]
Definition: lb.api:21
types.h
format_fns.h
vl_api_lb_add_del_as_t::is_flush
bool is_flush
Definition: lb.api:75
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
vl_api_lb_add_del_as_t::pfx
vl_api_address_with_prefix_t pfx
Definition: lb.api:70
api_helper_macros.h
vl_api_lb_add_del_intf_nat6_t
Enable/disable NAT6 feature on the interface.
Definition: lb.api:170
LB_API_ENCAP_TYPE_L3DSR
@ LB_API_ENCAP_TYPE_L3DSR
Definition: lb_types.api:30
lb_vip_find_index
int lb_vip_find_index(ip46_address_t *prefix, u8 plen, u8 protocol, u16 port, u32 *vip_index)
Definition: lb.c:554
LB_VIP_TYPE_IP6_GRE6
@ LB_VIP_TYPE_IP6_GRE6
Definition: lb.h:209
vl_api_lb_add_del_vip_t_handler
static void vl_api_lb_add_del_vip_t_handler(vl_api_lb_add_del_vip_t *mp)
Definition: api.c:70
vl_api_lb_conf_t_handler
static void vl_api_lb_conf_t_handler(vl_api_lb_conf_t *mp)
Definition: api.c:47
lb_vip_add_args_t::type
lb_vip_type_t type
Definition: lb.h:578
lb_vip_type_t
lb_vip_type_t
The load balancer supports IPv4 and IPv6 traffic and GRE4, GRE6, L3DSR and NAT4, NAT6 encap.
Definition: lb.h:208
vlib_main_t
Definition: main.h:102
vl_api_lb_vip_details_t
Reply all configured vip.
Definition: lb.api:112
vl_api_lb_flush_vip_t::protocol
u8 protocol
Definition: lb.api:90
ip_address_encode
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
Definition: ip_types_api.c:220
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
lb_flush_vip_as
int lb_flush_vip_as(u32 vip_index, u32 as_index)
Definition: lb.c:762
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
lb_main_t::ass
lb_as_t * ass
Pool of ASs.
Definition: lb.h:487
vl_api_lb_add_del_vip_t::is_del
bool is_del
Definition: lb.api:53
lb_as_t::flags
u8 flags
Some per-AS flags.
Definition: lb.h:133
context
u32 context
Definition: ip.api:780
rv
int __clib_unused rv
Definition: application.c:491
IP46_TYPE_ANY
@ IP46_TYPE_ANY
Definition: ip46_address.h:24
vl_api_lb_as_dump_t_handler
static void vl_api_lb_as_dump_t_handler(vl_api_lb_as_dump_t *mp)
Definition: api.c:247
lb_main_t::flow_timeout
u32 flow_timeout
Flow timeout in seconds.
Definition: lb.h:527
lb_vip_t::new_flow_table_mask
u32 new_flow_table_mask
New flows table length - 1 (length MUST be a power of 2)
Definition: lb.h:276
vl_api_lb_flush_vip_t::pfx
vl_api_address_with_prefix_t pfx
Definition: lb.api:89
vnet.h
lb_vip_t::as_indexes
u32 * as_indexes
Pool of AS indexes used for this VIP.
Definition: lb.h:332
lb_vip_add_args_t
Definition: lb.h:573
LB_API_ENCAP_TYPE_NAT6
@ LB_API_ENCAP_TYPE_NAT6
Definition: lb_types.api:32
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
ip46_prefix_is_ip4
#define ip46_prefix_is_ip4(ip46, len)
Definition: util.h:27
ip_types_api.h
lb_main_t::vnet_main
vnet_main_t * vnet_main
Definition: lb.h:569
lb_vip_encap_args_t::dscp
u8 dscp
Definition: lb.h:236
lb_conf
int lb_conf(ip4_address_t *ip4_address, ip6_address_t *ip6_address, u32 per_cpu_sticky_buckets, u32 flow_timeout)
Fix global load-balancer parameters.
Definition: lb.c:476
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vl_api_lb_add_del_as_t::as_address
vl_api_address_t as_address
Definition: lb.api:73
prefix
vl_api_prefix_t prefix
Definition: ip.api:146
vl_api_lb_add_del_intf_nat6_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: lb.api:174
LB_API_ENCAP_TYPE_NAT4
@ LB_API_ENCAP_TYPE_NAT4
Definition: lb_types.api:31
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
vl_api_lb_add_del_intf_nat4_t
Enable/disable NAT4 feature on the interface.
Definition: lb.api:157