From: Patrick McHardy <kaber@trash.net>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: Netfilter Developer Mailing List <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH] Change xt_TOS v1 target to zero-out semantic
Date: Mon, 17 Dec 2007 14:13:15 +0100 [thread overview]
Message-ID: <476675EB.7040103@trash.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0712171407300.32270@fbirervta.pbzchgretzou.qr>
Jan Engelhardt wrote:
> On Dec 17 2007 14:04, Patrick McHardy wrote:
>
>> I'd prefer:
>>
>> --set-tos: set exact value, no mask
>> --or-tos: set single bits
>> --xor-tos: flip single bits
>> --and-tos: mask single bits
>>
>
> Ok, I'll add these. However, since they get transformed to xmark
> internally, they would normally be displayed as
>
> --set-tos value/mask (iptables-save, iptables -nL)
> TOS set value/mask (iptables -L)
>
> Is that ok, or should I figure out some math to transform it back to
> --{or,xor,and}-tos for the human-readable (iptables -L) case?
That would be better. The mark patch I pointer you to some
time ago did this:
+print_mark(unsigned long mark, unsigned long mask, int numeric)
{
- printf("0x%lx ", mark);
+ if (mask == 0)
+ printf("set 0x%lx ", mark);
+ else if (mark == ~mask)
+ printf("or 0x%lx ", mark);
+ else if ((mark & mask) == 0)
+ printf("set 0x%lx/0x%lx ", mark, ~mask);
+ else {
+ if (mask != ~0UL)
+ printf("and 0x%lx ", mask);
+ if (mark)
+ printf("xor 0x%lx ", mark);
+ }
}
which I guess would also work for tos.
prev parent reply other threads:[~2007-12-17 13:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-15 13:48 [PATCH] Change xt_TOS v1 target to zero-out semantic Jan Engelhardt
2007-12-17 13:04 ` Patrick McHardy
2007-12-17 13:09 ` Jan Engelhardt
2007-12-17 13:13 ` Patrick McHardy [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=476675EB.7040103@trash.net \
--to=kaber@trash.net \
--cc=jengelh@computergmbh.de \
--cc=netfilter-devel@vger.kernel.org \
/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.