Skip to contentSkip to conversation

Serialize iptables calls in hotplug scripts

PATCH New Jiri Denemark 1 participant 1 message May 28, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Serialize iptables calls in hotplug scripts

Hi,

iptables cannot correctly handle situations when more than one command is trying to set netfilter rules. In such situations, iptables may fail with EAGAIN, which results in iptables: Unknown error 18446744073709551615.

Such situation can easily happen when multiple network devices are configured for a domain as vif hotplug scripts are called in parallel for all of the network devices.

Attached is a patch which serializes all iptables calls from vif-* hotplug scripts...

tools/hotplug/Linux/vif-common.sh +4 -0
diff -r fe68405201d2 tools/hotplug/Linux/vif-common.sh
@@ -103,6 +103,8 @@ handle_iptable()
     return
   fi
 
+  claim_lock "iptables"
+
   if [ "$ip" != "" ]
   then
       local addr
@@ -117,6 +119,8 @@ handle_iptable()
       # No IP addresses have been specified, so allow anything.
       frob_iptable
   fi
+
+  release_lock "iptables"
 }
 
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel