From f65e6cbd215e99f34d256c6fd5d944b10b82c071 Mon Sep 17 00:00:00 2001 From: NHAS Date: Tue, 2 May 2023 17:04:52 +1200 Subject: [PATCH] Fix rule ordering issue, add test to make sure I dont do that again --- internal/config/test_port_based_rules.json | 16 ++++ .../test_route_restriction_preference.json | 5 ++ internal/router/bpf_bpfeb.o | Bin 9936 -> 9696 bytes internal/router/bpf_bpfel.o | Bin 9848 -> 9776 bytes internal/router/ebpf_test.go | 81 ++++++++++++++++++ internal/router/xdp.c | 10 ++- 6 files changed, 110 insertions(+), 2 deletions(-) diff --git a/internal/config/test_port_based_rules.json b/internal/config/test_port_based_rules.json index d76076b2..3d5e0521 100644 --- a/internal/config/test_port_based_rules.json +++ b/internal/config/test_port_based_rules.json @@ -36,6 +36,22 @@ "6.6.6.6 100-150/tcp", "7.7.7.7 icmp" ] + }, + "tester": { + "Allow": [ + "8.8.8.8 icmp 8080/any", + "9.9.9.9 8081/tcp 80/udp", + "10.10.10.10 8081-9000/tcp icmp", + "11.11.11.11 7777-8888/tcp 90/any" + ] + }, + "randomthingappliedtoall": { + "Allow": [ + "8.8.8.8 8080/any icmp", + "9.9.9.9 80/udp 8081/tcp", + "10.10.10.10 icmp 8081-9000/tcp", + "11.11.11.11 90/any 7777-8888/tcp " + ] } } } diff --git a/internal/config/test_route_restriction_preference.json b/internal/config/test_route_restriction_preference.json index dbb4c98e..0fd4abf7 100644 --- a/internal/config/test_route_restriction_preference.json +++ b/internal/config/test_route_restriction_preference.json @@ -53,6 +53,11 @@ "Mfa": [ "1.1.2.3/32" ] + }, + "test2": { + "Allow": [ + "1.1.2.0/24" + ] } } } diff --git a/internal/router/bpf_bpfeb.o b/internal/router/bpf_bpfeb.o index 3645c640b7779ba9fbfe113a81005c13e19055ac..09676b1048c497fa014aff4f1060e537a0422b9e 100644 GIT binary patch literal 9696 zcmbtZZ)_Y#6`wu({y3z~rA@$T({`Pf^z78`#c`_8*6t;Z+eC8WBe9jVqFP_?*7lO~ z{dZzFDO{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&g5UWXi4Fw^P-7<{P^VNbV46eHgadP zxkD#~mLFsxksF4bBGv8JVAx((ILjSWl$JM4u@J5ig9!3L}&kUrL>%6T5gW}UqenSr`zAa zuzl1V_b-N=R!+BHf?<1kLTmZ!%W`>AYdQUZrtOzxV6rGNsOlQ3UYv!zk)`z84>h7) zhFl6+evcs^Uq&~&ii1fKR0>elYiZCipe(-jguBmSvYNBT1R@a>ox_( z#M2g@vG5fO&slih!V4B&tj98q#`sR$(z_N;SU73nl!en4E?IcW!qXO>vG5fO&slih z!V4B&tjDqpjroV-mfp2+!oo=lr!1VdaLK|`7M`~7jD@dQc+SG}7GALMVm+4I-og1Q579!Ki{!$;6Mif`HA-lpMv^Zk~+~Z{Pu79q9dO_HR{ptM))Iv@m*_u zZCc-=9r!^4KNX3N%H*h|9FyqVw=d!Cd{oihihMo%o~jr-<<3~26V YGxPU-D6DnYrke*8=j_oErc3?*2lUUu4FCWD diff --git a/internal/router/bpf_bpfel.o b/internal/router/bpf_bpfel.o index 3e8794d3d2d94bf45593ca9cf62f1e0906f439d9..60aa8ff1633abc832b0ac289ebdfd42fc9fbb02a 100644 GIT binary patch literal 9776 zcmbtaeQZ?65np5MJCm5tTmzIO&p^o8V8<8-kq?L=A%x1o7GOcDR?nBaXZwlseH&~b ztqY`~ZT@ijp`uh(oTzPx8mYAX1FELARjCTCQpv5_idKPpW$znR(Dnc3OBw+}wQxAU<@RaMHgD)lclhYVM#ne}sYhbB8zJv1*bVt%se zomrxiP1Dl9rTfdZO501UT&xunD_DPG759;9rEUY+yy0!l$P51n_%q=2R8Ol8^!eNB zwEQx6>evfxKl!P5^*s5Q7OVamrO2ft=pRCF=2>=#<;@%ZsEOF(TJ2YCaa6%Y)w6i1 zBG)F`SuX;2qad3%PH9Gs)>4Z6)%*>=5q?DX_Bb8S#$RcEct0oT*bAJWuuZeou_pFE zvGP{UNH$&5aU^bE&iEwfapGmxkHE~e+1c6E&f+`+F|j7dDYTv_C&(T*{V~SHqCeK- z!&k+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KUt}+8N88rP8eSWwvbWR z4Gt6E6b|fnXrAW$C}cH1iI;Wxm=%n@O5RN2jxSiPI$u)Y&%$MTdoM|q`dCAm-ZrNE zcOpl4n+eA%`X8sTG1FZlKX1w3(@JGJEKL1}MZcDo*G&J_P^RWB`9DOCjEiM46MuH5aV`0Ov{IQ~CR6`!BJZQ+G1H$#j%72`n{Voys7b z7Ef6`WAUuTa~98AY#e1g|D~gi=WlV$Vq8yxg!PJBjO$8}^!i&oZt;Z0lNL`|JY(^! z#d8+VTda)dBJ9I;Do9{lr-B5=bt*{U4vXU!PljF#{Vep;(8bWtL#naljh0kn!Am#p z?|G&Xpx^QC@Gcmh`gmnDw~?TziH>!;+oAKW{F zM$k1AVr{kdGtxe1DpT3E|Dv?F)Kp9i4dIVoMzY7p-?MBP)SF-!r9LC>!M5&?NM;

", iphdr.Dst.String(), ", proto "+pkt.String()) + + if value != XDP_PASS { + + t.Fatalf("program did not XDP_PASS packet instead did: %s", result(value)) + } + } +} + func TestLookupDifferentKeyTypesInMap(t *testing.T) { if err := setup("../config/test_port_based_rules.json"); err != nil { t.Fatal(err) diff --git a/internal/router/xdp.c b/internal/router/xdp.c index 81ba4df9..47cfa1a7 100644 --- a/internal/router/xdp.c +++ b/internal/router/xdp.c @@ -546,12 +546,18 @@ static __always_inline int conntrack(struct ip *ip_info) if (policy.policy_type & SINGLE) { - return (policy.lower_port == 0 || policy.lower_port == port); + if (policy.lower_port == 0 || policy.lower_port == port) + { + return 1; + } } if (policy.policy_type & RANGE) { - return (policy.lower_port <= port && policy.upper_port >= port); + if (policy.lower_port <= port && policy.upper_port >= port) + { + return 1; + } } } }