update Intel copyright years to 2014
[dpdk.git] / app / test / test_acl.h
1 /*-
2  *   BSD LICENSE
3  * 
4  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
5  *   All rights reserved.
6  * 
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  * 
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Intel Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  * 
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef TEST_ACL_H_
35 #define TEST_ACL_H_
36
37 struct ipv4_7tuple {
38         uint16_t vlan;
39         uint16_t domain;
40         uint8_t proto;
41         uint32_t ip_src;
42         uint32_t ip_dst;
43         uint16_t port_src;
44         uint16_t port_dst;
45         uint32_t allow;
46         uint32_t deny;
47 };
48
49 /* rules for invalid layout test */
50 struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = {
51                 /* test src and dst address */
52                 {
53                                 .data = {.userdata = 1, .category_mask = 1},
54                                 .src_addr = IPv4(10,0,0,0),
55                                 .src_mask_len = 24,
56                 },
57                 {
58                                 .data = {.userdata = 2, .category_mask = 1},
59                                 .dst_addr = IPv4(10,0,0,0),
60                                 .dst_mask_len = 24,
61                 },
62                 /* test src and dst ports */
63                 {
64                                 .data = {.userdata = 3, .category_mask = 1},
65                                 .dst_port_low = 100,
66                                 .dst_port_high = 100,
67                 },
68                 {
69                                 .data = {.userdata = 4, .category_mask = 1},
70                                 .src_port_low = 100,
71                                 .src_port_high = 100,
72                 },
73                 /* test proto */
74                 {
75                                 .data = {.userdata = 5, .category_mask = 1},
76                                 .proto = 0xf,
77                                 .proto_mask = 0xf
78                 },
79                 {
80                                 .data = {.userdata = 6, .category_mask = 1},
81                                 .dst_port_low = 0xf,
82                                 .dst_port_high = 0xf,
83                 }
84 };
85
86 /* these might look odd because they don't match up the rules. This is
87  * intentional, as the invalid layout test presumes returning the correct
88  * results using the wrong data layout.
89  */
90 struct ipv4_7tuple invalid_layout_data[] = {
91                 {.ip_src = IPv4(10,0,1,0)},             /* should not match */
92                 {.ip_src = IPv4(10,0,0,1), .allow = 2}, /* should match 2 */
93                 {.port_src = 100, .allow = 4},          /* should match 4 */
94                 {.port_dst = 0xf, .allow = 6},          /* should match 6 */
95 };
96
97 #define ACL_ALLOW 0
98 #define ACL_DENY 1
99 #define ACL_ALLOW_MASK 0x1
100 #define ACL_DENY_MASK  0x2
101
102 /* ruleset for ACL unit test */
103 struct rte_acl_ipv4vlan_rule acl_test_rules[] = {
104 /* destination IP addresses */
105                 /* matches all packets traveling to 192.168.0.0/16 */
106                 {
107                                 .data = {.userdata = 1, .category_mask = ACL_ALLOW_MASK,
108                                                 .priority = 2},
109                                 .dst_addr = IPv4(192,168,0,0),
110                                 .dst_mask_len = 16,
111                                 .src_port_low = 0,
112                                 .src_port_high = 0xffff,
113                                 .dst_port_low = 0,
114                                 .dst_port_high = 0xffff,
115                 },
116                 /* matches all packets traveling to 192.168.1.0/24 */
117                 {
118                                 .data = {.userdata = 2, .category_mask = ACL_ALLOW_MASK,
119                                                 .priority = 3},
120                                 .dst_addr = IPv4(192,168,1,0),
121                                 .dst_mask_len = 24,
122                                 .src_port_low = 0,
123                                 .src_port_high = 0xffff,
124                                 .dst_port_low = 0,
125                                 .dst_port_high = 0xffff,
126                 },
127                 /* matches all packets traveling to 192.168.1.50 */
128                 {
129                                 .data = {.userdata = 3, .category_mask = ACL_DENY_MASK,
130                                                 .priority = 2},
131                                 .dst_addr = IPv4(192,168,1,50),
132                                 .dst_mask_len = 32,
133                                 .src_port_low = 0,
134                                 .src_port_high = 0xffff,
135                                 .dst_port_low = 0,
136                                 .dst_port_high = 0xffff,
137                 },
138
139 /* source IP addresses */
140                 /* matches all packets traveling from 10.0.0.0/8 */
141                 {
142                                 .data = {.userdata = 4, .category_mask = ACL_ALLOW_MASK,
143                                                 .priority = 2},
144                                 .src_addr = IPv4(10,0,0,0),
145                                 .src_mask_len = 8,
146                                 .src_port_low = 0,
147                                 .src_port_high = 0xffff,
148                                 .dst_port_low = 0,
149                                 .dst_port_high = 0xffff,
150                 },
151                 /* matches all packets traveling from 10.1.1.0/24 */
152                 {
153                                 .data = {.userdata = 5, .category_mask = ACL_ALLOW_MASK,
154                                                 .priority = 3},
155                                 .src_addr = IPv4(10,1,1,0),
156                                 .src_mask_len = 24,
157                                 .src_port_low = 0,
158                                 .src_port_high = 0xffff,
159                                 .dst_port_low = 0,
160                                 .dst_port_high = 0xffff,
161                 },
162                 /* matches all packets traveling from 10.1.1.1 */
163                 {
164                                 .data = {.userdata = 6, .category_mask = ACL_DENY_MASK,
165                                                 .priority = 2},
166                                 .src_addr = IPv4(10,1,1,1),
167                                 .src_mask_len = 32,
168                                 .src_port_low = 0,
169                                 .src_port_high = 0xffff,
170                                 .dst_port_low = 0,
171                                 .dst_port_high = 0xffff,
172                 },
173
174 /* VLAN tag */
175                 /* matches all packets with lower 7 bytes of VLAN tag equal to 0x64  */
176                 {
177                                 .data = {.userdata = 7, .category_mask = ACL_ALLOW_MASK,
178                                                 .priority = 2},
179                                 .vlan = 0x64,
180                                 .vlan_mask = 0x7f,
181                                 .src_port_low = 0,
182                                 .src_port_high = 0xffff,
183                                 .dst_port_low = 0,
184                                 .dst_port_high = 0xffff,
185                 },
186                 /* matches all packets with VLAN tags that have 0x5 in them */
187                 {
188                                 .data = {.userdata = 8, .category_mask = ACL_ALLOW_MASK,
189                                                 .priority = 2},
190                                 .vlan = 0x5,
191                                 .vlan_mask = 0x5,
192                                 .src_port_low = 0,
193                                 .src_port_high = 0xffff,
194                                 .dst_port_low = 0,
195                                 .dst_port_high = 0xffff,
196                 },
197                 /* matches all packets with VLAN tag 5 */
198                 {
199                                 .data = {.userdata = 9, .category_mask = ACL_DENY_MASK,
200                                                 .priority = 3},
201                                 .vlan = 0x5,
202                                 .vlan_mask = 0xffff,
203                                 .src_port_low = 0,
204                                 .src_port_high = 0xffff,
205                                 .dst_port_low = 0,
206                                 .dst_port_high = 0xffff,
207                 },
208
209 /* VLAN domain */
210                 /* matches all packets with lower 7 bytes of domain equal to 0x64  */
211                 {
212                                 .data = {.userdata = 10, .category_mask = ACL_ALLOW_MASK,
213                                                 .priority = 2},
214                                 .domain = 0x64,
215                                 .domain_mask = 0x7f,
216                                 .src_port_low = 0,
217                                 .src_port_high = 0xffff,
218                                 .dst_port_low = 0,
219                                 .dst_port_high = 0xffff,
220                 },
221                 /* matches all packets with domains that have 0x5 in them */
222                 {
223                                 .data = {.userdata = 11, .category_mask = ACL_ALLOW_MASK,
224                                                 .priority = 3},
225                                 .domain = 0x5,
226                                 .domain_mask = 0x5,
227                                 .src_port_low = 0,
228                                 .src_port_high = 0xffff,
229                                 .dst_port_low = 0,
230                                 .dst_port_high = 0xffff,
231                 },
232                 /* matches all packets with domain 5 */
233                 {
234                                 .data = {.userdata = 12, .category_mask = ACL_DENY_MASK,
235                                                 .priority = 3},
236                                 .domain = 0x5,
237                                 .domain_mask = 0xffff,
238                                 .src_port_low = 0,
239                                 .src_port_high = 0xffff,
240                                 .dst_port_low = 0,
241                                 .dst_port_high = 0xffff,
242                 },
243
244 /* destination port */
245                 /* matches everything with dst port 80 */
246                 {
247                                 .data = {.userdata = 13, .category_mask = ACL_ALLOW_MASK,
248                                                 .priority = 3},
249                                 .dst_port_low = 80,
250                                 .dst_port_high = 80,
251                                 .src_port_low = 0,
252                                 .src_port_high = 0xffff,
253                 },
254                 /* matches everything with dst port 22-1023 */
255                 {
256                                 .data = {.userdata = 14, .category_mask = ACL_ALLOW_MASK,
257                                                 .priority = 2},
258                                 .dst_port_low = 22,
259                                 .dst_port_high = 1023,
260                                 .src_port_low = 0,
261                                 .src_port_high = 0xffff,
262                 },
263                 /* matches everything with dst port 1020 */
264                 {
265                                 .data = {.userdata = 15, .category_mask = ACL_DENY_MASK,
266                                                 .priority = 3},
267                                 .dst_port_low = 1020,
268                                 .dst_port_high = 1020,
269                                 .src_port_low = 0,
270                                 .src_port_high = 0xffff,
271                 },
272                 /* matches everything with dst portrange  1000-2000 */
273                 {
274                                 .data = {.userdata = 16, .category_mask = ACL_DENY_MASK,
275                                                 .priority = 2},
276                                 .dst_port_low = 1000,
277                                 .dst_port_high = 2000,
278                                 .src_port_low = 0,
279                                 .src_port_high = 0xffff,
280                 },
281
282 /* source port */
283                 /* matches everything with src port 80 */
284                 {
285                                 .data = {.userdata = 17, .category_mask = ACL_ALLOW_MASK,
286                                                 .priority = 3},
287                                 .src_port_low = 80,
288                                 .src_port_high = 80,
289                                 .dst_port_low = 0,
290                                 .dst_port_high = 0xffff,
291                 },
292                 /* matches everything with src port 22-1023 */
293                 {
294                                 .data = {.userdata = 18, .category_mask = ACL_ALLOW_MASK,
295                                                 .priority = 2},
296                                 .src_port_low = 22,
297                                 .src_port_high = 1023,
298                                 .dst_port_low = 0,
299                                 .dst_port_high = 0xffff,
300                 },
301                 /* matches everything with src port 1020 */
302                 {
303                                 .data = {.userdata = 19, .category_mask = ACL_DENY_MASK,
304                                                 .priority = 3},
305                                 .src_port_low = 1020,
306                                 .src_port_high = 1020,
307                                 .dst_port_low = 0,
308                                 .dst_port_high = 0xffff,
309                 },
310                 /* matches everything with src portrange  1000-2000 */
311                 {
312                                 .data = {.userdata = 20, .category_mask = ACL_DENY_MASK,
313                                                 .priority = 2},
314                                 .src_port_low = 1000,
315                                 .src_port_high = 2000,
316                                 .dst_port_low = 0,
317                                 .dst_port_high = 0xffff,
318                 },
319
320 /* protocol number */
321                 /* matches all packets with protocol number either 0x64 or 0xE4 */
322                 {
323                                 .data = {.userdata = 21, .category_mask = ACL_ALLOW_MASK,
324                                                 .priority = 2},
325                                 .proto = 0x64,
326                                 .proto_mask = 0x7f,
327                                 .src_port_low = 0,
328                                 .src_port_high = 0xffff,
329                                 .dst_port_low = 0,
330                                 .dst_port_high = 0xffff,
331                 },
332                 /* matches all packets with protocol that have 0x5 in them */
333                 {
334                                 .data = {.userdata = 22, .category_mask = ACL_ALLOW_MASK,
335                                                 .priority = 2},
336                                 .proto = 0x5,
337                                 .proto_mask = 0x5,
338                                 .src_port_low = 0,
339                                 .src_port_high = 0xffff,
340                                 .dst_port_low = 0,
341                                 .dst_port_high = 0xffff,
342                 },
343                 /* matches all packets with protocol 5 */
344                 {
345                                 .data = {.userdata = 23, .category_mask = ACL_DENY_MASK,
346                                                 .priority = 3},
347                                 .proto = 0x5,
348                                 .proto_mask = 0xff,
349                                 .src_port_low = 0,
350                                 .src_port_high = 0xffff,
351                                 .dst_port_low = 0,
352                                 .dst_port_high = 0xffff,
353                 },
354
355 /* rules combining various fields */
356                 {
357                                 .data = {.userdata = 24, .category_mask = ACL_ALLOW_MASK,
358                                                 .priority = 4},
359                                 /** make sure that unmasked bytes don't fail! */
360                                 .dst_addr = IPv4(1,2,3,4),
361                                 .dst_mask_len = 16,
362                                 .src_addr = IPv4(5,6,7,8),
363                                 .src_mask_len = 24,
364                                 .proto = 0x5,
365                                 .proto_mask = 0xff,
366                                 .src_port_low = 0,
367                                 .src_port_high = 0xffff,
368                                 .dst_port_low = 22,
369                                 .dst_port_high = 1024,
370                                 .vlan = 0x8100,
371                                 .vlan_mask = 0xffff,
372                                 .domain = 0x64,
373                                 .domain_mask = 0xffff,
374                 },
375                 {
376                                 .data = {.userdata = 25, .category_mask = ACL_DENY_MASK,
377                                                 .priority = 4},
378                                 .dst_addr = IPv4(5,6,7,8),
379                                 .dst_mask_len = 24,
380                                 .src_addr = IPv4(1,2,3,4),
381                                 .src_mask_len = 16,
382                                 .proto = 0x5,
383                                 .proto_mask = 0xff,
384                                 .src_port_low = 0,
385                                 .src_port_high = 0xffff,
386                                 .dst_port_low = 22,
387                                 .dst_port_high = 1024,
388                                 .vlan = 0x8100,
389                                 .vlan_mask = 0xffff,
390                                 .domain = 0x64,
391                                 .domain_mask = 0xffff,
392                 },
393                 {
394                                 .data = {.userdata = 26, .category_mask = ACL_ALLOW_MASK,
395                                                 .priority = 5},
396                                 .dst_addr = IPv4(1,2,3,4),
397                                 .dst_mask_len = 8,
398                                 .src_addr = IPv4(5,6,7,8),
399                                 .src_mask_len = 32,
400                                 .proto = 0x5,
401                                 .proto_mask = 0xff,
402                                 .src_port_low = 0,
403                                 .src_port_high = 0xffff,
404                                 .dst_port_low = 22,
405                                 .dst_port_high = 1024,
406                                 .vlan = 0x64,
407                                 .vlan_mask = 0xffff,
408                 },
409                 {
410                                 .data = {.userdata = 27, .category_mask = ACL_DENY_MASK,
411                                                 .priority = 5},
412                                 .dst_addr = IPv4(5,6,7,8),
413                                 .dst_mask_len = 32,
414                                 .src_addr = IPv4(1,2,3,4),
415                                 .src_mask_len = 8,
416                                 .proto = 0x5,
417                                 .proto_mask = 0xff,
418                                 .src_port_low = 0,
419                                 .src_port_high = 0xffff,
420                                 .dst_port_low = 22,
421                                 .dst_port_high = 1024,
422                                 .vlan = 0x64,
423                                 .vlan_mask = 0xffff,
424                 },
425 };
426
427 /* data for ACL unit test */
428 struct ipv4_7tuple acl_test_data[] = {
429 /* testing single rule aspects */
430                 {.ip_src = IPv4(10,0,0,0), .allow = 4}, /* should match 4 */
431                 {.ip_src = IPv4(10,1,1,2), .allow = 5}, /* should match 5 */
432                 {.ip_src = IPv4(10,1,1,1), .allow = 5,
433                                 .deny = 6},                     /* should match 5, 6 */
434                 {.ip_dst = IPv4(10,0,0,0)},             /* should not match */
435                 {.ip_dst = IPv4(10,1,1,2)},             /* should not match */
436                 {.ip_dst = IPv4(10,1,1,1)},             /* should not match */
437
438                 {.ip_src = IPv4(192,168,2,50)},             /* should not match */
439                 {.ip_src = IPv4(192,168,1,2)},              /* should not match */
440                 {.ip_src = IPv4(192,168,1,50)},             /* should not match */
441                 {.ip_dst = IPv4(192,168,2,50), .allow = 1}, /* should match 1 */
442                 {.ip_dst = IPv4(192,168,1,49), .allow = 2}, /* should match 2 */
443                 {.ip_dst = IPv4(192,168,1,50), .allow = 2,
444                                 .deny = 3},                         /* should match 2, 3 */
445
446                 {.vlan = 0x64, .allow = 7},            /* should match 7 */
447                 {.vlan = 0xfE4, .allow = 7},           /* should match 7 */
448                 {.vlan = 0xE2},                        /* should not match */
449                 {.vlan = 0xD, .allow = 8},             /* should match 8 */
450                 {.vlan = 0x6},                         /* should not match */
451                 {.vlan = 0x5, .allow = 8, .deny = 9},  /* should match 8, 9 */
452
453                 {.domain = 0x64, .allow = 10},             /* should match 10 */
454                 {.domain = 0xfE4, .allow = 10},            /* should match 10 */
455                 {.domain = 0xE2},                          /* should not match */
456                 {.domain = 0xD, .allow = 11},              /* should match 11 */
457                 {.domain = 0x6},                           /* should not match */
458                 {.domain = 0x5, .allow = 11, .deny = 12},  /* should match 11, 12 */
459
460                 {.port_dst = 80, .allow = 13},                /* should match 13 */
461                 {.port_dst = 79, .allow = 14},                /* should match 14 */
462                 {.port_dst = 81, .allow = 14},                /* should match 14 */
463                 {.port_dst = 21},                             /* should not match */
464                 {.port_dst = 1024, .deny = 16},               /* should match 16 */
465                 {.port_dst = 1020, .allow = 14, .deny = 15},  /* should match 14, 15 */
466
467                 {.port_src = 80, .allow = 17},                /* should match 17 */
468                 {.port_src = 79, .allow = 18},                /* should match 18 */
469                 {.port_src = 81, .allow = 18},                /* should match 18 */
470                 {.port_src = 21},                             /* should not match */
471                 {.port_src = 1024, .deny = 20},               /* should match 20 */
472                 {.port_src = 1020, .allow = 18, .deny = 19},  /* should match 18, 19 */
473
474                 {.proto = 0x64, .allow = 21},             /* should match 21 */
475                 {.proto = 0xE4, .allow = 21},             /* should match 21 */
476                 {.proto = 0xE2},                          /* should not match */
477                 {.proto = 0xD, .allow = 22},              /* should match 22 */
478                 {.proto = 0x6},                           /* should not match */
479                 {.proto = 0x5, .allow = 22, .deny = 23},  /* should match 22, 23 */
480
481 /* testing matching multiple rules at once */
482                 {.vlan = 0x5, .ip_src = IPv4(10,1,1,1),
483                                 .allow = 5, .deny = 9},               /* should match 5, 9 */
484                 {.vlan = 0x5, .ip_src = IPv4(192,168,2,50),
485                                 .allow = 8, .deny = 9},               /* should match 8, 9 */
486                 {.vlan = 0x55, .ip_src = IPv4(192,168,1,49),
487                                 .allow = 8},                          /* should match 8 */
488                 {.port_dst = 80, .port_src = 1024,
489                                 .allow = 13, .deny = 20},             /* should match 13,20 */
490                 {.port_dst = 79, .port_src = 1024,
491                                 .allow = 14, .deny = 20},             /* should match 14,20 */
492                 {.proto = 0x5, .ip_dst = IPv4(192,168,2,50),
493                                 .allow = 1, .deny = 23},               /* should match 1, 23 */
494
495                 {.proto = 0x5, .ip_dst = IPv4(192,168,1,50),
496                                 .allow = 2, .deny = 23},              /* should match 2, 23 */
497                 {.vlan = 0x64, .domain = 0x5,
498                                 .allow = 11, .deny = 12},             /* should match 11, 12 */
499                 {.proto = 0x5, .port_src = 80,
500                                 .allow = 17, .deny = 23},             /* should match 17, 23 */
501                 {.proto = 0x5, .port_dst = 80,
502                                 .allow = 13, .deny = 23},             /* should match 13, 23 */
503                 {.proto = 0x51, .port_src = 5000},            /* should not match */
504                 {.ip_src = IPv4(192,168,1,50),
505                                 .ip_dst = IPv4(10,0,0,0),
506                                 .proto = 0x51,
507                                 .port_src = 5000,
508                                 .port_dst = 5000},                    /* should not match */
509
510 /* test full packet rules */
511                 {
512                                 .ip_dst = IPv4(1,2,100,200),
513                                 .ip_src = IPv4(5,6,7,254),
514                                 .proto = 0x5,
515                                 .vlan = 0x8100,
516                                 .domain = 0x64,
517                                 .port_src = 12345,
518                                 .port_dst = 80,
519                                 .allow = 24,
520                                 .deny = 23
521                 }, /* should match 23, 24 */
522                 {
523                                 .ip_dst = IPv4(5,6,7,254),
524                                 .ip_src = IPv4(1,2,100,200),
525                                 .proto = 0x5,
526                                 .vlan = 0x8100,
527                                 .domain = 0x64,
528                                 .port_src = 12345,
529                                 .port_dst = 80,
530                                 .allow = 13,
531                                 .deny = 25
532                 }, /* should match 13, 25 */
533                 {
534                                 .ip_dst = IPv4(1,10,20,30),
535                                 .ip_src = IPv4(5,6,7,8),
536                                 .proto = 0x5,
537                                 .vlan = 0x64,
538                                 .port_src = 12345,
539                                 .port_dst = 80,
540                                 .allow = 26,
541                                 .deny = 23
542                 }, /* should match 23, 26 */
543                 {
544                                 .ip_dst = IPv4(5,6,7,8),
545                                 .ip_src = IPv4(1,10,20,30),
546                                 .proto = 0x5,
547                                 .vlan = 0x64,
548                                 .port_src = 12345,
549                                 .port_dst = 80,
550                                 .allow = 13,
551                                 .deny = 27
552                 }, /* should match 13, 27 */
553                 {
554                                 .ip_dst = IPv4(2,2,3,4),
555                                 .ip_src = IPv4(4,6,7,8),
556                                 .proto = 0x5,
557                                 .vlan = 0x64,
558                                 .port_src = 12345,
559                                 .port_dst = 80,
560                                 .allow = 13,
561                                 .deny = 23
562                 }, /* should match 13, 23 */
563                 {
564                                 .ip_dst = IPv4(1,2,3,4),
565                                 .ip_src = IPv4(4,6,7,8),
566                                 .proto = 0x5,
567                                 .vlan = 0x64,
568                                 .port_src = 12345,
569                                 .port_dst = 80,
570                                 .allow = 13,
571                                 .deny = 23
572                 }, /* should match 13, 23 */
573
574
575 /* visual separator! */
576                 {
577                                 .ip_dst = IPv4(1,2,100,200),
578                                 .ip_src = IPv4(5,6,7,254),
579                                 .proto = 0x55,
580                                 .vlan = 0x8000,
581                                 .domain = 0x6464,
582                                 .port_src = 12345,
583                                 .port_dst = 8080,
584                                 .allow = 10
585                 }, /* should match 10 */
586                 {
587                                 .ip_dst = IPv4(5,6,7,254),
588                                 .ip_src = IPv4(1,2,100,200),
589                                 .proto = 0x55,
590                                 .vlan = 0x8100,
591                                 .domain = 0x6464,
592                                 .port_src = 12345,
593                                 .port_dst = 180,
594                                 .allow = 10
595                 }, /* should match 10 */
596                 {
597                                 .ip_dst = IPv4(1,10,20,30),
598                                 .ip_src = IPv4(5,6,7,8),
599                                 .proto = 0x55,
600                                 .vlan = 0x64,
601                                 .port_src = 12345,
602                                 .port_dst = 180,
603                                 .allow = 7
604                 }, /* should match 7 */
605                 {
606                                 .ip_dst = IPv4(5,6,7,8),
607                                 .ip_src = IPv4(1,10,20,30),
608                                 .proto = 0x55,
609                                 .vlan = 0x64,
610                                 .port_src = 12345,
611                                 .port_dst = 180,
612                                 .allow = 7
613                 }, /* should match 7 */
614                 {
615                                 .ip_dst = IPv4(2,2,3,4),
616                                 .ip_src = IPv4(4,6,7,8),
617                                 .proto = 0x55,
618                                 .vlan = 0x64,
619                                 .port_src = 12345,
620                                 .port_dst = 180,
621                                 .allow = 7
622                 }, /* should match 7 */
623                 {
624                                 .ip_dst = IPv4(1,2,3,4),
625                                 .ip_src = IPv4(4,6,7,8),
626                                 .proto = 0x50,
627                                 .vlan = 0x6466,
628                                 .port_src = 12345,
629                                 .port_dst = 12345,
630                 }, /* should not match */
631 };
632
633 #endif /* TEST_ACL_H_ */