2 * Copyright (c) 2015 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
15 #include <vnet/ip/ip.h>
16 #include <vnet/classify/vnet_classify.h>
17 #include <vnet/classify/in_out_acl.h>
26 ip_in_out_acl_trace_t;
28 /* packet trace format function */
30 format_ip_in_out_acl_trace (u8 * s, u32 is_output, va_list * args)
32 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
33 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
34 ip_in_out_acl_trace_t *t = va_arg (*args, ip_in_out_acl_trace_t *);
36 s = format (s, "%s: sw_if_index %d, next_index %d, table %d, offset %d",
37 is_output ? "OUTACL" : "INACL",
38 t->sw_if_index, t->next_index, t->table_index, t->offset);
43 format_ip_inacl_trace (u8 * s, va_list * args)
45 return format_ip_in_out_acl_trace (s, 0 /* is_output */ , args);
49 format_ip_outacl_trace (u8 * s, va_list * args)
51 return format_ip_in_out_acl_trace (s, 1 /* is_output */ , args);
54 extern vlib_node_registration_t ip4_inacl_node;
55 extern vlib_node_registration_t ip4_outacl_node;
56 extern vlib_node_registration_t ip6_inacl_node;
57 extern vlib_node_registration_t ip6_outacl_node;
59 #define foreach_ip_inacl_error \
60 _(MISS, "input ACL misses") \
61 _(HIT, "input ACL hits") \
62 _(CHAIN_HIT, "input ACL hits after chain walk")
64 #define foreach_ip_outacl_error \
65 _(MISS, "output ACL misses") \
66 _(HIT, "output ACL hits") \
67 _(CHAIN_HIT, "output ACL hits after chain walk")
71 #define _(sym,str) IP_INACL_ERROR_##sym,
72 foreach_ip_inacl_error
78 static char *ip_inacl_error_strings[] = {
79 #define _(sym,string) string,
80 foreach_ip_inacl_error
86 #define _(sym,str) IP_OUTACL_ERROR_##sym,
87 foreach_ip_outacl_error
93 static char *ip_outacl_error_strings[] = {
94 #define _(sym,string) string,
95 foreach_ip_outacl_error
99 static_always_inline void
100 ip_in_out_acl_inline_trace (vlib_main_t *vm, vlib_node_runtime_t *node,
101 vlib_frame_t *frame, vlib_buffer_t **b, u16 *next,
102 u32 n_left, u32 *hits__, u32 *misses__,
103 u32 *chain_hits__, const vlib_error_t error_none,
104 const vlib_error_t error_deny,
105 const vlib_error_t error_miss,
106 vnet_classify_table_t *tables,
107 const u32 *table_index_by_sw_if_index,
108 vnet_config_main_t *cm, const vlib_rx_or_tx_t way,
109 const int is_output, const int do_trace)
111 f64 now = vlib_time_now (vm);
115 u32 n_next_nodes = node->n_next_nodes;
119 vnet_classify_table_t *t[4] = { 0, 0 };
122 /* calculate hashes for b[0] & b[1] */
125 /* ~0 is used as a wildcard to say 'always use sw_if_index 0'
126 * aka local0. It is used when we do not care about the sw_if_index, as
128 sw_if_index[2] = ~0 == way ? 0 : vnet_buffer (b[0])->sw_if_index[way];
129 sw_if_index[3] = ~0 == way ? 0 : vnet_buffer (b[1])->sw_if_index[way];
131 table_index[2] = table_index_by_sw_if_index[sw_if_index[2]];
132 table_index[3] = table_index_by_sw_if_index[sw_if_index[3]];
134 t[2] = pool_elt_at_index (tables, table_index[2]);
135 t[3] = pool_elt_at_index (tables, table_index[3]);
137 if (t[2]->current_data_flag == CLASSIFY_FLAG_USE_CURR_DATA)
139 (void *) vlib_buffer_get_current (b[0]) + t[2]->current_data_offset;
143 if (t[3]->current_data_flag == CLASSIFY_FLAG_USE_CURR_DATA)
145 (void *) vlib_buffer_get_current (b[1]) + t[3]->current_data_offset;
151 /* Save the rewrite length, since we are using the l2_classify struct */
152 vnet_buffer (b[0])->l2_classify.pad.l2_len =
153 vnet_buffer (b[0])->ip.save_rewrite_length;
154 /* advance the match pointer so the matching happens on IP header */
155 h[2] += vnet_buffer (b[0])->l2_classify.pad.l2_len;
157 /* Save the rewrite length, since we are using the l2_classify struct */
158 vnet_buffer (b[1])->l2_classify.pad.l2_len =
159 vnet_buffer (b[1])->ip.save_rewrite_length;
160 /* advance the match pointer so the matching happens on IP header */
161 h[3] += vnet_buffer (b[1])->l2_classify.pad.l2_len;
164 hash[2] = vnet_classify_hash_packet_inline (t[2], (u8 *) h[2]);
165 hash[3] = vnet_classify_hash_packet_inline (t[3], (u8 *) h[3]);
167 vnet_buffer (b[0])->l2_classify.hash = hash[2];
168 vnet_buffer (b[1])->l2_classify.hash = hash[3];
170 vnet_buffer (b[0])->l2_classify.table_index = table_index[2];
171 vnet_buffer (b[1])->l2_classify.table_index = table_index[3];
173 vnet_buffer (b[0])->l2_classify.opaque_index = ~0;
174 vnet_buffer (b[1])->l2_classify.opaque_index = ~0;
176 vnet_classify_prefetch_bucket (t[2],
177 vnet_buffer (b[0])->l2_classify.hash);
178 vnet_classify_prefetch_bucket (t[3],
179 vnet_buffer (b[1])->l2_classify.hash);
184 vnet_classify_entry_t *e[2] = { 0, 0 };
185 u32 _next[2] = { ACL_NEXT_INDEX_DENY, ACL_NEXT_INDEX_DENY };
192 sw_if_index[0] = sw_if_index[2];
193 sw_if_index[1] = sw_if_index[3];
195 table_index[0] = table_index[2];
196 table_index[1] = table_index[3];
201 /* prefetch next iteration */
204 vlib_prefetch_buffer_header (b[4], LOAD);
205 vlib_prefetch_buffer_header (b[5], LOAD);
207 clib_prefetch_load (b[4]->data);
208 clib_prefetch_load (b[5]->data);
211 /* calculate hashes for b[2] & b[3] */
215 ~0 == way ? 0 : vnet_buffer (b[2])->sw_if_index[way];
217 ~0 == way ? 0 : vnet_buffer (b[3])->sw_if_index[way];
219 table_index[2] = table_index_by_sw_if_index[sw_if_index[2]];
220 table_index[3] = table_index_by_sw_if_index[sw_if_index[3]];
222 t[2] = pool_elt_at_index (tables, table_index[2]);
223 t[3] = pool_elt_at_index (tables, table_index[3]);
225 if (t[2]->current_data_flag == CLASSIFY_FLAG_USE_CURR_DATA)
227 (void *) vlib_buffer_get_current (b[2]) +
228 t[2]->current_data_offset;
232 if (t[3]->current_data_flag == CLASSIFY_FLAG_USE_CURR_DATA)
234 (void *) vlib_buffer_get_current (b[3]) +
235 t[3]->current_data_offset;
241 /* Save the rewrite length, since we are using the l2_classify struct */
242 vnet_buffer (b[2])->l2_classify.pad.l2_len =
243 vnet_buffer (b[2])->ip.save_rewrite_length;
244 /* advance the match pointer so the matching happens on IP header */
245 h[2] += vnet_buffer (b[2])->l2_classify.pad.l2_len;
247 /* Save the rewrite length, since we are using the l2_classify struct */
248 vnet_buffer (b[3])->l2_classify.pad.l2_len =
249 vnet_buffer (b[3])->ip.save_rewrite_length;
250 /* advance the match pointer so the matching happens on IP header */
251 h[3] += vnet_buffer (b[3])->l2_classify.pad.l2_len;
254 hash[2] = vnet_classify_hash_packet_inline (t[2], (u8 *) h[2]);
255 hash[3] = vnet_classify_hash_packet_inline (t[3], (u8 *) h[3]);
257 vnet_buffer (b[2])->l2_classify.hash = hash[2];
258 vnet_buffer (b[3])->l2_classify.hash = hash[3];
260 vnet_buffer (b[2])->l2_classify.table_index = table_index[2];
261 vnet_buffer (b[3])->l2_classify.table_index = table_index[3];
263 vnet_buffer (b[2])->l2_classify.opaque_index = ~0;
264 vnet_buffer (b[3])->l2_classify.opaque_index = ~0;
266 vnet_classify_prefetch_bucket (t[2],
269 vnet_classify_prefetch_bucket (t[3],
274 /* find entry for b[0] & b[1] */
275 vnet_get_config_data (cm, &b[0]->current_config_index, &_next[0],
276 /* # bytes of config data */ 0);
277 vnet_get_config_data (cm, &b[1]->current_config_index, &_next[1],
278 /* # bytes of config data */ 0);
280 if (PREDICT_TRUE (table_index[0] != ~0))
283 vnet_classify_find_entry_inline (t[0], (u8 *) h[0], hash[0], now);
286 vnet_buffer (b[0])->l2_classify.opaque_index
287 = e[0]->opaque_index;
288 vlib_buffer_advance (b[0], e[0]->advance);
290 _next[0] = (e[0]->next_index < n_next_nodes) ?
291 e[0]->next_index : _next[0];
296 (_next[0] == ACL_NEXT_INDEX_DENY) ? error_deny : error_none;
300 if (e[0]->action == CLASSIFY_ACTION_SET_IP4_FIB_INDEX ||
301 e[0]->action == CLASSIFY_ACTION_SET_IP6_FIB_INDEX)
302 vnet_buffer (b[0])->sw_if_index[VLIB_TX] = e[0]->metadata;
303 else if (e[0]->action == CLASSIFY_ACTION_SET_METADATA)
304 vnet_buffer (b[0])->ip.adj_index[VLIB_TX] =
312 if (PREDICT_TRUE (t[0]->next_table_index != ~0))
313 t[0] = pool_elt_at_index (tables, t[0]->next_table_index);
316 _next[0] = (t[0]->miss_next_index < n_next_nodes) ?
317 t[0]->miss_next_index : _next[0];
321 b[0]->error = (_next[0] == ACL_NEXT_INDEX_DENY) ?
327 if (t[0]->current_data_flag == CLASSIFY_FLAG_USE_CURR_DATA)
329 (void *) vlib_buffer_get_current (b[0]) +
330 t[0]->current_data_offset;
334 /* advance the match pointer so the matching happens on IP header */
336 h[0] += vnet_buffer (b[0])->l2_classify.pad.l2_len;
339 vnet_classify_hash_packet_inline (t[0], (u8 *) h[0]);
341 vnet_classify_find_entry_inline (t[0], (u8 *) h[0],
345 vnet_buffer (b[0])->l2_classify.opaque_index
346 = e[0]->opaque_index;
347 vlib_buffer_advance (b[0], e[0]->advance);
348 _next[0] = (e[0]->next_index < n_next_nodes) ?
349 e[0]->next_index : _next[0];
353 b[0]->error = (_next[0] == ACL_NEXT_INDEX_DENY) ?
360 CLASSIFY_ACTION_SET_IP4_FIB_INDEX
362 CLASSIFY_ACTION_SET_IP6_FIB_INDEX)
363 vnet_buffer (b[0])->sw_if_index[VLIB_TX] =
365 else if (e[0]->action ==
366 CLASSIFY_ACTION_SET_METADATA)
367 vnet_buffer (b[0])->ip.adj_index[VLIB_TX] =
376 if (PREDICT_TRUE (table_index[1] != ~0))
379 vnet_classify_find_entry_inline (t[1], (u8 *) h[1], hash[1], now);
382 vnet_buffer (b[1])->l2_classify.opaque_index
383 = e[1]->opaque_index;
384 vlib_buffer_advance (b[1], e[1]->advance);
386 _next[1] = (e[1]->next_index < n_next_nodes) ?
387 e[1]->next_index : _next[1];
392 (_next[1] == ACL_NEXT_INDEX_DENY) ? error_deny : error_none;
396 if (e[1]->action == CLASSIFY_ACTION_SET_IP4_FIB_INDEX ||
397 e[1]->action == CLASSIFY_ACTION_SET_IP6_FIB_INDEX)
398 vnet_buffer (b[1])->sw_if_index[VLIB_TX] = e[1]->metadata;
399 else if (e[1]->action == CLASSIFY_ACTION_SET_METADATA)
400 vnet_buffer (b[1])->ip.adj_index[VLIB_TX] =
408 if (PREDICT_TRUE (t[1]->next_table_index != ~0))
409 t[1] = pool_elt_at_index (tables, t[1]->next_table_index);
412 _next[1] = (t[1]->miss_next_index < n_next_nodes) ?
413 t[1]->miss_next_index : _next[1];
417 b[1]->error = (_next[1] == ACL_NEXT_INDEX_DENY) ?
423 if (t[1]->current_data_flag == CLASSIFY_FLAG_USE_CURR_DATA)
425 (void *) vlib_buffer_get_current (b[1]) +
426 t[1]->current_data_offset;
430 /* advance the match pointer so the matching happens on IP header */
432 h[1] += vnet_buffer (b[1])->l2_classify.pad.l2_len;
435 vnet_classify_hash_packet_inline (t[1], (u8 *) h[1]);
437 vnet_classify_find_entry_inline (t[1], (u8 *) h[1],
441 vnet_buffer (b[1])->l2_classify.opaque_index
442 = e[1]->opaque_index;
443 vlib_buffer_advance (b[1], e[1]->advance);
444 _next[1] = (e[1]->next_index < n_next_nodes) ?
445 e[1]->next_index : _next[1];
449 b[1]->error = (_next[1] == ACL_NEXT_INDEX_DENY) ?
456 CLASSIFY_ACTION_SET_IP4_FIB_INDEX
458 CLASSIFY_ACTION_SET_IP6_FIB_INDEX)
459 vnet_buffer (b[1])->sw_if_index[VLIB_TX] =
461 else if (e[1]->action ==
462 CLASSIFY_ACTION_SET_METADATA)
463 vnet_buffer (b[1])->ip.adj_index[VLIB_TX] =
472 if (do_trace && b[0]->flags & VLIB_BUFFER_IS_TRACED)
474 ip_in_out_acl_trace_t *_t =
475 vlib_add_trace (vm, node, b[0], sizeof (*_t));
477 ~0 == way ? 0 : vnet_buffer (b[0])->sw_if_index[way];
478 _t->next_index = _next[0];
479 _t->table_index = t[0] ? t[0] - tables : ~0;
481 && t[0]) ? vnet_classify_get_offset (t[0], e[0]) : ~0;
484 if (do_trace && b[1]->flags & VLIB_BUFFER_IS_TRACED)
486 ip_in_out_acl_trace_t *_t =
487 vlib_add_trace (vm, node, b[1], sizeof (*_t));
489 ~0 == way ? 0 : vnet_buffer (b[1])->sw_if_index[way];
490 _t->next_index = _next[1];
491 _t->table_index = t[1] ? t[1] - tables : ~0;
493 && t[1]) ? vnet_classify_get_offset (t[1], e[1]) : ~0;
496 if ((_next[0] == ACL_NEXT_INDEX_DENY) && is_output)
498 /* on output, for the drop node to work properly, go back to ip header */
499 vlib_buffer_advance (b[0], vnet_buffer (b[0])->l2.l2_len);
502 if ((_next[1] == ACL_NEXT_INDEX_DENY) && is_output)
504 /* on output, for the drop node to work properly, go back to ip header */
505 vlib_buffer_advance (b[1], vnet_buffer (b[1])->l2.l2_len);
522 vnet_classify_table_t *t0 = 0;
523 vnet_classify_entry_t *e0 = 0;
524 u32 next0 = ACL_NEXT_INDEX_DENY;
527 sw_if_index0 = ~0 == way ? 0 : vnet_buffer (b[0])->sw_if_index[way];
528 table_index0 = table_index_by_sw_if_index[sw_if_index0];
530 t0 = pool_elt_at_index (tables, table_index0);
532 if (t0->current_data_flag == CLASSIFY_FLAG_USE_CURR_DATA)
534 (void *) vlib_buffer_get_current (b[0]) + t0->current_data_offset;
540 /* Save the rewrite length, since we are using the l2_classify struct */
541 vnet_buffer (b[0])->l2_classify.pad.l2_len =
542 vnet_buffer (b[0])->ip.save_rewrite_length;
543 /* advance the match pointer so the matching happens on IP header */
544 h0 += vnet_buffer (b[0])->l2_classify.pad.l2_len;
547 vnet_buffer (b[0])->l2_classify.hash =
548 vnet_classify_hash_packet (t0, (u8 *) h0);
550 vnet_buffer (b[0])->l2_classify.table_index = table_index0;
551 vnet_buffer (b[0])->l2_classify.opaque_index = ~0;
553 vnet_get_config_data (cm, &b[0]->current_config_index, &next0,
554 /* # bytes of config data */ 0);
556 if (PREDICT_TRUE (table_index0 != ~0))
558 hash0 = vnet_buffer (b[0])->l2_classify.hash;
559 t0 = pool_elt_at_index (tables, table_index0);
561 if (t0->current_data_flag == CLASSIFY_FLAG_USE_CURR_DATA)
563 (void *) vlib_buffer_get_current (b[0]) +
564 t0->current_data_offset;
568 /* advance the match pointer so the matching happens on IP header */
570 h0 += vnet_buffer (b[0])->l2_classify.pad.l2_len;
572 e0 = vnet_classify_find_entry_inline (t0, (u8 *) h0, hash0, now);
575 vnet_buffer (b[0])->l2_classify.opaque_index = e0->opaque_index;
576 vlib_buffer_advance (b[0], e0->advance);
578 next0 = (e0->next_index < n_next_nodes) ?
579 e0->next_index : next0;
584 (next0 == ACL_NEXT_INDEX_DENY) ? error_deny : error_none;
588 if (e0->action == CLASSIFY_ACTION_SET_IP4_FIB_INDEX ||
589 e0->action == CLASSIFY_ACTION_SET_IP6_FIB_INDEX)
590 vnet_buffer (b[0])->sw_if_index[VLIB_TX] = e0->metadata;
591 else if (e0->action == CLASSIFY_ACTION_SET_METADATA)
592 vnet_buffer (b[0])->ip.adj_index[VLIB_TX] = e0->metadata;
599 if (PREDICT_TRUE (t0->next_table_index != ~0))
600 t0 = pool_elt_at_index (tables, t0->next_table_index);
603 next0 = (t0->miss_next_index < n_next_nodes) ?
604 t0->miss_next_index : next0;
608 b[0]->error = (next0 == ACL_NEXT_INDEX_DENY) ?
614 if (t0->current_data_flag == CLASSIFY_FLAG_USE_CURR_DATA)
616 (void *) vlib_buffer_get_current (b[0]) +
617 t0->current_data_offset;
621 /* advance the match pointer so the matching happens on IP header */
623 h0 += vnet_buffer (b[0])->l2_classify.pad.l2_len;
625 hash0 = vnet_classify_hash_packet_inline (t0, (u8 *) h0);
626 e0 = vnet_classify_find_entry_inline
627 (t0, (u8 *) h0, hash0, now);
630 vnet_buffer (b[0])->l2_classify.opaque_index
632 vlib_buffer_advance (b[0], e0->advance);
633 next0 = (e0->next_index < n_next_nodes) ?
634 e0->next_index : next0;
637 b[0]->error = (next0 == ACL_NEXT_INDEX_DENY) ?
644 CLASSIFY_ACTION_SET_IP4_FIB_INDEX
646 CLASSIFY_ACTION_SET_IP6_FIB_INDEX)
647 vnet_buffer (b[0])->sw_if_index[VLIB_TX] =
649 else if (e0->action == CLASSIFY_ACTION_SET_METADATA)
650 vnet_buffer (b[0])->ip.adj_index[VLIB_TX] =
659 if (do_trace && b[0]->flags & VLIB_BUFFER_IS_TRACED)
661 ip_in_out_acl_trace_t *t =
662 vlib_add_trace (vm, node, b[0], sizeof (*t));
664 ~0 == way ? 0 : vnet_buffer (b[0])->sw_if_index[way];
665 t->next_index = next0;
666 t->table_index = t0 - tables;
667 t->offset = (e0 && t0) ? vnet_classify_get_offset (t0, e0) : ~0;
670 if ((next0 == ACL_NEXT_INDEX_DENY) && is_output)
672 /* on output, for the drop node to work properly, go back to ip header */
673 vlib_buffer_advance (b[0], vnet_buffer (b[0])->l2.l2_len);
686 *chain_hits__ = chain_hits;
689 static_always_inline uword
690 ip_in_out_acl_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
691 vlib_frame_t *frame, const in_out_acl_table_id_t tid,
692 const vlib_node_registration_t *parent_error_node,
693 const u32 error_none_index, const u32 error_deny_index,
694 const u32 error_miss_index, const vlib_rx_or_tx_t way,
697 const in_out_acl_main_t *am = &in_out_acl_main;
698 vnet_classify_table_t *tables = am->vnet_classify_main->tables;
699 u32 *from = vlib_frame_vector_args (frame);
700 const u32 *table_index_by_sw_if_index =
701 am->classify_table_index_by_sw_if_index[is_output][tid];
702 vnet_config_main_t *cm = am->vnet_config_main[is_output][tid];
703 const vlib_node_runtime_t *error_node =
704 vlib_node_get_runtime (vm, parent_error_node->index);
705 const vlib_error_t error_none = error_node->errors[error_none_index];
706 const vlib_error_t error_deny = error_node->errors[error_deny_index];
707 const vlib_error_t error_miss = error_node->errors[error_miss_index];
708 vlib_buffer_t *bufs[VLIB_FRAME_SIZE];
709 u16 nexts[VLIB_FRAME_SIZE];
710 u32 hits, misses, chain_hits;
712 vlib_get_buffers (vm, from, bufs, frame->n_vectors);
714 #define ip_in_out_acl_inline_trace__(do_trace) \
715 ip_in_out_acl_inline_trace ( \
716 vm, node, frame, bufs, nexts, frame->n_vectors, &hits, &misses, \
717 &chain_hits, error_deny, error_miss, error_none, tables, \
718 table_index_by_sw_if_index, cm, way, is_output, do_trace)
720 if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE))
721 ip_in_out_acl_inline_trace__ (1 /* do_trace */);
723 ip_in_out_acl_inline_trace__ (0 /* do_trace */);
725 vlib_node_increment_counter (
726 vm, node->node_index,
727 is_output ? IP_OUTACL_ERROR_MISS : IP_INACL_ERROR_MISS, misses);
728 vlib_node_increment_counter (
729 vm, node->node_index, is_output ? IP_OUTACL_ERROR_HIT : IP_INACL_ERROR_HIT,
731 vlib_node_increment_counter (vm, node->node_index,
732 is_output ? IP_OUTACL_ERROR_CHAIN_HIT :
733 IP_INACL_ERROR_CHAIN_HIT,
736 vlib_buffer_enqueue_to_next (vm, node, from, nexts, frame->n_vectors);
737 return frame->n_vectors;
740 VLIB_NODE_FN (ip4_inacl_node)
741 (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
743 return ip_in_out_acl_inline (
744 vm, node, frame, IN_OUT_ACL_TABLE_IP4, &ip4_input_node, IP4_ERROR_NONE,
745 IP4_ERROR_INACL_SESSION_DENY, IP4_ERROR_INACL_TABLE_MISS, VLIB_RX,
749 VLIB_NODE_FN (ip4_punt_acl_node)
750 (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
752 return ip_in_out_acl_inline (
753 vm, node, frame, IN_OUT_ACL_TABLE_IP4_PUNT, &ip4_input_node,
754 IP4_ERROR_NONE, IP4_ERROR_INACL_SESSION_DENY, IP4_ERROR_INACL_TABLE_MISS,
755 ~0 /* way */, 0 /* is_output */);
758 VLIB_NODE_FN (ip4_outacl_node)
759 (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
761 return ip_in_out_acl_inline (
762 vm, node, frame, IN_OUT_ACL_TABLE_IP4, &ip4_input_node, IP4_ERROR_NONE,
763 IP4_ERROR_INACL_SESSION_DENY, IP4_ERROR_INACL_TABLE_MISS, VLIB_TX,
768 VLIB_REGISTER_NODE (ip4_inacl_node) = {
770 .vector_size = sizeof (u32),
771 .format_trace = format_ip_inacl_trace,
772 .n_errors = ARRAY_LEN(ip_inacl_error_strings),
773 .error_strings = ip_inacl_error_strings,
775 .n_next_nodes = ACL_NEXT_INDEX_N_NEXT,
777 [ACL_NEXT_INDEX_DENY] = "ip4-drop",
781 VLIB_REGISTER_NODE (ip4_punt_acl_node) = {
782 .name = "ip4-punt-acl",
783 .vector_size = sizeof (u32),
784 .format_trace = format_ip_inacl_trace,
785 .n_errors = ARRAY_LEN(ip_inacl_error_strings),
786 .error_strings = ip_inacl_error_strings,
788 .n_next_nodes = ACL_NEXT_INDEX_N_NEXT,
790 [ACL_NEXT_INDEX_DENY] = "ip4-drop",
794 VLIB_REGISTER_NODE (ip4_outacl_node) = {
795 .name = "ip4-outacl",
796 .vector_size = sizeof (u32),
797 .format_trace = format_ip_outacl_trace,
798 .n_errors = ARRAY_LEN(ip_outacl_error_strings),
799 .error_strings = ip_outacl_error_strings,
801 .n_next_nodes = ACL_NEXT_INDEX_N_NEXT,
803 [ACL_NEXT_INDEX_DENY] = "ip4-drop",
808 VNET_FEATURE_INIT (ip4_punt_acl_feature) = {
809 .arc_name = "ip4-punt",
810 .node_name = "ip4-punt-acl",
811 .runs_after = VNET_FEATURES ("ip4-punt-policer"),
814 VLIB_NODE_FN (ip6_inacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
815 vlib_frame_t * frame)
817 return ip_in_out_acl_inline (
818 vm, node, frame, IN_OUT_ACL_TABLE_IP6, &ip6_input_node, IP6_ERROR_NONE,
819 IP6_ERROR_INACL_SESSION_DENY, IP6_ERROR_INACL_TABLE_MISS, VLIB_RX,
823 VLIB_NODE_FN (ip6_punt_acl_node)
824 (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
826 return ip_in_out_acl_inline (
827 vm, node, frame, IN_OUT_ACL_TABLE_IP6_PUNT, &ip6_input_node,
828 IP6_ERROR_NONE, IP6_ERROR_INACL_SESSION_DENY, IP6_ERROR_INACL_TABLE_MISS,
829 ~0 /* way */, 0 /* is_output */);
832 VLIB_NODE_FN (ip6_outacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
833 vlib_frame_t * frame)
835 return ip_in_out_acl_inline (
836 vm, node, frame, IN_OUT_ACL_TABLE_IP6, &ip6_input_node, IP6_ERROR_NONE,
837 IP6_ERROR_INACL_SESSION_DENY, IP6_ERROR_INACL_TABLE_MISS, VLIB_TX,
842 VLIB_REGISTER_NODE (ip6_inacl_node) = {
844 .vector_size = sizeof (u32),
845 .format_trace = format_ip_inacl_trace,
846 .n_errors = ARRAY_LEN(ip_inacl_error_strings),
847 .error_strings = ip_inacl_error_strings,
849 .n_next_nodes = ACL_NEXT_INDEX_N_NEXT,
851 [ACL_NEXT_INDEX_DENY] = "ip6-drop",
855 VLIB_REGISTER_NODE (ip6_punt_acl_node) = {
856 .name = "ip6-punt-acl",
857 .vector_size = sizeof (u32),
858 .format_trace = format_ip_inacl_trace,
859 .n_errors = ARRAY_LEN(ip_inacl_error_strings),
860 .error_strings = ip_inacl_error_strings,
862 .n_next_nodes = ACL_NEXT_INDEX_N_NEXT,
864 [ACL_NEXT_INDEX_DENY] = "ip6-drop",
868 VLIB_REGISTER_NODE (ip6_outacl_node) = {
869 .name = "ip6-outacl",
870 .vector_size = sizeof (u32),
871 .format_trace = format_ip_outacl_trace,
872 .n_errors = ARRAY_LEN(ip_outacl_error_strings),
873 .error_strings = ip_outacl_error_strings,
875 .n_next_nodes = ACL_NEXT_INDEX_N_NEXT,
877 [ACL_NEXT_INDEX_DENY] = "ip6-drop",
882 VNET_FEATURE_INIT (ip6_punt_acl_feature) = {
883 .arc_name = "ip6-punt",
884 .node_name = "ip6-punt-acl",
885 .runs_after = VNET_FEATURES ("ip6-punt-policer"),
888 #ifndef CLIB_MARCH_VARIANT
889 static clib_error_t *
890 ip_in_out_acl_init (vlib_main_t * vm)
895 VLIB_INIT_FUNCTION (ip_in_out_acl_init);
896 #endif /* CLIB_MARCH_VARIANT */
900 * fd.io coding-style-patch-verification: ON
903 * eval: (c-set-style "gnu")