FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
classify_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * classify_api.c - classify api
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <vnet/vnet.h>
21 #include <vlibmemory/api.h>
22 
23 #include <vnet/interface.h>
24 #include <vnet/api_errno.h>
25 
30 #include <vnet/l2/l2_classify.h>
31 #include <vnet/ip/ip6.h>
32 #include <vnet/ip/ip4.h>
33 
34 #include <classify/classify.api_enum.h>
35 #include <classify/classify.api_types.h>
36 
37 #define REPLY_MSG_ID_BASE msg_id_base
39 
41 
42 #define foreach_classify_add_del_table_field \
43 _(table_index) \
44 _(nbuckets) \
45 _(memory_size) \
46 _(skip_n_vectors) \
47 _(match_n_vectors) \
48 _(next_table_index) \
49 _(miss_next_index) \
50 _(mask_len)
51 
52 
55 {
59  int rv = 0;
60  u32 table_index = ~0;
61 
63  if (!reg)
64  return;
65 
66  u32 n_skip = ntohl (mp->skip_n_vectors);
67  u32 n_match = ntohl (mp->match_n_vectors);
68  u32 mask_len = ntohl (mp->mask_len);
69  u32 sw_if_index = ntohl (mp->sw_if_index);
70 
71  if (n_skip > 5 || n_match == 0 || n_match > 5 ||
72  mask_len != n_match * sizeof (u32x4) || sw_if_index == ~0 ||
73  sw_if_index >= vec_len (cm->classify_table_index_by_sw_if_index))
74  {
75  rv = VNET_API_ERROR_INVALID_VALUE;
76  goto out;
77  }
78 
79  u32 table_chain;
80  table_chain = classify_get_pcap_chain (cm, sw_if_index);
81 
82  u8 *mask_vec = 0;
83  vec_validate (mask_vec, mask_len - 1);
84  clib_memcpy (mask_vec, mp->mask, mask_len);
85 
86  if (table_chain != ~0)
87  table_index = classify_lookup_chain (table_chain,
88  mask_vec, n_skip, n_match);
89 
90  vec_free (mask_vec);
91 
92 out:
93  rmp = vl_msg_api_alloc (sizeof (*rmp));
94  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_PCAP_LOOKUP_TABLE_REPLY);
95  rmp->context = mp->context;
96  rmp->retval = ntohl (rv);
97  rmp->table_index = htonl (table_index);
98 
99  vl_api_send_msg (reg, (u8 *) rmp);
100 }
101 
104 {
108  int rv = 0;
109 
111  if (!reg)
112  return;
113 
114  u32 table_index = ntohl (mp->table_index);
115  u32 sw_if_index = ntohl (mp->sw_if_index);
116 
117  if (sw_if_index == ~0
118  || sw_if_index >= vec_len (cm->classify_table_index_by_sw_if_index)
119  || (table_index != ~0 && pool_is_free_index (cm->tables, table_index)))
120  {
121  rv = VNET_API_ERROR_INVALID_VALUE;
122  goto out;
123  }
124 
125  /*
126  * Maybe reorder tables such that masks are most-specify to least-specific.
127  */
128  if (table_index != ~0 && mp->sort_masks)
129  table_index = classify_sort_table_chain (cm, table_index);
130 
131  classify_set_pcap_chain (cm, sw_if_index, table_index);
132 
133 out:
134  rmp = vl_msg_api_alloc (sizeof (*rmp));
135  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_PCAP_SET_TABLE_REPLY);
136  rmp->context = mp->context;
137  rmp->retval = ntohl (rv);
138  rmp->table_index = htonl (table_index);
139 
140  vl_api_send_msg (reg, (u8 *) rmp);
141 }
142 
145 {
149  int rv = 0;
150  u32 *tables = 0;
151  u32 count;
152 
154  if (!reg)
155  return;
156 
157  u32 sw_if_index = ntohl (mp->sw_if_index);
158  if (sw_if_index == ~0
159  || sw_if_index >= vec_len (cm->classify_table_index_by_sw_if_index))
160  {
161  rv = VNET_API_ERROR_INVALID_VALUE;
162  goto out;
163  }
164 
165  u32 table_index = classify_get_pcap_chain (cm, sw_if_index);
166  if (table_index == ~0)
167  goto out;
168 
169  /*
170  * Form a vector of all classifier tables in this chain.
171  */
173  u32 i;
174 
175  for (i = table_index; i != ~0; i = t->next_table_index)
176  {
177  vec_add1 (tables, i);
178  t = pool_elt_at_index (cm->tables, i);
179  }
180 
181 out:
182  count = vec_len (tables);
183  rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
184  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_PCAP_GET_TABLES_REPLY);
185  rmp->context = mp->context;
186  rmp->retval = ntohl (rv);
187  rmp->count = htonl (count);
188 
189  for (i = 0; i < count; ++i)
190  {
191  rmp->indices[i] = htonl (tables[i]);
192  }
193 
194  vec_free (tables);
195 
196  vl_api_send_msg (reg, (u8 *) rmp);
197 }
198 
199 
202 {
205  int rv = 0;
206  u32 table_index = ~0;
207 
209  if (!reg)
210  return;
211 
212  u32 n_skip = ntohl (mp->skip_n_vectors);
213  u32 n_match = ntohl (mp->match_n_vectors);
214  u32 mask_len = ntohl (mp->mask_len);
215  if (n_skip > 5
216  || n_match == 0 || n_match > 5 || mask_len != n_match * sizeof (u32x4))
217  {
218  rv = VNET_API_ERROR_INVALID_VALUE;
219  goto out;
220  }
221 
222  u32 table_chain;
223  table_chain = classify_get_trace_chain ();
224 
225  u8 *mask_vec = 0;
226  vec_validate (mask_vec, mask_len - 1);
227  clib_memcpy (mask_vec, mp->mask, mask_len);
228 
229  if (table_chain != ~0)
230  table_index = classify_lookup_chain (table_chain,
231  mask_vec, n_skip, n_match);
232  vec_free (mask_vec);
233 
234 out:
235  rmp = vl_msg_api_alloc (sizeof (*rmp));
236  rmp->_vl_msg_id = ntohs ((VL_API_CLASSIFY_TRACE_LOOKUP_TABLE_REPLY));
237  rmp->context = mp->context;
238  rmp->retval = ntohl (rv);
239  rmp->table_index = htonl (table_index);
240 
241  vl_api_send_msg (reg, (u8 *) rmp);
242 }
243 
246 {
250  int rv = 0;
251 
253  if (!reg)
254  return;
255 
256  u32 table_index = ntohl (mp->table_index);
257  if (table_index != ~0 && pool_is_free_index (cm->tables, table_index))
258  {
259  rv = VNET_API_ERROR_INVALID_VALUE;
260  goto out;
261  }
262 
263  /*
264  * Maybe reorder tables such that masks are most-specific to least-specific.
265  */
266  if (table_index != ~0 && mp->sort_masks)
267  table_index = classify_sort_table_chain (cm, table_index);
268 
269  classify_set_trace_chain (cm, table_index);
270 
271 out:
272  rmp = vl_msg_api_alloc (sizeof (*rmp));
273  rmp->_vl_msg_id = ntohs ((VL_API_CLASSIFY_TRACE_SET_TABLE_REPLY));
274  rmp->context = mp->context;
275  rmp->retval = ntohl (rv);
276  rmp->table_index = htonl (table_index);
277 
278  vl_api_send_msg (reg, (u8 *) rmp);
279 }
280 
283 {
287  int rv = 0;
288  u32 *tables = 0;
289  u32 count;
290 
292  if (!reg)
293  return;
294 
295  u32 table_index = classify_get_trace_chain ();
296  if (table_index == ~0)
297  goto out;
298 
299  /*
300  * Form a vector of all classifier tables in this chain.
301  */
303  u32 i;
304 
305  for (i = table_index; i != ~0; i = t->next_table_index)
306  {
307  vec_add1 (tables, i);
308  t = pool_elt_at_index (cm->tables, i);
309  }
310 
311 out:
312  count = vec_len (tables);
313  rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
314  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TRACE_GET_TABLES_REPLY);
315  rmp->context = mp->context;
316  rmp->retval = ntohl (rv);
317  rmp->count = htonl (count);
318 
319  for (i = 0; i < count; ++i)
320  {
321  rmp->indices[i] = htonl (tables[i]);
322  }
323 
324  vec_free (tables);
325 
326  vl_api_send_msg (reg, (u8 *) rmp);
327 }
328 
329 
332 {
336  int rv;
337 
338 #define _(a) u32 a;
340 #undef _
341 
342 #define _(a) a = ntohl(mp->a);
344 #undef _
345 
346  if (mask_len != match_n_vectors * sizeof (u32x4))
347  {
348  rv = VNET_API_ERROR_INVALID_VALUE;
349  goto out;
350  }
351 
352  /* The underlying API fails silently, on purpose, so check here */
353  if (mp->is_add == 0) /* delete */
354  {
355  if (pool_is_free_index (cm->tables, table_index))
356  {
357  rv = VNET_API_ERROR_NO_SUCH_TABLE;
358  goto out;
359  }
360  }
361  else /* add or update */
362  {
363  if (table_index != ~0 && pool_is_free_index (cm->tables, table_index))
364  table_index = ~0;
365  }
366 
367  u8 current_data_flag = mp->current_data_flag;
368  i16 current_data_offset = clib_net_to_host_i16 (mp->current_data_offset);
369 
371  (cm, mp->mask, nbuckets, memory_size,
372  skip_n_vectors, match_n_vectors,
373  next_table_index, miss_next_index, &table_index,
374  current_data_flag, current_data_offset, mp->is_add, mp->del_chain);
375 
376 out:
377  /* *INDENT-OFF* */
378  REPLY_MACRO2(VL_API_CLASSIFY_ADD_DEL_TABLE_REPLY,
379  ({
380  if (rv == 0 && mp->is_add)
381  {
382  t = pool_elt_at_index (cm->tables, table_index);
383  rmp->skip_n_vectors = htonl(t->skip_n_vectors);
384  rmp->match_n_vectors = htonl(t->match_n_vectors);
385  rmp->new_table_index = htonl(table_index);
386  }
387  else
388  {
389  rmp->skip_n_vectors = ~0;
390  rmp->match_n_vectors = ~0;
391  rmp->new_table_index = ~0;
392  }
393  }));
394  /* *INDENT-ON* */
395 }
396 
399 {
401  vl_api_classify_add_del_session_reply_t *rmp;
402  int rv;
403  u32 table_index, hit_next_index, opaque_index, metadata, match_len;
404  i32 advance;
405  u8 action;
407 
408  table_index = ntohl (mp->table_index);
409  hit_next_index = ntohl (mp->hit_next_index);
410  opaque_index = ntohl (mp->opaque_index);
411  advance = ntohl (mp->advance);
412  action = mp->action;
413  metadata = ntohl (mp->metadata);
414  match_len = ntohl (mp->match_len);
415 
416  if (pool_is_free_index (cm->tables, table_index))
417  {
418  rv = VNET_API_ERROR_NO_SUCH_TABLE;
419  goto out;
420  }
421 
422  t = pool_elt_at_index (cm->tables, table_index);
423 
424  if (match_len != (t->skip_n_vectors + t->match_n_vectors) * sizeof (u32x4))
425  {
426  rv = VNET_API_ERROR_INVALID_VALUE;
427  goto out;
428  }
429 
431  (cm, table_index, mp->match, hit_next_index, opaque_index,
432  advance, action, metadata, mp->is_add);
433 
434 out:
435  REPLY_MACRO (VL_API_CLASSIFY_ADD_DEL_SESSION_REPLY);
436 }
437 
438 static void
441 {
443  vl_api_policer_classify_set_interface_reply_t *rmp;
444  int rv;
445  u32 sw_if_index, ip4_table_index, ip6_table_index, l2_table_index;
446 
447  ip4_table_index = ntohl (mp->ip4_table_index);
448  ip6_table_index = ntohl (mp->ip6_table_index);
449  l2_table_index = ntohl (mp->l2_table_index);
450  sw_if_index = ntohl (mp->sw_if_index);
451 
453 
454  rv = vnet_set_policer_classify_intfc (vm, sw_if_index, ip4_table_index,
455  ip6_table_index, l2_table_index,
456  mp->is_add);
457 
459 
460  REPLY_MACRO (VL_API_POLICER_CLASSIFY_SET_INTERFACE_REPLY);
461 }
462 
463 static void
465  u32 table_index, vl_api_registration_t * reg,
466  u32 context)
467 {
469 
470  mp = vl_msg_api_alloc (sizeof (*mp));
471  clib_memset (mp, 0, sizeof (*mp));
472  mp->_vl_msg_id = ntohs (VL_API_POLICER_CLASSIFY_DETAILS);
473  mp->context = context;
474  mp->sw_if_index = htonl (sw_if_index);
475  mp->table_index = htonl (table_index);
476 
477  vl_api_send_msg (reg, (u8 *) mp);
478 }
479 
480 static void
482 {
485  u32 *vec_tbl;
486  int i;
487  u32 filter_sw_if_index;
488 
490  if (!reg)
491  return;
492 
493  filter_sw_if_index = ntohl (mp->sw_if_index);
494  if (filter_sw_if_index
496  return;
497 
498  if (filter_sw_if_index != ~0)
499  vec_tbl =
500  &pcm->classify_table_index_by_sw_if_index[mp->type][filter_sw_if_index];
501  else
502  vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type];
503 
504  if (vec_len (vec_tbl))
505  {
506  for (i = 0; i < vec_len (vec_tbl); i++)
507  {
508  if (vec_elt (vec_tbl, i) == ~0)
509  continue;
510 
511  send_policer_classify_details (i, vec_elt (vec_tbl, i), reg,
512  mp->context);
513  }
514  }
515 }
516 
517 static void
519 {
521 
523  if (!reg)
524  return;
525 
528  u32 *table_ids = 0;
529  u32 count;
530 
531  /* *INDENT-OFF* */
532  pool_foreach (t, cm->tables)
533  {
534  vec_add1 (table_ids, ntohl(t - cm->tables));
535  }
536  /* *INDENT-ON* */
537  count = vec_len (table_ids);
538 
540  rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
541  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_IDS_REPLY);
542  rmp->context = mp->context;
543  rmp->count = ntohl (count);
544  clib_memcpy (rmp->ids, table_ids, count * sizeof (u32));
545  rmp->retval = 0;
546 
547  vl_api_send_msg (reg, (u8 *) rmp);
548 
549  vec_free (table_ids);
550 }
551 
552 static void
555 {
557  int rv = 0;
558 
559  u32 sw_if_index = ntohl (mp->sw_if_index);
560  u32 *acl = 0;
561 
563  vec_set (acl, ~0);
564 
566 
568 
569  int if_idx;
570  u32 type;
571 
572  for (type = 0; type < IN_OUT_ACL_N_TABLES; type++)
573  {
574  u32 *vec_tbl =
575  am->classify_table_index_by_sw_if_index[IN_OUT_ACL_INPUT_TABLE_GROUP]
576  [type];
577  if (vec_len (vec_tbl))
578  {
579  for (if_idx = 0; if_idx < vec_len (vec_tbl); if_idx++)
580  {
581  if (vec_elt (vec_tbl, if_idx) == ~0 || sw_if_index != if_idx)
582  {
583  continue;
584  }
585  acl[type] = vec_elt (vec_tbl, if_idx);
586  }
587  }
588  }
589 
591 
592  /* *INDENT-OFF* */
593  REPLY_MACRO2(VL_API_CLASSIFY_TABLE_BY_INTERFACE_REPLY,
594  ({
595  rmp->sw_if_index = ntohl(sw_if_index);
596  rmp->l2_table_id = ntohl(acl[IN_OUT_ACL_TABLE_L2]);
597  rmp->ip4_table_id = ntohl(acl[IN_OUT_ACL_TABLE_IP4]);
598  rmp->ip6_table_id = ntohl(acl[IN_OUT_ACL_TABLE_IP6]);
599  }));
600  /* *INDENT-ON* */
601  vec_free (acl);
602 }
603 
604 static void
606 {
608 
610  if (!reg)
611  return;
612 
614 
616  u32 table_id = ntohl (mp->table_id);
618 
619  /* *INDENT-OFF* */
620  pool_foreach (t, cm->tables)
621  {
622  if (table_id == t - cm->tables)
623  {
625  (sizeof (*rmp) + t->match_n_vectors * sizeof (u32x4));
626  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_INFO_REPLY);
627  rmp->context = mp->context;
628  rmp->table_id = ntohl(table_id);
629  rmp->nbuckets = ntohl(t->nbuckets);
630  rmp->match_n_vectors = ntohl(t->match_n_vectors);
631  rmp->skip_n_vectors = ntohl(t->skip_n_vectors);
632  rmp->active_sessions = ntohl(t->active_elements);
633  rmp->next_table_index = ntohl(t->next_table_index);
634  rmp->miss_next_index = ntohl(t->miss_next_index);
635  rmp->mask_length = ntohl(t->match_n_vectors * sizeof (u32x4));
636  clib_memcpy(rmp->mask, t->mask, t->match_n_vectors * sizeof(u32x4));
637  rmp->retval = 0;
638  break;
639  }
640  }
641  /* *INDENT-ON* */
642 
643  if (rmp == 0)
644  {
645  rmp = vl_msg_api_alloc (sizeof (*rmp));
646  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_INFO_REPLY);
647  rmp->context = mp->context;
648  rmp->retval = ntohl (VNET_API_ERROR_CLASSIFY_TABLE_NOT_FOUND);
649  }
650 
651  vl_api_send_msg (reg, (u8 *) rmp);
652 }
653 
654 static void
656  u32 table_id,
657  u32 match_length,
659 {
661 
662  rmp = vl_msg_api_alloc (sizeof (*rmp));
663  clib_memset (rmp, 0, sizeof (*rmp));
664  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_SESSION_DETAILS);
665  rmp->context = context;
666  rmp->table_id = ntohl (table_id);
667  rmp->hit_next_index = ntohl (e->next_index);
668  rmp->advance = ntohl (e->advance);
669  rmp->opaque_index = ntohl (e->opaque_index);
670  rmp->match_length = ntohl (match_length);
671  clib_memcpy (rmp->match, e->key, match_length);
672 
673  vl_api_send_msg (reg, (u8 *) rmp);
674 }
675 
676 static void
678 {
681 
682  u32 table_id = ntohl (mp->table_id);
684 
686  if (!reg)
687  return;
688 
689  /* *INDENT-OFF* */
690  pool_foreach (t, cm->tables)
691  {
692  if (table_id == t - cm->tables)
693  {
695  vnet_classify_entry_t * v, * save_v;
696  int i, j, k;
697 
698  for (i = 0; i < t->nbuckets; i++)
699  {
700  b = &t->buckets [i];
701  if (b->offset == 0)
702  continue;
703 
704  save_v = vnet_classify_get_entry (t, b->offset);
705  for (j = 0; j < (1<<b->log2_pages); j++)
706  {
707  for (k = 0; k < t->entries_per_page; k++)
708  {
710  (t, save_v, j*t->entries_per_page + k);
712  continue;
713 
715  (reg, table_id, t->match_n_vectors * sizeof (u32x4),
716  v, mp->context);
717  }
718  }
719  }
720  break;
721  }
722  }
723  /* *INDENT-ON* */
724 }
725 
726 static void
729 {
731  vl_api_flow_classify_set_interface_reply_t *rmp;
732  int rv;
733  u32 sw_if_index, ip4_table_index, ip6_table_index;
734 
735  ip4_table_index = ntohl (mp->ip4_table_index);
736  ip6_table_index = ntohl (mp->ip6_table_index);
737  sw_if_index = ntohl (mp->sw_if_index);
738 
740 
741  rv = vnet_set_flow_classify_intfc (vm, sw_if_index, ip4_table_index,
742  ip6_table_index, mp->is_add);
743 
745 
746  REPLY_MACRO (VL_API_FLOW_CLASSIFY_SET_INTERFACE_REPLY);
747 }
748 
749 static void
751  u32 table_index, vl_api_registration_t * reg,
752  u32 context)
753 {
755 
756  mp = vl_msg_api_alloc (sizeof (*mp));
757  clib_memset (mp, 0, sizeof (*mp));
758  mp->_vl_msg_id = ntohs (VL_API_FLOW_CLASSIFY_DETAILS);
759  mp->context = context;
760  mp->sw_if_index = htonl (sw_if_index);
761  mp->table_index = htonl (table_index);
762 
763  vl_api_send_msg (reg, (u8 *) mp);
764 }
765 
766 static void
768 {
771  u32 *vec_tbl;
772  int i;
773  u32 filter_sw_if_index;
774 
776  if (!reg)
777  return;
778 
779  filter_sw_if_index = ntohl (mp->sw_if_index);
780  if (filter_sw_if_index
782  return;
783 
784  if (filter_sw_if_index != ~0)
785  vec_tbl =
786  &pcm->classify_table_index_by_sw_if_index[mp->type][filter_sw_if_index];
787  else
788  vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type];
789 
790  if (vec_len (vec_tbl))
791  {
792  for (i = 0; i < vec_len (vec_tbl); i++)
793  {
794  if (vec_elt (vec_tbl, i) == ~0)
795  continue;
796 
797  send_flow_classify_details (i, vec_elt (vec_tbl, i), reg,
798  mp->context);
799  }
800  }
801 }
802 
805 {
807  vl_api_classify_set_interface_ip_table_reply_t *rmp;
808  int rv;
809 
811 
812  u32 table_index = ntohl (mp->table_index);
813  u32 sw_if_index = ntohl (mp->sw_if_index);
814 
815  if (mp->is_ipv6)
816  rv = vnet_set_ip6_classify_intfc (vm, sw_if_index, table_index);
817  else
818  rv = vnet_set_ip4_classify_intfc (vm, sw_if_index, table_index);
819 
821 
822  REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_IP_TABLE_REPLY);
823 }
824 
827 {
828  vl_api_classify_set_interface_l2_tables_reply_t *rmp;
829  int rv;
830  u32 sw_if_index, ip4_table_index, ip6_table_index, other_table_index;
831  int enable;
832 
833  ip4_table_index = ntohl (mp->ip4_table_index);
834  ip6_table_index = ntohl (mp->ip6_table_index);
835  other_table_index = ntohl (mp->other_table_index);
836  sw_if_index = ntohl (mp->sw_if_index);
837 
839 
840  if (mp->is_input)
842  ip6_table_index,
843  other_table_index);
844  else
846  ip6_table_index,
847  other_table_index);
848 
849  if (rv == 0)
850  {
851  if (ip4_table_index != ~0 || ip6_table_index != ~0
852  || other_table_index != ~0)
853  enable = 1;
854  else
855  enable = 0;
856 
857  if (mp->is_input)
859  else
861  }
862 
864 
865  REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_L2_TABLES_REPLY);
866 }
867 
870 {
872  vl_api_input_acl_set_interface_reply_t *rmp;
873  int rv;
874 
876 
877  u32 ip4_table_index = ntohl (mp->ip4_table_index);
878  u32 ip6_table_index = ntohl (mp->ip6_table_index);
879  u32 l2_table_index = ntohl (mp->l2_table_index);
880  u32 sw_if_index = ntohl (mp->sw_if_index);
881 
882  rv = vnet_set_input_acl_intfc (vm, sw_if_index, ip4_table_index,
883  ip6_table_index, l2_table_index, mp->is_add);
884 
886 
887  REPLY_MACRO (VL_API_INPUT_ACL_SET_INTERFACE_REPLY);
888 }
889 
892 {
894  vl_api_output_acl_set_interface_reply_t *rmp;
895  int rv;
896 
898 
899  u32 ip4_table_index = ntohl (mp->ip4_table_index);
900  u32 ip6_table_index = ntohl (mp->ip6_table_index);
901  u32 l2_table_index = ntohl (mp->l2_table_index);
902  u32 sw_if_index = ntohl (mp->sw_if_index);
903 
904  rv = vnet_set_output_acl_intfc (vm, sw_if_index, ip4_table_index,
905  ip6_table_index, l2_table_index,
906  mp->is_add);
907 
909 
910  REPLY_MACRO (VL_API_OUTPUT_ACL_SET_INTERFACE_REPLY);
911 }
912 
913 #include <classify/classify.api.c>
914 
915 static clib_error_t *
917 {
918  /*
919  * Set up the (msg_name, crc, message-id) table
920  */
922 
923  return 0;
924 }
925 
927 
928 /*
929  * fd.io coding-style-patch-verification: ON
930  *
931  * Local Variables:
932  * eval: (c-set-style "gnu")
933  * End:
934  */
vl_api_classify_table_ids_reply_t::count
u32 count
Definition: classify.api:209
vl_api_classify_table_by_interface_t_handler
static void vl_api_classify_table_by_interface_t_handler(vl_api_classify_table_by_interface_t *mp)
Definition: classify_api.c:554
vl_api_input_acl_set_interface_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:417
vl_api_classify_trace_get_tables_t
Classify get the Trace table indices.
Definition: classify.api:594
vl_api_classify_trace_lookup_table_reply_t::context
u32 context
Definition: classify.api:559
vl_api_classify_pcap_set_table_t
Add a Classify table into a PCAP chain on an interface.
Definition: classify.api:486
classify_get_pcap_chain
u32 classify_get_pcap_chain(vnet_classify_main_t *cm, u32 sw_if_index)
Definition: vnet_classify.c:1748
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
vl_api_classify_trace_get_tables_reply_t::context
u32 context
Definition: classify.api:608
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
vl_api_classify_trace_lookup_table_t::skip_n_vectors
u32 skip_n_vectors[default=0]
Definition: classify.api:546
api.h
vl_api_classify_table_by_interface_t
Classify table ids by interface index request.
Definition: classify.api:218
vl_api_policer_classify_details_t::table_index
u32 table_index
Definition: classify.api:187
vl_api_classify_session_details_t::match
u8 match[match_length]
Definition: classify.api:312
vl_api_classify_pcap_get_tables_t_handler
static void vl_api_classify_pcap_get_tables_t_handler(vl_api_classify_pcap_get_tables_t *mp)
Definition: classify_api.c:144
vnet_classify_entry_t
struct _vnet_classify_entry vnet_classify_entry_t
vl_api_classify_trace_get_tables_reply_t::indices
u32 indices[count]
Definition: classify.api:611
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
vl_api_classify_trace_get_tables_t::client_index
u32 client_index
Definition: classify.api:596
vnet_classify_add_del_session
int vnet_classify_add_del_session(vnet_classify_main_t *cm, u32 table_index, const u8 *match, u32 hit_next_index, u32 opaque_index, i32 advance, u8 action, u16 metadata, int is_add)
Definition: vnet_classify.c:2746
vl_api_classify_set_interface_l2_tables_t::is_input
bool is_input
Definition: classify.api:398
vl_api_classify_table_info_t::table_id
u32 table_id
Definition: classify.api:252
vl_api_policer_classify_dump_t::context
u32 context
Definition: classify.api:173
vl_api_classify_session_details_t::opaque_index
u32 opaque_index
Definition: classify.api:310
vl_api_classify_table_ids_t
Classify get table IDs request.
Definition: classify.api:194
vnet_classify_entry_is_free
static int vnet_classify_entry_is_free(vnet_classify_entry_t *e)
Definition: vnet_classify.h:111
vl_api_classify_add_del_table_t::current_data_offset
i16 current_data_offset[default=0]
Definition: classify.api:59
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
vl_api_policer_classify_set_interface_t
Set/unset policer classify interface.
Definition: classify.api:145
vnet_set_input_acl_intfc
int vnet_set_input_acl_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 l2_table_index, u32 is_add)
Definition: in_out_acl.c:129
vnet_classify_table_t::miss_next_index
u32 miss_next_index
Definition: vnet_classify.h:173
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
vl_api_flow_classify_details_t::context
u32 context
Definition: classify.api:360
vnet_l2_output_classify_enable_disable
void vnet_l2_output_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
Definition: l2_output_classify.c:506
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_policer_classify_details_t::context
u32 context
Definition: classify.api:185
vl_api_classify_pcap_get_tables_t::client_index
u32 client_index
Definition: classify.api:513
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
vl_api_classify_session_details_t::match_length
u32 match_length
Definition: classify.api:311
vl_api_classify_set_interface_l2_tables_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:393
classify_lookup_chain
u32 classify_lookup_chain(u32 table_index, u8 *mask, u32 n_skip, u32 n_match)
Definition: vnet_classify.c:1799
vl_api_classify_set_interface_ip_table_t::is_ipv6
bool is_ipv6
Definition: classify.api:376
vl_api_input_acl_set_interface_t::is_add
bool is_add
Definition: classify.api:420
vl_api_classify_table_info_reply_t::context
u32 context
Definition: classify.api:269
vl_api_classify_session_details_t::advance
i32 advance
Definition: classify.api:309
vl_api_classify_table_ids_reply_t
Reply for classify get table IDs request.
Definition: classify.api:205
vl_api_classify_add_del_session_t::match
u8 match[match_len]
Definition: classify.api:131
vnet_classify_main
vnet_classify_main_t vnet_classify_main
Definition: vnet_classify.c:32
vl_api_classify_trace_get_tables_t_handler
static void vl_api_classify_trace_get_tables_t_handler(vl_api_classify_trace_get_tables_t *mp)
Definition: classify_api.c:282
vl_api_flow_classify_set_interface_t::is_add
bool is_add
Definition: classify.api:332
vl_api_classify_pcap_get_tables_reply_t::indices
u32 indices[count]
Definition: classify.api:529
vl_api_classify_add_del_table_t
Add/Delete classification table request.
Definition: classify.api:45
vnet_classify_entry_at_index
static vnet_classify_entry_t * vnet_classify_entry_at_index(vnet_classify_table_t *t, vnet_classify_entry_t *e, u32 index)
Definition: vnet_classify.h:354
IN_OUT_ACL_TABLE_IP4
@ IN_OUT_ACL_TABLE_IP4
Definition: in_out_acl.h:31
vl_api_classify_table_info_t::client_index
u32 client_index
Definition: classify.api:250
u16
unsigned short u16
Definition: types.h:57
vnet_classify_get_entry
static vnet_classify_entry_t * vnet_classify_get_entry(vnet_classify_table_t *t, uword offset)
Definition: vnet_classify.h:332
vl_api_input_acl_set_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:416
vl_api_classify_add_del_session_t
Classify add / del session request.
Definition: classify.api:119
am
app_main_t * am
Definition: application.c:489
vl_api_input_acl_set_interface_t
Set/unset input ACL interface.
Definition: classify.api:412
flow_classify_main_t::classify_table_index_by_sw_if_index
u32 * classify_table_index_by_sw_if_index[FLOW_CLASSIFY_N_TABLES]
Definition: flow_classify.h:39
vl_api_classify_trace_get_tables_reply_t::retval
i32 retval
Definition: classify.api:609
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vl_api_classify_pcap_lookup_table_t::match_n_vectors
u32 match_n_vectors[default=1]
Definition: classify.api:462
vl_api_output_acl_set_interface_t_handler
static void vl_api_output_acl_set_interface_t_handler(vl_api_output_acl_set_interface_t *mp)
Definition: classify_api.c:891
vnet_classify_table_t::entries_per_page
u32 entries_per_page
Definition: vnet_classify.h:162
vl_api_classify_pcap_set_table_t::client_index
u32 client_index
Definition: classify.api:488
vl_api_classify_table_by_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:222
vl_api_flow_classify_details_t
Flow classify operational state response.
Definition: classify.api:359
vl_api_classify_table_info_reply_t::mask_length
u32 mask_length
Definition: classify.api:278
vl_api_classify_trace_lookup_table_t
Find a mask-compatible Classify table in the Trace chain.
Definition: classify.api:542
vl_api_classify_pcap_set_table_reply_t::retval
i32 retval
Definition: classify.api:503
vl_api_classify_trace_lookup_table_t_handler
static void vl_api_classify_trace_lookup_table_t_handler(vl_api_classify_trace_lookup_table_t *mp)
Definition: classify_api.c:201
vl_api_policer_classify_dump_t
Get list of policer classify interfaces and tables.
Definition: classify.api:170
vl_api_policer_classify_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:175
vl_api_classify_session_dump_t::client_index
u32 client_index
Definition: classify.api:289
memory_size
u64 memory_size
Definition: vhost_user.h:124
vl_api_flow_classify_set_interface_t
Set/unset flow classify interface.
Definition: classify.api:326
vl_api_classify_pcap_get_tables_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:515
IN_OUT_ACL_INPUT_TABLE_GROUP
@ IN_OUT_ACL_INPUT_TABLE_GROUP
Definition: in_out_acl.h:39
vl_msg_api_alloc_as_if_client
void * vl_msg_api_alloc_as_if_client(int nbytes)
Definition: memory_shared.c:236
vl_api_input_acl_set_interface_t::l2_table_index
u32 l2_table_index
Definition: classify.api:419
vl_api_policer_classify_set_interface_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:150
vl_api_classify_trace_get_tables_reply_t::count
u32 count
Definition: classify.api:610
send_policer_classify_details
static void send_policer_classify_details(u32 sw_if_index, u32 table_index, vl_api_registration_t *reg, u32 context)
Definition: classify_api.c:464
i32
signed int i32
Definition: types.h:77
vl_api_classify_pcap_lookup_table_reply_t::table_index
u32 table_index
Definition: classify.api:476
vl_api_classify_pcap_lookup_table_t::sw_if_index
vl_api_interface_index_t sw_if_index[default=0xffffffff]
Definition: classify.api:460
vl_api_classify_trace_set_table_t::sort_masks
bool sort_masks[default=0]
Definition: classify.api:575
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
vec_elt
#define vec_elt(v, i)
Get vector value at index i.
Definition: vec_bootstrap.h:210
vl_api_classify_table_info_reply_t::retval
i32 retval
Definition: classify.api:270
classify_api_hookup
static clib_error_t * classify_api_hookup(vlib_main_t *vm)
Definition: classify_api.c:916
vnet_classify_table_t::mask
u32x4 mask[8]
Definition: vnet_classify.h:198
i16
signed short i16
Definition: types.h:46
vl_api_classify_set_interface_l2_tables_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:396
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
vnet_classify_add_del_table
int vnet_classify_add_del_table(vnet_classify_main_t *cm, const u8 *mask, u32 nbuckets, u32 memory_size, u32 skip, u32 match, u32 next_table_index, u32 miss_next_index, u32 *table_index, u8 current_data_flag, i16 current_data_offset, int is_add, int del_chain)
Definition: vnet_classify.c:746
vl_api_classify_table_info_t
Classify table info.
Definition: classify.api:248
vl_api_classify_add_del_session_t::opaque_index
u32 opaque_index[default=0xffffffff]
Definition: classify.api:126
msg_id_base
static u16 msg_id_base
Definition: classify_api.c:40
flow_classify.h
vl_api_classify_add_del_table_t::current_data_flag
u8 current_data_flag[default=0]
Definition: classify.api:58
vl_api_classify_table_by_interface_reply_t::ip6_table_id
u32 ip6_table_id
Definition: classify.api:240
count
u8 count
Definition: dhcp.api:208
send_flow_classify_details
static void send_flow_classify_details(u32 sw_if_index, u32 table_index, vl_api_registration_t *reg, u32 context)
Definition: classify_api.c:750
policer_classify_main_t::classify_table_index_by_sw_if_index
u32 * classify_table_index_by_sw_if_index[POLICER_CLASSIFY_N_TABLES]
Definition: policer_classify.h:40
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vl_api_classify_table_info_reply_t::table_id
u32 table_id
Definition: classify.api:271
vl_api_classify_add_del_session_t::metadata
u32 metadata[default=0]
Definition: classify.api:129
vl_api_classify_trace_set_table_t_handler
static void vl_api_classify_trace_set_table_t_handler(vl_api_classify_trace_set_table_t *mp)
Definition: classify_api.c:245
vnet_classify_table_t::skip_n_vectors
u32 skip_n_vectors
Definition: vnet_classify.h:163
vl_api_classify_pcap_get_tables_reply_t::context
u32 context
Definition: classify.api:526
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
foreach_classify_add_del_table_field
#define foreach_classify_add_del_table_field
Definition: classify_api.c:42
vl_api_policer_classify_set_interface_t::is_add
bool is_add
Definition: classify.api:153
vl_api_input_acl_set_interface_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:418
vl_api_classify_session_details_t::context
u32 context
Definition: classify.api:305
vl_api_classify_session_dump_t::table_id
u32 table_id
Definition: classify.api:291
vl_api_input_acl_set_interface_t_handler
static void vl_api_input_acl_set_interface_t_handler(vl_api_input_acl_set_interface_t *mp)
Definition: classify_api.c:869
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: sr_mpls_api.c:174
classify_set_pcap_chain
void classify_set_pcap_chain(vnet_classify_main_t *cm, u32 sw_if_index, u32 table_index)
Definition: vnet_classify.c:1760
vl_api_flow_classify_dump_t
Get list of flow classify interfaces and tables.
Definition: classify.api:347
vl_api_classify_pcap_set_table_reply_t::context
u32 context
Definition: classify.api:502
vl_api_classify_trace_lookup_table_reply_t::table_index
u32 table_index
Definition: classify.api:561
vl_api_classify_add_del_session_t::advance
i32 advance[default=0]
Definition: classify.api:127
vl_api_classify_pcap_get_tables_reply_t::retval
i32 retval
Definition: classify.api:527
vl_api_classify_add_del_session_t::action
vl_api_classify_action_t action[default=0]
Definition: classify.api:128
vl_api_classify_pcap_get_tables_reply_t::count
u32 count
Definition: classify.api:528
vl_api_classify_table_info_reply_t::active_sessions
u32 active_sessions
Definition: classify.api:275
vl_api_classify_trace_set_table_reply_t::table_index
u32 table_index
Definition: classify.api:587
vnet_set_policer_classify_intfc
int vnet_set_policer_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 l2_table_index, u32 is_add)
Definition: policer_classify.c:57
vl_api_classify_table_info_reply_t::match_n_vectors
u32 match_n_vectors
Definition: classify.api:273
vl_api_classify_session_dump_t::context
u32 context
Definition: classify.api:290
vl_api_classify_trace_set_table_t::table_index
u32 table_index[default=0xffffffff]
Definition: classify.api:574
vl_api_classify_table_info_reply_t::nbuckets
u32 nbuckets
Definition: classify.api:272
vl_api_flow_classify_set_interface_t_handler
static void vl_api_flow_classify_set_interface_t_handler(vl_api_flow_classify_set_interface_t *mp)
Definition: classify_api.c:728
vl_api_classify_add_del_table_t::mask
u8 mask[mask_len]
Definition: classify.api:61
vl_api_classify_pcap_set_table_reply_t
Classify pcap table lookup response.
Definition: classify.api:500
vl_api_classify_session_dump_t
Classify sessions dump request.
Definition: classify.api:287
vl_api_classify_set_interface_l2_tables_t::other_table_index
u32 other_table_index
Definition: classify.api:397
vnet_classify_table_t::buckets
vnet_classify_bucket_t * buckets
Definition: vnet_classify.h:151
vl_api_classify_pcap_set_table_t_handler
static void vl_api_classify_pcap_set_table_t_handler(vl_api_classify_pcap_set_table_t *mp)
Definition: classify_api.c:103
interface.h
vl_api_policer_classify_details_t
Policer classify operational state response.
Definition: classify.api:183
vl_api_classify_trace_lookup_table_t::match_n_vectors
u32 match_n_vectors[default=1]
Definition: classify.api:547
vl_api_classify_table_ids_reply_t::ids
u32 ids[count]
Definition: classify.api:210
cm
vnet_feature_config_main_t * cm
Definition: nat44_ei_hairpinning.c:594
vl_api_flow_classify_set_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:329
vl_api_classify_table_info_reply_t::mask
u8 mask[mask_length]
Definition: classify.api:279
vl_api_classify_set_interface_ip_table_t_handler
static void vl_api_classify_set_interface_ip_table_t_handler(vl_api_classify_set_interface_ip_table_t *mp)
Definition: classify_api.c:804
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
vl_api_flow_classify_set_interface_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:331
IN_OUT_ACL_N_TABLES
@ IN_OUT_ACL_N_TABLES
Definition: in_out_acl.h:34
vl_api_classify_set_interface_l2_tables_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:395
vl_api_classify_session_details_t::hit_next_index
u32 hit_next_index
Definition: classify.api:308
vl_api_classify_table_ids_reply_t::context
u32 context
Definition: classify.api:207
vl_api_classify_table_by_interface_reply_t::ip4_table_id
u32 ip4_table_id
Definition: classify.api:239
vnet_classify_table_t
Definition: vnet_classify.h:147
vl_api_classify_table_ids_t::client_index
u32 client_index
Definition: classify.api:196
policer_classify_main
policer_classify_main_t policer_classify_main
Definition: policer_classify.c:18
vl_api_classify_pcap_lookup_table_t::mask
u8 mask[mask_len]
Definition: classify.api:464
vl_api_classify_trace_set_table_reply_t::retval
i32 retval
Definition: classify.api:586
vnet_classify_table_t::nbuckets
u32 nbuckets
Definition: vnet_classify.h:160
vl_api_classify_pcap_lookup_table_t::skip_n_vectors
u32 skip_n_vectors[default=0]
Definition: classify.api:461
vl_api_flow_classify_set_interface_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:330
vl_api_classify_pcap_lookup_table_t::client_index
u32 client_index
Definition: classify.api:458
vl_api_policer_classify_dump_t::type
vl_api_policer_classify_table_t type
Definition: classify.api:174
vl_api_classify_trace_get_tables_reply_t
Classify get the Trace tables response.
Definition: classify.api:606
vl_api_output_acl_set_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:438
vl_api_classify_pcap_lookup_table_t
Find a compatible Classify table in a PCAP chain.
Definition: classify.api:456
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
policer_classify.h
vl_api_classify_set_interface_l2_tables_t_handler
static void vl_api_classify_set_interface_l2_tables_t_handler(vl_api_classify_set_interface_l2_tables_t *mp)
Definition: classify_api.c:826
flow_classify_main_t
Definition: flow_classify.h:36
vl_api_classify_set_interface_ip_table_t::table_index
u32 table_index
Definition: classify.api:378
vl_api_classify_pcap_lookup_table_t::mask_len
u32 mask_len
Definition: classify.api:463
vl_api_classify_set_interface_l2_tables_t
Set/unset l2 classification tables for an interface request.
Definition: classify.api:389
vl_api_classify_pcap_lookup_table_reply_t::retval
i32 retval
Definition: classify.api:475
vl_api_classify_add_del_table_reply_t
Add/Delete classification table response.
Definition: classify.api:71
vl_api_policer_classify_set_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:149
vl_api_policer_classify_set_interface_t::l2_table_index
u32 l2_table_index
Definition: classify.api:152
vnet_classify_table_t::next_table_index
u32 next_table_index
Definition: vnet_classify.h:167
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
vnet_set_output_acl_intfc
int vnet_set_output_acl_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 l2_table_index, u32 is_add)
Definition: in_out_acl.c:139
vl_api_classify_pcap_lookup_table_reply_t::context
u32 context
Definition: classify.api:474
vl_api_classify_trace_lookup_table_reply_t::retval
i32 retval
Definition: classify.api:560
vl_api_classify_table_by_interface_reply_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:237
vl_api_classify_add_del_session_t::hit_next_index
u32 hit_next_index[default=0xffffffff]
Definition: classify.api:125
vl_api_classify_table_by_interface_reply_t
Reply for classify table id by interface index request.
Definition: classify.api:233
vl_api_classify_table_info_reply_t
Reply for classify table info request.
Definition: classify.api:267
vl_api_classify_pcap_lookup_table_reply_t
Classify pcap table lookup response.
Definition: classify.api:472
vl_api_classify_table_ids_reply_t::retval
i32 retval
Definition: classify.api:208
vl_api_classify_pcap_get_tables_t::context
u32 context
Definition: classify.api:514
vl_api_classify_pcap_set_table_t::context
u32 context
Definition: classify.api:489
vnet_l2_output_classify_set_tables
int vnet_l2_output_classify_set_tables(u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 other_table_index)
Set l2 per-protocol, per-interface output classification tables.
Definition: l2_output_classify.c:525
policer_classify_main_t
Definition: policer_classify.h:37
vl_api_output_acl_set_interface_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:440
vnet_classify_table_t::match_n_vectors
u32 match_n_vectors
Definition: vnet_classify.h:164
u32
unsigned int u32
Definition: types.h:88
vl_api_classify_table_info_reply_t::skip_n_vectors
u32 skip_n_vectors
Definition: classify.api:274
vl_api_classify_trace_lookup_table_t::client_index
u32 client_index
Definition: classify.api:544
vl_api_policer_classify_set_interface_t_handler
static void vl_api_policer_classify_set_interface_t_handler(vl_api_policer_classify_set_interface_t *mp)
Definition: classify_api.c:440
table_id
u32 table_id
Definition: wireguard.api:102
vl_api_classify_table_ids_t_handler
static void vl_api_classify_table_ids_t_handler(vl_api_classify_table_ids_t *mp)
Definition: classify_api.c:518
vl_api_classify_table_ids_t::context
u32 context
Definition: classify.api:197
vnet_set_flow_classify_intfc
int vnet_set_flow_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 is_add)
Definition: flow_classify.c:49
api_helper_macros.h
classify_get_trace_chain
void classify_get_trace_chain(void)
Definition: pnat_test_stubs.h:30
u32x4
unsigned long long u32x4
Definition: ixge.c:28
l2_classify.h
vnet_classify_main_t
struct _vnet_classify_main vnet_classify_main_t
Definition: vnet_classify.h:61
vl_api_output_acl_set_interface_t::l2_table_index
u32 l2_table_index
Definition: classify.api:441
vl_api_flow_classify_dump_t_handler
static void vl_api_flow_classify_dump_t_handler(vl_api_flow_classify_dump_t *mp)
Definition: classify_api.c:767
vl_api_classify_trace_lookup_table_t::context
u32 context
Definition: classify.api:545
vl_api_policer_classify_dump_t_handler
static void vl_api_policer_classify_dump_t_handler(vl_api_policer_classify_dump_t *mp)
Definition: classify_api.c:481
vnet_classify.h
ip4.h
vl_api_output_acl_set_interface_t::is_add
bool is_add
Definition: classify.api:442
vl_api_classify_pcap_set_table_t::sort_masks
bool sort_masks[default=0]
Definition: classify.api:492
vl_api_policer_classify_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:186
vl_api_classify_table_info_reply_t::miss_next_index
u32 miss_next_index
Definition: classify.api:277
vl_api_classify_session_dump_t_handler
static void vl_api_classify_session_dump_t_handler(vl_api_classify_session_dump_t *mp)
Definition: classify_api.c:677
vl_api_classify_add_del_table_t::is_add
bool is_add
Definition: classify.api:49
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_policer_classify_set_interface_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:151
in_out_acl.h
vl_api_flow_classify_dump_t::context
u32 context
Definition: classify.api:349
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
vec_set
#define vec_set(v, val)
Set all vector elements to given value.
Definition: vec.h:1005
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
vl_api_classify_add_del_session_t::table_index
u32 table_index
Definition: classify.api:124
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vl_api_classify_pcap_get_tables_t
Classify get the PCAP table indices for an interface.
Definition: classify.api:511
classify_sort_table_chain
u32 classify_sort_table_chain(vnet_classify_main_t *cm, u32 table_index)
Definition: vnet_classify.c:1679
vl_api_classify_pcap_lookup_table_t::context
u32 context
Definition: classify.api:459
vnet_l2_input_classify_set_tables
int vnet_l2_input_classify_set_tables(u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 other_table_index)
Set l2 per-protocol, per-interface input classification tables.
Definition: l2_input_classify.c:535
i
int i
Definition: flowhash_template.h:376
vnet_set_ip6_classify_intfc
int vnet_set_ip6_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
Definition: ip6_forward.c:3016
vl_api_policer_classify_dump_t::client_index
u32 client_index
Definition: classify.api:172
classify_set_trace_chain
void classify_set_trace_chain(vnet_classify_main_t *cm, u32 table_index)
Definition: vnet_classify.c:1733
vl_api_classify_table_by_interface_reply_t::l2_table_id
u32 l2_table_id
Definition: classify.api:238
vl_api_classify_add_del_session_t::match_len
u32 match_len
Definition: classify.api:130
vl_api_flow_classify_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:351
context
u32 context
Definition: ip.api:852
vl_api_output_acl_set_interface_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:439
vl_api_classify_session_details_t::table_id
u32 table_id
Definition: classify.api:307
vl_api_classify_trace_set_table_t::context
u32 context
Definition: classify.api:573
vl_api_classify_pcap_lookup_table_t_handler
static void vl_api_classify_pcap_lookup_table_t_handler(vl_api_classify_pcap_lookup_table_t *mp)
Definition: classify_api.c:54
send_classify_session_details
static void send_classify_session_details(vl_api_registration_t *reg, u32 table_id, u32 match_length, vnet_classify_entry_t *e, u32 context)
Definition: classify_api.c:655
rv
int __clib_unused rv
Definition: application.c:491
vl_api_classify_set_interface_ip_table_t
Set/unset the classification table for an interface request.
Definition: classify.api:372
vl_api_classify_pcap_set_table_reply_t::table_index
u32 table_index
Definition: classify.api:504
vl_api_classify_session_details_t
Reply for classify table session dump request.
Definition: classify.api:303
vl_api_classify_pcap_get_tables_reply_t
Classify get a PCAP tables response.
Definition: classify.api:524
vl_api_classify_trace_lookup_table_t::mask
u8 mask[mask_len]
Definition: classify.api:549
vl_api_classify_trace_lookup_table_t::mask_len
u32 mask_len
Definition: classify.api:548
vl_api_classify_trace_set_table_reply_t
Classify Trace table lookup response.
Definition: classify.api:583
vnet.h
api_errno.h
in_out_acl_main
in_out_acl_main_t in_out_acl_main
Definition: in_out_acl.c:21
vnet_set_ip4_classify_intfc
int vnet_set_ip4_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
Definition: ip4_forward.c:2785
IN_OUT_ACL_TABLE_L2
@ IN_OUT_ACL_TABLE_L2
Definition: in_out_acl.h:33
vl_api_flow_classify_dump_t::type
vl_api_flow_classify_table_t type
Definition: classify.api:350
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(classify_api_hookup)
vl_api_classify_add_del_session_t::is_add
bool is_add
Definition: classify.api:123
action
vl_api_mac_event_action_t action
Definition: l2.api:211
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
vl_api_classify_trace_set_table_reply_t::context
u32 context
Definition: classify.api:585
vl_api_flow_classify_details_t::table_index
u32 table_index
Definition: classify.api:362
vl_api_classify_table_info_t::context
u32 context
Definition: classify.api:251
vl_api_classify_pcap_set_table_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:490
vl_api_classify_pcap_set_table_t::table_index
u32 table_index[default=0xffffffff]
Definition: classify.api:491
ip6.h
vnet_classify_bucket_t
Definition: vnet_classify.h:132
vnet_l2_input_classify_enable_disable
void vnet_l2_input_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
Definition: l2_input_classify.c:517
vl_api_classify_add_del_table_t_handler
static void vl_api_classify_add_del_table_t_handler(vl_api_classify_add_del_table_t *mp)
Definition: classify_api.c:331
vl_api_classify_trace_lookup_table_reply_t
Classify trace table lookup response.
Definition: classify.api:557
vl_api_classify_trace_get_tables_t::context
u32 context
Definition: classify.api:597
flow_classify_main
flow_classify_main_t flow_classify_main
Definition: flow_classify.c:19
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vl_api_classify_trace_set_table_t::client_index
u32 client_index
Definition: classify.api:572
vl_api_output_acl_set_interface_t
Set/unset output ACL interface.
Definition: classify.api:434
vl_api_classify_table_info_t_handler
static void vl_api_classify_table_info_t_handler(vl_api_classify_table_info_t *mp)
Definition: classify_api.c:605
vl_api_classify_add_del_session_t_handler
static void vl_api_classify_add_del_session_t_handler(vl_api_classify_add_del_session_t *mp)
Definition: classify_api.c:398
vl_api_classify_trace_set_table_t
Add a Classify table into the Trace chain.
Definition: classify.api:570
vl_api_classify_table_info_reply_t::next_table_index
u32 next_table_index
Definition: classify.api:276
in_out_acl_main_t
Definition: in_out_acl.h:44
IN_OUT_ACL_TABLE_IP6
@ IN_OUT_ACL_TABLE_IP6
Definition: in_out_acl.h:32
vl_api_classify_add_del_table_t::del_chain
bool del_chain
Definition: classify.api:50
vnet_classify_table_t::active_elements
u32 active_elements
Definition: vnet_classify.h:182
vl_api_classify_set_interface_ip_table_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:377
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
vl_api_flow_classify_dump_t::client_index
u32 client_index
Definition: classify.api:348
vl_api_flow_classify_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:361