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