All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] invert u32 match selector
@ 2006-02-21 16:25 richard lucassen
  2006-02-22  9:43 ` Vaidas
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: richard lucassen @ 2006-02-21 16:25 UTC (permalink / raw)
  To: lartc

Is it possible to negate the "match" to the ip? I want to match all
traffic to dport 80 NOT going to dst 1.2.3.4:

$TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
  match ip protocol 0x6 0xff \
  match ip dport 80 0xffff \
  match ip dst 1.2.3.4/32 \
  classid 1:14

I can't find it in the docs. I tried "!" "\!" and "not" in several
places, but always resulting in a "illegal match".

R.

-- 
___________________________________________________________________
It is better to remain silent and be thought a fool, than to speak
aloud and remove all doubt.

+------------------------------------------------------------------+
| Richard Lucassen, Utrecht                                        |
| Public key and email address:                                    |
| http://www.lucassen.org/mail-pubkey.html                         |
+------------------------------------------------------------------+
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [LARTC] invert u32 match selector
  2006-02-21 16:25 [LARTC] invert u32 match selector richard lucassen
@ 2006-02-22  9:43 ` Vaidas
  2006-02-22 10:35 ` richard lucassen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Vaidas @ 2006-02-22  9:43 UTC (permalink / raw)
  To: lartc

With u32 you cannot negate, that's why it is lame...
Use iptables for marking packets

$TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip handle 14 fw
classid 1:14

Iptables -t mangle -A PREROUTING -p TCP --dport 80 -d ! 1.2.3.4 -j MARK
--set-mark 14

-----Original Message-----
From: lartc-bounces@mailman.ds9a.nl [mailto:lartc-bounces@mailman.ds9a.nl]
On Behalf Of richard lucassen
Sent: 2006 m. vasario 21 d. 18:25
To: lartc@mailman.ds9a.nl
Subject: [LARTC] invert u32 match selector

Is it possible to negate the "match" to the ip? I want to match all
traffic to dport 80 NOT going to dst 1.2.3.4:

$TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
  match ip protocol 0x6 0xff \
  match ip dport 80 0xffff \
  match ip dst 1.2.3.4/32 \
  classid 1:14

I can't find it in the docs. I tried "!" "\!" and "not" in several
places, but always resulting in a "illegal match".

R.

-- 
___________________________________________________________________
It is better to remain silent and be thought a fool, than to speak
aloud and remove all doubt.

+------------------------------------------------------------------+
| Richard Lucassen, Utrecht                                        |
| Public key and email address:                                    |
| http://www.lucassen.org/mail-pubkey.html                         |
+------------------------------------------------------------------+
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc


__________ NOD32 1.1415 (20060221) Information __________

This message was checked by NOD32 antivirus system.
http://www.nod32.com


_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LARTC] invert u32 match selector
  2006-02-21 16:25 [LARTC] invert u32 match selector richard lucassen
  2006-02-22  9:43 ` Vaidas
@ 2006-02-22 10:35 ` richard lucassen
  2006-02-22 11:04 ` Anton Glinkov
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: richard lucassen @ 2006-02-22 10:35 UTC (permalink / raw)
  To: lartc

On Wed, 22 Feb 2006 11:43:40 +0200
"Vaidas" <admin@vdx.lt> wrote:

> With u32 you cannot negate, that's why it is lame...

And why doesn't this work? (I send all port 80 to 1.2.3.4 to class 14
/before/ I send the rest to classid 13):

$TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
  match ip protocol 0x6 0xff \
  match ip dport 80 0xffff \
  match ip dst 1.2.3.4/32 \
  classid 1:14

$TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
  match ip protocol 0x6 0xff \
  match ip dport 80 0xffff \
  classid 1:13

Any ideas?

> Use iptables for marking packets
> 
> $TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip handle 14
> fw classid 1:14
> 
> Iptables -t mangle -A PREROUTING -p TCP --dport 80 -d ! 1.2.3.4 -j
> MARK --set-mark 14

Ok, thnx. That's of course a solution, but I just wondered if this were
possible with u32...

R.

-- 
___________________________________________________________________
It is better to remain silent and be thought a fool, than to speak
aloud and remove all doubt.

+------------------------------------------------------------------+
| Richard Lucassen, Utrecht                                        |
| Public key and email address:                                    |
| http://www.lucassen.org/mail-pubkey.html                         |
+------------------------------------------------------------------+
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LARTC] invert u32 match selector
  2006-02-21 16:25 [LARTC] invert u32 match selector richard lucassen
  2006-02-22  9:43 ` Vaidas
  2006-02-22 10:35 ` richard lucassen
@ 2006-02-22 11:04 ` Anton Glinkov
  2006-02-25 16:04 ` Andy Furniss
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Anton Glinkov @ 2006-02-22 11:04 UTC (permalink / raw)
  To: lartc

You should change the prios. The first filter should have a lower prio
number than the second. That means that it is processed first and whatever
is not matched by it is passed on to filters with higher prio number.

