From 0cb0179bd91d131faa70c1b674ef7da861b69c59 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Sun, 4 May 2003 16:52:04 +0000 Subject: --atomic-commit should only try insmod when all else fails --- communication.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'communication.c') 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) -- cgit v1.2.3