All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Cc: Jan Engelhardt <jengelh@medozas.de>,
	Tom Eastep <teastep@shorewall.net>,
	Netfilter Developer Mailing List
	<netfilter-devel@vger.kernel.org>,
	Steven Jan Springl <steven@springl.ukfsn.org>
Subject: Re: Possible iptables 4.4.11 issues
Date: Tue, 31 May 2011 11:53:26 +0200	[thread overview]
Message-ID: <4DE4BA96.3070603@netfilter.org> (raw)
In-Reply-To: <BANLkTikKCG1O3MPY66J1omnOQF+QPf-NJw@mail.gmail.com>

On 31/05/11 11:51, Maciej Żenczykowski wrote:
>>>> -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.

makes sense, thanks for the clarification.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2011-05-31  9:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-29 14:33 Possible iptables 4.4.11 issues Tom Eastep
2011-05-29 14:43 ` Tom Eastep
2011-05-29 14:48 ` Jan Engelhardt
2011-05-29 14:52   ` Tom Eastep
2011-05-31  9:42   ` Pablo Neira Ayuso
2011-05-31  9:51     ` Maciej Żenczykowski
2011-05-31  9:53       ` Pablo Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DE4BA96.3070603@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=jengelh@medozas.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=steven@springl.ukfsn.org \
    --cc=teastep@shorewall.net \
    --cc=zenczykowski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.