summaryrefslogtreecommitdiffstats
path: root/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
commit03462993f2b3428e14355ac646f0694609a8b2bf (patch)
treeae1d2fe6db5d83e6051646f9cbd79de143cee470 /arptables.c
parent1b0d70ec5ea0e2320a7c4071486099e70a0036d2 (diff)
auto-detect 2.4 or 2.6
Diffstat (limited to 'arptables.c')
-rw-r--r--arptables.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arptables.c b/arptables.c
index e20d370..225f36a 100644
--- a/arptables.c
+++ b/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;