* How to use mark and connmark in one rule
@ 2009-04-24 13:32 Tino Keitel
2009-04-24 13:37 ` Brian Austin - Standard Universal
2009-04-24 13:40 ` Gáspár Lajos
0 siblings, 2 replies; 12+ messages in thread
From: Tino Keitel @ 2009-04-24 13:32 UTC (permalink / raw)
To: netfilter
Hi folks,
when I try to use the mark and connmark extensions in one rule, I get
an error:
$ iptables -A INPUT -m mark --mark 1 -m connmark --mark 2
iptables v1.4.2: mark: "--mark" option may only be specified once
Is this intended? If not, is there a way to make this work with a stock
iptables, or do I have to patch the source and rename one of the
options?
Regards,
--
Tino Keitel
Software Engineer
Innominate Security Technologies AG
/protecting industrial networks/
Tel: +49.30.921028-206
Fax: +49.30.921028-020
Rudower Chaussee 13
12489 Berlin / Germany
http://www.innominate.com/
Register Court: AG Charlottenburg, HRB 81603 Management Board: Dirk
Seewald, Chairman of the Supervisory Board: Volker Bibelhausen
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 13:32 How to use mark and connmark in one rule Tino Keitel
@ 2009-04-24 13:37 ` Brian Austin - Standard Universal
2009-04-24 13:39 ` Brian Austin - Standard Universal
2009-04-24 13:40 ` Gáspár Lajos
1 sibling, 1 reply; 12+ messages in thread
From: Brian Austin - Standard Universal @ 2009-04-24 13:37 UTC (permalink / raw)
To: Tino Keitel; +Cc: netfilter
to do this would be faster than patching and etc..
iptables -A INPUT -m mark --mark 1
iptables -A INPUT -m connmark --mark 2
regards
Brian
Tino Keitel wrote:
> Hi folks,
>
> when I try to use the mark and connmark extensions in one rule, I get
> an error:
>
> $ iptables -A INPUT -m mark --mark 1 -m connmark --mark 2
> iptables v1.4.2: mark: "--mark" option may only be specified once
>
> Is this intended? If not, is there a way to make this work with a stock
> iptables, or do I have to patch the source and rename one of the
> options?
>
> Regards,
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 13:37 ` Brian Austin - Standard Universal
@ 2009-04-24 13:39 ` Brian Austin - Standard Universal
2009-05-12 13:00 ` Tino Keitel
0 siblings, 1 reply; 12+ messages in thread
From: Brian Austin - Standard Universal @ 2009-04-24 13:39 UTC (permalink / raw)
To: Tino Keitel; +Cc: netfilter
that should be 2 separate lines.. stupid email
iptables -A INPUT -m mark --mark 1
iptables -A INPUT -m connmark --mark 2
Brian Austin - Standard Universal wrote:
> to do this would be faster than patching and etc..
>
> iptables -A INPUT -m mark --mark 1 iptables -A INPUT -m connmark --mark 2
>
> regards
>
> Brian
>
>
> Tino Keitel wrote:
>> Hi folks,
>>
>> when I try to use the mark and connmark extensions in one rule, I get
>> an error:
>>
>> $ iptables -A INPUT -m mark --mark 1 -m connmark --mark 2
>> iptables v1.4.2: mark: "--mark" option may only be specified once
>>
>> Is this intended? If not, is there a way to make this work with a stock
>> iptables, or do I have to patch the source and rename one of the
>> options?
>>
>> Regards,
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 13:32 How to use mark and connmark in one rule Tino Keitel
2009-04-24 13:37 ` Brian Austin - Standard Universal
@ 2009-04-24 13:40 ` Gáspár Lajos
2009-04-24 13:49 ` Tino Keitel
2009-04-24 14:46 ` Pascal Hambourg
1 sibling, 2 replies; 12+ messages in thread
From: Gáspár Lajos @ 2009-04-24 13:40 UTC (permalink / raw)
To: Tino Keitel; +Cc: netfilter
Hi!
Tino Keitel írta:
> $ iptables -A INPUT -m mark --mark 1 -m connmark --mark 2
> iptables v1.4.2: mark: "--mark" option may only be specified once
>
> Is this intended? If not, is there a way to make this work with a stock
> iptables, or do I have to patch the source and rename one of the
> options?
>
If you want then rename one of the options...
The problem is that both connmark and mark have a --mark option...
But you may check the manual... :D --save-mark may be your friend...
Swifty
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 13:40 ` Gáspár Lajos
@ 2009-04-24 13:49 ` Tino Keitel
2009-04-24 13:55 ` Gáspár Lajos
2009-04-24 14:46 ` Pascal Hambourg
1 sibling, 1 reply; 12+ messages in thread
From: Tino Keitel @ 2009-04-24 13:49 UTC (permalink / raw)
To: netfilter
On Fri, Apr 24, 2009 at 15:40:53 +0200, Gáspár Lajos wrote:
> Hi!
>
> Tino Keitel írta:
>> $ iptables -A INPUT -m mark --mark 1 -m connmark --mark 2
>> iptables v1.4.2: mark: "--mark" option may only be specified once
>>
>> Is this intended? If not, is there a way to make this work with a stock
>> iptables, or do I have to patch the source and rename one of the
>> options?
>>
> If you want then rename one of the options...
> The problem is that both connmark and mark have a --mark option...
Yes, that's why I renamed the connmark parameter to --conmark to make
it work. But I want to be sure that I don't break something (except for
all scripts that use -m connmark --mark), or if there is a way to even
make this work without patching.
> But you may check the manual... :D --save-mark may be your friend...
Not in this case.
Regards,
Tino
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 13:49 ` Tino Keitel
@ 2009-04-24 13:55 ` Gáspár Lajos
2009-05-12 13:01 ` Tino Keitel
0 siblings, 1 reply; 12+ messages in thread
From: Gáspár Lajos @ 2009-04-24 13:55 UTC (permalink / raw)
To: Tino Keitel; +Cc: netfilter
Tino Keitel írta:
>> If you want then rename one of the options...
>> The problem is that both connmark and mark have a --mark option...
>>
>
> Yes, that's why I renamed the connmark parameter to --conmark to make
> it work. But I want to be sure that I don't break something (except for
> all scripts that use -m connmark --mark), or if there is a way to even
> make this work without patching.
>
>
I think that you won't break anything... just those scripts...
>> But you may check the manual... :D --save-mark may be your friend...
>>
>
> Not in this case.
>
>
Why not?
Swifty
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 13:40 ` Gáspár Lajos
2009-04-24 13:49 ` Tino Keitel
@ 2009-04-24 14:46 ` Pascal Hambourg
2009-04-24 16:15 ` Gáspár Lajos
1 sibling, 1 reply; 12+ messages in thread
From: Pascal Hambourg @ 2009-04-24 14:46 UTC (permalink / raw)
To: Gáspár Lajos; +Cc: netfilter
Hello,
Gáspár Lajos a écrit :
>
> Tino Keitel írta:
>> $ iptables -A INPUT -m mark --mark 1 -m connmark --mark 2
>> iptables v1.4.2: mark: "--mark" option may only be specified once
>>
>> Is this intended? If not, is there a way to make this work with a stock
>> iptables, or do I have to patch the source and rename one of the
>> options?
>>
> If you want then rename one of the options...
> The problem is that both connmark and mark have a --mark option...
I just wonder why a match looks for options beyond the next -m which
starts a new match.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 14:46 ` Pascal Hambourg
@ 2009-04-24 16:15 ` Gáspár Lajos
2009-04-24 19:13 ` Pascal Hambourg
0 siblings, 1 reply; 12+ messages in thread
From: Gáspár Lajos @ 2009-04-24 16:15 UTC (permalink / raw)
To: Pascal Hambourg; +Cc: netfilter
Pascal Hambourg írta:
>> The problem is that both connmark and mark have a --mark option...
>
> I just wonder why a match looks for options beyond the next -m which
> starts a new match.
Maybe I am wrong, but as I know the iptables GIVES the options to the
match...
So there is no command line parsing/looking for options by the match...
I think it is happens like this:
1. iptables checks the command line for matches and loads them,
2. every match registers its "extra_opts" in an internal table, (this
time connmark and mark registers the same "mark" option.)
3. iptables checks the remaining command line options against the table.
4. if the option found in the table then the match will decide the
option's fate (with the "parse" callback function).
The first registered match having "mark" option gets called every time a
"mark" found in the command line.
And because this option is not allowed twice the match gives an error
message.
Swifty
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 16:15 ` Gáspár Lajos
@ 2009-04-24 19:13 ` Pascal Hambourg
0 siblings, 0 replies; 12+ messages in thread
From: Pascal Hambourg @ 2009-04-24 19:13 UTC (permalink / raw)
To: Gáspár Lajos; +Cc: netfilter
Gáspár Lajos a écrit :
>
> I think it is happens like this:
> 1. iptables checks the command line for matches and loads them,
> 2. every match registers its "extra_opts" in an internal table, (this
> time connmark and mark registers the same "mark" option.)
> 3. iptables checks the remaining command line options against the table.
> 4. if the option found in the table then the match will decide the
> option's fate (with the "parse" callback function).
Well, then I rephrase : why does iptables pass to the match options
which are beyond the next -m ? It seems obvious to me that those options
belong to the next matches. Is it an accepted practice to order matches
and options randomly ? If yes, then non-exclusive matches should not be
allowed to have the same options.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 13:39 ` Brian Austin - Standard Universal
@ 2009-05-12 13:00 ` Tino Keitel
2009-05-12 13:13 ` Pascal Hambourg
0 siblings, 1 reply; 12+ messages in thread
From: Tino Keitel @ 2009-05-12 13:00 UTC (permalink / raw)
To: netfilter
On Fri, Apr 24, 2009 at 23:39:44 +1000, Brian Austin - Standard Universal wrote:
> that should be 2 separate lines.. stupid email
>
> iptables -A INPUT -m mark --mark 1
>
> iptables -A INPUT -m connmark --mark 2
I want to match packets with both a specific nfmark _and_ a specific
connmark, so I need both matches in one rule.
Regards,
--
Tino Keitel
Software Engineer
Innominate Security Technologies AG
/protecting industrial networks/
Tel: +49.30.921028-206
Fax: +49.30.921028-020
Rudower Chaussee 13
12489 Berlin / Germany
http://www.innominate.com/
----------------------------------------------------------------
Visit us at the Hannover Messe in Germany
20 - 24 April 2009, Hall 9, Stand F54
----------------------------------------------------------------
Register Court: AG Charlottenburg, HRB 81603 Management Board: Dirk
Seewald, Chairman of the Supervisory Board: Volker Bibelhausen
INNOMINATE HAS MOVED. PLEASE NOTE THAT OUR BUSINESS CONTACT DATA HAS
CHANGED.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-04-24 13:55 ` Gáspár Lajos
@ 2009-05-12 13:01 ` Tino Keitel
0 siblings, 0 replies; 12+ messages in thread
From: Tino Keitel @ 2009-05-12 13:01 UTC (permalink / raw)
To: netfilter
On Fri, Apr 24, 2009 at 15:55:42 +0200, Gáspár Lajos wrote:
> Tino Keitel írta:
>>> If you want then rename one of the options...
>>> The problem is that both connmark and mark have a --mark option...
>>>
>>
>> Yes, that's why I renamed the connmark parameter to --conmark to make
>> it work. But I want to be sure that I don't break something (except for
>> all scripts that use -m connmark --mark), or if there is a way to even
>> make this work without patching.
>>
>>
> I think that you won't break anything... just those scripts...
Great, thanks.
Regards,
--
Tino Keitel
Software Engineer
Innominate Security Technologies AG
/protecting industrial networks/
Tel: +49.30.921028-206
Fax: +49.30.921028-020
Rudower Chaussee 13
12489 Berlin / Germany
http://www.innominate.com/
----------------------------------------------------------------
Visit us at the Hannover Messe in Germany
20 - 24 April 2009, Hall 9, Stand F54
----------------------------------------------------------------
Register Court: AG Charlottenburg, HRB 81603 Management Board: Dirk
Seewald, Chairman of the Supervisory Board: Volker Bibelhausen
INNOMINATE HAS MOVED. PLEASE NOTE THAT OUR BUSINESS CONTACT DATA HAS
CHANGED.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to use mark and connmark in one rule
2009-05-12 13:00 ` Tino Keitel
@ 2009-05-12 13:13 ` Pascal Hambourg
0 siblings, 0 replies; 12+ messages in thread
From: Pascal Hambourg @ 2009-05-12 13:13 UTC (permalink / raw)
To: netfilter
Tino Keitel a écrit :
> On Fri, Apr 24, 2009 at 23:39:44 +1000, Brian Austin - Standard Universal wrote:
>>
>> iptables -A INPUT -m mark --mark 1
>> iptables -A INPUT -m connmark --mark 2
>
> I want to match packets with both a specific nfmark _and_ a specific
> connmark, so I need both matches in one rule.
Not necessarily. For example with user-defined chains :
iptables -A INPUT -m mark --mark 1 -j mark1
iptables -A mark1 -m connmark --mark 2
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-05-12 13:13 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-24 13:32 How to use mark and connmark in one rule Tino Keitel
2009-04-24 13:37 ` Brian Austin - Standard Universal
2009-04-24 13:39 ` Brian Austin - Standard Universal
2009-05-12 13:00 ` Tino Keitel
2009-05-12 13:13 ` Pascal Hambourg
2009-04-24 13:40 ` Gáspár Lajos
2009-04-24 13:49 ` Tino Keitel
2009-04-24 13:55 ` Gáspár Lajos
2009-05-12 13:01 ` Tino Keitel
2009-04-24 14:46 ` Pascal Hambourg
2009-04-24 16:15 ` Gáspár Lajos
2009-04-24 19:13 ` Pascal Hambourg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox