1 /* Hey Emacs use -*- mode: C -*- */
3 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Copyright 2019 Vinci Consulting Corp. All Rights Reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 /** \brief Access List Rule entry
20 @param is_permit - deny (0), permit (1), or permit+reflect(2) action on this rule.
21 @param is_ipv6 - IP addresses in this rule are IPv6 (1) or IPv4 (0)
22 @param src_ip_addr - Source prefix value
23 @param src_ip_prefix_len - Source prefix length
24 @param dst_ip_addr - Destination prefix value
25 @param dst_ip_prefix_len - Destination prefix length
26 @param proto - L4 protocol (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)
27 @param srcport_or_icmptype_first - beginning of source port or ICMP4/6 type range
28 @param srcport_or_icmptype_last - end of source port or ICMP4/6 type range
29 @param dstport_or_icmpcode_first - beginning of destination port or ICMP4/6 code range
30 @param dstport_or_icmpcode_last - end of destination port or ICMP4/6 code range
31 @param tcp_flags_mask - if proto==6, match masked TCP flags with this value
32 @param tcp_flags_value - if proto==6, mask to AND the TCP flags in the packet with
44 * L4 protocol. IANA number. 1 = ICMP, 58 = ICMPv6, 6 = TCP, 17 = UDP.
45 * 0 => ignore L4 and ignore the ports/tcpflags when matching.
49 * If the L4 protocol is TCP or UDP, the below
50 * hold ranges of ports, else if the L4 is ICMP/ICMPv6
51 * they hold ranges of ICMP(v6) types/codes.
53 * Ranges are inclusive, i.e. to match "any" TCP/UDP port,
54 * use first=0,last=65535. For ICMP(v6),
55 * use first=0,last=255.
57 u16 srcport_or_icmptype_first;
58 u16 srcport_or_icmptype_last;
59 u16 dstport_or_icmpcode_first;
60 u16 dstport_or_icmpcode_last;
62 * for proto = 6, this matches if the
63 * TCP flags in the packet, ANDed with tcp_flags_mask,
64 * is equal to tcp_flags_value.
71 /** \brief MACIP Access List Rule entry
72 @param is_permit - deny (0), permit (1) action on this rule.
73 @param is_ipv6 - IP addresses in this rule are IPv6 (1) or IPv4 (0)
74 @param src_mac - match masked source MAC address against this value
75 @param src_mac_mask - AND source MAC address with this value before matching
76 @param src_ip_addr - Source prefix value
77 @param src_ip_prefix_len - Source prefix length
80 typedef macip_acl_rule
85 * The source mac of the packet ANDed with src_mac_mask.
86 * The source ip[46] address in the packet is matched
87 * against src_ip_addr, with src_ip_prefix_len set to 0.
89 * For better performance, minimize the number of
90 * (src_mac_mask, src_ip_prefix_len) combinations