FD.io VPP  v17.07-30-g839fa73
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 
23 /** \brief Get the plugin version
24  @param client_index - opaque cookie to identify the sender
25  @param context - sender context, to match reply w/ request
26 */
27 
28 define acl_plugin_get_version
29 {
32 };
33 
34 /** \brief Reply to get the plugin version
35  @param context - returned sender context, to match reply w/ request
36  @param major - Incremented every time a known breaking behavior change is introduced
37  @param minor - Incremented with small changes, may be used to avoid buggy versions
38 */
39 
40 define acl_plugin_get_version_reply
41 {
45 };
46 
47 /** \brief Control ping from client to api server request
48  @param client_index - opaque cookie to identify the sender
49  @param context - sender context, to match reply w/ request
50 */
51 define acl_plugin_control_ping
52 {
55 };
56 
57 /** \brief Control ping from the client to the server response
58  @param client_index - opaque cookie to identify the sender
59  @param context - sender context, to match reply w/ request
60  @param retval - return code for the request
61  @param vpe_pid - the pid of the vpe, returned by the server
62 */
63 define acl_plugin_control_ping_reply
64 {
69 };
70 
71 /** \brief Access List Rule entry
72  @param is_permit - deny (0), permit (1), or permit+reflect(2) action on this rule.
73  @param is_ipv6 - IP addresses in this rule are IPv6 (1) or IPv4 (0)
74  @param src_ip_addr - Source prefix value
75  @param src_ip_prefix_len - Source prefix length
76  @param dst_ip_addr - Destination prefix value
77  @param dst_ip_prefix_len - Destination prefix length
78  @param proto - L4 protocol (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)
79  @param srcport_or_icmptype_first - beginning of source port or ICMP4/6 type range
80  @param srcport_or_icmptype_last - end of source port or ICMP4/6 type range
81  @param dstport_or_icmpcode_first - beginning of destination port or ICMP4/6 code range
82  @param dstport_or_icmpcode_last - end of destination port or ICMP4/6 code range
83  @param tcp_flags_mask - if proto==6, match masked TCP flags with this value
84  @param tcp_flags_value - if proto==6, mask to AND the TCP flags in the packet with
85 */
86 
87 typeonly manual_print define acl_rule
88 {
91  u8 src_ip_addr[16];
93  u8 dst_ip_addr[16];
95 /*
96  * L4 protocol. IANA number. 1 = ICMP, 58 = ICMPv6, 6 = TCP, 17 = UDP.
97  * 0 => ignore L4 and ignore the ports/tcpflags when matching.
98  */
100 /*
101  * If the L4 protocol is TCP or UDP, the below
102  * hold ranges of ports, else if the L4 is ICMP/ICMPv6
103  * they hold ranges of ICMP(v6) types/codes.
104  *
105  * Ranges are inclusive, i.e. to match "any" TCP/UDP port,
106  * use first=0,last=65535. For ICMP(v6),
107  * use first=0,last=255.
108  */
113 /*
114  * for proto = 6, this matches if the
115  * TCP flags in the packet, ANDed with tcp_flags_mask,
116  * is equal to tcp_flags_value.
117  */
120 };
121 
122 /** \brief MACIP Access List Rule entry
123  @param is_permit - deny (0), permit (1) action on this rule.
124  @param is_ipv6 - IP addresses in this rule are IPv6 (1) or IPv4 (0)
125  @param src_mac - match masked source MAC address against this value
126  @param src_mac_mask - AND source MAC address with this value before matching
127  @param src_ip_addr - Source prefix value
128  @param src_ip_prefix_len - Source prefix length
129 */
130 
131 typeonly manual_print define macip_acl_rule
132 {
135 /*
136  * The source mac of the packet ANDed with src_mac_mask.
137  * The source ip[46] address in the packet is matched
138  * against src_ip_addr, with src_ip_prefix_len set to 0.
139  *
140  * For better performance, minimize the number of
141  * (src_mac_mask, src_ip_prefix_len) combinations
142  * in a MACIP ACL.
143  */
144  u8 src_mac[6];
145  u8 src_mac_mask[6];
146  u8 src_ip_addr[16];
148 };
149 
150 /** \brief Replace an existing ACL in-place or create a new ACL
151  @param client_index - opaque cookie to identify the sender
152  @param context - sender context, to match reply w/ request
153  @param acl_index - an existing ACL entry (0..0xfffffffe) to replace, or 0xffffffff to make new ACL
154  @param tag - a string value stored along with the ACL, for descriptive purposes
155  @param count - number of ACL rules
156  @r - Rules for this access-list
157 */
158 
159 manual_print manual_endian define acl_add_replace
160 {
163  u32 acl_index; /* ~0 to add, existing ACL# to replace */
164  u8 tag[64]; /* What gets in here gets out in the corresponding tag field when dumping the ACLs. */
167 };
168 
169 /** \brief Reply to add/replace ACL
170  @param context - returned sender context, to match reply w/ request
171  @param acl_index - index of the updated or newly created ACL
172  @param retval 0 - no error
173 */
174 
175 define acl_add_replace_reply
176 {
180 };
181 
182 /** \brief Delete an ACL
183  @param client_index - opaque cookie to identify the sender
184  @param context - sender context, to match reply w/ request
185  @param acl_index - ACL index to delete
186 */
187 
188 autoreply manual_print define acl_del
189 {
193 };
194 
195 /* acl_interface_add_del(_reply) to be deprecated in lieu of acl_interface_set_acl_list */
196 /** \brief Use acl_interface_set_acl_list instead
197  Append/remove an ACL index to/from the list of ACLs checked for an interface
198  @param client_index - opaque cookie to identify the sender
199  @param context - sender context, to match reply w/ request
200  @param is_add - add or delete the ACL index from the list
201  @param is_input - check the ACL on input (1) or output (0)
202  @param sw_if_index - the interface to alter the list of ACLs on
203  @param acl_index - index of ACL for the operation
204 */
205 
206 autoreply manual_print define acl_interface_add_del
207 {
211 /*
212  * is_input = 0 => ACL applied on interface egress
213  * is_input = 1 => ACL applied on interface ingress
214  */
218 };
219 
220 /** \brief Set the vector of input/output ACLs checked for an interface
221  @param client_index - opaque cookie to identify the sender
222  @param context - sender context, to match reply w/ request
223  @param sw_if_index - the interface to alter the list of ACLs on
224  @param count - total number of ACL indices in the vector
225  @param n_input - this many first elements correspond to input ACLs, the rest - output
226  @param acls - vector of ACL indices
227 */
228 
229 autoreply manual_print define acl_interface_set_acl_list
230 {
235  u8 n_input; /* First n_input ACLs are set as a list of input ACLs, the rest are applied as output */
236  u32 acls[count];
237 };
238 
239 /** \brief Reply to set the ACL list on an interface
240  @param context - returned sender context, to match reply w/ request
241  @param retval 0 - no error
242 */
243 
244 /** \brief Dump the specific ACL contents or all of the ACLs' contents
245  @param client_index - opaque cookie to identify the sender
246  @param context - sender context, to match reply w/ request
247  @param acl_index - ACL index to dump, ~0 to dump all ACLs
248 */
249 
250 define acl_dump
251 {
254  u32 acl_index; /* ~0 for all ACLs */
255 };
256 
257 /** \brief Details about a single ACL contents
258  @param context - returned sender context, to match reply w/ request
259  @param acl_index - ACL index whose contents are being sent in this message
260  @param tag - Descriptive tag value which was supplied at ACL creation
261  @param count - Number of rules in this ACL
262  @param r - Array of rules within this ACL
263 */
264 
265 manual_endian manual_print define acl_details
266 {
269  u8 tag[64]; /* Same blob that was supplied to us when creating the ACL, one hopes. */
272 };
273 
274 /** \brief Dump the list(s) of ACL applied to specific or all interfaces
275  @param client_index - opaque cookie to identify the sender
276  @param context - sender context, to match reply w/ request
277  @param sw_if_index - interface to dump the ACL list for
278 */
279 
280 define acl_interface_list_dump
281 {
284  u32 sw_if_index; /* ~0 for all interfaces */
285 };
286 
287 /** \brief Details about a single ACL contents
288  @param context - returned sender context, to match reply w/ request
289  @param sw_if_index - interface for which the list of ACLs is applied
290  @param count - total length of acl indices vector
291  @param n_input - this many of indices in the beginning are input ACLs, the rest - output
292  @param acls - the vector of ACL indices
293 */
294 
295 define acl_interface_list_details
296 {
301  u32 acls[count];
302 };
303 
304 /** \brief Add a MACIP ACL
305  @param client_index - opaque cookie to identify the sender
306  @param context - sender context, to match reply w/ request
307  @param tag - descriptive value for this MACIP ACL
308  @param count - number of rules in this ACL
309  @param r - vector of MACIP ACL rules
310 */
311 
312 manual_endian manual_print define macip_acl_add
313 {
316  u8 tag[64];
319 };
320 
321 /** \brief Reply to add MACIP ACL
322  @param context - returned sender context, to match reply w/ request
323  @param acl_index - index of the newly created ACL
324  @param retval 0 - no error
325 */
326 
327 define macip_acl_add_reply
328 {
332 };
333 
334 /** \brief Delete a MACIP ACL
335  @param client_index - opaque cookie to identify the sender
336  @param context - sender context, to match reply w/ request
337  @param acl_index - MACIP ACL index to delete
338 */
339 
340 autoreply manual_print define macip_acl_del
341 {
345 };
346 
347 /** \brief Add or delete a MACIP ACL to/from interface
348  @param client_index - opaque cookie to identify the sender
349  @param context - sender context, to match reply w/ request
350  @param is_add - add (1) or delete (0) ACL from being used on an interface
351  @param sw_if_index - interface to apply the action to
352  @param acl_index - MACIP ACL index
353 */
354 
355 autoreply manual_print define macip_acl_interface_add_del
356 {
360  /* macip ACLs are always input */
363 };
364 
365 /** \brief Dump one or all defined MACIP ACLs
366  @param client_index - opaque cookie to identify the sender
367  @param context - sender context, to match reply w/ request
368  @param acl_index - MACIP ACL index or ~0 to dump all ACLs
369 */
370 
371 define macip_acl_dump
372 {
375  u32 acl_index; /* ~0 for all ACLs */
376 };
377 
378 /** \brief Details about one MACIP ACL
379  @param context - returned sender context, to match reply w/ request
380  @param acl_index - index of this MACIP ACL
381  @param tag - descriptive tag which was supplied during the creation
382  @param count - length of the vector of MACIP ACL rules
383  @param r - rules comprising this ACL
384 */
385 
386 manual_endian manual_print define macip_acl_details
387 {
390  u8 tag[64];
393 };
394 
395 /** \brief Get the vector of MACIP ACL IDs applied to the interfaces
396  @param client_index - opaque cookie to identify the sender
397  @param context - sender context, to match reply w/ request
398 */
399 
400 define macip_acl_interface_get
401 {
404 };
405 
406 /** \brief Reply with the vector of MACIP ACLs by sw_if_index
407  @param context - returned sender context, to match reply w/ request
408  @param count - total number of elements in the vector
409  @param acls - the vector of active MACACL indices per sw_if_index
410 */
411 
412 define macip_acl_interface_get_reply
413 {
416  u32 acls[count];
417 };
418 
Access List Rule entry.
Definition: acl.api:87
u16 dstport_or_icmpcode_last
Definition: acl.api:112
u16 dstport_or_icmpcode_first
Definition: acl.api:111
u8 src_ip_prefix_len
Definition: acl.api:92
int i32
Definition: types.h:81
u8 tcp_flags_value
Definition: acl.api:119
u16 srcport_or_icmptype_first
Definition: acl.api:109
u16 srcport_or_icmptype_last
Definition: acl.api:110
unsigned int u32
Definition: types.h:88
MACIP Access List Rule entry.
Definition: acl.api:131
u8 dst_ip_prefix_len
Definition: acl.api:94
unsigned short u16
Definition: types.h:57
unsigned char u8
Definition: types.h:56
u32 client_index
Definition: acl.api:190
u32 client_index
Definition: acl.api:252