[netfilter-cvslog] r7293 - in trunk/conntrack-tools: . include src

pablo at netfilter.org pablo at netfilter.org
Wed Jan 23 13:30:37 CET 2008


Author: pablo at netfilter.org
Date: 2008-01-23 13:30:36 +0100 (Wed, 23 Jan 2008)
New Revision: 7293

Modified:
   trunk/conntrack-tools/ChangeLog
   trunk/conntrack-tools/include/mcast.h
   trunk/conntrack-tools/include/network.h
   trunk/conntrack-tools/src/build.c
   trunk/conntrack-tools/src/local.c
   trunk/conntrack-tools/src/mcast.c
   trunk/conntrack-tools/src/network.c
   trunk/conntrack-tools/src/sync-alarm.c
   trunk/conntrack-tools/src/sync-ftfw.c
   trunk/conntrack-tools/src/sync-mode.c
Log:
Max Kellermann <max at duempel.org>:
use size_t


Modified: trunk/conntrack-tools/ChangeLog
===================================================================
--- trunk/conntrack-tools/ChangeLog	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/ChangeLog	2008-01-23 12:30:36 UTC (rev 7293)
@@ -95,6 +95,7 @@
 o remove unused prototypes in network.h
 o check if the received packet is large enough
 o introduce alarm_pending()
+o cleanup: use size_t instead of integer
 
 version 0.9.5 (2007/07/29)
 ------------------------------

Modified: trunk/conntrack-tools/include/mcast.h
===================================================================
--- trunk/conntrack-tools/include/mcast.h	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/include/mcast.h	2008-01-23 12:30:36 UTC (rev 7293)
@@ -43,8 +43,8 @@
 struct mcast_sock *mcast_client_create(struct mcast_conf *conf);
 void mcast_client_destroy(struct mcast_sock *m);
 
-int mcast_send(struct mcast_sock *m, void *data, int size);
-int mcast_recv(struct mcast_sock *m, void *data, int size);
+ssize_t mcast_send(struct mcast_sock *m, void *data, int size);
+ssize_t mcast_recv(struct mcast_sock *m, void *data, int size);
 
 struct mcast_stats *mcast_get_stats(struct mcast_sock *m);
 void mcast_dump_stats(int fd, struct mcast_sock *s, struct mcast_sock *r);

Modified: trunk/conntrack-tools/include/network.h
===================================================================
--- trunk/conntrack-tools/include/network.h	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/include/network.h	2008-01-23 12:30:36 UTC (rev 7293)
@@ -2,6 +2,7 @@
 #define _NETWORK_H_
 
 #include <stdint.h>
+#include <sys/types.h>
 
 struct nf_conntrack;
 
@@ -53,7 +54,7 @@
 struct mcast_sock;
 
 void build_netmsg(struct nf_conntrack *ct, int query, struct nethdr *net);
-int prepare_send_netmsg(struct mcast_sock *m, void *data);
+size_t prepare_send_netmsg(struct mcast_sock *m, void *data);
 int mcast_send_netmsg(struct mcast_sock *m, void *data);
 int handle_netmsg(struct nethdr *net);
 int mcast_track_seq(uint32_t seq, uint32_t *exp_seq);
@@ -62,8 +63,8 @@
 
 int mcast_buffered_init(struct mcast_conf *conf);
 void mcast_buffered_destroy(void);
-int mcast_buffered_send_netmsg(struct mcast_sock *m, void *data, int len);
-int mcast_buffered_pending_netmsg(struct mcast_sock *m);
+int mcast_buffered_send_netmsg(struct mcast_sock *m, void *data, size_t len);
+ssize_t mcast_buffered_pending_netmsg(struct mcast_sock *m);
 
 #define IS_DATA(x)	((x->flags & ~NET_F_HELLO) == 0)
 #define IS_ACK(x)	(x->flags & NET_F_ACK)

Modified: trunk/conntrack-tools/src/build.c
===================================================================
--- trunk/conntrack-tools/src/build.c	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/src/build.c	2008-01-23 12:30:36 UTC (rev 7293)
@@ -20,7 +20,7 @@
 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
 #include "network.h"
 
