From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter =?utf-8?q?M=C3=BCller?= To: development@lists.ipfire.org Subject: Re: [PATCH 2/9] suricata: Rename MARK/MASK to REPEAT_MARK/REPEAT_MASK Date: Mon, 18 Oct 2021 22:42:52 +0200 Message-ID: In-Reply-To: <20211018101022.15448-2-michael.tremer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3553248854579451590==" List-Id: --===============3553248854579451590== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Reviewed-by: Peter M=C3=BCller > This should avoid confusion when we add more marks >=20 > Signed-off-by: Michael Tremer > --- > src/initscripts/system/suricata | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) >=20 > diff --git a/src/initscripts/system/suricata b/src/initscripts/system/suric= ata > index e327225d7..111bd9df3 100644 > --- a/src/initscripts/system/suricata > +++ b/src/initscripts/system/suricata > @@ -35,8 +35,8 @@ network_zones=3D( red green blue orange ovpn ) > enabled_ips_zones=3D() > =20 > # Mark and Mask options. > -MARK=3D"0x80000000" > -MASK=3D"0x80000000" > +REPEAT_MARK=3D"0x80000000" > +REPEAT_MASK=3D"0x80000000" > =20 > # PID file of suricata. > PID_FILE=3D"/var/run/suricata.pid" > @@ -137,19 +137,19 @@ function generate_fw_rules { > # Loop through the array and create firewall rules. > for enabled_ips_zone in "${enabled_ips_zones[@]}"; do > # Create rules queue input and output related traffic and pass it to th= e IPS. > - iptables -w -I "$IPS_INPUT_CHAIN" -i "$enabled_ips_zone" -m mark ! --ma= rk "$MARK"/"$MASK" -j NFQUEUE $NFQ_OPTIONS > - iptables -w -I "$IPS_OUTPUT_CHAIN" -o "$enabled_ips_zone" -m mark ! --m= ark "$MARK"/"$MASK" -j NFQUEUE $NFQ_OPTIONS > + iptables -w -I "$IPS_INPUT_CHAIN" -i "$enabled_ips_zone" -m mark ! --ma= rk "${REPEAT_MARK}/${REPEAT_MASK}" -j NFQUEUE $NFQ_OPTIONS > + iptables -w -I "$IPS_OUTPUT_CHAIN" -o "$enabled_ips_zone" -m mark ! --m= ark "${REPEAT_MARK}/${REPEAT_MASK}" -j NFQUEUE $NFQ_OPTIONS > =20 > # Create rules which are required to handle forwarded traffic. > for enabled_ips_zone_forward in "${enabled_ips_zones[@]}"; do > - iptables -w -I "$IPS_FORWARD_CHAIN" -i "$enabled_ips_zone" -o "$enable= d_ips_zone_forward" -m mark ! --mark "$MARK"/"$MASK" -j NFQUEUE $NFQ_OPTIONS > + iptables -w -I "$IPS_FORWARD_CHAIN" -i "$enabled_ips_zone" -o "$enable= d_ips_zone_forward" -m mark ! --mark "${REPEAT_MARK}/${REPEAT_MASK}" -j NFQUE= UE $NFQ_OPTIONS > done > done > =20 > # Clear repeat bit, so that it does not confuse IPsec or QoS > - iptables -w -A "${IPS_INPUT_CHAIN}" -j MARK --set-xmark "0x0/${MASK}" > - iptables -w -A "${IPS_FORWARD_CHAIN}" -j MARK --set-xmark "0x0/${MASK}" > - iptables -w -A "${IPS_OUTPUT_CHAIN}" -j MARK --set-xmark "0x0/${MASK}" > + iptables -w -A "${IPS_INPUT_CHAIN}" -j MARK --set-xmark "0x0/${REPEAT_MA= SK}" > + iptables -w -A "${IPS_FORWARD_CHAIN}" -j MARK --set-xmark "0x0/${REPEAT_= MASK}" > + iptables -w -A "${IPS_OUTPUT_CHAIN}" -j MARK --set-xmark "0x0/${REPEAT_M= ASK}" > fi > } > =20 >=20 --===============3553248854579451590==--