Call shutdown functions for all subcomponents in nwfilterDriverShutdown.
Make sure that this shutdown functions can safely be called multiple times
and independent from the actual subcomponents state.
* only one filter update allowed
*/
static virMutex updateMutex;
+static bool initialized = false;
void
virNWFilterLockFilterUpdates(void) {
{
virNWFilterDomainFWUpdateCB = domUpdateCB;
+ initialized = true;
+
if (virMutexInitRecursive(&updateMutex))
return 1;
void virNWFilterConfLayerShutdown(void)
{
+ if (!initialized)
+ return;
+
virMutexDestroy(&updateMutex);
+
+ initialized = false;
}
if (!driverState)
return -1;
+ virNWFilterConfLayerShutdown();
+ virNWFilterTechDriversShutdown();
virNWFilterLearnShutdown();
nwfilterDriverLock(driverState);
* Shutdown of this layer
*/
void
-virNWFilterLearnShutdown(void) {
+virNWFilterLearnShutdown(void)
+{
+ if (!pendingLearnReq)
+ return;
virNWFilterLearnThreadsTerminate(false);