> On Wed, 22 Feb 2006 11:43:40 +0200
> "Vaidas" <admin@vdx.lt> wrote:
>
>> With u32 you cannot negate, that's why it is lame...
>
> And why doesn't this work? (I send all port 80 to 1.2.3.4 to class 14
> /before/ I send the rest to classid 13):
>
> $TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
>   match ip protocol 0x6 0xff \
>   match ip dport 80 0xffff \
>   match ip dst 1.2.3.4/32 \
>   classid 1:14
>
> $TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
>   match ip protocol 0x6 0xff \
>   match ip dport 80 0xffff \
>   classid 1:13
>
> Any ideas?
>
>> Use iptables for marking packets
>>
>> $TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip handle 14
>> fw classid 1:14
>>
>> Iptables -t mangle -A PREROUTING -p TCP --dport 80 -d ! 1.2.3.4 -j
>> MARK --set-mark 14
>
> Ok, thnx. That's of course a solution, but I just wondered if this were
> possible with u32...
>
> R.
>
> --
> ___________________________________________________________________
> It is better to remain silent and be thought a fool, than to speak
> aloud and remove all doubt.
>
> +------------------------------------------------------------------+
> | Richard Lucassen, Utrecht                                        |
> | Public key and email address:                                    |
> | http://www.lucassen.org/mail-pubkey.html                         |
> +------------------------------------------------------------------+
> _______________________________________________
> LARTC mailing list
> LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
>


-- 
Anton Glinkov
network administrator

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LARTC] invert u32 match selector
  2006-02-21 16:25 [LARTC] invert u32 match selector richard lucassen
                   ` (2 preceding siblings ...)
  2006-02-22 11:04 ` Anton Glinkov
@ 2006-02-25 16:04 ` Andy Furniss
  2006-02-26 17:38 ` richard lucassen
  2006-03-01 15:01 ` Andy Furniss
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Furniss @ 2006-02-25 16:04 UTC (permalink / raw)
  To: lartc

richard lucassen wrote:
> On Wed, 22 Feb 2006 11:43:40 +0200
> "Vaidas" <admin@vdx.lt> wrote:
> 
> 
>>With u32 you cannot negate, that's why it is lame...
> 
> 
> And why doesn't this work? (I send all port 80 to 1.2.3.4 to class 14
> /before/ I send the rest to classid 13):
> 
> $TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
>   match ip protocol 0x6 0xff \
>   match ip dport 80 0xffff \
>   match ip dst 1.2.3.4/32 \
>   classid 1:14
> 
> $TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
>   match ip protocol 0x6 0xff \
>   match ip dport 80 0xffff \
>   classid 1:13
> 
> Any ideas?

Looks OK to me - try what Anton suggested to be safe but order is 
usually enough.

I guess IFB means this is ingress - if you are doing nat / or the ip you 
  match is on that machine maybe it not passing ifb with the address you 
expect.

Andy.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LARTC] invert u32 match selector
  2006-02-21 16:25 [LARTC] invert u32 match selector richard lucassen
                   ` (3 preceding siblings ...)
  2006-02-25 16:04 ` Andy Furniss
@ 2006-02-26 17:38 ` richard lucassen
  2006-03-01 15:01 ` Andy Furniss
  5 siblings, 0 replies; 7+ messages in thread
From: richard lucassen @ 2006-02-26 17:38 UTC (permalink / raw)
  To: lartc

On Sat, 25 Feb 2006 16:04:06 +0000
Andy Furniss <andy.furniss@dsl.pipex.com> wrote:

> > And why doesn't this work? (I send all port 80 to 1.2.3.4 to class
> > 14 /before/ I send the rest to classid 13):
> > 
> > $TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
> >   match ip protocol 0x6 0xff \
> >   match ip dport 80 0xffff \
> >   match ip dst 1.2.3.4/32 \
> >   classid 1:14
> > 
> > $TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \
> >   match ip protocol 0x6 0xff \
> >   match ip dport 80 0xffff \
> >   classid 1:13
> > 
> > Any ideas?
> 
> Looks OK to me - try what Anton suggested to be safe but order is 
> usually enough.

ok, thnx.
 
> I guess IFB means this is ingress - if you are doing nat / or the ip
> you match is on that machine maybe it not passing ifb with the address
> you expect.

Hmm, I don't think so because the ip is the machine itself and it won't
be translated...

R.

-- 
___________________________________________________________________
It is better to remain silent and be thought a fool, than to speak
aloud and remove all doubt.

+------------------------------------------------------------------+
| Richard Lucassen, Utrecht                                        |
| Public key and email address:                                    |
| http://www.lucassen.org/mail-pubkey.html                         |
+------------------------------------------------------------------+
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LARTC] invert u32 match selector
  2006-02-21 16:25 [LARTC] invert u32 match selector richard lucassen
                   ` (4 preceding siblings ...)
  2006-02-26 17:38 ` richard lucassen
@ 2006-03-01 15:01 ` Andy Furniss
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Furniss @ 2006-03-01 15:01 UTC (permalink / raw)
  To: lartc

richard lucassen wrote:

>>I guess IFB means this is ingress - if you are doing nat / or the ip
>>you match is on that machine maybe it not passing ifb with the address
>>you expect.
> 
> 
> Hmm, I don't think so because the ip is the machine itself and it won't
> be translated...

Yes it should still have the interface address of the device it came in 
on - are you sure the packets are getting to ifb alright?

Andy.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-03-01 15:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-21 16:25 [LARTC] invert u32 match selector richard lucassen
2006-02-22  9:43 ` Vaidas
2006-02-22 10:35 ` richard lucassen
2006-02-22 11:04 ` Anton Glinkov
2006-02-25 16:04 ` Andy Furniss
2006-02-26 17:38 ` richard lucassen
2006-03-01 15:01 ` Andy Furniss

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.