[ulogd2] cleanup: fix gcc warnings

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Tue Jul 29 12:24:29 CEST 2008


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=ulogd2.git;a=commit;h=9fdec30e232e74e103d80049e0772f2d619574cb
commit 9fdec30e232e74e103d80049e0772f2d619574cb
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Tue Jul 29 12:24:18 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Tue Jul 29 12:24:18 2008 +0200

    cleanup: fix gcc warnings
    
    This patch fixes some gcc warnings:
     * Unused variables
     * Functions with wrong return (or without return)
    
    Signed-off-by: Eric Leblond <eric at inl.fr>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit cd8abed46eff3683a5d81e500673df5e80e2a353
Author:     Pablo Neira Ayuso <pablo at netfilter.org>
AuthorDate: Tue Jul 29 12:12:13 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Tue Jul 29 12:12:13 2008 +0200

    NFLOG: minor cleanup
    
    break lines at 80 char columns
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 904e16a934da969d5f32d35a7c0946a86a96a079
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Tue Jul 29 12:11:21 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Tue Jul 29 12:11:21 2008 +0200

    MAC2STR: Rename it to HWHDR
    
    Use a more appropriate name for this filter.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 6fcfeb97f7c28b75ee28d91663176ab5ff23414e
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Tue Jul 29 12:08:19 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Tue Jul 29 12:08:19 2008 +0200

    MAC2STR: add support for the new RAW MAC keys
    
    This patch modifies MAC2STR to use the new MAC keys that gives us more
    accurate information to parse the link layer header. This patch also
    does some probing based on the header and field size in the case of
    ULOG (since we do not have enough information to perform accurate
    parsing).
    
    Signed-off-by: Eric Leblond <eric at inl.fr>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 2d4c60fed7c0179450d07523ac023fcec391e634
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Tue Jul 29 11:49:24 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Tue Jul 29 11:49:24 2008 +0200

    NFLOG: get full link layer header (requires >= 2.6.27)
    
    This patch modifies the key structure of NFLOG. It solves the conflict
    between ULOG and NFLOG by ensuring that keys have the same meaning:
     * raw.mac is the full hardware header
     * raw.mac.saddr is the source hardware address
    Following Patrick suggestion, it adds a new key "raw.type" which is
    used to store the type of hardware.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
       via  9fdec30e232e74e103d80049e0772f2d619574cb (commit)
       via  cd8abed46eff3683a5d81e500673df5e80e2a353 (commit)
       via  904e16a934da969d5f32d35a7c0946a86a96a079 (commit)
       via  6fcfeb97f7c28b75ee28d91663176ab5ff23414e (commit)
       via  2d4c60fed7c0179450d07523ac023fcec391e634 (commit)
      from  0b789ea9bf810497845456e9b83bff8c5ae5ca23 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9fdec30e232e74e103d80049e0772f2d619574cb
Author: Eric Leblond <eric at inl.fr>
Date:   Tue Jul 29 12:24:18 2008 +0200

    cleanup: fix gcc warnings
    
    This patch fixes some gcc warnings:
     * Unused variables
     * Functions with wrong return (or without return)
    
    Signed-off-by: Eric Leblond <eric at inl.fr>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit cd8abed46eff3683a5d81e500673df5e80e2a353
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date:   Tue Jul 29 12:12:13 2008 +0200

    NFLOG: minor cleanup
    
    break lines at 80 char columns
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 904e16a934da969d5f32d35a7c0946a86a96a079
Author: Eric Leblond <eric at inl.fr>
Date:   Tue Jul 29 12:11:21 2008 +0200

    MAC2STR: Rename it to HWHDR
    
    Use a more appropriate name for this filter.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 6fcfeb97f7c28b75ee28d91663176ab5ff23414e
Author: Eric Leblond <eric at inl.fr>
Date:   Tue Jul 29 12:08:19 2008 +0200

    MAC2STR: add support for the new RAW MAC keys
    
    This patch modifies MAC2STR to use the new MAC keys that gives us more
    accurate information to parse the link layer header. This patch also
    does some probing based on the header and field size in the case of
    ULOG (since we do not have enough information to perform accurate
    parsing).
    
    Signed-off-by: Eric Leblond <eric at inl.fr>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 2d4c60fed7c0179450d07523ac023fcec391e634
Author: Eric Leblond <eric at inl.fr>
Date:   Tue Jul 29 11:49:24 2008 +0200

    NFLOG: get full link layer header (requires >= 2.6.27)
    
    This patch modifies the key structure of NFLOG. It solves the conflict
    between ULOG and NFLOG by ensuring that keys have the same meaning:
     * raw.mac is the full hardware header
     * raw.mac.saddr is the source hardware address
    Following Patrick suggestion, it adds a new key "raw.type" which is
    used to store the type of hardware.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

-----------------------------------------------------------------------

 configure.in                              |    2 +-
 filter/Makefile.am                        |    6 +-
 filter/raw2packet/ulogd_raw2packet_BASE.c |    3 -
 filter/ulogd_filter_HWHDR.c               |  241 +++++++++++++++++++++++++++++
 filter/ulogd_filter_IFINDEX.c             |    2 +-
 filter/ulogd_filter_IP2BIN.c              |    4 +-
 filter/ulogd_filter_MAC2STR.c             |  111 -------------
 filter/ulogd_filter_PWSNIFF.c             |    1 -
 input/packet/ulogd_inppkt_NFLOG.c         |   56 ++++++--
 output/mysql/ulogd_output_MYSQL.c         |    2 -
 output/pgsql/ulogd_output_PGSQL.c         |    1 -
 src/ulogd.c                               |    3 +-
 util/db.c                                 |    5 +-
 util/printpkt.c                           |    2 -
 14 files changed, 295 insertions(+), 144 deletions(-)
 create mode 100644 filter/ulogd_filter_HWHDR.c
 delete mode 100644 filter/ulogd_filter_MAC2STR.c
