From b9852862eaacfef318ee03a0827f5736aac8af0a Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 15 Jun 2012 13:56:13 +0100 Subject: [PATCH] Fix launch of libvirtd when DHCP snooping support is not available. 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 22f76e2098..5dffaad40a 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 4769d21d4f..d833bbb33e 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 af13738122..a891377c14 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); -- GitLab