Commit d0d58d9
committed
Fix GENEVE- and VXLAN-encapsulated matching.
In my recent commit 1687065 the filter programs for "vxlan [NUM]",
"vxlan and vxlan", "geneve [NUM]" and "geneve and geneve" have become
substantially shorter. As it turns out, the missing instructions are
the outputs of gen_geneve_offsets() and gen_vxlan_offsets(), so
filtering of protocols encapsulated in GENEVE and VXLAN is no longer
correct. Because libpcap does not have any apply filter tests for the
affected syntax, this was not apparent until a tcpdump test failed.
The instructions went missing because gen_geneve() and gen_vxlan() need
to use these as a block, but instead of making a new block from scratch
the functions take the result of gen_true() and modify it to add side
effects. After the commit the block with the wanted side effects ended
up incorrectly marked as a Boolean constant and susequently gen_and()
started to discard it.
In gen_cond() take an optional list of side effect instructions and make
a Boolean constant block a specific case of a block with a degenerate
branch statement. Switch gen_geneve() and gen_vxlan() from gen_true()
to gen_uncond() to reduce the violation of layers. Restore the six
previously affected tests exactly as they were before.1 parent 730a8db commit d0d58d9
2 files changed
+352
-214
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
660 | | - | |
| 660 | + | |
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
| |||
2526 | 2526 | | |
2527 | 2527 | | |
2528 | 2528 | | |
2529 | | - | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
2530 | 2536 | | |
2531 | | - | |
| 2537 | + | |
2532 | 2538 | | |
2533 | 2539 | | |
2534 | 2540 | | |
2535 | 2541 | | |
2536 | 2542 | | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
2537 | 2547 | | |
2538 | | - | |
| 2548 | + | |
| 2549 | + | |
2539 | 2550 | | |
2540 | 2551 | | |
2541 | 2552 | | |
2542 | 2553 | | |
2543 | 2554 | | |
2544 | 2555 | | |
2545 | | - | |
| 2556 | + | |
2546 | 2557 | | |
2547 | 2558 | | |
2548 | 2559 | | |
2549 | 2560 | | |
2550 | 2561 | | |
2551 | | - | |
| 2562 | + | |
2552 | 2563 | | |
2553 | 2564 | | |
2554 | 2565 | | |
| |||
9123 | 9134 | | |
9124 | 9135 | | |
9125 | 9136 | | |
9126 | | - | |
9127 | | - | |
9128 | | - | |
| 9137 | + | |
9129 | 9138 | | |
9130 | 9139 | | |
9131 | 9140 | | |
| |||
9313 | 9322 | | |
9314 | 9323 | | |
9315 | 9324 | | |
9316 | | - | |
9317 | | - | |
9318 | | - | |
| 9325 | + | |
9319 | 9326 | | |
9320 | 9327 | | |
9321 | 9328 | | |
| |||
0 commit comments