Possible iptables 4.4.11 issues
One of the Shorewall Beta testers just installed iptables 1.4.11 and is seeing a couple of anomalies. Before I run off and change Shorewall, I would like to confirm that these are intentional changes in iptables behavior and not bugs:
-------- Original Message --------
Subject: Re: [Shorewall-devel] Shorewall 4.4.20 Beta 5
Date: Sun, 29 May 2011 15:01:09 +0100
From: Steven Jan Springl <[email protected]>
Reply-To: [email protected]
To: [email protected]
Using kernel 2.6.39, iptables 1.4.10 and xtables-addons 1.35
The following rules file entry:
ACCEPT $FW lan tcp 22 - - - !root:root
produces the following iptables rule:
-A fw2lan -p 6 --dport 22 -m owner ! --uid-owner root ! --gid-owner root -j ACCEPT
Which works.
After upgrading iptables to 1.4.11 the following iptables-restore error is produced:
iptables-restore v1.4.11: owner: option "--uid-owner" cannot be inverted.
The following tcrules file entry:
IPMARK(dst,-1,-64) $FW eth1 tcp 888
produces the following iptables rule:
-A OUTPUT -p 6 --dport 888 -o eth1 -j IPMARK --addr dst --and-mask -1 --or-mask -64 --shift 0
Which works.
After upgrading to iptables 1.4.11 the following iptables-restore error is produced:
iptables-restore v1.4.11: IPMARK: Bad value for "and-mask" option: "-1"
---------------------------------
Thanks,
-Tom
Quoted 4 lines · Tom Eastep
One of the Shorewall Beta testers just installed iptables 1.4.11 and is seeing a couple of anomalies. Before I run off and change Shorewall, I would like to confirm that these are intentional changes in iptables behavior and not bugs:
...
Quoted 5 lines
IPMARK(dst,-1,-64)$FW eth1 tcp 888produces the following iptables rule:
Quoted 8 lines
-A OUTPUT -p 6 --dport 888 -o eth1 -j IPMARK --addr dst --and-mask -1 --or-mask -64 --shift 0
Which works.
After upgrading to iptables 1.4.11 the following iptables-restore error is produced:iptables-restore v1.4.11: IPMARK: Bad value for "and-mask" option: "-1"
I apologize for responding to my own post, but this one looks like inadequate edited by Shorewall. So this one is mine.
-Tom
Signature · 4 lines
Tom Eastep \ When I die, I want to go like my Grandfather who Shoreline, \ died peacefully in his sleep. Not screaming like Washington, USA \ all of the passengers in his car http://shorewall.net \________________________________________________
Quoted 4 lines · Tom Eastep
After upgrading iptables to 1.4.11 the following iptables-restore error is produced:
iptables-restore v1.4.11: owner: option "--uid-owner" cannot be inverted.
Bug, fix will be submitted.
Quoted 6 lines
-A OUTPUT -p 6 --dport 888 -o eth1 -j IPMARK --addr
dst --and-mask -1 --or-mask -64 --shift 0
After upgrading to iptables 1.4.11 the following iptables-restore error is produced:iptables-restore v1.4.11: IPMARK: Bad value for "and-mask" option: "-1"
This is intentional. Bitwise operations work best when fed unsigned numbers only.
Quoted 15 lines · Jan Engelhardt
Quoted 4 lines · Tom Eastep
After upgrading iptables to 1.4.11 the following iptables-restore error is produced:
iptables-restore v1.4.11: owner: option "--uid-owner" cannot be inverted.
Bug, fix will be submitted.
Quoted 5 lines
-A OUTPUT -p 6 --dport 888 -o eth1 -j IPMARK --addr
dst --and-mask -1 --or-mask -64 --shift 0
After upgrading to iptables 1.4.11 the following iptables-restore error is produced:
Quoted 4 lines
Quoted 1 line
iptables-restore v1.4.11: IPMARK: Bad value for "and-mask" option: "-1"
This is intentional. Bitwise operations work best when fed unsigned numbers only.
Thanks, Jan -- I've sent Steven a Shorewall patch for this one.
-Tom
Signature · 4 lines
Tom Eastep \ When I die, I want to go like my Grandfather who Shoreline, \ died peacefully in his sleep. Not screaming like Washington, USA \ all of the passengers in his car http://shorewall.net \________________________________________________
Pablo Neira Ayuso
maintainerQuoted 14 lines · Jan Engelhardt
Quoted 4 lines · Tom Eastep
After upgrading iptables to 1.4.11 the following iptables-restore error is produced:
iptables-restore v1.4.11: owner: option "--uid-owner" cannot be inverted.
Bug, fix will be submitted.
Quoted 5 lines
-A OUTPUT -p 6 --dport 888 -o eth1 -j IPMARK --addr
dst --and-mask -1 --or-mask -64 --shift 0
After upgrading to iptables 1.4.11 the following iptables-restore error is produced:
Quoted 4 lines
Quoted 1 line
iptables-restore v1.4.11: IPMARK: Bad value for "and-mask" option: "-1"
This is intentional. Bitwise operations work best when fed unsigned numbers only.
but this used to work, we shouldn't break this sort of things Jan.
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
-A OUTPUT -p 6 --dport 888 -o eth1 -j IPMARK --addr
dst --and-mask -1 --or-mask -64 --shift 0
After upgrading to iptables 1.4.11 the following iptables-restore error is produced:iptables-restore v1.4.11: IPMARK: Bad value for "and-mask" option: "-1"
This is intentional. Bitwise operations work best when fed unsigned numbers only.
but this used to work, we shouldn't break this sort of things Jan.
Assuming 2's complement arithmetic, an --and-mask of -1 should be a no-op (since -1 is all 1's in binary)
However when reading --and-mask -1 my first gut instinct is that this is --and-mask ~1 and is thus clears the least significant bit. I also instinctively incorrectly assume --or-mask -64 sets all but bit 6, when it is actually setting all but the bottom 6 bits (ie. bits 0 through 5)...
To me this sort of lack of clarity is undesirable, and I can certainly understand the desire to disable masks with negative integers.
-- Maciej
Pablo Neira Ayuso
maintainerQuoted 15 lines · Maciej Żenczykowski
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
-A OUTPUT -p 6 --dport 888 -o eth1 -j IPMARK --addr
dst --and-mask -1 --or-mask -64 --shift 0
After upgrading to iptables 1.4.11 the following iptables-restore error is produced:iptables-restore v1.4.11: IPMARK: Bad value for "and-mask" option: "-1"
This is intentional. Bitwise operations work best when fed unsigned numbers only.
but this used to work, we shouldn't break this sort of things Jan.
Assuming 2's complement arithmetic, an --and-mask of -1 should be a no-op (since -1 is all 1's in binary)
Quoted 8 lines
However when reading --and-mask -1 my first gut instinct is that this is --and-mask ~1 and is thus clears the least significant bit. I also instinctively incorrectly assume --or-mask -64 sets all but bit 6, when it is actually setting all but the bottom 6 bits (ie. bits 0 through 5)...
To me this sort of lack of clarity is undesirable, and I can certainly understand the desire to disable masks with negative integers.
makes sense, thanks for the clarification.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html