Skip to contentSkip to conversation

minor code cleaning

PATCH In review Eric Leblond 1 participant 6 messages Jan 19, 2013 – Jan 25, 2013 netfilter

lore
Share & tools
lore
#0 lore raw

cover minor code cleaning

Hello,

Here's a ulogd patchset containing minor code cleaning. First patch is suppressing $Id$ used by svn. Remaining patches fix clang warning.

BR,
--
Eric Leblond <[email protected]>

#1 lore raw

PATCH 1/4 Get rid of SVN tag in comment.

This patch also update some copyright and licence declaration.

---
 README                                    |    2 --
 doc/ulogd.sgml                            |    2 --
 filter/raw2packet/ulogd_raw2packet_BASE.c |    4 +---
 filter/ulogd_filter_HWHDR.c               |    3 +--
 filter/ulogd_filter_IFINDEX.c             |    4 +---
 filter/ulogd_filter_IP2BIN.c              |    1 -
 filter/ulogd_filter_IP2STR.c              |    3 +--
 filter/ulogd_filter_MARK.c                |    3 +--
 filter/ulogd_filter_PWSNIFF.c             |    2 --
 include/libipulog/libipulog.h             |    2 --
 include/ulogd/addr.h                      |    7 +++++++
 include/ulogd/conffile.h                  |    2 --
 include/ulogd/db.h                        |    7 +++++++
 include/ulogd/ulogd.h                     |    3 +--
 libipulog/libipulog.c                     |    5 ++---
 libipulog/ulog_test.c                     |    3 +--
 output/mysql/ulogd_output_MYSQL.c         |    2 --
 output/pcap/ulogd_output_PCAP.c           |    2 --
 output/ulogd_output_IPFIX.c               |    4 +---
 output/ulogd_output_LOGEMU.c              |    4 +---
 output/ulogd_output_OPRINT.c              |    4 +---
 output/ulogd_output_SYSLOG.c              |    2 --
 src/addr.c                                |    5 +----
 src/conffile.c                            |    3 +--
 src/select.c                              |    7 +------
 src/timer.c                               |    4 +---
 src/ulogd.c                               |    5 ++---
 ulogd.conf.in                             |    1 -
 util/db.c                                 |    3 +--
 util/printflow.c                          |    2 --
 util/printpkt.c                           |    2 --
 31 files changed, 33 insertions(+), 70 deletions(-)
README +0 -2
index 31549a4..369c264 100644
@@ -1,7 +1,5 @@
 Userspace logging daemon for netfilter/iptables
 
-$Id$
-
 Project Homepage: http://www.gnumonks.org/projects/ulogd
 Mailinglist: http://lists.gnumonks.org/mailman/listinfo/ulogd/
 
doc/ulogd.sgml +0 -2
index 9781e9f..30bfecb 100644
@@ -1,7 +1,5 @@
 <!doctype linuxdoc system>
 
-<!-- $Id$ -->
-
 <article>
 
 <title>ULOGD 2.x - the Netfilter Userspace Logging Daemon</title>
filter/raw2packet/ulogd_raw2packet_BASE.c +1 -3
index 9ae838d..8a6b4da 100644
@@ -1,4 +1,4 @@
-/* ulogd_MAC.c, Version $Revision$
+/* ulogd_MAC.c
  *
  * ulogd interpreter plugin for 
  * 	o MAC addresses
@@ -26,8 +26,6 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- 
- * $Id$
  *
  */
 
filter/ulogd_filter_HWHDR.c +1 -2
index 2f266fa..3b095c9 100644
@@ -1,4 +1,4 @@
-/* ulogd_filter_HWHDR.c, Version $Revision: 1500 $
+/* ulogd_filter_HWHDR.c
  *
  * ulogd interpreter plugin for HWMAC
  *
@@ -20,7 +20,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ulogd_filter_IFINDEX.c 1500 2005-10-03 16:54:02Z laforge $
  */
 
 #include <stdio.h>
filter/ulogd_filter_IFINDEX.c +1 -3
index 41e556d..3ca5795 100644
@@ -1,4 +1,4 @@
-/* ulogd_filter_IFINDEX.c, Version $Revision: 1500 $
+/* ulogd_filter_IFINDEX.c
  *
  * ulogd interpreter plugin for ifindex to ifname conversion
  *
@@ -18,8 +18,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ulogd_filter_IFINDEX.c 1500 2005-10-03 16:54:02Z laforge $
- *
  */
 
 #include <stdio.h>
