From 2f0d748e21037fe684efeac09048d17d1eec04c9 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Wed, 4 Jun 2003 06:23:49 +0000 Subject: undo last change --- 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, 37 insertions(+), 20 deletions(-) diff --git a/extensions/ebt_802_3.c b/extensions/ebt_802_3.c index 181c7ae..953a115 100644 --- a/extensions/ebt_802_3.c +++ b/extensions/ebt_802_3.c @@ -32,7 +32,6 @@ 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 3e86419..a4a4105 100644 --- a/extensions/ebt_arp.c +++ b/extensions/ebt_arp.c @@ -69,7 +69,6 @@ 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 618e7ec..1e1504c 100644 --- a/extensions/ebt_ip.c +++ b/extensions/ebt_ip.c @@ -230,7 +230,6 @@ 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 18ac5dc..3c2409f 100644 --- a/extensions/ebt_log.c +++ b/extensions/ebt_log.c @@ -87,7 +87,6 @@ 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 @@ -177,15 +176,15 @@ static int compare(const struct ebt_entry_watcher *w1, static struct ebt_u_watcher log_watcher = { - .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, + EBT_LOG_WATCHER, + sizeof(struct ebt_log_info), + print_help, + init, + parse, + final_check, + print, + compare, + opts }; static void _init(void) __attribute__ ((constructor)); diff --git a/extensions/ebt_mark.c b/extensions/ebt_mark.c index 0b6da74..8696348 100644 --- a/extensions/ebt_mark.c +++ b/extensions/ebt_mark.c @@ -32,7 +32,6 @@ 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 073dac8..4fdc41d 100644 --- a/extensions/ebt_mark_m.c +++ b/extensions/ebt_mark_m.c @@ -28,7 +28,6 @@ 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 7a32def..c627714 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; - target->version = VERSIONIZE(1,0); + return; } static void init_d(struct ebt_entry_target *target) diff --git a/extensions/ebt_pkttype.c b/extensions/ebt_pkttype.c index e0de38d..e129996 100644 --- a/extensions/ebt_pkttype.c +++ b/extensions/ebt_pkttype.c @@ -46,7 +46,6 @@ 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 bfa5380..d74d46d 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; - target->version = VERSIONIZE(1,0); + return; } #define OPT_REDIRECT_TARGET 0x01 diff --git a/extensions/ebt_vlan.c b/extensions/ebt_vlan.c index e95a79d..f7bec62 100644 --- a/extensions/ebt_vlan.c +++ b/extensions/ebt_vlan.c @@ -76,6 +76,10 @@ 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" @@ -93,19 +97,33 @@ 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, @@ -166,6 +184,9 @@ 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, @@ -201,6 +222,9 @@ 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