* Odd use of netmasks - Supported?
@ 2012-10-04 22:07 tlhackque
2012-10-04 23:41 ` Jan Engelhardt
0 siblings, 1 reply; 2+ messages in thread
From: tlhackque @ 2012-10-04 22:07 UTC (permalink / raw)
To: netfilter
I have some very long (thousands of rules) rule chains, which I wish to
shorten by dispatching on part of the address.
Clearly, I can do something like -A FOO -s 2001:db8:1000/36 -j SUBCHAIN-81.
But in IPV6, the high order bits really aren't interesting.
The syntax -A FOO -s 001:c000::0/0f:f000:: (note the leading 1s in the
"netmask") seems to be accepted by iptables, and the rule appears with -L.
I would expect an address to be XORed with the -s address, ANDed with
the mask, and be true if 0. Even though this is an illegal mask for
routing, it's interesting for this.
Rather than experiment and rely on some undocumented behavior, I thought
I should ask:
Is this usage supported (in the sense that it will behave as described
and will continue to do so)? Or is this living dangerously?
Of course, it would be nice to have a chain type that didn't have
sequential evaluation semantics and just dispatched based on netmask and
address... but that's how things might be, not how they are...
(Why ridiculous chain lengths, you ask? Country blocking. But no
philosophical discussions about why this is a bad idea/easy to subvert,
please.)
Thanks.
--
---------------------------------------------------------
This communication may not represent my employer's views,
if any, on the matters discussed.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Odd use of netmasks - Supported?
2012-10-04 22:07 Odd use of netmasks - Supported? tlhackque
@ 2012-10-04 23:41 ` Jan Engelhardt
0 siblings, 0 replies; 2+ messages in thread
From: Jan Engelhardt @ 2012-10-04 23:41 UTC (permalink / raw)
To: tlhackque; +Cc: netfilter
On Friday 2012-10-05 00:07, tlhackque wrote:
>
> The syntax -A FOO -s 001:c000::0/0f:f000:: (note the leading 1s in the
> "netmask") seems to be accepted by iptables, and the rule appears with -L.
Yes, that is officially supported. So all that's lacking is the
mention in iptables.8.
> Of course, it would be nice to have a chain type that didn't have sequential
> evaluation semantics and just dispatched based on netmask and address... but
> that's how things might be, not how they are...
>
> (Why ridiculous chain lengths, you ask? Country blocking. But no
> philosophical discussions about why this is a bad idea/easy to subvert,
> please.)
To match on countries, you can preferably use xt_geoip (space
efficient and reasonably time efficient), or construct
something handmade with ipsets (time efficient but space is
secondary).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-04 23:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-04 22:07 Odd use of netmasks - Supported? tlhackque
2012-10-04 23:41 ` Jan Engelhardt
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.