add logic to support the --concurrent option: use a file lock to support concurrent scripts running ebtables
diff --git a/ebtables.c b/ebtables.c
index d71a981..d5d24b0 100644
--- a/ebtables.c
+++ b/ebtables.c
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <inttypes.h>
+#include <signal.h>
 #include "include/ebtables_u.h"
 #include "include/ethernetdb.h"
 
@@ -91,6 +92,7 @@
 	{ "atomic-file"    , required_argument, 0, 9   },
 	{ "atomic-save"    , no_argument      , 0, 10  },
 	{ "init-table"     , no_argument      , 0, 11  },
+	{ "concurrent"     , no_argument      , 0, 13  },
 	{ 0 }
 };
 
@@ -374,6 +376,7 @@
 "--set-counters -c chain\n"
 "          pcnt bcnt           : set the counters of the to be added rule\n"
 "--modprobe -M program         : try to insert modules using this program\n"
+"--concurrent                  : use a file lock to support concurrent scripts\n"
 "--version -V                  : print package version\n\n"
 "Environment variable:\n"
 ATOMIC_ENV_VARIABLE "          : if set <FILE> (see above) will equal its value"
@@ -525,6 +528,12 @@
 	ebt_iterate_targets(merge_target);
 }
 
+/* signal handler, installed when the option --concurrent is specified. */
+static void sighandler(int signum)
+{
+	exit(-1);
+}
+
 /* We use exec_style instead of #ifdef's because ebtables.so is a shared object. */
 int do_command(int argc, char *argv[], int exec_style,
                struct ebt_u_replace *replace_)
@@ -1037,6 +1046,11 @@
 			replace->filename = (char *)malloc(strlen(optarg) + 1);
 			strcpy(replace->filename, optarg);
 			break;
+		case 13 : /* concurrent */
+			signal(SIGINT, sighandler);
+			signal(SIGTERM, sighandler);
+			use_lockfd = 1;
+			break;
 		case 1 :
 			if (!strcmp(optarg, "!"))
 				ebt_check_inverse2(optarg);