-static void addattr(struct netpld *pld, int attr, const void *data, int len)
+static void addattr(struct netpld *pld, int attr, const void *data, size_t len)
 {
 	struct netattr *nta;
 	int tlen = NTA_LENGTH(len);

Modified: trunk/conntrack-tools/src/local.c
===================================================================
--- trunk/conntrack-tools/src/local.c	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/src/local.c	2008-01-23 12:30:36 UTC (rev 7293)
@@ -29,7 +29,7 @@
 int local_server_create(struct local_server *server, struct local_conf *conf)
 {
 	int fd;
-	int len;
+	socklen_t len;
 	struct sockaddr_un local;
 
 	if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
@@ -90,7 +90,7 @@
 
 int local_client_create(struct local_conf *conf)
 {
-	int len;
+	socklen_t len;
 	struct sockaddr_un local;
 	int fd;
 

Modified: trunk/conntrack-tools/src/mcast.c
===================================================================
--- trunk/conntrack-tools/src/mcast.c	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/src/mcast.c	2008-01-23 12:30:36 UTC (rev 7293)
@@ -238,9 +238,9 @@
 	free(m);
 }
 
-int mcast_send(struct mcast_sock *m, void *data, int size)
+ssize_t mcast_send(struct mcast_sock *m, void *data, int size)
 {
-	int ret;
+	ssize_t ret;
 	
 	ret = sendto(m->fd, 
 		     data,
@@ -260,9 +260,9 @@
 	return ret;
 }
 
-int mcast_recv(struct mcast_sock *m, void *data, int size)
+ssize_t mcast_recv(struct mcast_sock *m, void *data, int size)
 {
-	int ret;
+	ssize_t ret;
 	socklen_t sin_size = sizeof(struct sockaddr_in);
 
         ret = recvfrom(m->fd,

Modified: trunk/conntrack-tools/src/network.c
===================================================================
--- trunk/conntrack-tools/src/network.c	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/src/network.c	2008-01-23 12:30:36 UTC (rev 7293)
@@ -27,7 +27,7 @@
 
 static unsigned int seq_set, cur_seq;
 
-static int __do_send(struct mcast_sock *m, void *data, int len)
+static size_t __do_send(struct mcast_sock *m, void *data, size_t len)
 {
 	struct nethdr *net = data;
 
@@ -50,7 +50,7 @@
 	return mcast_send(m, net, len);
 }
 
-static int __do_prepare(struct mcast_sock *m, void *data, int len)
+static size_t __do_prepare(struct mcast_sock *m, void *data, size_t len)
 {
 	struct nethdr *net = data;
 
@@ -66,12 +66,12 @@
 	return len;
 }
 
-static int __prepare_ctl(struct mcast_sock *m, void *data)
+static size_t __prepare_ctl(struct mcast_sock *m, void *data)
 {
 	return __do_prepare(m, data, NETHDR_ACK_SIZ);
 }
 
-static int __prepare_data(struct mcast_sock *m, void *data)
+static size_t __prepare_data(struct mcast_sock *m, void *data)
 {
 	struct nethdr *net = (struct nethdr *) data;
 	struct netpld *pld = NETHDR_DATA(net);
@@ -79,7 +79,7 @@
 	return __do_prepare(m, data, ntohs(pld->len) + NETPLD_SIZ + NETHDR_SIZ);
 }
 
-int prepare_send_netmsg(struct mcast_sock *m, void *data)
+size_t prepare_send_netmsg(struct mcast_sock *m, void *data)
 {
 	int ret = 0;
 	struct nethdr *net = (struct nethdr *) data;
@@ -92,8 +92,8 @@
 	return ret;
 }
 
-static int tx_buflenmax;
-static int tx_buflen = 0;
+static size_t tx_buflenmax;
+static size_t tx_buflen = 0;
 static char *tx_buf;
 
 #define HEADERSIZ 28 /* IP header (20 bytes) + UDP header 8 (bytes) */
@@ -121,7 +121,7 @@
 }
 
 /* return 0 if it is not sent, otherwise return 1 */
-int mcast_buffered_send_netmsg(struct mcast_sock *m, void *data, int len)
+int mcast_buffered_send_netmsg(struct mcast_sock *m, void *data, size_t len)
 {
 	int ret = 0;
 	struct nethdr *net = data;
@@ -140,9 +140,9 @@
 	return ret;
 }
 
-int mcast_buffered_pending_netmsg(struct mcast_sock *m)
+ssize_t mcast_buffered_pending_netmsg(struct mcast_sock *m)
 {
-	int ret;
+	ssize_t ret;
 
 	if (tx_buflen == 0)
 		return 0;
@@ -156,7 +156,7 @@
 int mcast_send_netmsg(struct mcast_sock *m, void *data)
 {
 	int ret;
-	int len = prepare_send_netmsg(m, data);
+	size_t len = prepare_send_netmsg(m, data);
 
 	ret = mcast_buffered_send_netmsg(m, data, len);
 	mcast_buffered_pending_netmsg(m);

Modified: trunk/conntrack-tools/src/sync-alarm.c
===================================================================
--- trunk/conntrack-tools/src/sync-alarm.c	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/src/sync-alarm.c	2008-01-23 12:30:36 UTC (rev 7293)
@@ -29,7 +29,7 @@
 
 static void refresher(struct alarm_list *a, void *data)
 {
-	int len;
+	size_t len;
 	struct nethdr *net;
 	struct us_conntrack *u = data;
 

Modified: trunk/conntrack-tools/src/sync-ftfw.c
===================================================================
--- trunk/conntrack-tools/src/sync-ftfw.c	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/src/sync-ftfw.c	2008-01-23 12:30:36 UTC (rev 7293)
@@ -285,7 +285,7 @@
 static int tx_queue_xmit(void *data1, const void *data2)
 {
 	struct nethdr *net = data1;
-	int len = prepare_send_netmsg(STATE_SYNC(mcast_client), net);
+	size_t len = prepare_send_netmsg(STATE_SYNC(mcast_client), net);
 
 	dp("tx_queue sq: %u fl:%u len:%u\n",
                ntohl(net->seq), ntohs(net->flags), ntohs(net->len));
@@ -307,7 +307,7 @@
 {
 	int ret;
 	struct nethdr *net = BUILD_NETMSG(u->ct, NFCT_Q_UPDATE);
-	int len = prepare_send_netmsg(STATE_SYNC(mcast_client), net);
+	size_t len = prepare_send_netmsg(STATE_SYNC(mcast_client), net);
 
 	dp("tx_list sq: %u fl:%u len:%u\n",
                 ntohl(net->seq), ntohs(net->flags),

Modified: trunk/conntrack-tools/src/sync-mode.c
===================================================================
--- trunk/conntrack-tools/src/sync-mode.c	2008-01-23 12:15:25 UTC (rev 7292)
+++ trunk/conntrack-tools/src/sync-mode.c	2008-01-23 12:30:36 UTC (rev 7293)
@@ -88,7 +88,8 @@
 /* handler for multicast messages received */
 static void mcast_handler(void)
 {
-	int numbytes, remain;
+	ssize_t numbytes;
+	ssize_t remain;
 	char __net[65536], *ptr = __net; /* XXX: maximum MTU for IPv4 */
 
 	numbytes = mcast_recv(STATE_SYNC(mcast_server), __net, sizeof(__net));
@@ -339,7 +340,7 @@
 			    struct nf_conntrack *ct,
 			    int query)
 {
-	int len;
+	size_t len;
 	struct nethdr *net;
 
 	if (!state_helper_verdict(query, ct))
@@ -373,7 +374,7 @@
 
 	if (!cache_test(STATE_SYNC(internal), ct)) {
 		if ((u = cache_update_force(STATE_SYNC(internal), ct))) {
-			int len;
+			size_t len;
 
 			debug_ct(u->ct, "overrun resync");
 
@@ -397,7 +398,7 @@
 
 	ret = nfct_query(h, NFCT_Q_GET, u->ct);
 	if (ret == -1 && errno == ENOENT) {
-		int len;
+		size_t len;
 		struct nethdr *net = BUILD_NETMSG(u->ct, NFCT_Q_DESTROY);
 
 		debug_ct(u->ct, "overrun purge resync");




More information about the netfilter-cvslog mailing list