This patch modifies the key structure of NFLOG. It solves the conflict
between ULOG and NFLOG by ensuring that keys have the same meaning:
 * raw.mac is the full hardware header
 * raw.mac.saddr is the source hardware address
Following Patrick suggestion, it adds a new key "raw.type" which is
used to store the type of hardware.

Signed-off-by: Eric Leblond <eric at inl.fr>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

diff --git a/configure.in b/configure.in
index 8e0f6a3..96cc2d0 100644
--- a/configure.in
+++ b/configure.in
@@ -35,7 +35,7 @@ CFLAGS="$CFLAGS -Wall -Wextra"
 dnl Check for the right nfnetlink version
 LIBNFNETLINK_REQUIRED=0.0.39
 LIBNETFILTER_CONNTRACK_REQUIRED=0.0.95
-LIBNETFILTER_LOG_REQUIRED=0.0.14
+LIBNETFILTER_LOG_REQUIRED=0.0.15
 
 PKG_CHECK_MODULES(LIBNFNETLINK, libnfnetlink >= $LIBNFNETLINK_REQUIRED,, AC_MSG_ERROR(Cannot find libnfnetlink >= $LIBNFNETLINK_REQUIRED))
 
diff --git a/input/packet/ulogd_inppkt_NFLOG.c b/input/packet/ulogd_inppkt_NFLOG.c
index cb58661..4853c77 100644
--- a/input/packet/ulogd_inppkt_NFLOG.c
+++ b/input/packet/ulogd_inppkt_NFLOG.c
@@ -133,6 +133,9 @@ enum nflog_keys {
 	NFLOG_KEY_OOB_UID,
 	NFLOG_KEY_OOB_GID,
 	NFLOG_KEY_RAW_LABEL,
+	NFLOG_KEY_RAW_TYPE,
+	NFLOG_KEY_RAW_MAC_SADDR,
+	NFLOG_KEY_RAW_MAC_ADDRLEN,
 };
 
 static struct ulogd_key output_keys[] = {
@@ -140,6 +143,11 @@ static struct ulogd_key output_keys[] = {
 		.type = ULOGD_RET_RAW,
 		.flags = ULOGD_RETF_NONE,
 		.name = "raw.mac",
+	},
+	[NFLOG_KEY_RAW_MAC_SADDR] = {
+		.type = ULOGD_RET_RAW,
+		.flags = ULOGD_RETF_NONE,
+		.name = "raw.mac.saddr",
 		.ipfix = {
 			.vendor = IPFIX_VENDOR_IETF,
 			.field_id = IPFIX_sourceMacAddress,
@@ -240,6 +248,12 @@ static struct ulogd_key output_keys[] = {
 		.flags = ULOGD_RETF_NONE,
 		.name = "raw.mac_len",
 	},
+	[NFLOG_KEY_RAW_MAC_ADDRLEN] = {
+		.type = ULOGD_RET_UINT16,
+		.flags = ULOGD_RETF_NONE,
+		.name = "raw.mac.addrlen",
+	},
+
 	[NFLOG_KEY_OOB_SEQ_LOCAL] = {
 		.type = ULOGD_RET_UINT32,
 		.flags = ULOGD_RETF_NONE,
@@ -283,6 +297,11 @@ static struct ulogd_key output_keys[] = {
 		.flags = ULOGD_RETF_NONE,
 		.name = "raw.label",
 	},
+	[NFLOG_KEY_RAW_TYPE] = {
+		.type = ULOGD_RET_UINT16,
+		.flags = ULOGD_RETF_NONE,
+		.name = "raw.type",
+	},
 
 };
 
@@ -318,11 +337,22 @@ interp_packet(struct ulogd_pluginstance *upi, struct nflog_data *ldata)
 		ret[NFLOG_KEY_OOB_PROTOCOL].flags |= ULOGD_RETF_VALID;
 	}
 
-	if (hw) {
-		ret[NFLOG_KEY_RAW_MAC].u.value.ptr = hw->hw_addr;
+	if (nflog_get_msg_packet_hwhdrlen(ldata)) {
+		ret[NFLOG_KEY_RAW_MAC].u.value.ptr = nflog_get_msg_packet_hwhdr(ldata);
 		ret[NFLOG_KEY_RAW_MAC].flags |= ULOGD_RETF_VALID;
-		ret[NFLOG_KEY_RAW_MAC_LEN].u.value.ui16 = ntohs(hw->hw_addrlen);
+		ret[NFLOG_KEY_RAW_MAC_LEN].u.value.ui16 =
+			nflog_get_msg_packet_hwhdrlen(ldata);
 		ret[NFLOG_KEY_RAW_MAC_LEN].flags |= ULOGD_RETF_VALID;
+		ret[NFLOG_KEY_RAW_TYPE].u.value.ui16 =
+			nflog_get_hwtype(ldata);
+		ret[NFLOG_KEY_RAW_TYPE].flags |= ULOGD_RETF_VALID;
+	}
+
+	if (hw) {
+		ret[NFLOG_KEY_RAW_MAC_SADDR].u.value.ptr = hw->hw_addr;
+		ret[NFLOG_KEY_RAW_MAC_SADDR].flags |= ULOGD_RETF_VALID;
+		ret[NFLOG_KEY_RAW_MAC_ADDRLEN].u.value.ui16 = ntohs(hw->hw_addrlen);
+		ret[NFLOG_KEY_RAW_MAC_ADDRLEN].flags |= ULOGD_RETF_VALID;
 	}
 
 	if (payload_len >= 0) {



More information about the netfilter-cvslog mailing list