netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Victor Stinner <victor.stinner@inl.fr>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: iptables-save and /proc/net/ip_tables_names
Date: Thu, 18 Oct 2007 16:23:02 +0200	[thread overview]
Message-ID: <47176C46.70307@trash.net> (raw)
In-Reply-To: <200710181616.00944.victor.stinner@inl.fr>

Victor Stinner wrote:
> Hi,
> 
> I found a bug in iptables-save: when fopen("/proc/net/ip_tables_names") fails, 
> iptables-save just exit with code 0 (success). I expected an error to make 
> this command works together:
>   $ iptables-save > /tmp/iptables-backup
>   $ iptables (...)
>   $ iptables-restore > /tmp/iptables-backup
> 
> The problem is that ip_tables module is not loaded before first iptables 
> command.
> 
> Workaround: load iptables kernel modules before calling iptables-save or check 
> that iptables-save is not empty.
> 
> Bugfix in iptables-save: exit with error code (1) on fopen failure => see 
> attached patch proposition. The error message could be "iptables kernel 
> module is not loaded (unable to open ...)" or something better. The most 
> important point is the exit code to make my bash script work :-)


Applied with a similar change for ip6tables-restore. Thanks Victor.

      reply	other threads:[~2007-10-18 14:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-18 14:16 iptables-save and /proc/net/ip_tables_names Victor Stinner
2007-10-18 14:23 ` Patrick McHardy [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=47176C46.70307@trash.net \
    --to=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=victor.stinner@inl.fr \
    /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).