All of lore.kernel.org
 help / color / mirror / Atom feed
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 10:56:03 +0200	[thread overview]
Message-ID: <20050509085603.GA12173@suse.de> (raw)
In-Reply-To: <20050506114151.GJ30482@sunbeam.de.gnumonks.org>

Harald Welte wrote:
> On Wed, Apr 27, 2005 at 02:58:08PM +0200, Ludwig Nussel wrote:
> ...
> > +	fprintf(stderr, "Usage: %s [FILE]\n\n", program_name);
> > +	puts("Read iptables commands from FILE, commit them at EOF\n");
> > +	puts("In addition to normal iptables calls the commands");
> > +	puts("'commit' and 'exit' are understood.");
> > +	exit(0);
> 
> So why don't you put some simple parser/converter in front of
> iptables-restore?  I mean, iptables-restore does pretty much the same,
> just that it expects the input format to be something different than a
> shell script.
> 
> Those differences should be quite easy to convert (probably even in some
> shell or perl script).  Basically all you need to do is to remove the
> "iptables" from the beginning of the command, and add the COMMIT line at
> the end.  Even though "-P" and "-N" are not used.

That was my first approach but the startup costs for perl are too
high. So you'd need to write the converter in e.g. C. But then it
doesn't make much sense to print text that is parsed by
iptables-restore again when you can just do the appropriate calls
yourself. The disadvantage is that you need to build iptables-batch
inside iptables since there doesn't seem to be an external library.

> 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.

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/

  reply	other threads:[~2005-05-09  8:56 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 [this message]
2005-05-09  9:02         ` Harald Welte
2005-05-09  9:45           ` Ludwig Nussel

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=20050509085603.GA12173@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.