#include "iptables.h"
+#define XT_LOCK_NAME "/var/run/xtables.lock"
+static int xt_lock_fd = -1;
struct fw3_ipt_rule {
struct fw3_ipt_handle *h;
xtables_init();
+ while (!fw3_lock_path(&xt_lock_fd, XT_LOCK_NAME)) {
+ warn("Currently busy xtables.lock - wait 1 second");
+ sleep(1);
+ }
+
if (family == FW3_FAMILY_V6)
{
#ifndef DISABLE_IPV6
if (!h->handle)
{
free(h);
+ fw3_unlock_path(&xt_lock_fd, XT_LOCK_NAME);
return NULL;
}
void
fw3_ipt_close(struct fw3_ipt_handle *h)
{
+ fw3_unlock_path(&xt_lock_fd, XT_LOCK_NAME);
free(h);
}