7db0efa7be33fc09a84a6e331345810603c52e36
[vpp.git] / src / plugins / acl / dataplane_node.c
1 /*
2  * Copyright (c) 2016-2018 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 #include <stddef.h>
16 #include <netinet/in.h>
17
18 #include <vlib/vlib.h>
19 #include <vnet/vnet.h>
20 #include <vnet/pg/pg.h>
21 #include <vppinfra/error.h>
22
23
24 #include <acl/acl.h>
25 #include <vnet/ip/icmp46_packet.h>
26
27 #include <plugins/acl/fa_node.h>
28 #include <plugins/acl/acl.h>
29 #include <plugins/acl/lookup_context.h>
30 #include <plugins/acl/public_inlines.h>
31 #include <plugins/acl/session_inlines.h>
32
33 #include <vppinfra/bihash_40_8.h>
34 #include <vppinfra/bihash_template.h>
35
36 typedef struct
37 {
38   u32 next_index;
39   u32 sw_if_index;
40   u32 lc_index;
41   u32 match_acl_in_index;
42   u32 match_rule_index;
43   u64 packet_info[6];
44   u32 trace_bitmap;
45   u8 action;
46 } acl_fa_trace_t;
47
48 /* *INDENT-OFF* */
49 #define foreach_acl_fa_error \
50 _(ACL_DROP, "ACL deny packets")  \
51 _(ACL_PERMIT, "ACL permit packets")  \
52 _(ACL_NEW_SESSION, "new sessions added") \
53 _(ACL_EXIST_SESSION, "existing session packets") \
54 _(ACL_CHECK, "checked packets") \
55 _(ACL_RESTART_SESSION_TIMER, "restart session timer") \
56 _(ACL_TOO_MANY_SESSIONS, "too many sessions to add new") \
57 /* end  of errors */
58
59 typedef enum
60 {
61 #define _(sym,str) ACL_FA_ERROR_##sym,
62   foreach_acl_fa_error
63 #undef _
64     ACL_FA_N_ERROR,
65 } acl_fa_error_t;
66
67 /* *INDENT-ON* */
68
69 always_inline u16
70 get_current_policy_epoch (acl_main_t * am, int is_input, u32 sw_if_index0)
71 {
72   u32 **p_epoch_vec =
73     is_input ? &am->input_policy_epoch_by_sw_if_index :
74     &am->output_policy_epoch_by_sw_if_index;
75   u16 current_policy_epoch =
76     sw_if_index0 < vec_len (*p_epoch_vec) ? vec_elt (*p_epoch_vec,
77                                                      sw_if_index0)
78     : (is_input * FA_POLICY_EPOCH_IS_INPUT);
79   return current_policy_epoch;
80 }
81
82 always_inline uword
83 acl_fa_node_fn (vlib_main_t * vm,
84                 vlib_node_runtime_t * node, vlib_frame_t * frame, int is_ip6,
85                 int is_input, int is_l2_path, u32 * l2_feat_next_node_index,
86                 vlib_node_registration_t * acl_fa_node)
87 {
88   u32 n_left, *from;
89   u32 pkts_acl_checked = 0;
90   u32 pkts_new_session = 0;
91   u32 pkts_exist_session = 0;
92   u32 pkts_acl_permit = 0;
93   u32 pkts_restart_session_timer = 0;
94   u32 trace_bitmap = 0;
95   acl_main_t *am = &acl_main;
96   fa_5tuple_t fa_5tuple;
97   vlib_node_runtime_t *error_node;
98   u64 now = clib_cpu_time_now ();
99   uword thread_index = os_get_thread_index ();
100   acl_fa_per_worker_data_t *pw = &am->per_worker_data[thread_index];
101
102   u16 nexts[VLIB_FRAME_SIZE], *next;
103   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
104
105   from = vlib_frame_vector_args (frame);
106
107   error_node = vlib_node_get_runtime (vm, acl_fa_node->index);
108
109   vlib_get_buffers (vm, from, bufs, frame->n_vectors);
110   /* set the initial values for the current buffer the next pointers */
111   b = bufs;
112   next = nexts;
113
114   n_left = frame->n_vectors;
115   while (n_left > 0)
116     {
117       u32 next0 = 0;
118       u8 action = 0;
119       u32 sw_if_index0;
120       u32 lc_index0 = ~0;
121       int acl_check_needed = 1;
122       u32 match_acl_in_index = ~0;
123       u32 match_acl_pos = ~0;
124       u32 match_rule_index = ~0;
125       u8 error0 = 0;
126
127       n_left -= 1;
128
129       if (is_input)
130         sw_if_index0 = vnet_buffer (b[0])->sw_if_index[VLIB_RX];
131       else
132         sw_if_index0 = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
133
134       if (is_input)
135         lc_index0 = am->input_lc_index_by_sw_if_index[sw_if_index0];
136       else
137         lc_index0 = am->output_lc_index_by_sw_if_index[sw_if_index0];
138
139       u16 current_policy_epoch =
140         get_current_policy_epoch (am, is_input, sw_if_index0);
141
142
143       /*
144        * Extract the L3/L4 matching info into a 5-tuple structure.
145        */
146
147       acl_plugin_fill_5tuple_inline (&acl_main, lc_index0, b[0], is_ip6,
148                                      is_input, is_l2_path,
149                                      (fa_5tuple_opaque_t *) & fa_5tuple);
150       fa_5tuple.l4.lsb_of_sw_if_index = sw_if_index0 & 0xffff;
151       fa_5tuple.pkt.mask_type_index_lsb = ~0;
152 #ifdef FA_NODE_VERBOSE_DEBUG
153       clib_warning
154         ("ACL_FA_NODE_DBG: packet 5-tuple %016llx %016llx %016llx %016llx %016llx %016llx",
155          fa_5tuple.kv.key[0], fa_5tuple.kv.key[1], fa_5tuple.kv.key[2],
156          fa_5tuple.kv.key[3], fa_5tuple.kv.key[4], fa_5tuple.kv.value);
157 #endif
158
159       /* Try to match an existing session first */
160
161       if (acl_fa_ifc_has_sessions (am, sw_if_index0))
162         {
163           u64 value_sess = ~0ULL;
164           if (acl_fa_find_session
165               (am, is_ip6, sw_if_index0, &fa_5tuple, &value_sess)
166               && (value_sess != ~0ULL))
167             {
168               trace_bitmap |= 0x80000000;
169               error0 = ACL_FA_ERROR_ACL_EXIST_SESSION;
170               fa_full_session_id_t f_sess_id;
171
172               f_sess_id.as_u64 = value_sess;
173               ASSERT (f_sess_id.thread_index < vec_len (vlib_mains));
174
175               fa_session_t *sess =
176                 get_session_ptr (am, f_sess_id.thread_index,
177                                  f_sess_id.session_index);
178               int old_timeout_type = fa_session_get_timeout_type (am, sess);
179               action =
180                 acl_fa_track_session (am, is_input, sw_if_index0, now,
181                                       sess, &fa_5tuple);
182               /* expose the session id to the tracer */
183               match_rule_index = f_sess_id.session_index;
184               int new_timeout_type = fa_session_get_timeout_type (am, sess);
185               acl_check_needed = 0;
186               pkts_exist_session += 1;
187               /* Tracking might have changed the session timeout type, e.g. from transient to established */
188               if (PREDICT_FALSE (old_timeout_type != new_timeout_type))
189                 {
190                   acl_fa_restart_timer_for_session (am, now, f_sess_id);
191                   pkts_restart_session_timer++;
192                   trace_bitmap |=
193                     0x00010000 + ((0xff & old_timeout_type) << 8) +
194                     (0xff & new_timeout_type);
195                 }
196               /*
197                * I estimate the likelihood to be very low - the VPP needs
198                * to have >64K interfaces to start with and then on
199                * exactly 64K indices apart needs to be exactly the same
200                * 5-tuple... Anyway, since this probability is nonzero -
201                * print an error and drop the unlucky packet.
202                * If this shows up in real world, we would need to bump
203                * the hash key length.
204                */
205               if (PREDICT_FALSE (sess->sw_if_index != sw_if_index0))
206                 {
207                   clib_warning
208                     ("BUG: session LSB16(sw_if_index) and 5-tuple collision!");
209                   acl_check_needed = 0;
210                   action = 0;
211                 }
212               if (PREDICT_FALSE (am->reclassify_sessions))
213                 {
214                   /* if the MSB of policy epoch matches but not the LSB means it is a stale session */
215                   if ((0 ==
216                        ((current_policy_epoch ^
217                          f_sess_id.intf_policy_epoch) &
218                         FA_POLICY_EPOCH_IS_INPUT))
219                       && (current_policy_epoch !=
220                           f_sess_id.intf_policy_epoch))
221                     {
222                       /* delete session and increment the counter */
223                       vec_validate
224                         (pw->fa_session_epoch_change_by_sw_if_index,
225                          sw_if_index0);
226                       vec_elt (pw->fa_session_epoch_change_by_sw_if_index,
227                                sw_if_index0)++;
228                       if (acl_fa_conn_list_delete_session
229                           (am, f_sess_id, now))
230                         {
231                           /* delete the session only if we were able to unlink it */
232                           acl_fa_two_stage_delete_session (am, sw_if_index0,
233                                                            f_sess_id, now);
234                         }
235                       acl_check_needed = 1;
236                       trace_bitmap |= 0x40000000;
237                     }
238                 }
239             }
240         }
241
242       if (acl_check_needed)
243         {
244           action = 0;           /* deny by default */
245           acl_plugin_match_5tuple_inline (&acl_main, lc_index0,
246                                           (fa_5tuple_opaque_t *) &
247                                           fa_5tuple, is_ip6, &action,
248                                           &match_acl_pos,
249                                           &match_acl_in_index,
250                                           &match_rule_index, &trace_bitmap);
251           error0 = action;
252           if (1 == action)
253             pkts_acl_permit += 1;
254           if (2 == action)
255             {
256               if (!acl_fa_can_add_session (am, is_input, sw_if_index0))
257                 acl_fa_try_recycle_session (am, is_input, thread_index,
258                                             sw_if_index0, now);
259
260               if (acl_fa_can_add_session (am, is_input, sw_if_index0))
261                 {
262                   fa_session_t *sess =
263                     acl_fa_add_session (am, is_input, is_ip6,
264                                         sw_if_index0,
265                                         now, &fa_5tuple,
266                                         current_policy_epoch);
267                   acl_fa_track_session (am, is_input, sw_if_index0,
268                                         now, sess, &fa_5tuple);
269                   pkts_new_session += 1;
270                 }
271               else
272                 {
273                   action = 0;
274                   error0 = ACL_FA_ERROR_ACL_TOO_MANY_SESSIONS;
275                 }
276             }
277         }
278
279
280
281       if (action > 0)
282         {
283           if (is_l2_path)
284             next0 = vnet_l2_feature_next (b[0], l2_feat_next_node_index, 0);
285           else
286             vnet_feature_next (&next0, b[0]);
287         }
288 #ifdef FA_NODE_VERBOSE_DEBUG
289       clib_warning
290         ("ACL_FA_NODE_DBG: sw_if_index %d lc_index %d action %d acl_index %d rule_index %d",
291          sw_if_index0, lc_index0, action, match_acl_in_index,
292          match_rule_index);
293 #endif
294
295       if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)
296                          && (b[0]->flags & VLIB_BUFFER_IS_TRACED)))
297         {
298           acl_fa_trace_t *t = vlib_add_trace (vm, node, b[0], sizeof (*t));
299           t->sw_if_index = sw_if_index0;
300           t->lc_index = lc_index0;
301           t->next_index = next0;
302           t->match_acl_in_index = match_acl_in_index;
303           t->match_rule_index = match_rule_index;
304           t->packet_info[0] = fa_5tuple.kv_40_8.key[0];
305           t->packet_info[1] = fa_5tuple.kv_40_8.key[1];
306           t->packet_info[2] = fa_5tuple.kv_40_8.key[2];
307           t->packet_info[3] = fa_5tuple.kv_40_8.key[3];
308           t->packet_info[4] = fa_5tuple.kv_40_8.key[4];
309           t->packet_info[5] = fa_5tuple.kv_40_8.value;
310           t->action = action;
311           t->trace_bitmap = trace_bitmap;
312         }
313
314       next0 = next0 < node->n_next_nodes ? next0 : 0;
315       if (0 == next0)
316         b[0]->error = error_node->errors[error0];
317       next[0] = next0;
318
319       next++;
320       b++;
321       pkts_acl_checked += 1;
322     }
323
324   vlib_buffer_enqueue_to_next (vm, node, from, nexts, frame->n_vectors);
325
326   vlib_node_increment_counter (vm, acl_fa_node->index,
327                                ACL_FA_ERROR_ACL_CHECK, pkts_acl_checked);
328   vlib_node_increment_counter (vm, acl_fa_node->index,
329                                ACL_FA_ERROR_ACL_PERMIT, pkts_acl_permit);
330   vlib_node_increment_counter (vm, acl_fa_node->index,
331                                ACL_FA_ERROR_ACL_NEW_SESSION,
332                                pkts_new_session);
333   vlib_node_increment_counter (vm, acl_fa_node->index,
334                                ACL_FA_ERROR_ACL_EXIST_SESSION,
335                                pkts_exist_session);
336   vlib_node_increment_counter (vm, acl_fa_node->index,
337                                ACL_FA_ERROR_ACL_RESTART_SESSION_TIMER,
338                                pkts_restart_session_timer);
339   return frame->n_vectors;
340 }
341
342 vlib_node_registration_t acl_in_l2_ip6_node;
343 VLIB_NODE_FN (acl_in_l2_ip6_node) (vlib_main_t * vm,
344                                    vlib_node_runtime_t * node,
345                                    vlib_frame_t * frame)
346 {
347   acl_main_t *am = &acl_main;
348   return acl_fa_node_fn (vm, node, frame, 1, 1, 1,
349                          am->fa_acl_in_ip6_l2_node_feat_next_node_index,
350                          &acl_in_l2_ip6_node);
351 }
352
353 vlib_node_registration_t acl_in_l2_ip4_node;
354 VLIB_NODE_FN (acl_in_l2_ip4_node) (vlib_main_t * vm,
355                                    vlib_node_runtime_t * node,
356                                    vlib_frame_t * frame)
357 {
358   acl_main_t *am = &acl_main;
359   return acl_fa_node_fn (vm, node, frame, 0, 1, 1,
360                          am->fa_acl_in_ip4_l2_node_feat_next_node_index,
361                          &acl_in_l2_ip4_node);
362 }
363
364 vlib_node_registration_t acl_out_l2_ip6_node;
365 VLIB_NODE_FN (acl_out_l2_ip6_node) (vlib_main_t * vm,
366                                     vlib_node_runtime_t * node,
367                                     vlib_frame_t * frame)
368 {
369   acl_main_t *am = &acl_main;
370   return acl_fa_node_fn (vm, node, frame, 1, 0, 1,
371                          am->fa_acl_out_ip6_l2_node_feat_next_node_index,
372                          &acl_out_l2_ip6_node);
373 }
374
375 vlib_node_registration_t acl_out_l2_ip4_node;
376 VLIB_NODE_FN (acl_out_l2_ip4_node) (vlib_main_t * vm,
377                                     vlib_node_runtime_t * node,
378                                     vlib_frame_t * frame)
379 {
380   acl_main_t *am = &acl_main;
381   return acl_fa_node_fn (vm, node, frame, 0, 0, 1,
382                          am->fa_acl_out_ip4_l2_node_feat_next_node_index,
383                          &acl_out_l2_ip4_node);
384 }
385
386 /**** L3 processing path nodes ****/
387
388 vlib_node_registration_t acl_in_fa_ip6_node;
389 VLIB_NODE_FN (acl_in_fa_ip6_node) (vlib_main_t * vm,
390                                    vlib_node_runtime_t * node,
391                                    vlib_frame_t * frame)
392 {
393   return acl_fa_node_fn (vm, node, frame, 1, 1, 0, 0, &acl_in_fa_ip6_node);
394 }
395
396 vlib_node_registration_t acl_in_fa_ip4_node;
397 VLIB_NODE_FN (acl_in_fa_ip4_node) (vlib_main_t * vm,
398                                    vlib_node_runtime_t * node,
399                                    vlib_frame_t * frame)
400 {
401   return acl_fa_node_fn (vm, node, frame, 0, 1, 0, 0, &acl_in_fa_ip4_node);
402 }
403
404 vlib_node_registration_t acl_out_fa_ip6_node;
405 VLIB_NODE_FN (acl_out_fa_ip6_node) (vlib_main_t * vm,
406                                     vlib_node_runtime_t * node,
407                                     vlib_frame_t * frame)
408 {
409   return acl_fa_node_fn (vm, node, frame, 1, 0, 0, 0, &acl_out_fa_ip6_node);
410 }
411
412 vlib_node_registration_t acl_out_fa_ip4_node;
413 VLIB_NODE_FN (acl_out_fa_ip4_node) (vlib_main_t * vm,
414                                     vlib_node_runtime_t * node,
415                                     vlib_frame_t * frame)
416 {
417   return acl_fa_node_fn (vm, node, frame, 0, 0, 0, 0, &acl_out_fa_ip4_node);
418 }
419
420 #ifndef CLIB_MARCH_VARIANT
421 static u8 *
422 format_fa_5tuple (u8 * s, va_list * args)
423 {
424   fa_5tuple_t *p5t = va_arg (*args, fa_5tuple_t *);
425
426   if (p5t->pkt.is_ip6)
427     return format (s, "lc_index %d (lsb16 of sw_if_index %d) l3 %s%s %U -> %U"
428                    " l4 proto %d l4_valid %d port %d -> %d tcp flags (%s) %02x rsvd %x",
429                    p5t->pkt.lc_index, p5t->l4.lsb_of_sw_if_index,
430                    "ip6",
431                    p5t->
432                    pkt.is_nonfirst_fragment ? " non-initial fragment" : "",
433                    format_ip6_address, &p5t->ip6_addr[0], format_ip6_address,
434                    &p5t->ip6_addr[1], p5t->l4.proto, p5t->pkt.l4_valid,
435                    p5t->l4.port[0], p5t->l4.port[1],
436                    p5t->pkt.tcp_flags_valid ? "valid" : "invalid",
437                    p5t->pkt.tcp_flags, p5t->pkt.flags_reserved);
438   else
439     return format (s, "lc_index %d (lsb16 of sw_if_index %d) l3 %s%s %U -> %U"
440                    " l4 proto %d l4_valid %d port %d -> %d tcp flags (%s) %02x rsvd %x",
441                    p5t->pkt.lc_index, p5t->l4.lsb_of_sw_if_index,
442                    "ip4",
443                    p5t->
444                    pkt.is_nonfirst_fragment ? " non-initial fragment" : "",
445                    format_ip4_address, &p5t->ip4_addr[0], format_ip4_address,
446                    &p5t->ip4_addr[1], p5t->l4.proto, p5t->pkt.l4_valid,
447                    p5t->l4.port[0], p5t->l4.port[1],
448                    p5t->pkt.tcp_flags_valid ? "valid" : "invalid",
449                    p5t->pkt.tcp_flags, p5t->pkt.flags_reserved);
450 }
451
452 u8 *
453 format_acl_plugin_5tuple (u8 * s, va_list * args)
454 {
455   return format_fa_5tuple (s, args);
456 }
457
458 /* packet trace format function */
459 u8 *
460 format_acl_plugin_trace (u8 * s, va_list * args)
461 {
462   CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
463   CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
464   acl_fa_trace_t *t = va_arg (*args, acl_fa_trace_t *);
465
466   s =
467     format (s,
468             "acl-plugin: lc_index: %d, sw_if_index %d, next index %d, action: %d, match: acl %d rule %d trace_bits %08x\n"
469             "  pkt info %016llx %016llx %016llx %016llx %016llx %016llx",
470             t->lc_index, t->sw_if_index, t->next_index, t->action,
471             t->match_acl_in_index, t->match_rule_index, t->trace_bitmap,
472             t->packet_info[0], t->packet_info[1], t->packet_info[2],
473             t->packet_info[3], t->packet_info[4], t->packet_info[5]);
474
475   /* Now also print out the packet_info in a form usable by humans */
476   s = format (s, "\n   %U", format_fa_5tuple, t->packet_info);
477   return s;
478 }
479
480
481 /* *INDENT-OFF* */
482
483 static char *acl_fa_error_strings[] = {
484 #define _(sym,string) string,
485   foreach_acl_fa_error
486 #undef _
487 };
488
489 VLIB_REGISTER_NODE (acl_in_l2_ip6_node) =
490 {
491   .name = "acl-plugin-in-ip6-l2",
492   .vector_size = sizeof (u32),
493   .format_trace = format_acl_plugin_trace,
494   .type = VLIB_NODE_TYPE_INTERNAL,
495   .n_errors = ARRAY_LEN (acl_fa_error_strings),
496   .error_strings = acl_fa_error_strings,
497   .n_next_nodes = ACL_FA_N_NEXT,
498   .next_nodes =
499   {
500     [ACL_FA_ERROR_DROP] = "error-drop",
501   }
502 };
503
504 VLIB_REGISTER_NODE (acl_in_l2_ip4_node) =
505 {
506   .name = "acl-plugin-in-ip4-l2",
507   .vector_size = sizeof (u32),
508   .format_trace = format_acl_plugin_trace,
509   .type = VLIB_NODE_TYPE_INTERNAL,
510   .n_errors = ARRAY_LEN (acl_fa_error_strings),
511   .error_strings = acl_fa_error_strings,
512   .n_next_nodes = ACL_FA_N_NEXT,
513   .next_nodes =
514   {
515     [ACL_FA_ERROR_DROP] = "error-drop",
516   }
517 };
518
519 VLIB_REGISTER_NODE (acl_out_l2_ip6_node) =
520 {
521   .name = "acl-plugin-out-ip6-l2",
522   .vector_size = sizeof (u32),
523   .format_trace = format_acl_plugin_trace,
524   .type = VLIB_NODE_TYPE_INTERNAL,
525   .n_errors = ARRAY_LEN (acl_fa_error_strings),
526   .error_strings = acl_fa_error_strings,
527   .n_next_nodes = ACL_FA_N_NEXT,
528   .next_nodes =
529   {
530     [ACL_FA_ERROR_DROP] = "error-drop",
531   }
532 };
533
534 VLIB_REGISTER_NODE (acl_out_l2_ip4_node) =
535 {
536   .name = "acl-plugin-out-ip4-l2",
537   .vector_size = sizeof (u32),
538   .format_trace = format_acl_plugin_trace,
539   .type = VLIB_NODE_TYPE_INTERNAL,
540   .n_errors = ARRAY_LEN (acl_fa_error_strings),
541   .error_strings = acl_fa_error_strings,
542   .n_next_nodes = ACL_FA_N_NEXT,
543   .next_nodes =
544   {
545     [ACL_FA_ERROR_DROP] = "error-drop",
546   }
547 };
548
549
550 VLIB_REGISTER_NODE (acl_in_fa_ip6_node) =
551 {
552   .name = "acl-plugin-in-ip6-fa",
553   .vector_size = sizeof (u32),
554   .format_trace = format_acl_plugin_trace,
555   .type = VLIB_NODE_TYPE_INTERNAL,
556   .n_errors = ARRAY_LEN (acl_fa_error_strings),
557   .error_strings = acl_fa_error_strings,
558   .n_next_nodes = ACL_FA_N_NEXT,
559   .next_nodes =
560   {
561     [ACL_FA_ERROR_DROP] = "error-drop",
562   }
563 };
564
565 VNET_FEATURE_INIT (acl_in_ip6_fa_feature, static) =
566 {
567   .arc_name = "ip6-unicast",
568   .node_name = "acl-plugin-in-ip6-fa",
569   .runs_before = VNET_FEATURES ("ip6-flow-classify"),
570 };
571
572 VLIB_REGISTER_NODE (acl_in_fa_ip4_node) =
573 {
574   .name = "acl-plugin-in-ip4-fa",
575   .vector_size = sizeof (u32),
576   .format_trace = format_acl_plugin_trace,
577   .type = VLIB_NODE_TYPE_INTERNAL,
578   .n_errors = ARRAY_LEN (acl_fa_error_strings),
579   .error_strings = acl_fa_error_strings,
580   .n_next_nodes = ACL_FA_N_NEXT,
581   .next_nodes =
582   {
583     [ACL_FA_ERROR_DROP] = "error-drop",
584   }
585 };
586
587 VNET_FEATURE_INIT (acl_in_ip4_fa_feature, static) =
588 {
589   .arc_name = "ip4-unicast",
590   .node_name = "acl-plugin-in-ip4-fa",
591   .runs_before = VNET_FEATURES ("ip4-flow-classify"),
592 };
593
594
595 VLIB_REGISTER_NODE (acl_out_fa_ip6_node) =
596 {
597   .name = "acl-plugin-out-ip6-fa",
598   .vector_size = sizeof (u32),
599   .format_trace = format_acl_plugin_trace,
600   .type = VLIB_NODE_TYPE_INTERNAL,
601   .n_errors = ARRAY_LEN (acl_fa_error_strings),
602   .error_strings = acl_fa_error_strings,
603   .n_next_nodes = ACL_FA_N_NEXT,
604   .next_nodes =
605   {
606     [ACL_FA_ERROR_DROP] = "error-drop",
607   }
608 };
609
610 VNET_FEATURE_INIT (acl_out_ip6_fa_feature, static) =
611 {
612   .arc_name = "ip6-output",
613   .node_name = "acl-plugin-out-ip6-fa",
614   .runs_before = VNET_FEATURES ("interface-output"),
615 };
616
617 VLIB_REGISTER_NODE (acl_out_fa_ip4_node) =
618 {
619   .name = "acl-plugin-out-ip4-fa",
620   .vector_size = sizeof (u32),
621   .format_trace = format_acl_plugin_trace,
622   .type = VLIB_NODE_TYPE_INTERNAL,
623   .n_errors = ARRAY_LEN (acl_fa_error_strings),
624   .error_strings = acl_fa_error_strings,
625   .n_next_nodes = ACL_FA_N_NEXT,
626     /* edit / add dispositions here */
627   .next_nodes =
628   {
629     [ACL_FA_ERROR_DROP] = "error-drop",
630   }
631 };
632
633 VNET_FEATURE_INIT (acl_out_ip4_fa_feature, static) =
634 {
635   .arc_name = "ip4-output",
636   .node_name = "acl-plugin-out-ip4-fa",
637   .runs_before = VNET_FEATURES ("interface-output"),
638 };
639 #endif
640
641 /* *INDENT-ON* */
642
643 /*
644  * fd.io coding-style-patch-verification: ON
645  *
646  * Local Variables:
647  * eval: (c-set-style "gnu")
648  * End:
649  */