[libvirt] [PATCH] Fix launch of libvirtd when DHCP snooping support is not available.

Daniel P. Berrange berrange at redhat.com
Fri Jun 15 12:57:51 UTC 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

When libpcap is not available, the NWFilter driver provides a
no-op stub for the DHCP snooping initialization. This was
mistakenly returning '-1' instead of '0', so the entire driver
initialization failed
---
 src/nwfilter/nwfilter_dhcpsnoop.c      |    5 ++++-
 src/nwfilter/nwfilter_gentech_driver.c |    1 +
 src/nwfilter/nwfilter_learnipaddr.c    |    1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index 22f76e2..5dffaad 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -2056,6 +2056,8 @@ virNWFilterDHCPSnoopInit(void)
     if (virNWFilterSnoopState.snoopReqs)
         return 0;
 
+    VIR_DEBUG("Initializing DHCP snooping");
+
     if (virMutexInitRecursive(&virNWFilterSnoopState.snoopLock) < 0 ||
         virMutexInit(&virNWFilterSnoopState.activeLock) < 0 ||
         virAtomicIntInit(&virNWFilterSnoopState.nLeases) < 0 ||
@@ -2176,7 +2178,8 @@ virNWFilterDHCPSnoopShutdown(void)
 int
 virNWFilterDHCPSnoopInit(void)
 {
-    return -1;
+    VIR_DEBUG("No DHCP snooping support available");
+    return 0;
 }
 
 void
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 4769d21..d833bbb 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -57,6 +57,7 @@ static virNWFilterTechDriverPtr filter_tech_drivers[] = {
 
 void virNWFilterTechDriversInit(bool privileged) {
     int i = 0;
+    VIR_DEBUG("Initializing NWFilter technology drivers");
     while (filter_tech_drivers[i]) {
         if (!(filter_tech_drivers[i]->flags & TECHDRV_FLAG_INITIALIZED))
             filter_tech_drivers[i]->init(privileged);
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index af13738..a891377 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -782,6 +782,7 @@ virNWFilterLearnInit(void) {
     if (pendingLearnReq)
         return 0;
 
+    VIR_DEBUG("Initializing IP address learning");
     threadsTerminate = false;
 
     pendingLearnReq = virHashCreate(0, freeLearnReqEntry);
-- 
1.7.10.2




More information about the libvir-list mailing list