filter/ulogd_filter_IP2BIN.c +0 -1
index 84fe21b..e47eeaf 100644
@@ -19,7 +19,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ulogd_filter_IFINDEX.c 1500 2005-10-03 16:54:02Z laforge $
  */
 
 #include <stdio.h>
filter/ulogd_filter_IP2STR.c +1 -2
index 146c054..44157fe 100644
@@ -1,4 +1,4 @@
-/* ulogd_filter_IP2STR.c, Version $Revision: 1500 $
+/* ulogd_filter_IP2STR.c
  *
  * ulogd interpreter plugin for internal IP storage format to string conversion
  *
@@ -19,7 +19,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ulogd_filter_IFINDEX.c 1500 2005-10-03 16:54:02Z laforge $
  */
 
 #include <stdio.h>
filter/ulogd_filter_MARK.c +1 -2
index b113f7d..7807f63 100644
@@ -1,4 +1,4 @@
-/* ulogd_filter_MARK.c, Version $Revision: 1500 $
+/* ulogd_filter_MARK.c
  *
  * ulogd interpreter plugin for internal IP storage format to string conversion
  *
@@ -19,7 +19,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ulogd_filter_IFINDEX.c 1500 2005-10-03 16:54:02Z laforge $
  */
 
 #include <stdio.h>
filter/ulogd_filter_PWSNIFF.c +0 -2
index 439a8b3..5169eee 100644
@@ -17,8 +17,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id$
- *
  */
 
 #include <stdio.h>
include/libipulog/libipulog.h +0 -2
index 1f6aee9..b3c9616 100644
@@ -1,8 +1,6 @@
 #ifndef _LIBIPULOG_H
 #define _LIBIPULOG_H
 
-/* $Id$ */
-
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
include/ulogd/addr.h +7 -0
index 9c91270..b4432e3 100644
@@ -1,3 +1,10 @@
+/* IP address handling functions
+ *
+ * (C) 2012 by Pablo Neira Ayuso <[email protected]>
+ * (C) 2012 by Eric Leblond <[email protected]>
+ *
+ * This code is distributed under the terms of GNU GPL version 2 */
+
 #ifndef _ADDR_H
 #define _ADDR_H
 
include/ulogd/conffile.h +0 -2
index aa35809..09eb8cf 100644
@@ -2,8 +2,6 @@
  *
  * (C) 2000 by Harald Welte <[email protected]>
  *
- * $Id$
- * 
  * This code is distributed under the terms of GNU GPL */
 
 #ifndef _CONFFILE_H
include/ulogd/db.h +7 -0
index b0b7295..1c910ff 100644
@@ -1,3 +1,10 @@
+/* DB handling functions
+ *
+ * (C) 2000-2005 by Harald Welte <[email protected]>
+ *
+ * This code is distributed under the terms of GNU GPL version 2 */
+
+
 #ifndef _ULOGD_DB_H
 #define _ULOGD_DB_H
 
include/ulogd/ulogd.h +1 -2
index 41c2e9b..90272eb 100644
@@ -1,6 +1,6 @@
 #ifndef _ULOGD_H
 #define _ULOGD_H
-/* ulogd, Version $Revision$
+/* ulogd
  *
  * userspace logging daemon for netfilter ULOG target
  * of the linux 2.4/2.6 netfilter subsystem.
@@ -9,7 +9,6 @@
  *
  * this code is released under the terms of GNU GPL
  *
- * $Id$
  */
 
 #include <ulogd/linuxlist.h>
libipulog/libipulog.c +2 -3
index 2f58ea6..ab28bb4 100644
@@ -1,5 +1,5 @@
-/* 
- * libipulog.c, $Revision$
+/*
+ * libipulog.c
  *
  * netfilter ULOG userspace library.
  *
@@ -21,7 +21,6 @@
  * This library is still under development, so be aware of sudden interface
  * changes
  *
- * $Id$
  */
 
 #include <stdlib.h>
libipulog/ulog_test.c +1 -2
index fd9c925..0665717 100644
@@ -1,4 +1,4 @@
-/* ulog_test, $Revision: 1.4 $
+/* ulog_test
  *
  * small testing program for libipulog, part of the netfilter ULOG target
  * for the linux 2.4 netfilter subsystem.
@@ -7,7 +7,6 @@
  *
  * this code is released under the terms of GNU GPL
  *
- * $Id: ulog_test.c,v 1.4 2001/01/30 09:28:04 laforge Exp $
  */
 
 #include <stdio.h>
