summaryrefslogtreecommitdiffstats
path: root/communication.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2003-05-04 16:52:04 +0000
committerBart De Schuymer <bdschuym@pandora.be>2003-05-04 16:52:04 +0000
commit0cb0179bd91d131faa70c1b674ef7da861b69c59 (patch)
tree236c63c5de4d6a19fe84f7a0a776042688fca631 /communication.c
parent21aa50fff32d9730eea3c07bdbc321d758ee97a4 (diff)
--atomic-commit should only try insmod when all else fails
Diffstat (limited to 'communication.c')
-rw-r--r--communication.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/communication.c b/communication.c
index ab21327..82888c0 100644
--- a/communication.c
+++ b/communication.c
@@ -263,10 +263,19 @@ void deliver_table(struct ebt_u_replace *u_repl)
/* give the data to the kernel */
optlen = sizeof(struct ebt_replace) + repl->entries_size;
get_sockfd();
- if (setsockopt(sockfd, IPPROTO_IP, EBT_SO_SET_ENTRIES, repl, optlen))
- print_error("The kernel doesn't support a certain ebtables"
- " extension, consider recompiling your kernel or insmod"
- " the extension");
+ if (!setsockopt(sockfd, IPPROTO_IP, EBT_SO_SET_ENTRIES, repl, optlen))
+ return;
+ if (u_repl->command == 8) { /* the ebtables module may not
+ * yet be loaded with --atomic-commit */
+ ebtables_insmod("ebtables");
+ if (!setsockopt(sockfd, IPPROTO_IP, EBT_SO_SET_ENTRIES,
+ repl, optlen))
+ return;
+ }
+
+ print_error("The kernel doesn't support a certain ebtables"
+ " extension, consider recompiling your kernel or insmod"
+ " the extension");
}
static void store_counters_in_file(char *filename, struct ebt_u_replace *repl)