summaryrefslogtreecommitdiffstats
path: root/extensions/ebt_log.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2002-08-13 16:08:08 +0000
committerBart De Schuymer <bdschuym@pandora.be>2002-08-13 16:08:08 +0000
commit9cfd654314d5718393b847758ded6ef86530e5c6 (patch)
tree5627fb56a1ba249a06561e8d47fc961560388ba8 /extensions/ebt_log.c
parentb3dbdfb2b63c3f87edba502230b12e7daa5c354f (diff)
cosmetic improvements and some bugfixes (global description)
Diffstat (limited to 'extensions/ebt_log.c')
-rw-r--r--extensions/ebt_log.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/extensions/ebt_log.c b/extensions/ebt_log.c
index b6e62eb..4232bed 100644
--- a/extensions/ebt_log.c
+++ b/extensions/ebt_log.c
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/socket.h>
#include <getopt.h>
#include "../include/ebtables_u.h"
#include <linux/netfilter_bridge/ebt_log.h>
@@ -16,11 +15,12 @@
#define LOG_NOTICE 5 // normal but significant condition
#define LOG_INFO 6 // informational
#define LOG_DEBUG 7 // debug-level messages
+
#define LOG_DEFAULT_LEVEL LOG_INFO
typedef struct _code {
- char *c_name;
- int c_val;
+ char *c_name;
+ int c_val;
} CODE;
static CODE eight_priority[] = {
@@ -31,20 +31,16 @@ static CODE eight_priority[] = {
{ "warning", LOG_WARNING },
{ "notice", LOG_NOTICE },
{ "info", LOG_INFO },
- { "debug", LOG_DEBUG },
- { NULL, -1 }
+ { "debug", LOG_DEBUG }
};
static int name_to_loglevel(char* arg)
{
- int i = 0, c_val = eight_priority[0].c_val;
+ int i;
- while (c_val != -1) {
+ for (i = 0; i < 8; i++)
if (!strcmp(arg, eight_priority[i].c_name))
- return c_val;
- i++;
- c_val = eight_priority[i].c_val;
- }
+ return eight_priority[i].c_val;
// return bad loglevel
return 9;
}
@@ -100,7 +96,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
unsigned int *flags, struct ebt_entry_watcher **watcher)
{
struct ebt_log_info *loginfo = (struct ebt_log_info *)(*watcher)->data;
- int i;
+ long int i;
char *end;
switch (c) {
@@ -186,10 +182,9 @@ static struct ebt_u_watcher log_watcher =
final_check,
print,
compare,
- opts,
+ opts
};
-#undef _init
static void _init(void) __attribute__ ((constructor));
static void _init(void)
{