]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
From: Eric Leblond <eric@inl.fr>
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>
Sat, 9 Feb 2008 17:34:00 +0000 (17:34 +0000)
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>
Sat, 9 Feb 2008 17:34:00 +0000 (17:34 +0000)
Some macros were defined several time. This was the case of GET_VALUE,
pp_is_valid. This patch puts the definition in ulogd.h and fixes the
definition of pp_is_valid which was wrong (causing segfault by acessing to
fields at NULL).

filter/ulogd_filter_IP2BIN.c
filter/ulogd_filter_IP2STR.c
include/ulogd/ulogd.h
util/printflow.c
util/printpkt.c

index e490b6476008e6e866b3c020523307421148de7d..9b0110e0d7670651b50f01c303e1605d3911b38f 100644 (file)
@@ -114,11 +114,6 @@ static struct ulogd_key ip2bin_keys[] = {
 
 };
 
-#define GET_VALUE(res, x)      (res[x].u.source->u.value)
-#define GET_FLAGS(res, x)      (res[x].u.source->flags)
-#define pp_is_valid(res, x)    \
-       (res[x].u.source && (GET_FLAGS(res, x) & ULOGD_RETF_VALID))
-
 /**
  * Convert IPv4 address (as 32-bit unsigned integer) to IPv6 address:
  * add 96 bits prefix "::ffff:" to get IPv6 address "::ffff:a.b.c.d".
index 2a612203abc000426fb6567ebefabb4b996af4f8..39edc057cb253d31efc0fdfa571f6ac30c41bb6a 100644 (file)
@@ -113,11 +113,6 @@ static struct ulogd_key ip2str_keys[] = {
        },
 };
 
-#define GET_VALUE(res, x)      (res[x].u.source->u.value)
-#define GET_FLAGS(res, x)      (res[x].u.source->flags)
-#define pp_is_valid(res, x)    \
-       (res[x].u.source && (GET_FLAGS(res, x) & ULOGD_RETF_VALID))
-
 static char *ip2str(struct ulogd_key* inp, int index, char family)
 {
        char tmp[IPADDR_LENGTH];
index 1bd0b6cf8dab94a052ef91932266b7a5036f39ed..b1d099643c3ca958fbd8461bd96e420cee6e52ef 100644 (file)
@@ -216,6 +216,11 @@ void __ulogd_log(int level, char *file, int line, const char *message, ...);
 #define IS_NEEDED(x)   (x.flags & ULOGD_RETF_NEEDED)
 #define SET_NEEDED(x)  (x.flags |= ULOGD_RETF_NEEDED)
 
+#define GET_VALUE(res, x)      (res[x].u.source->u.value)
+#define GET_FLAGS(res, x)      (res[x].u.source->flags)
+#define pp_is_valid(res, x)    \
+       (res[x].u.source && (GET_FLAGS(res, x) & ULOGD_RETF_VALID))
+
 int ulogd_key_size(struct ulogd_key *key);
 int ulogd_wildcard_inputkeys(struct ulogd_pluginstance *upi);
 
index d80363321262365795815b4385378d5c17b74d18..92c4f0fbc2fa715c3c3572d5a2b7e35a97dcdac5 100644 (file)
@@ -131,10 +131,6 @@ struct ulogd_key printflow_keys[FLOW_IDS] = {
 };
 int printflow_keys_num = sizeof(printflow_keys)/sizeof(*printflow_keys);
 
-#define GET_VALUE(res, x)      (res[x].u.source->u.value)
-#define GET_FLAGS(res, x)      (res[x].u.source->flags)
-#define pp_is_valid(res, x)    (GET_FLAGS(res, x) & ULOGD_RETF_VALID)
-
 #define pp_print(buf_cur, label, res, x, type) \
        if (pp_is_valid(res, x)) \
                buf_cur += sprintf(buf_cur, label"=%u ", GET_VALUE(res, x).type);
index 66068243635bbd6481dea089f8e33274ab3f99df..35d8080aec3398929de47c8e11e43f7427dec642 100644 (file)
@@ -89,10 +89,6 @@ struct ulogd_key printpkt_keys[] = {
        [KEY_AHESP_SPI]         = { .name = "ahesp.spi", },
 };
 
-#define GET_VALUE(res, x)      (res[x].u.source->u.value)
-#define GET_FLAGS(res, x)      (res[x].u.source->flags)
-#define pp_is_valid(res, x)    (GET_FLAGS(res, x) & ULOGD_RETF_VALID)
-
 static int printpkt_proto(struct ulogd_key *res, char *buf, int protocol)
 {
        char *buf_cur = buf;