netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Holler <holler@ahsoftware.de>
To: netfilter-devel@vger.kernel.org
Cc: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>,
	Eric Leblond <eric@regit.org>
Subject: Re: [PATCH] parser: add kludges for "param-problem" and "redirect"
Date: Sat, 04 Apr 2015 12:50:57 +0200	[thread overview]
Message-ID: <551FC211.6000907@ahsoftware.de> (raw)
In-Reply-To: <551ED696.4070001@ahsoftware.de>

Am 03.04.2015 um 20:06 schrieb Alexander Holler:
> Am 03.04.2015 um 19:50 schrieb Alexander Holler:
>> Context sensitive handling of "param-problem" and "redirect" is necessary
>> to allow usage of them as token or as string for icmp types.
>>
>> Without this patch, e.g. the following fails:
>>
>> nft add rule filter input icmp type redirect accept
>> nft add rule filter input icmpv6 type param-problem accept
>>
>> Signed-off-by: Alexander Holler <holler@ahsoftware.de>
>> ---
>
> Just in case of, I have not tested this extensively.
>
> So please be careful with that patch and review it.
>
> E.g. I'm not sure if I might have forgotten to set icmp_flag = 0 in
> another desctructor than those two I've added it too because I haven't
> tested rules which are using "redirect" or param-problem as token and
> not just as string to describe an icmp type as in the above two statements.

Also I'm soliloquizing, here is an update.

Having had a second look at the parser, I think I indeed have forgotten 
a desctructor and this one should be changed too:

-%destructor { stmt_free($$); } reject_stmt reject_stmt_alloc
+%destructor { stmt_free($$); icmp_flag = 0; }  reject_stmt 
reject_stmt_alloc

I've now also written a small test-script which revealed an error in my 
kludges:

-- test-kludges.nft --
#!/sbin/nft -f

# small script to test the kludges (context sensitivity) for
# for "redirect" and "param-problem".

flush ruleset

table filter {
         chain input {
                 type filter hook input priority 0;
                 icmp type redirect accept
                 tcp dport 22223 reject with icmp type host-prohibited
         }
}
table ip6 filter {
         chain input {
                 type filter hook input priority 0;
                 icmpv6 type param-problem accept
                 tcp dport 22224 reject with icmpv6 type admin-prohibited
                 # THIS NOW FAILS:
                 #icmpv6 param-problem 2 drop
         }
}
table nat {
         chain prerouting {
                 type nat hook prerouting priority 0;
                 tcp dport 22222 redirect to 22
         }
         chain postrouting {
                 type nat hook postrouting priority 0;
         }
}
-- test-kludges.nft --


I'll already have an idea how to fix that and will post a second version 
of the patch when I've found the time to change and test it.


Regards,

Alexander Holler

  reply	other threads:[~2015-04-04 10:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01  7:58 nft parser and problems with icmp type names (redirect and param-problem) Alexander Holler
2015-04-01 13:15 ` Alexander Holler
2015-04-03 17:50   ` [PATCH] parser: add kludges for "param-problem" and "redirect" Alexander Holler
2015-04-03 18:06     ` Alexander Holler
2015-04-04 10:50       ` Alexander Holler [this message]
2015-04-04 11:13         ` [PATCH v2] " Alexander Holler
2015-04-04 11:55           ` Pablo Neira Ayuso
2015-04-04 12:30             ` Alexander Holler
2015-04-05 11:42               ` Patrick McHardy
2015-04-05 11:32             ` Patrick McHardy
2015-04-05 12:11               ` Patrick McHardy
2015-04-05 19:07                 ` Alexander Holler
2015-04-06  1:51                   ` Patrick McHardy
2015-04-06  8:44                     ` Alexander Holler
2015-04-06  9:01                       ` Alexander Holler
2015-04-06  9:14                         ` Alexander Holler
2015-04-06 11:25                           ` Patrick McHardy
2015-04-06 20:41                             ` Alexander Holler
2015-04-09 10:52                             ` nft parser and names for constants (was [PATCH v2] parser: add kludges for "param-problem" and "redirect") Alexander Holler
2015-04-09 11:07                               ` Patrick McHardy
2015-04-09 17:50                                 ` Alexander Holler
2015-04-09 19:15                                   ` Patrick McHardy
2015-04-10  5:38                                     ` Alexander Holler
2015-04-06  7:12                 ` [PATCH v2] parser: add kludges for "param-problem" and "redirect" Arturo Borrero Gonzalez
2015-04-06 11:23                   ` Patrick McHardy

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=551FC211.6000907@ahsoftware.de \
    --to=holler@ahsoftware.de \
    --cc=arturo.borrero.glez@gmail.com \
    --cc=eric@regit.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).