summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich2022-01-26 10:01:55 +0000
committerJo-Philipp Wich2022-01-26 10:02:51 +0000
commit101988d2ec1fee6d37f57e99e31d37554918447e (patch)
tree5b50f19f0aee4e295415846cdfc7646a9a195e68
parent0bc844ba02ae460d4a895878b9136ba5d8e09b37 (diff)
downloadfirewall4-101988d2ec1fee6d37f57e99e31d37554918447e.tar.gz
fw4: fix family comparisons
The address family of an object might be either `0` or `null` so loosen the checks to accomodate both. Ref: https://github.com/jow-/ucode/commit/aa860a35252b4833a188f8b2f9c6a7d68963767d Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--root/usr/share/ucode/fw4.uc8
1 files changed, 4 insertions, 4 deletions
diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc
index 6973eae..113e4f5 100644
--- a/root/usr/share/ucode/fw4.uc
+++ b/root/usr/share/ucode/fw4.uc
@@ -264,9 +264,9 @@ function ensure_tcpudp(x) {
return false;
}
-let is_family = (x, v) => (x.family == 0 || x.family == v);
-let family_is_ipv4 = (x) => (x.family == 0 || x.family == 4);
-let family_is_ipv6 = (x) => (x.family == 0 || x.family == 6);
+let is_family = (x, v) => (!x.family || x.family == v);
+let family_is_ipv4 = (x) => (!x.family || x.family == 4);
+let family_is_ipv6 = (x) => (!x.family || x.family == 6);
function infer_family(f, objects) {
let res = f;
@@ -277,7 +277,7 @@ function infer_family(f, objects) {
desc = objects[i + 1];
for (let obj in objs) {
- if (!obj || obj.family == 0 || obj.family == res)
+ if (!obj || !obj.family || obj.family == res)
continue;
if (res == 0) {