FD.io VPP  v18.10-32-g1161dda
Vector Packet Processing
acl.api
Go to the documentation of this file.
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2016 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /** \file
18  This file defines the vpp control-plane API messages
19  used to control the ACL plugin
20 */
21 
22 option version = "1.0.0";
23 
24 /** \brief Get the plugin version
25  @param client_index - opaque cookie to identify the sender
26  @param context - sender context, to match reply w/ request
27 */
28 
29 define acl_plugin_get_version
30 {
33 };
34 
35 /** \brief Reply to get the plugin version
36  @param context - returned sender context, to match reply w/ request
37  @param major - Incremented every time a known breaking behavior change is introduced
38  @param minor - Incremented with small changes, may be used to avoid buggy versions
39 */
40 
41 define acl_plugin_get_version_reply
42 {
46 };
47 
48 /** \brief Control ping from client to api server request
49  @param client_index - opaque cookie to identify the sender
50  @param context - sender context, to match reply w/ request
51 */
52 define acl_plugin_control_ping
53 {
56 };
57 
58 /** \brief Control ping from the client to the server response
59  @param client_index - opaque cookie to identify the sender
60  @param context - sender context, to match reply w/ request
61  @param retval - return code for the request
62  @param vpe_pid - the pid of the vpe, returned by the server
63 */
64 define acl_plugin_control_ping_reply
65 {
70 };
71 
72 /** \brief Access List Rule entry
73  @param is_permit - deny (0), permit (1), or permit+reflect(2) action on this rule.
74  @param is_ipv6 - IP addresses in this rule are IPv6 (1) or IPv4 (0)
75  @param src_ip_addr - Source prefix value
76  @param src_ip_prefix_len - Source prefix length
77  @param dst_ip_addr - Destination prefix value
78  @param dst_ip_prefix_len - Destination prefix length
79  @param proto - L4 protocol (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)
80  @param srcport_or_icmptype_first - beginning of source port or ICMP4/6 type range
81  @param srcport_or_icmptype_last - end of source port or ICMP4/6 type range
82  @param dstport_or_icmpcode_first - beginning of destination port or ICMP4/6 code range
83  @param dstport_or_icmpcode_last - end of destination port or ICMP4/6 code range
84  @param tcp_flags_mask - if proto==6, match masked TCP flags with this value
85  @param tcp_flags_value - if proto==6, mask to AND the TCP flags in the packet with
86 */
87 
88 typeonly manual_print define acl_rule
89 {
92  u8 src_ip_addr[16];
94  u8 dst_ip_addr[16];
96 /*
97  * L4 protocol. IANA number. 1 = ICMP, 58 = ICMPv6, 6 = TCP, 17 = UDP.
98  * 0 => ignore L4 and ignore the ports/tcpflags when matching.
99  */
101 /*
102  * If the L4 protocol is TCP or UDP, the below
103  * hold ranges of ports, else if the L4 is ICMP/ICMPv6
104  * they hold ranges of ICMP(v6) types/codes.
105  *
106  * Ranges are inclusive, i.e. to match "any" TCP/UDP port,
107  * use first=0,last=65535. For ICMP(v6),
108  * use first=0,last=255.
109  */
114 /*
115  * for proto = 6, this matches if the
116  * TCP flags in the packet, ANDed with tcp_flags_mask,
117  * is equal to tcp_flags_value.
118  */
121 };
122 
123 /** \brief MACIP Access List Rule entry
124  @param is_permit - deny (0), permit (1) action on this rule.
125  @param is_ipv6 - IP addresses in this rule are IPv6 (1) or IPv4 (0)
126  @param src_mac - match masked source MAC address against this value
127  @param src_mac_mask - AND source MAC address with this value before matching
128  @param src_ip_addr - Source prefix value
129  @param src_ip_prefix_len - Source prefix length
130 */
131 
132 typeonly manual_print define macip_acl_rule
133 {
136 /*
137  * The source mac of the packet ANDed with src_mac_mask.
138  * The source ip[46] address in the packet is matched
139  * against src_ip_addr, with src_ip_prefix_len set to 0.
140  *
141  * For better performance, minimize the number of
142  * (src_mac_mask, src_ip_prefix_len) combinations
143  * in a MACIP ACL.
144  */
145  u8 src_mac[6];
146  u8 src_mac_mask[6];
147  u8 src_ip_addr[16];
149 };
150 
151 /** \brief Replace an existing ACL in-place or create a new ACL
152  @param client_index - opaque cookie to identify the sender
153  @param context - sender context, to match reply w/ request
154  @param acl_index - an existing ACL entry (0..0xfffffffe) to replace, or 0xffffffff to make new ACL
155  @param tag - a string value stored along with the ACL, for descriptive purposes
156  @param count - number of ACL rules
157  @r - Rules for this access-list
158 */
159 
160 manual_print manual_endian define acl_add_replace
161 {
164  u32 acl_index; /* ~0 to add, existing ACL# to replace */
165  u8 tag[64]; /* What gets in here gets out in the corresponding tag field when dumping the ACLs. */
168 };
169 
170 /** \brief Reply to add/replace ACL
171  @param context - returned sender context, to match reply w/ request
172  @param acl_index - index of the updated or newly created ACL
173  @param retval 0 - no error
174 */
175 
176 define acl_add_replace_reply
177 {
181 };
182 
183 /** \brief Delete an ACL
184  @param client_index - opaque cookie to identify the sender
185  @param context - sender context, to match reply w/ request
186  @param acl_index - ACL index to delete
187 */
188 
189 autoreply manual_print define acl_del
190 {
194 };
195 
196 /* acl_interface_add_del(_reply) to be deprecated in lieu of acl_interface_set_acl_list */
197 /** \brief Use acl_interface_set_acl_list instead
198  Append/remove an ACL index to/from the list of ACLs checked for an interface
199  @param client_index - opaque cookie to identify the sender
200  @param context - sender context, to match reply w/ request
201  @param is_add - add or delete the ACL index from the list
202  @param is_input - check the ACL on input (1) or output (0)
203  @param sw_if_index - the interface to alter the list of ACLs on
204  @param acl_index - index of ACL for the operation
205 */
206 
207 autoreply manual_print define acl_interface_add_del
208 {
212 /*
213  * is_input = 0 => ACL applied on interface egress
214  * is_input = 1 => ACL applied on interface ingress
215  */
219 };
220 
221 /** \brief Set the vector of input/output ACLs checked for an interface
222  @param client_index - opaque cookie to identify the sender
223  @param context - sender context, to match reply w/ request
224  @param sw_if_index - the interface to alter the list of ACLs on
225  @param count - total number of ACL indices in the vector
226  @param n_input - this many first elements correspond to input ACLs, the rest - output
227  @param acls - vector of ACL indices
228 */
229 
230 autoreply manual_print define acl_interface_set_acl_list
231 {
236  u8 n_input; /* First n_input ACLs are set as a list of input ACLs, the rest are applied as output */
237  u32 acls[count];
238 };
239 
240 /** \brief Reply to set the ACL list on an interface
241  @param context - returned sender context, to match reply w/ request
242  @param retval 0 - no error
243 */
244 
245 /** \brief Dump the specific ACL contents or all of the ACLs' contents
246  @param client_index - opaque cookie to identify the sender
247  @param context - sender context, to match reply w/ request
248  @param acl_index - ACL index to dump, ~0 to dump all ACLs
249 */
250 
251 define acl_dump
252 {
255  u32 acl_index; /* ~0 for all ACLs */
256 };
257 
258 /** \brief Details about a single ACL contents
259  @param context - returned sender context, to match reply w/ request
260  @param acl_index - ACL index whose contents are being sent in this message
261  @param tag - Descriptive tag value which was supplied at ACL creation
262  @param count - Number of rules in this ACL
263  @param r - Array of rules within this ACL
264 */
265 
266 manual_endian manual_print define acl_details
267 {
270  u8 tag[64]; /* Same blob that was supplied to us when creating the ACL, one hopes. */
273 };
274 
275 /** \brief Dump the list(s) of ACL applied to specific or all interfaces
276  @param client_index - opaque cookie to identify the sender
277  @param context - sender context, to match reply w/ request
278  @param sw_if_index - interface to dump the ACL list for
279 */
280 
281 define acl_interface_list_dump
282 {
285  u32 sw_if_index; /* ~0 for all interfaces */
286 };
287 
288 /** \brief Details about a single ACL contents
289  @param context - returned sender context, to match reply w/ request
290  @param sw_if_index - interface for which the list of ACLs is applied
291  @param count - total length of acl indices vector
292  @param n_input - this many of indices in the beginning are input ACLs, the rest - output
293  @param acls - the vector of ACL indices
294 */
295 
296 define acl_interface_list_details
297 {
302  u32 acls[count];
303 };
304 
305 /** \brief Add a MACIP ACL
306  @param client_index - opaque cookie to identify the sender
307  @param context - sender context, to match reply w/ request
308  @param tag - descriptive value for this MACIP ACL
309  @param count - number of rules in this MACIP ACL
310  @param r - vector of MACIP ACL rules
311 */
312 
313 manual_endian manual_print define macip_acl_add
314 {
317  u8 tag[64];
320 };
321 
322 /** \brief Reply to add MACIP ACL
323  @param context - returned sender context, to match reply w/ request
324  @param acl_index - index of the newly created MACIP ACL
325  @param retval 0 - no error
326 */
327 
328 define macip_acl_add_reply
329 {
333 };
334 
335 /** \brief Add/Replace a MACIP ACL
336  @param client_index - opaque cookie to identify the sender
337  @param context - sender context, to match reply w/ request
338  @param acl_index - an existing MACIP ACL entry (0..0xfffffffe) to replace, or 0xffffffff to make new MACIP ACL
339  @param tag - descriptive value for this MACIP ACL
340  @param count - number of rules in this MACIP ACL
341  @param r - vector of MACIP ACL rules
342 */
343 
344 manual_endian manual_print define macip_acl_add_replace
345 {
348  u32 acl_index; /* ~0 to add, existing MACIP ACL# to replace */
349  u8 tag[64];
352 };
353 
354 /** \brief Reply to add/replace MACIP ACL
355  @param context - returned sender context, to match reply w/ request
356  @param acl_index - index of the newly created MACIP ACL
357  @param retval 0 - no error
358 */
359 
360 define macip_acl_add_replace_reply
361 {
365 };
366 
367 /** \brief Delete a MACIP ACL
368  @param client_index - opaque cookie to identify the sender
369  @param context - sender context, to match reply w/ request
370  @param acl_index - MACIP ACL index to delete
371 */
372 
373 autoreply manual_print define macip_acl_del
374 {
378 };
379 
380 /** \brief Add or delete a MACIP ACL to/from interface
381  @param client_index - opaque cookie to identify the sender
382  @param context - sender context, to match reply w/ request
383  @param is_add - add (1) or delete (0) MACIP ACL from being used on an interface
384  @param sw_if_index - interface to apply the action to
385  @param acl_index - MACIP ACL index
386 */
387 
388 autoreply manual_print define macip_acl_interface_add_del
389 {
393  /* MACIP ACLs are always input */
396 };
397 
398 /** \brief Dump one or all defined MACIP ACLs
399  @param client_index - opaque cookie to identify the sender
400  @param context - sender context, to match reply w/ request
401  @param acl_index - MACIP ACL index or ~0 to dump all MACIP ACLs
402 */
403 
404 define macip_acl_dump
405 {
408  u32 acl_index; /* ~0 for all ACLs */
409 };
410 
411 /** \brief Details about one MACIP ACL
412  @param context - returned sender context, to match reply w/ request
413  @param acl_index - index of this MACIP ACL
414  @param tag - descriptive tag which was supplied during the creation
415  @param count - length of the vector of MACIP ACL rules
416  @param r - rules comprising this MACIP ACL
417 */
418 
419 manual_endian manual_print define macip_acl_details
420 {
423  u8 tag[64];
426 };
427 
428 /** \brief Get the vector of MACIP ACL IDs applied to the interfaces
429  @param client_index - opaque cookie to identify the sender
430  @param context - sender context, to match reply w/ request
431 */
432 
433 define macip_acl_interface_get
434 {
437 };
438 
439 /** \brief Reply with the vector of MACIP ACLs by sw_if_index
440  @param context - returned sender context, to match reply w/ request
441  @param count - total number of elements in the vector
442  @param acls - the vector of active MACIP ACL indices per sw_if_index
443 */
444 
445 define macip_acl_interface_get_reply
446 {
449  u32 acls[count];
450 };
451 
452 /** \brief Dump the list(s) of MACIP ACLs applied to specific or all interfaces
453  @param client_index - opaque cookie to identify the sender
454  @param context - sender context, to match reply w/ request
455  @param sw_if_index - interface to dump the MACIP ACL list for
456 */
457 
458 define macip_acl_interface_list_dump
459 {
462  u32 sw_if_index; /* ~0 for all interfaces */
463 };
464 
465 /** \brief Details about a single MACIP ACL contents
466  @param context - returned sender context, to match reply w/ request
467  @param sw_if_index - interface for which the list of MACIP ACLs is applied
468  @param count - total length of acl indices vector
469  @param acls - the vector of MACIP ACL indices
470 */
471 
472 define macip_acl_interface_list_details
473 {
477  u32 acls[count];
478 };
479 
480 /** \brief Set the ethertype whitelists on an interface. Takes effect when applying ACLs on the interface, so must be given prior.
481  @param client_index - opaque cookie to identify the sender
482  @param context - sender context, to match reply w/ request
483  @param sw_if_index - the interface to alter the list of ACLs on
484  @param count - total number of whitelisted ethertypes in the vector
485  @param n_input - this many first elements correspond to input whitelisted ethertypes, the rest - output
486  @param whitelist - vector of whitelisted ethertypes
487 */
488 
489 autoreply manual_print define acl_interface_set_etype_whitelist
490 {
494  u8 count; /* Total number of ethertypes in the whitelist */
495  u8 n_input; /* first n_input ethertypes are input, the rest - output */
496  u16 whitelist[count];
497 };
498 
499 /** \brief Dump the list(s) of Ethertype whitelists applied to specific or all interfaces
500  @param client_index - opaque cookie to identify the sender
501  @param context - sender context, to match reply w/ request
502  @param sw_if_index - interface to dump the ethertype whitelist for
503 */
504 
505 define acl_interface_etype_whitelist_dump
506 {
509  u32 sw_if_index; /* ~0 for all interfaces */
510 };
511 
512 /** \brief Details about ethertype whitelist on a single interface
513  @param context - returned sender context, to match reply w/ request
514  @param sw_if_index - interface for which the list of MACIP ACLs is applied
515  @param count - total number of whitelisted ethertypes in the vector
516  @param n_input - this many first elements correspond to input whitelisted ethertypes, the rest - output
517  @param whitelist - vector of whitelisted ethertypes
518 */
519 
520 define acl_interface_etype_whitelist_details
521 {
525  u8 n_input; /* first n_input ethertypes are input, the rest - output */
526  u16 whitelist[count];
527 };
528 
Access List Rule entry.
Definition: acl.api:88
u16 dstport_or_icmpcode_last
Definition: acl.api:113
option version
Definition: acl.api:22
unsigned char u8
Definition: types.h:56
u16 dstport_or_icmpcode_first
Definition: acl.api:112
u8 src_ip_prefix_len
Definition: acl.api:93
u8 tcp_flags_value
Definition: acl.api:120
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
u16 srcport_or_icmptype_first
Definition: acl.api:110
u16 srcport_or_icmptype_last
Definition: acl.api:111
signed int i32
Definition: types.h:77
MACIP Access List Rule entry.
Definition: acl.api:132
u8 dst_ip_prefix_len
Definition: acl.api:95
size_t count
Definition: vapi.c:46
u32 client_index
Definition: acl.api:191
u32 client_index
Definition: acl.api:253