From 2eb474dd8d301c0d0e391aeebda0495538e85f6d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 12 Nov 2020 21:29:20 -0800 Subject: [PATCH] wgengine/filter: add test cases for len(dsts) > 1. While the code was correct, I broke it during a refactoring and tests didn't detect it. This fixes that glitch. Signed-off-by: David Anderson --- wgengine/filter/filter_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wgengine/filter/filter_test.go b/wgengine/filter/filter_test.go index 33a8d55cc..75403e461 100644 --- a/wgengine/filter/filter_test.go +++ b/wgengine/filter/filter_test.go @@ -54,6 +54,11 @@ func TestFilter(t *testing.T) { {Accept, parsed(packet.TCP, "8.2.2.2", "1.2.3.4", 0, 22)}, {Drop, parsed(packet.TCP, "8.2.2.2", "1.2.3.4", 0, 23)}, {Drop, parsed(packet.TCP, "8.3.3.3", "1.2.3.4", 0, 22)}, + // allow 8.1.1.1 => 5.6.7.8:23-24 + {Accept, parsed(packet.TCP, "8.1.1.1", "5.6.7.8", 0, 23)}, + {Accept, parsed(packet.TCP, "8.1.1.1", "5.6.7.8", 0, 24)}, + {Drop, parsed(packet.TCP, "8.1.1.3", "5.6.7.8", 0, 24)}, + {Drop, parsed(packet.TCP, "8.1.1.1", "5.6.7.8", 0, 22)}, // allow * => *:443 {Accept, parsed(packet.TCP, "17.34.51.68", "8.1.34.51", 0, 443)}, {Drop, parsed(packet.TCP, "17.34.51.68", "8.1.34.51", 0, 444)},