summaryrefslogtreecommitdiffstats
path: root/userspace/arptables/arptables.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2003-10-25 10:18:31 +0000
committerBart De Schuymer <bdschuym@pandora.be>2003-10-25 10:18:31 +0000
commit701ac743a858af2bc34828d7c135d93a29a2c6ff (patch)
tree2fce1844fda2c4f5edf1e8128d839465c1c34c78 /userspace/arptables/arptables.c
parent23f91968fd615abaef134d5fa5170c02e0473a78 (diff)
auto-detect 2.4 or 2.6
Diffstat (limited to 'userspace/arptables/arptables.c')
-rw-r--r--userspace/arptables/arptables.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/userspace/arptables/arptables.c b/userspace/arptables/arptables.c
index e20d370..225f36a 100644
--- a/userspace/arptables/arptables.c
+++ b/userspace/arptables/arptables.c
@@ -154,6 +154,8 @@ static struct option original_opts[] = {
{ 0 }
};
+int NF_ARP_NUMHOOKS = 3;
+
/*#ifndef __OPTIMIZE__
struct arpt_entry_target *
arpt_get_target(struct arpt_entry *e)
@@ -1776,6 +1778,23 @@ int do_command(int argc, char *argv[], char **table, arptc_handle_t *handle)
char *protocol = NULL;
const char *modprobe = NULL;
+ /* first figure out if this is a 2.6 or a 2.4 kernel */
+ *handle = arptc_init(*table);
+
+ if (!*handle) {
+ arptables_insmod("arp_tables", modprobe);
+ *handle = arptc_init(*table);
+ if (!*handle) {
+ NF_ARP_NUMHOOKS = 2;
+ *handle = arptc_init(*table);
+ if (!*handle) {
+ exit_error(VERSION_PROBLEM,
+ "can't initialize arptables table `%s': %s",
+ *table, arptc_strerror(errno));
+ }
+ }
+ }
+
memset(&fw, 0, sizeof(fw));
opts = original_opts;
global_option_offset = 0;