mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-20 11:34:57 +02:00
Add a compat wrapper to make modules work with older Linux.
The extension modules use the API of a fairly recent kernel, if not even the networking git tree. To make it work with older Linux kernels, an API wrapper is added. Should compile against running-kernels Linux 2.6.19..current (tested: 2.6.22..current). Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
This commit is contained in:
70
extensions/compat_xtnu.h
Normal file
70
extensions/compat_xtnu.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#ifndef _COMPAT_XTNU_H
|
||||
#define _COMPAT_XTNU_H 1
|
||||
|
||||
#include <linux/list.h>
|
||||
#include <linux/netfilter/x_tables.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
struct module;
|
||||
struct net_device;
|
||||
struct sk_buff;
|
||||
|
||||
struct xtnu_match {
|
||||
struct list_head list;
|
||||
char name[XT_FUNCTION_MAXNAMELEN - 1 - sizeof(void *)];
|
||||
bool (*match)(const struct sk_buff *, const struct net_device *,
|
||||
const struct net_device *, const struct xtnu_match *,
|
||||
const void *, int, unsigned int, bool *);
|
||||
bool (*checkentry)(const char *, const void *,
|
||||
const struct xtnu_match *, void *, unsigned int);
|
||||
void (*destroy)(const struct xtnu_match *, void *);
|
||||
struct module *me;
|
||||
const char *table;
|
||||
unsigned int matchsize, hooks;
|
||||
unsigned short proto, family;
|
||||
uint8_t revision;
|
||||
|
||||
void *__compat_match;
|
||||
};
|
||||
|
||||
struct xtnu_target {
|
||||
struct list_head list;
|
||||
char name[XT_FUNCTION_MAXNAMELEN - 1 - sizeof(void *)];
|
||||
unsigned int (*target)(struct sk_buff *, const struct net_device *,
|
||||
const struct net_device *, unsigned int,
|
||||
const struct xtnu_target *, const void *);
|
||||
bool (*checkentry)(const char *, const void *,
|
||||
const struct xtnu_target *, void *, unsigned int);
|
||||
void (*destroy)(const struct xtnu_target *, void *);
|
||||
struct module *me;
|
||||
const char *table;
|
||||
unsigned int targetsize, hooks;
|
||||
unsigned short proto, family;
|
||||
uint8_t revision;
|
||||
|
||||
void *__compat_target;
|
||||
};
|
||||
|
||||
static inline struct xtnu_match *xtcompat_numatch(const struct xt_match *m)
|
||||
{
|
||||
void *q;
|
||||
memcpy(&q, m->name + sizeof(m->name) - sizeof(void *), sizeof(void *));
|
||||
return q;
|
||||
}
|
||||
|
||||
static inline struct xtnu_target *xtcompat_nutarget(const struct xt_target *t)
|
||||
{
|
||||
void *q;
|
||||
memcpy(&q, t->name + sizeof(t->name) - sizeof(void *), sizeof(void *));
|
||||
return q;
|
||||
}
|
||||
|
||||
extern int xtnu_ip_route_me_harder(struct sk_buff *, unsigned int);
|
||||
extern int xtnu_register_match(struct xtnu_match *);
|
||||
extern void xtnu_unregister_match(struct xtnu_match *);
|
||||
extern int xtnu_register_matches(struct xtnu_match *, unsigned int);
|
||||
extern void xtnu_unregister_matches(struct xtnu_match *, unsigned int);
|
||||
extern int xtnu_register_target(struct xtnu_target *);
|
||||
extern void xtnu_unregister_target(struct xtnu_target *);
|
||||
|
||||
#endif /* _COMPAT_XTNU_H */
|
Reference in New Issue
Block a user