Linux Netfilter development
 help / color / mirror / Atom feed
From: Soren Hansen <soren@ubuntu.com>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: Automatically load modules in iptables-save
Date: Thu, 19 Mar 2009 14:50:06 +0100	[thread overview]
Message-ID: <20090319135006.GD20472@ralph.linux2go.dk> (raw)
In-Reply-To: <49C24332.2020107@trash.net>

[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]

On Thu, Mar 19, 2009 at 02:05:54PM +0100, Patrick McHardy wrote:
>>> If the iptables modules are not loaded when iptables-save is run,
>>> iptables-save will fail, because it can't open the relevant files in
>>> /proc.  This patch makes iptables-save attempt to load the modules,
>>> and then retries.
>> Is this the correct list for this?
> It is. The patch seems rather pointless though, if the module isn't
> loaded, there's obviously nothing to save.

Right. I thought about just silently bailing out, but decided to go this
route instead. Explanation follows.

>> If the iptables modules are not loaded when iptables-save is run,
>> iptables-save will fail
> What does "fail" mean in this context?

$ sudo iptables-save
iptables-save v1.4.1.1: Unable to open /proc/net/ip_tables_names: No such file or directory
$ echo $?
1

I decided to try to load the modules instead of just silently returning,
so that if iptables-save succeeds, you can reasonably expect
iptables-restore to work as well. I would be quite surprised if I found
that the firewall rules I just saved (perhaps not realising that there
weren't any) coulnd't be loaded again, which is what you'd get if your
system had no iptables support at all.

-- 
Soren Hansen                 | 
Lead Virtualisation Engineer | Ubuntu Server Team
Canonical Ltd.               | http://www.ubuntu.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 315 bytes --]

  reply	other threads:[~2009-03-19 13:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-16 17:10 Automatically load modules in iptables-save Soren Hansen
2009-03-19 12:55 ` Soren Hansen
2009-03-19 13:05   ` Patrick McHardy
2009-03-19 13:50     ` Soren Hansen [this message]
2009-03-19 13:55       ` Jan Engelhardt
2009-03-19 13:58         ` Patrick McHardy
2009-03-19 14:29         ` Soren Hansen
2009-03-19 14:31           ` Jan Engelhardt
2009-03-19 15:43             ` Soren Hansen
2009-03-19 16:02               ` Jan Engelhardt
2009-03-19 17:00                 ` Soren Hansen
2009-03-20 18:42                 ` Patrick McHardy
2009-03-19 16:43               ` Soren Hansen
  -- strict thread matches above, loose matches on Subject: below --
2009-03-16 11:42 Soren Hansen

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=20090319135006.GD20472@ralph.linux2go.dk \
    --to=soren@ubuntu.com \
    --cc=kaber@trash.net \
    --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