summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2003-06-03 19:10:05 +0000
committerBart De Schuymer <bdschuym@pandora.be>2003-06-03 19:10:05 +0000
commit83837b20c887f559401a6947c9baa237d5787184 (patch)
tree02b717a57f09a5e266e2556094ad8e9e763cf91d /kernel
parentff87172709d0fff1ac43183c38c05732ff2b8c9a (diff)
module versioning
Diffstat (limited to 'kernel')
-rw-r--r--kernel/linux2.5/include/linux/netfilter_bridge/ebtables.h22
-rw-r--r--kernel/linux2.5/net/bridge/netfilter/ebt_802_3.c7
2 files changed, 25 insertions, 4 deletions
diff --git a/kernel/linux2.5/include/linux/netfilter_bridge/ebtables.h b/kernel/linux2.5/include/linux/netfilter_bridge/ebtables.h
index 1056e45..04b064c 100644
--- a/kernel/linux2.5/include/linux/netfilter_bridge/ebtables.h
+++ b/kernel/linux2.5/include/linux/netfilter_bridge/ebtables.h
@@ -85,6 +85,7 @@ struct ebt_entry_match
char name[EBT_FUNCTION_MAXNAMELEN];
struct ebt_match *match;
} u;
+ unsigned int version;
/* size of data */
unsigned int match_size;
unsigned char data[0];
@@ -96,6 +97,7 @@ struct ebt_entry_watcher
char name[EBT_FUNCTION_MAXNAMELEN];
struct ebt_watcher *watcher;
} u;
+ unsigned int version;
/* size of data */
unsigned int watcher_size;
unsigned char data[0];
@@ -107,6 +109,7 @@ struct ebt_entry_target
char name[EBT_FUNCTION_MAXNAMELEN];
struct ebt_target *target;
} u;
+ unsigned int version;
/* size of data */
unsigned int target_size;
unsigned char data[0];
@@ -176,8 +179,15 @@ struct ebt_replace
#define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1)
#define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES+1)
+#define NR_MINORS 8
+#define VERSIONIZE(major,minor) ((major << NR_MINORS) + minor)
+
#ifdef __KERNEL__
+extern void ebt_print_string(const char *fmt, ...);
+#define PRINT_BUFFER_LENGTH 1024
+extern int ebt_check_version(unsigned int u,unsigned int k, const char *n);
+
/* return values for match() functions */
#define EBT_MATCH 0
#define EBT_NOMATCH 1
@@ -186,13 +196,15 @@ struct ebt_match
{
struct list_head list;
const char name[EBT_FUNCTION_MAXNAMELEN];
+ unsigned int version;
/* 0 == it matches */
int (*match)(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const void *matchdata,
unsigned int datalen);
/* 0 == let it in */
int (*check)(const char *tablename, unsigned int hookmask,
- const struct ebt_entry *e, void *matchdata, unsigned int datalen);
+ const struct ebt_entry *e, void *matchdata, unsigned int datalen,
+ unsigned int version);
void (*destroy)(void *matchdata, unsigned int datalen);
struct module *me;
};
@@ -201,12 +213,14 @@ struct ebt_watcher
{
struct list_head list;
const char name[EBT_FUNCTION_MAXNAMELEN];
+ unsigned int version;
void (*watcher)(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const void *watcherdata,
unsigned int datalen);
/* 0 == let it in */
int (*check)(const char *tablename, unsigned int hookmask,
- const struct ebt_entry *e, void *watcherdata, unsigned int datalen);
+ const struct ebt_entry *e, void *watcherdata, unsigned int datalen,
+ unsigned int version);
void (*destroy)(void *watcherdata, unsigned int datalen);
struct module *me;
};
@@ -215,13 +229,15 @@ struct ebt_target
{
struct list_head list;
const char name[EBT_FUNCTION_MAXNAMELEN];
+ unsigned int version;
/* returns one of the standard verdicts */
int (*target)(struct sk_buff **pskb, unsigned int hooknr,
const struct net_device *in, const struct net_device *out,
const void *targetdata, unsigned int datalen);
/* 0 == let it in */
int (*check)(const char *tablename, unsigned int hookmask,
- const struct ebt_entry *e, void *targetdata, unsigned int datalen);
+ const struct ebt_entry *e, void *targetdata, unsigned int datalen,
+ unsigned int version);
void (*destroy)(void *targetdata, unsigned int datalen);
struct module *me;
};
diff --git a/kernel/linux2.5/net/bridge/netfilter/ebt_802_3.c b/kernel/linux2.5/net/bridge/netfilter/ebt_802_3.c
index 6eac757..c5eebea 100644
--- a/kernel/linux2.5/net/bridge/netfilter/ebt_802_3.c
+++ b/kernel/linux2.5/net/bridge/netfilter/ebt_802_3.c
@@ -36,13 +36,17 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *
return EBT_MATCH;
}
+static struct ebt_match filter_802_3;
static int ebt_802_3_check(const char *tablename, unsigned int hookmask,
- const struct ebt_entry *e, void *data, unsigned int datalen)
+ const struct ebt_entry *e, void *data, unsigned int datalen,
+ unsigned int version)
{
struct ebt_802_3_info *info = (struct ebt_802_3_info *)data;
if (datalen < sizeof(struct ebt_802_3_info))
return -EINVAL;
+ if (ebt_check_version(version, filter_802_3.version, filter_802_3.name))
+ return -EINVAL;
if (info->bitmask & ~EBT_802_3_MASK || info->invflags & ~EBT_802_3_MASK)
return -EINVAL;
@@ -55,6 +59,7 @@ static struct ebt_match filter_802_3 =
.match = ebt_filter_802_3,
.check = ebt_802_3_check,
.me = THIS_MODULE,
+ .version = VERSIONIZE(1,0),
};
static int __init init(void)