[netcf-devel] ncftool fails to run when kernel bridge module is not loaded

David Lutterkort lutter at redhat.com
Thu Nov 12 20:32:33 UTC 2009


On Wed, 2009-11-11 at 10:05 -0800, Dale Bewley wrote:
> I started this on the wrong list[1], but basically, guests typically
> don't have the kernel bridge module loaded and ncftool fails to run in
> this situation. I opened a bug[2].

Yes, you are absolutely right. If the bridge module is not loaded, we
should act the same as if bridge packets would not be forwarded to
iptables.

How about this patch:

>From cfc093c2d4f5eb8744924e8c6270d5fb8e0024a8 Mon Sep 17 00:00:00 2001
From: David Lutterkort <lutter at redhat.com>
Date: Thu, 12 Nov 2009 12:28:56 -0800
Subject: [PATCH] * src/dutil_linux.c (bridge_nf_call_iptables): no bridge module, no problem

If the bridge module is not loaded, just report that no bridge packets are
sent to iptables.
---
 src/dutil_linux.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index e5b1dc7..5054958 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -163,6 +163,11 @@ bool bridge_nf_call_iptables(struct netcf *ncf) {
     ERR_NOMEM(r < 0, ncf);
 
     proc = fopen(path, "r");
+    /* If the file does not exist, assume the bridge module is not loaded
+     * and just report that no bridge packets will hit iptables */
+    if (proc == NULL && errno == ENOENT)
+        goto error;
+
     ERR_THROW(proc == NULL, ncf, EFILE, "can not open %s: %s",
               path, strerror(errno));
     c = fgetc(proc);
-- 
1.6.2.5





More information about the netcf-devel mailing list