output/mysql/ulogd_output_MYSQL.c +0 -2
index e442e5a..72c080e 100644
@@ -16,8 +16,6 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
- * $Id$
  *
  * 15 May 2001, Alex Janssen <[email protected]>:
  *      Added a compability option for older MySQL-servers, which
output/pcap/ulogd_output_PCAP.c +0 -2
index 2d3f001..e7798f2 100644
@@ -17,8 +17,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id$
- *
  */
 
 #include <stdio.h>
output/ulogd_output_IPFIX.c +1 -3
index 432d37e..761d272 100644
@@ -1,4 +1,4 @@
-/* ulogd_output_IPFIX.c, Version $Revision: 1628 $
+/* ulogd_output_IPFIX.c
  *
  * ulogd output plugin for IPFIX
  *
@@ -20,8 +20,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ulogd_output_LOGEMU.c 1628 2005-11-04 15:23:12Z laforge $
- *
  * TODO:
  * - where to get a useable <sctp.h> for linux ?
  * - implement PR-SCTP (no api definition in draft sockets api)
output/ulogd_output_LOGEMU.c +1 -3
index 1d0a7e6..26f139b 100644
@@ -1,4 +1,4 @@
-/* ulogd_LOGEMU.c, Version $Revision$
+/* ulogd_LOGEMU.c
  *
  * ulogd output target for syslog logging emulation
  *
@@ -20,8 +20,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id$
- *
  */
 #include <limits.h>
 #include <stdio.h>
output/ulogd_output_OPRINT.c +1 -3
index 863859a..e390c84 100644
@@ -1,4 +1,4 @@
-/* ulogd_MAC.c, Version $Revision$
+/* ulogd_OPRINT.C
  *
  * ulogd output target for logging to a file 
  *
@@ -17,8 +17,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id$
- *
  */
 
 #include <stdio.h>
output/ulogd_output_SYSLOG.c +0 -2
index 3bcc637..9777f0f 100644
@@ -19,8 +19,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id$
- *
  */
 
 #include <stdio.h>
src/addr.c +1 -4
index 9a68ed8..2672fab 100644
@@ -1,7 +1,4 @@
-/* ulogd
- *
- * userspace logging daemon for the iptables ULOG target
- * of the linux 2.4 netfilter subsystem.
+/* IP address handling functions
  *
  * (C) 2012 by Pablo Neira Ayuso <[email protected]>
  * (C) 2012 by Eric Leblond <[email protected]>
src/conffile.c +1 -2
index 8dbd726..dd0ed8f 100644
@@ -1,9 +1,8 @@
 /* config file parser functions
  *
  * (C) 2000-2005 by Harald Welte <[email protected]>
+ * (C) 2013 by Eric Leblond <[email protected]>
  *
- * $Id$
- * 
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 
  *  as published by the Free Software Foundation
src/select.c +1 -6
index aaca517..edb75d5 100644
@@ -1,9 +1,4 @@
-/* ulogd, Version $LastChangedRevision: 476 $
- *
- * $Id: ulogd.c 476 2004-07-23 03:19:35Z laforge $
- *
- * userspace logging daemon for the iptables ULOG target
- * of the linux 2.4 netfilter subsystem.
+/* select related functions
  *
  * (C) 2000-2005 by Harald Welte <[email protected]>
  *
src/timer.c +1 -3
index c4da0a5..5969fb8 100644
@@ -1,6 +1,4 @@
-/* ulogd, Version $LastChangedRevision: 476 $
- *
- * $Id: ulogd.c 476 2004-07-23 03:19:35Z laforge $
+/* timer implementation
  *
  * userspace logging daemon for the netfilter subsystem
  *
src/ulogd.c +2 -3
index 5693572..d0fdcc5 100644
@@ -1,10 +1,9 @@
-/* ulogd, Version $LastChangedRevision$
- *
- * $Id$
+/* ulogd
  *
  * unified network logging daemon for Linux.
  *
  * (C) 2000-2005 by Harald Welte <[email protected]>
+ * (C) 2013 by Eric Leblond <[email protected]>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 
ulogd.conf.in +0 -1
index d5db77b..f4f63d9 100644
@@ -1,5 +1,4 @@
 # Example configuration for ulogd
-# $Id$
 # Adapted to Debian by Achilleas Kotsis <[email protected]>
 
 [global]
util/db.c +1 -2
index 54f8882..0d8b9c1 100644
@@ -1,4 +1,4 @@
-/* db.c, Version $Revision: 6304 $
+/* db.c
  *
  * ulogd helper functions for Database / SQL output plugins
  *
@@ -22,7 +22,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
- * $Id: ulogd_output_MYSQL.c 6304 2005-12-08 09:43:19Z /C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/[email protected] $
  */
 
 #include <unistd.h>
