Fixes for compiling libiptc with recent netfilter headers

This commit is contained in:
Michele Bini 2013-09-30 08:53:44 +02:00
parent 75e218b7f2
commit e0a0364f14
3 changed files with 14 additions and 9 deletions

View File

@ -5,7 +5,12 @@
#ifndef _IPT_CONNTRACK_H #ifndef _IPT_CONNTRACK_H
#define _IPT_CONNTRACK_H #define _IPT_CONNTRACK_H
#if 0
#include <linux/netfilter_ipv4/ip_conntrack.h> #include <linux/netfilter_ipv4/ip_conntrack.h>
#else
#include <linux/netfilter/nf_conntrack_common.h>
#include <linux/netfilter/nf_conntrack_tuple_common.h>
#endif
/* backwards compatibility crap. only exists in userspace - HW */ /* backwards compatibility crap. only exists in userspace - HW */
#include <linux/version.h> #include <linux/version.h>

View File

@ -59,12 +59,14 @@ static const char *hooknames[]
#endif #endif
}; };
#if 0
/* Convenience structures */ /* Convenience structures */
struct ipt_error_target struct ipt_error_target
{ {
STRUCT_ENTRY_TARGET t; STRUCT_ENTRY_TARGET t;
char error[TABLE_MAXNAMELEN]; char error[TABLE_MAXNAMELEN];
}; };
#endif
struct chain_head; struct chain_head;
struct rule_head; struct rule_head;
@ -638,10 +640,10 @@ static int iptcc_compile_chain(TC_HANDLE_T h, STRUCT_REPLACE *repl, struct chain
head = (void *)repl->entries + c->head_offset; head = (void *)repl->entries + c->head_offset;
head->e.target_offset = sizeof(STRUCT_ENTRY); head->e.target_offset = sizeof(STRUCT_ENTRY);
head->e.next_offset = IPTCB_CHAIN_START_SIZE; head->e.next_offset = IPTCB_CHAIN_START_SIZE;
strcpy(head->name.t.u.user.name, ERROR_TARGET); strcpy(head->name.target.u.user.name, ERROR_TARGET);
head->name.t.u.target_size = head->name.target.u.target_size =
ALIGN(sizeof(struct ipt_error_target)); ALIGN(sizeof(struct ipt_error_target));
strcpy(head->name.error, c->name); strcpy(head->name.errorname, c->name);
} else { } else {
repl->hook_entry[c->hooknum-1] = c->head_offset; repl->hook_entry[c->hooknum-1] = c->head_offset;
repl->underflow[c->hooknum-1] = c->foot_offset; repl->underflow[c->hooknum-1] = c->foot_offset;
@ -747,10 +749,10 @@ static int iptcc_compile_table(TC_HANDLE_T h, STRUCT_REPLACE *repl)
error = (void *)repl->entries + repl->size - IPTCB_CHAIN_ERROR_SIZE; error = (void *)repl->entries + repl->size - IPTCB_CHAIN_ERROR_SIZE;
error->entry.target_offset = sizeof(STRUCT_ENTRY); error->entry.target_offset = sizeof(STRUCT_ENTRY);
error->entry.next_offset = IPTCB_CHAIN_ERROR_SIZE; error->entry.next_offset = IPTCB_CHAIN_ERROR_SIZE;
error->target.t.u.user.target_size = error->target.target.u.user.target_size =
ALIGN(sizeof(struct ipt_error_target)); ALIGN(sizeof(struct ipt_error_target));
strcpy((char *)&error->target.t.u.user.name, ERROR_TARGET); strcpy((char *)&error->target.target.u.user.name, ERROR_TARGET);
strcpy((char *)&error->target.error, "ERROR"); strcpy((char *)&error->target.errorname, "ERROR");
return 1; return 1;
} }

View File

@ -2,13 +2,11 @@
#define MARK_H #define MARK_H
#include "libiptc/libiptc.h" #include "libiptc/libiptc.h"
#include <linux/netfilter_ipv4/ip_conntrack.h> #include <linux/netfilter/nf_conntrack_common.h>
#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
#include "libiptc/ipt_conntrack.h" #include "libiptc/ipt_conntrack.h"
#include "libiptc/ipt_connmark.h" #include "libiptc/ipt_connmark.h"
#include "libiptc/ipt_CONNMARK.h" #include "libiptc/ipt_CONNMARK.h"
#define MANGLE_TABLE "mangle" #define MANGLE_TABLE "mangle"
#define FILTER_TABLE "filter" #define FILTER_TABLE "filter"
#define NTK_MARK_CHAIN "ntk_mark_chain" #define NTK_MARK_CHAIN "ntk_mark_chain"