From 18661b0f94f10abe37d1e0716330216db2a8388c Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Tue, 3 Jun 2003 19:16:53 +0000 Subject: module versioning --- extensions/ebt_802_3.c | 1 + extensions/ebt_arp.c | 1 + extensions/ebt_ip.c | 1 + extensions/ebt_log.c | 19 ++++++++++--------- extensions/ebt_mark.c | 1 + extensions/ebt_mark_m.c | 1 + extensions/ebt_nat.c | 2 +- extensions/ebt_pkttype.c | 1 + extensions/ebt_redirect.c | 2 +- extensions/ebt_vlan.c | 28 ++-------------------------- 10 files changed, 20 insertions(+), 37 deletions(-) diff --git a/extensions/ebt_802_3.c b/extensions/ebt_802_3.c index 953a115..181c7ae 100644 --- a/extensions/ebt_802_3.c +++ b/extensions/ebt_802_3.c @@ -32,6 +32,7 @@ static void init(struct ebt_entry_match *match) info->invflags = 0; info->bitmask = 0; + match->version = VERSIONIZE(1,0); } static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, diff --git a/extensions/ebt_arp.c b/extensions/ebt_arp.c index a4a4105..3e86419 100644 --- a/extensions/ebt_arp.c +++ b/extensions/ebt_arp.c @@ -69,6 +69,7 @@ static void init(struct ebt_entry_match *match) arpinfo->invflags = 0; arpinfo->bitmask = 0; + match->version = VERSIONIZE(1,0); } /* defined in ebt_ip.c */ diff --git a/extensions/ebt_ip.c b/extensions/ebt_ip.c index 1e1504c..618e7ec 100644 --- a/extensions/ebt_ip.c +++ b/extensions/ebt_ip.c @@ -230,6 +230,7 @@ static void init(struct ebt_entry_match *match) ipinfo->invflags = 0; ipinfo->bitmask = 0; + match->version = VERSIONIZE(1,0); } #define OPT_SOURCE 0x01 diff --git a/extensions/ebt_log.c b/extensions/ebt_log.c index 3c2409f..18ac5dc 100644 --- a/extensions/ebt_log.c +++ b/extensions/ebt_log.c @@ -87,6 +87,7 @@ static void init(struct ebt_entry_watcher *watcher) loginfo->bitmask = 0; loginfo->prefix[0] = '\0'; loginfo->loglevel = LOG_NOTICE; + watcher->version = VERSIONIZE(1,0); } #define OPT_PREFIX 0x01 @@ -176,15 +177,15 @@ static int compare(const struct ebt_entry_watcher *w1, static struct ebt_u_watcher log_watcher = { - EBT_LOG_WATCHER, - sizeof(struct ebt_log_info), - print_help, - init, - parse, - final_check, - print, - compare, - opts + .name = EBT_LOG_WATCHER, + .size = sizeof(struct ebt_log_info), + .help = print_help, + .init = init, + .parse = parse, + .final_check = final_check, + .print = print, + .compare = compare, + .extra_ops = opts, }; static void _init(void) __attribute__ ((constructor)); diff --git a/extensions/ebt_mark.c b/extensions/ebt_mark.c index 8696348..0b6da74 100644 --- a/extensions/ebt_mark.c +++ b/extensions/ebt_mark.c @@ -32,6 +32,7 @@ static void init(struct ebt_entry_target *target) markinfo->target = EBT_ACCEPT; markinfo->mark = 0; mark_supplied = 0; + target->version = VERSIONIZE(1,0); } #define OPT_MARK_TARGET 0x01 diff --git a/extensions/ebt_mark_m.c b/extensions/ebt_mark_m.c index 4fdc41d..073dac8 100644 --- a/extensions/ebt_mark_m.c +++ b/extensions/ebt_mark_m.c @@ -28,6 +28,7 @@ static void init(struct ebt_entry_match *match) markinfo->mask = 0; markinfo->invert = 0; markinfo->bitmask = 0; + match->version = VERSIONIZE(1,0); } #define OPT_MARK 0x01 diff --git a/extensions/ebt_nat.c b/extensions/ebt_nat.c index c627714..7a32def 100644 --- a/extensions/ebt_nat.c +++ b/extensions/ebt_nat.c @@ -50,7 +50,7 @@ static void init_s(struct ebt_entry_target *target) to_source_supplied = 0; natinfo->target = EBT_ACCEPT; - return; + target->version = VERSIONIZE(1,0); } static void init_d(struct ebt_entry_target *target) diff --git a/extensions/ebt_pkttype.c b/extensions/ebt_pkttype.c index e129996..e0de38d 100644 --- a/extensions/ebt_pkttype.c +++ b/extensions/ebt_pkttype.c @@ -46,6 +46,7 @@ static void init(struct ebt_entry_match *match) struct ebt_pkttype_info *pt = (struct ebt_pkttype_info *)match->data; pt->invert = 0; + match->version = VERSIONIZE(1,0); } static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, diff --git a/extensions/ebt_redirect.c b/extensions/ebt_redirect.c index d74d46d..bfa5380 100644 --- a/extensions/ebt_redirect.c +++ b/extensions/ebt_redirect.c @@ -25,7 +25,7 @@ static void init(struct ebt_entry_target *target) (struct ebt_redirect_info *)target->data; redirectinfo->target = EBT_ACCEPT; - return; + target->version = VERSIONIZE(1,0); } #define OPT_REDIRECT_TARGET 0x01 diff --git a/extensions/ebt_vlan.c b/extensions/ebt_vlan.c index f7bec62..e95a79d 100644 --- a/extensions/ebt_vlan.c +++ b/extensions/ebt_vlan.c @@ -76,10 +76,6 @@ static struct option opts[] = { struct ethertypeent *ethent; -/* - * Print out local help by "ebtables -h " - */ - static void print_help() { #define HELP_TITLE "802.1Q VLAN extension" @@ -97,33 +93,19 @@ static void print_help() OPT_VLAN_FLAGS & OPT_VLAN_ENCAP ? "[!] " : ""); } -/* - * Initialization function - */ static void init(struct ebt_entry_match *match) { struct ebt_vlan_info *vlaninfo = (struct ebt_vlan_info *) match->data; - /* - * Set initial values - */ + vlaninfo->id = 1; /* Default VID for VLAN-tagged 802.1Q frames */ vlaninfo->prio = 0; vlaninfo->encap = 0; vlaninfo->invflags = 0; vlaninfo->bitmask = 0; + match->version = VERSIONIZE(1,0); } - -/* - * Parse passed arguments values (ranges, flags, etc...) - * int c - parameter number from static struct option opts[] - * int argc - total amout of arguments (std argc value) - * int argv - arguments (std argv value) - * const struct ebt_u_entry *entry - default ebtables entry set - * unsigned int *flags - - * struct ebt_entry_match **match - - */ static int parse(int c, char **argv, @@ -184,9 +166,6 @@ parse(int c, return 1; } -/* - * Final check - logical conditions - */ static void final_check(const struct ebt_u_entry *entry, const struct ebt_entry_match *match, @@ -222,9 +201,6 @@ final_check(const struct ebt_u_entry *entry, } } -/* - * Print line when listing rules by ebtables -L - */ static void print(const struct ebt_u_entry *entry, const struct ebt_entry_match *match) { -- cgit v1.2.3