util/printflow.c +0 -2
index 7743a6a..30e622c 100644
@@ -17,8 +17,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: printflow.c,v 1.1 2006/05/16 01:57:31 philipc Exp $
- *
  */
 
 #include <string.h>
util/printpkt.c +0 -2
index 9eb339b..3983a68 100644
@@ -17,8 +17,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id$
- *
  */
 
 #include <stdio.h>
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/4 Fix warning on format

In reply to Eric Leblond

It seems Z is a libc5 only format modifier. Using standard 'z' instead.

---
 util/printpkt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util/printpkt.c +1 -1
index 3983a68..6b646e9 100644
@@ -299,7 +299,7 @@ static int printpkt_ipv6(struct ulogd_key *res, char *buf)
 				   (char *) ikey_get_ptr(&res[KEY_IP_DADDR]));
 
 	if (pp_is_valid(res, KEY_IP6_PAYLOAD_LEN))
-		buf_cur += sprintf(buf_cur, "LEN=%Zu ",
+		buf_cur += sprintf(buf_cur, "LEN=%zu ",
 				   ikey_get_u16(&res[KEY_IP6_PAYLOAD_LEN]) +
 				   sizeof(struct ip6_hdr));
 
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/4 base: fix warning on pointer handling

In reply to Eric Leblond
---
 filter/raw2packet/ulogd_raw2packet_BASE.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
filter/raw2packet/ulogd_raw2packet_BASE.c +4 -4
index 8a6b4da..8dfe38e 100644
@@ -895,10 +895,10 @@ static int _interp_arp(struct ulogd_pluginstance *pi, u_int32_t len)
 	okey_set_u16(&ret[KEY_ARP_PTYPE], ntohs(arph->arp_pro));
 	okey_set_u16(&ret[KEY_ARP_OPCODE], ntohs(arph->arp_op));
 
-	okey_set_ptr(&ret[KEY_ARP_SHA], &arph->arp_sha);
-	okey_set_ptr(&ret[KEY_ARP_SPA], &arph->arp_spa),
-	okey_set_ptr(&ret[KEY_ARP_THA], &arph->arp_tha);
-	okey_set_ptr(&ret[KEY_ARP_TPA], &arph->arp_tpa);
+	okey_set_ptr(&ret[KEY_ARP_SHA], (void *)&arph->arp_sha);
+	okey_set_ptr(&ret[KEY_ARP_SPA], (void *)&arph->arp_spa),
+	okey_set_ptr(&ret[KEY_ARP_THA], (void *)&arph->arp_tha);
+	okey_set_ptr(&ret[KEY_ARP_TPA], (void *)&arph->arp_tpa);
 
 	return ULOGD_IRET_OK;
 }
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/4 graphite: fix warning about gnu extension usage

In reply to Eric Leblond

clang is complaining about missing = being a gnu extension. This patch adds equal sign to fix the warning.

---
 output/ulogd_output_GRAPHITE.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
output/ulogd_output_GRAPHITE.c +4 -4
index 25b578e..a4b31a5 100644
@@ -42,19 +42,19 @@ enum {
 
 
 static struct ulogd_key graphite_inp[] = {
-	[KEY_SUM_NAME] {
+	[KEY_SUM_NAME] = {
 		.type	= ULOGD_RET_STRING,
 		.name	= "sum.name",
 	},
-	[KEY_SUM_PKTS] {
+	[KEY_SUM_PKTS] = {
 		.type	= ULOGD_RET_UINT64,
 		.name	= "sum.pkts",
 	},
-	[KEY_SUM_BYTES] {
+	[KEY_SUM_BYTES] = {
 		.type	= ULOGD_RET_UINT64,
 		.name	= "sum.bytes",
 	},
-	[KEY_OOB_TIME_SEC] {
+	[KEY_OOB_TIME_SEC] = {
 		.type = ULOGD_RET_UINT32,
 		.name = "oob.time.sec",
 	},
Signature · 1 line
1.7.10.4
#5 lore raw
In reply to Eric Leblond

Hello,

Patchset has been applied with two more minor source cleaning.

BR,

Quoted 12 lines · Eric Leblond

Hello,

Here's a ulogd patchset containing minor code cleaning. First patch is suppressing $Id$ used by svn. Remaining patches fix clang warning.

BR,
--
Eric Leblond <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Eric Leblond <[email protected]>
Blog: https://home.regit.org/