From: Ludwig Nussel <ludwig.nussel@suse.de>
To: netfilter-devel@lists.netfilter.org
Cc: Harald Welte <laforge@netfilter.org>
Subject: Re: iptables-batch 2nd try
Date: Mon, 9 May 2005 11:45:39 +0200 [thread overview]
Message-ID: <20050509094539.GA12708@suse.de> (raw)
In-Reply-To: <20050509090244.GD30482@sunbeam.de.gnumonks.org>
Harald Welte wrote:
> On Mon, May 09, 2005 at 10:56:03AM +0200, Ludwig Nussel wrote:
> >
> > > My main objective is that the functionality between iptables-restore and
> > > iptables-batch is pretty much the same. I think either a converter
> > > before iptables-restore, or modifications to iptables-restore would be a
> > > better way.
> >
> > There isn't much code to share between iptables-restore and
> > iptables-batch. Although the functionality is similar they work
> > differently.
>
> The question would then rather be: why is there no code share since the
> functionality is similar? ;)
Hmm. Both read a file line by line and split it into words.
iptables-batch then searches for -t to select the correct handle
that is passed to do_command(). Allocation of the handle is left to
do_command(). At EOF (or when reading "commit") it calls
iptc_commit() on each handle. That's it. If you want to flush tables
you have to add "iptables -F" lines yourself.
iptables-restore has a special syntax for manually creating a single
handle, creating chains and set their policy and for setting
counters. One needs to COMMIT before switching to another table. A
global setting determines whether all tables are flushed when a
handle for them is allocated.
So IMHO all that can be shared are some lines initialization
(getenv(), init_extensions()) and maybe the tokenizer. All the other
code would need to be inside a if(batch) {...} else if (restore){...}
cu
Ludwig
--
(o_ Ludwig Nussel
//\ SUSE LINUX Products GmbH, Development
V_/_ http://www.suse.de/
prev parent reply other threads:[~2005-05-09 9:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-21 12:20 iptables-batch 2nd try Ludwig Nussel
2005-04-24 16:21 ` Patrick McHardy
2005-04-27 12:58 ` Ludwig Nussel
2005-05-06 11:41 ` Harald Welte
2005-05-09 8:56 ` Ludwig Nussel
2005-05-09 9:02 ` Harald Welte
2005-05-09 9:45 ` Ludwig Nussel [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=20050509094539.GA12708@suse.de \
--to=ludwig.nussel@suse.de \
--cc=laforge@netfilter.org \
--cc=netfilter-devel@lists.netfilter.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.