[netfilter-cvslog] r7446 - in trunk/iptables: . extensions include include/linux/netfilter libiptc

kaber at trash.net kaber at trash.net
Sun Apr 6 17:43:13 CEST 2008


Author: kaber at trash.net
Date: 2008-04-06 17:43:13 +0200 (Sun, 06 Apr 2008)
New Revision: 7446

Modified:
   trunk/iptables/configure.ac
   trunk/iptables/extensions/libipt_SAME.c
   trunk/iptables/extensions/libipt_addrtype.c
   trunk/iptables/extensions/libxt_RATEEST.c
   trunk/iptables/extensions/libxt_conntrack.c
   trunk/iptables/extensions/libxt_hashlimit.c
   trunk/iptables/extensions/libxt_state.c
   trunk/iptables/extensions/libxt_statistic.c
   trunk/iptables/include/linux/netfilter/xt_sctp.h
   trunk/iptables/include/xtables.h
   trunk/iptables/ip6tables-save.c
   trunk/iptables/ip6tables.c
   trunk/iptables/iptables-save.c
   trunk/iptables/iptables-xml.c
   trunk/iptables/iptables.c
   trunk/iptables/libiptc/libiptc.c
   trunk/iptables/xtables.c
Log:
[PATCH 05/24] Fix -Wshadow warnings and clean up xt_sctp.h

Note: xt_sctp.h is still not merged upstream in the kernel as of
this commit. But a refactoring was really needed.


Modified: trunk/iptables/configure.ac
===================================================================
--- trunk/iptables/configure.ac	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/configure.ac	2008-04-06 15:43:13 UTC (rev 7446)
@@ -46,8 +46,7 @@
 # Remove workarounds soon
 regular_CFLAGS="$regular_CFLAGS -Wno-aggregate-return \
 	-Wno-missing-declarations -Wno-missing-prototypes \
-        -Wno-unused-parameter \
-	-Wno-shadow -Wno-inline"
+        -Wno-unused-parameter"
 
 AC_SUBST([regular_CFLAGS kinclude_CFLAGS])
 AC_SUBST([kbuilddir])

Modified: trunk/iptables/extensions/libipt_SAME.c
===================================================================
--- trunk/iptables/extensions/libipt_SAME.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/extensions/libipt_SAME.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -149,7 +149,7 @@
 	unsigned int count;
 	struct ipt_same_info *mr
 		= (struct ipt_same_info *)target->data;
-	int random = 0;
+	int random_selection = 0;
 	
 	printf("same:");
 	
@@ -167,13 +167,13 @@
 		else
 			printf("-%s ", ipaddr_to_numeric(&a));
 		if (r->flags & IP_NAT_RANGE_PROTO_RANDOM) 
-			random = 1;
+			random_selection = 1;
 	}
 	
 	if (mr->info & IPT_SAME_NODST)
 		printf("nodst ");
 
-	if (random)
+	if (random_selection)
 		printf("random ");
 }
 
@@ -183,7 +183,7 @@
 	unsigned int count;
 	struct ipt_same_info *mr
 		= (struct ipt_same_info *)target->data;
-	int random = 0;
+	int random_selection = 0;
 
 	for (count = 0; count < mr->rangesize; count++) {
 		struct ip_nat_range *r = &mr->range[count];
@@ -198,13 +198,13 @@
 		else
 			printf("-%s ", ipaddr_to_numeric(&a));
 		if (r->flags & IP_NAT_RANGE_PROTO_RANDOM) 
-			random = 1;
+			random_selection = 1;
 	}
 	
 	if (mr->info & IPT_SAME_NODST)
 		printf("--nodst ");
 
-	if (random)
+	if (random_selection)
 		printf("--random ");
 }
 

Modified: trunk/iptables/extensions/libipt_addrtype.c
===================================================================
--- trunk/iptables/extensions/libipt_addrtype.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/extensions/libipt_addrtype.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -49,12 +49,12 @@
 }
 
 static int
-parse_type(const char *name, size_t strlen, u_int16_t *mask)
+parse_type(const char *name, size_t len, u_int16_t *mask)
 {
 	int i;
 
 	for (i = 0; rtn_names[i]; i++)
-		if (strncasecmp(name, rtn_names[i], strlen) == 0) {
+		if (strncasecmp(name, rtn_names[i], len) == 0) {
 			/* build up bitmask for kernel module */
 			*mask |= (1 << i);
 			return 1;

Modified: trunk/iptables/extensions/libxt_RATEEST.c
===================================================================
--- trunk/iptables/extensions/libxt_RATEEST.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/extensions/libxt_RATEEST.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -177,17 +177,17 @@
 __RATEEST_print(const struct xt_entry_target *target, const char *prefix)
 {
 	struct xt_rateest_target_info *info = (void *)target->data;
-	unsigned int interval;
-	unsigned int ewma_log;
+	unsigned int local_interval;
+	unsigned int local_ewma_log;
 
-	interval = (TIME_UNITS_PER_SEC << (info->interval + 2)) / 4;
-	ewma_log = interval * (1 << (info->ewma_log));
+	local_interval = (TIME_UNITS_PER_SEC << (info->interval + 2)) / 4;
+	local_ewma_log = local_interval * (1 << (info->ewma_log));
 
 	printf("%sname %s ", prefix, info->name);
 	printf("%sinterval ", prefix);
-	RATEEST_print_time(interval);
+	RATEEST_print_time(local_interval);
 	printf("%sewmalog ", prefix);
-	RATEEST_print_time(ewma_log);
+	RATEEST_print_time(local_ewma_log);
 }
 
 static void

Modified: trunk/iptables/extensions/libxt_conntrack.c
===================================================================
--- trunk/iptables/extensions/libxt_conntrack.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/extensions/libxt_conntrack.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -78,21 +78,21 @@
 };
 
 static int
-parse_state(const char *state, size_t strlen, struct xt_conntrack_info *sinfo)
+parse_state(const char *state, size_t len, struct xt_conntrack_info *sinfo)
 {
-	if (strncasecmp(state, "INVALID", strlen) == 0)
+	if (strncasecmp(state, "INVALID", len) == 0)
 		sinfo->statemask |= XT_CONNTRACK_STATE_INVALID;
-	else if (strncasecmp(state, "NEW", strlen) == 0)
+	else if (strncasecmp(state, "NEW", len) == 0)
 		sinfo->statemask |= XT_CONNTRACK_STATE_BIT(IP_CT_NEW);
-	else if (strncasecmp(state, "ESTABLISHED", strlen) == 0)
+	else if (strncasecmp(state, "ESTABLISHED", len) == 0)
 		sinfo->statemask |= XT_CONNTRACK_STATE_BIT(IP_CT_ESTABLISHED);
-	else if (strncasecmp(state, "RELATED", strlen) == 0)
+	else if (strncasecmp(state, "RELATED", len) == 0)
 		sinfo->statemask |= XT_CONNTRACK_STATE_BIT(IP_CT_RELATED);
-	else if (strncasecmp(state, "UNTRACKED", strlen) == 0)
+	else if (strncasecmp(state, "UNTRACKED", len) == 0)
 		sinfo->statemask |= XT_CONNTRACK_STATE_UNTRACKED;
-	else if (strncasecmp(state, "SNAT", strlen) == 0)
+	else if (strncasecmp(state, "SNAT", len) == 0)
 		sinfo->statemask |= XT_CONNTRACK_STATE_SNAT;
-	else if (strncasecmp(state, "DNAT", strlen) == 0)
+	else if (strncasecmp(state, "DNAT", len) == 0)
 		sinfo->statemask |= XT_CONNTRACK_STATE_DNAT;
 	else
 		return 0;
@@ -154,18 +154,18 @@
 }
 
 static int
-parse_status(const char *status, size_t strlen, struct xt_conntrack_info *sinfo)
+parse_status(const char *status, size_t len, struct xt_conntrack_info *sinfo)
 {
-	if (strncasecmp(status, "NONE", strlen) == 0)
+	if (strncasecmp(status, "NONE", len) == 0)
 		sinfo->statusmask |= 0;
-	else if (strncasecmp(status, "EXPECTED", strlen) == 0)
+	else if (strncasecmp(status, "EXPECTED", len) == 0)
 		sinfo->statusmask |= IPS_EXPECTED;
-	else if (strncasecmp(status, "SEEN_REPLY", strlen) == 0)
+	else if (strncasecmp(status, "SEEN_REPLY", len) == 0)
 		sinfo->statusmask |= IPS_SEEN_REPLY;
-	else if (strncasecmp(status, "ASSURED", strlen) == 0)
+	else if (strncasecmp(status, "ASSURED", len) == 0)
 		sinfo->statusmask |= IPS_ASSURED;
 #ifdef IPS_CONFIRMED
-	else if (strncasecmp(status, "CONFIRMED", strlen) == 0)
+	else if (strncasecmp(status, "CONFIRMED", len) == 0)
 		sinfo->statusmask |= IPS_CONFIRMED;
 #endif
 	else

Modified: trunk/iptables/extensions/libxt_hashlimit.c
===================================================================
--- trunk/iptables/extensions/libxt_hashlimit.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/extensions/libxt_hashlimit.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -106,10 +106,10 @@
 
 
 /* Parse a 'mode' parameter into the required bitmask */
-static int parse_mode(struct xt_hashlimit_info *r, char *optarg)
+static int parse_mode(struct xt_hashlimit_info *r, char *option_arg)
 {
 	char *tok;
-	char *arg = strdup(optarg);
+	char *arg = strdup(option_arg);
 
 	if (!arg)
 		return -1;

Modified: trunk/iptables/extensions/libxt_state.c
===================================================================
--- trunk/iptables/extensions/libxt_state.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/extensions/libxt_state.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -29,17 +29,17 @@
 };
 
 static int
-state_parse_state(const char *state, size_t strlen, struct xt_state_info *sinfo)
+state_parse_state(const char *state, size_t len, struct xt_state_info *sinfo)
 {
-	if (strncasecmp(state, "INVALID", strlen) == 0)
+	if (strncasecmp(state, "INVALID", len) == 0)
 		sinfo->statemask |= XT_STATE_INVALID;
-	else if (strncasecmp(state, "NEW", strlen) == 0)
+	else if (strncasecmp(state, "NEW", len) == 0)
 		sinfo->statemask |= XT_STATE_BIT(IP_CT_NEW);
-	else if (strncasecmp(state, "ESTABLISHED", strlen) == 0)
+	else if (strncasecmp(state, "ESTABLISHED", len) == 0)
 		sinfo->statemask |= XT_STATE_BIT(IP_CT_ESTABLISHED);
-	else if (strncasecmp(state, "RELATED", strlen) == 0)
+	else if (strncasecmp(state, "RELATED", len) == 0)
 		sinfo->statemask |= XT_STATE_BIT(IP_CT_RELATED);
-	else if (strncasecmp(state, "UNTRACKED", strlen) == 0)
+	else if (strncasecmp(state, "UNTRACKED", len) == 0)
 		sinfo->statemask |= XT_STATE_UNTRACKED;
 	else
 		return 0;

Modified: trunk/iptables/extensions/libxt_statistic.c
===================================================================
--- trunk/iptables/extensions/libxt_statistic.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/extensions/libxt_statistic.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -30,16 +30,20 @@
 	{ .name = NULL }
 };
 
-static struct xt_statistic_info *info;
+static struct xt_statistic_info *global_info;
 
+static void statistic_mt_init(struct xt_entry_match *match)
+{
+	global_info = (void *)match->data;
+}
+
 static int
 statistic_parse(int c, char **argv, int invert, unsigned int *flags,
                 const void *entry, struct xt_entry_match **match)
 {
+	struct xt_statistic_info *info = (void *)(*match)->data;
 	double prob;
 
-	info = (void *)(*match)->data;
-
 	if (invert)
 		info->flags |= XT_STATISTIC_INVERT;
 
@@ -100,25 +104,26 @@
 	if ((flags & 0x2) && (flags & (0x4 | 0x8)))
 		exit_error(PARAMETER_PROBLEM,
 			   "both nth and random parameters given");
-	if (flags & 0x2 && info->mode != XT_STATISTIC_MODE_RANDOM)
+	if (flags & 0x2 && global_info->mode != XT_STATISTIC_MODE_RANDOM)
 		exit_error(PARAMETER_PROBLEM,
 			   "--probability can only be used in random mode");
-	if (flags & 0x4 && info->mode != XT_STATISTIC_MODE_NTH)
+	if (flags & 0x4 && global_info->mode != XT_STATISTIC_MODE_NTH)
 		exit_error(PARAMETER_PROBLEM,
 			   "--every can only be used in nth mode");
-	if (flags & 0x8 && info->mode != XT_STATISTIC_MODE_NTH)
+	if (flags & 0x8 && global_info->mode != XT_STATISTIC_MODE_NTH)
 		exit_error(PARAMETER_PROBLEM,
 			   "--packet can only be used in nth mode");
 	if ((flags & 0x8) && !(flags & 0x4))
 		exit_error(PARAMETER_PROBLEM,
 			   "--packet can only be used with --every");
 	/* at this point, info->u.nth.every have been decreased. */
-	if (info->u.nth.packet > info->u.nth.every)
+	if (global_info->u.nth.packet > global_info->u.nth.every)
 		exit_error(PARAMETER_PROBLEM,
 			  "the --packet p must be 0 <= p <= n-1");
 
 
-	info->u.nth.count = info->u.nth.every - info->u.nth.packet;
+	global_info->u.nth.count = global_info->u.nth.every -
+	                           global_info->u.nth.packet;
 }
 
 /* Prints out the matchinfo. */
@@ -164,6 +169,7 @@
 	.version	= IPTABLES_VERSION,
 	.size		= XT_ALIGN(sizeof(struct xt_statistic_info)),
 	.userspacesize	= offsetof(struct xt_statistic_info, u.nth.count),
+	.init		= statistic_mt_init,
 	.help		= statistic_help,
 	.parse		= statistic_parse,
 	.final_check	= statistic_check,
@@ -178,6 +184,7 @@
 	.version	= IPTABLES_VERSION,
 	.size		= XT_ALIGN(sizeof(struct xt_statistic_info)),
 	.userspacesize	= offsetof(struct xt_statistic_info, u.nth.count),
+	.init		= statistic_mt_init,
 	.help		= statistic_help,
 	.parse		= statistic_parse,
 	.final_check	= statistic_check,

Modified: trunk/iptables/include/linux/netfilter/xt_sctp.h
===================================================================
--- trunk/iptables/include/linux/netfilter/xt_sctp.h	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/include/linux/netfilter/xt_sctp.h	2008-04-06 15:43:13 UTC (rev 7446)
@@ -7,7 +7,8 @@
 
 #define XT_SCTP_VALID_FLAGS		0x07
 
-#define ELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
+/* temporary */
+#define SCTP_ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
 
 
 struct xt_sctp_flag_info {
@@ -40,68 +41,54 @@
 
 #define SCTP_CHUNKMAP_SET(chunkmap, type) 		\
 	do { 						\
-		chunkmap[type / bytes(u_int32_t)] |= 	\
+		(chunkmap)[type / bytes(u_int32_t)] |= 	\
 			1 << (type % bytes(u_int32_t));	\
 	} while (0)
 
 #define SCTP_CHUNKMAP_CLEAR(chunkmap, type)		 	\
 	do {							\
-		chunkmap[type / bytes(u_int32_t)] &= 		\
+		(chunkmap)[type / bytes(u_int32_t)] &= 		\
 			~(1 << (type % bytes(u_int32_t)));	\
 	} while (0)
 
 #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) 			\
 ({								\
-	(chunkmap[type / bytes (u_int32_t)] & 			\
+	((chunkmap)[type / bytes (u_int32_t)] & 		\
 		(1 << (type % bytes (u_int32_t)))) ? 1: 0;	\
 })
 
-#define SCTP_CHUNKMAP_RESET(chunkmap) 				\
-	do {							\
-		int i; 						\
-		for (i = 0; i < ELEMCOUNT(chunkmap); i++)	\
-			chunkmap[i] = 0;			\
-	} while (0)
+#define SCTP_CHUNKMAP_RESET(chunkmap) \
+	memset((chunkmap), 0, sizeof(chunkmap))
 
-#define SCTP_CHUNKMAP_SET_ALL(chunkmap) 			\
-	do {							\
-		int i; 						\
-		for (i = 0; i < ELEMCOUNT(chunkmap); i++) 	\
-			chunkmap[i] = ~0;			\
-	} while (0)
+#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
+	memset((chunkmap), ~0U, sizeof(chunkmap))
 
-#define SCTP_CHUNKMAP_COPY(destmap, srcmap) 			\
-	do {							\
-		int i; 						\
-		for (i = 0; i < ELEMCOUNT(chunkmap); i++) 	\
-			destmap[i] = srcmap[i];			\
-	} while (0)
+#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
+	memcpy((destmap), (srcmap), sizeof(srcmap))
 
-#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) 		\
-({							\
-	int i; 						\
-	int flag = 1;					\
-	for (i = 0; i < ELEMCOUNT(chunkmap); i++) {	\
-		if (chunkmap[i]) {			\
-			flag = 0;			\
-			break;				\
-		}					\
-	}						\
-        flag;						\
-})
+#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
+	__sctp_chunkmap_is_clear((chunkmap), SCTP_ARRAY_SIZE(chunkmap))
+static inline bool
+__sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n)
+{
+	unsigned int i;
+	for (i = 0; i < n; ++i)
+		if (chunkmap[i])
+			return false;
+	return true;
+}
 
-#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) 		\
-({							\
-	int i; 						\
-	int flag = 1;					\
-	for (i = 0; i < ELEMCOUNT(chunkmap); i++) {	\
-		if (chunkmap[i] != ~0) {		\
-			flag = 0;			\
-				break;			\
-		}					\
-	}						\
-        flag;						\
-})
+#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
+	__sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
+static inline bool
+__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n)
+{
+	unsigned int i;
+	for (i = 0; i < n; ++i)
+		if (chunkmap[i] != ~0U)
+			return false;
+	return true;
+}
 
 #endif /* _XT_SCTP_H_ */
 

Modified: trunk/iptables/include/xtables.h
===================================================================
--- trunk/iptables/include/xtables.h	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/include/xtables.h	2008-04-06 15:43:13 UTC (rev 7446)
@@ -176,7 +176,7 @@
 extern void *fw_calloc(size_t count, size_t size);
 extern void *fw_malloc(size_t size);
 
-extern const char *modprobe;
+extern const char *modprobe_program;
 extern int xtables_insmod(const char *modname, const char *modprobe, int quiet);
 extern int load_xtables_ko(const char *modprobe, int quiet);
 
@@ -230,7 +230,7 @@
 /* this is a special 64bit data type that is 8-byte aligned */
 #define aligned_u64 u_int64_t __attribute__((aligned(8)))
 
-int check_inverse(const char option[], int *invert, int *optind, int argc);
+int check_inverse(const char option[], int *invert, int *my_optind, int argc);
 void exit_error(enum exittype, const char *, ...)__attribute__((noreturn,
 							  format(printf,2,3)));
 extern void param_act(unsigned int, const char *, ...);

Modified: trunk/iptables/ip6tables-save.c
===================================================================
--- trunk/iptables/ip6tables-save.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/ip6tables-save.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -21,7 +21,7 @@
 #include <dlfcn.h>
 #endif
 
-static int binary = 0, counters = 0;
+static int show_binary = 0, show_counters = 0;
 
 static struct option options[] = {
 	{ "binary", 0, 0, 'b' },
@@ -264,7 +264,7 @@
 		exit_error(OTHER_PROBLEM, "Can't initialize: %s\n",
 			   ip6tc_strerror(errno));
 
-	if (!binary) {
+	if (!show_binary) {
 		time_t now = time(NULL);
 
 		printf("# Generated by ip6tables-save v%s on %s",
@@ -297,7 +297,7 @@
 			/* Dump out rules */
 			e = ip6tc_first_rule(chain, &h);
 			while(e) {
-				print_rule(e, &h, chain, counters);
+				print_rule(e, &h, chain, show_counters);
 				e = ip6tc_next_rule(e, &h);
 			}
 		}
@@ -342,11 +342,11 @@
 	while ((c = getopt_long(argc, argv, "bcdt:", options, NULL)) != -1) {
 		switch (c) {
 		case 'b':
-			binary = 1;
+			show_binary = 1;
 			break;
 
 		case 'c':
-			counters = 1;
+			show_counters = 1;
 			break;
 
 		case 't':

Modified: trunk/iptables/ip6tables.c
===================================================================
--- trunk/iptables/ip6tables.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/ip6tables.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -440,16 +440,16 @@
 }
 
 int
-check_inverse(const char option[], int *invert, int *optind, int argc)
+check_inverse(const char option[], int *invert, int *my_optind, int argc)
 {
 	if (option && strcmp(option, "!") == 0) {
 		if (*invert)
 			exit_error(PARAMETER_PROBLEM,
 				   "Multiple `!' flags not allowed");
 		*invert = TRUE;
-		if (optind) {
-			*optind = *optind+1;
-			if (argc && *optind > argc)
+		if (my_optind != NULL) {
+			++*my_optind;
+			if (argc && *my_optind > argc)
 				exit_error(PARAMETER_PROBLEM,
 					   "no argument following `!'");
 		}
@@ -1492,7 +1492,7 @@
 			break;
 
 		case 'M':
-			modprobe = optarg;
+			modprobe_program = optarg;
 			break;
 
 		case 'c':
@@ -1673,7 +1673,7 @@
 		*handle = ip6tc_init(*table);
 
 	/* try to insmod the module if iptc_init failed */
-	if (!*handle && load_xtables_ko(modprobe, 0) != -1)
+	if (!*handle && load_xtables_ko(modprobe_program, 0) != -1)
 		*handle = ip6tc_init(*table);
 
 	if (!*handle)

Modified: trunk/iptables/iptables-save.c
===================================================================
--- trunk/iptables/iptables-save.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/iptables-save.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -20,7 +20,7 @@
 #include <dlfcn.h>
 #endif
 
-static int binary = 0, counters = 0;
+static int show_binary = 0, show_counters = 0;
 
 static struct option options[] = {
 	{ "binary", 0, 0, 'b' },
@@ -287,7 +287,7 @@
 		exit_error(OTHER_PROBLEM, "Can't initialize: %s\n",
 			   iptc_strerror(errno));
 
-	if (!binary) {
+	if (!show_binary) {
 		time_t now = time(NULL);
 
 		printf("# Generated by iptables-save v%s on %s",
@@ -320,7 +320,7 @@
 			/* Dump out rules */
 			e = iptc_first_rule(chain, &h);
 			while(e) {
-				print_rule(e, &h, chain, counters);
+				print_rule(e, &h, chain, show_counters);
 				e = iptc_next_rule(e, &h);
 			}
 		}
@@ -367,11 +367,11 @@
 	while ((c = getopt_long(argc, argv, "bcdt:", options, NULL)) != -1) {
 		switch (c) {
 		case 'b':
-			binary = 1;
+			show_binary = 1;
 			break;
 
 		case 'c':
-			counters = 1;
+			show_counters = 1;
 			break;
 
 		case 't':

Modified: trunk/iptables/iptables-xml.c
===================================================================
--- trunk/iptables/iptables-xml.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/iptables-xml.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -99,16 +99,15 @@
 char curTable[IPT_TABLE_MAXNAMELEN + 1];
 char curChain[IPT_CHAIN_MAXNAMELEN + 1];
 
-typedef struct chain
-{
+struct chain {
 	char *chain;
 	char *policy;
 	struct ipt_counters count;
 	int created;
-} chain;
+};
 
 #define maxChains 10240		/* max chains per table */
-static chain chains[maxChains];
+static struct chain chains[maxChains];
 static int nextChain = 0;
 
 /* funCtion adding one argument to newargv, updating newargc 

Modified: trunk/iptables/iptables.c
===================================================================
--- trunk/iptables/iptables.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/iptables.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -447,16 +447,16 @@
 }
 
 int
-check_inverse(const char option[], int *invert, int *optind, int argc)
+check_inverse(const char option[], int *invert, int *my_optind, int argc)
 {
 	if (option && strcmp(option, "!") == 0) {
 		if (*invert)
 			exit_error(PARAMETER_PROBLEM,
 				   "Multiple `!' flags not allowed");
 		*invert = TRUE;
-		if (optind) {
-			*optind = *optind+1;
-			if (argc && *optind > argc)
+		if (my_optind != NULL) {
+			++*my_optind;
+			if (argc && *my_optind > argc)
 				exit_error(PARAMETER_PROBLEM,
 					   "no argument following `!'");
 		}
@@ -1529,7 +1529,7 @@
 			break;
 
 		case 'M':
-			modprobe = optarg;
+			modprobe_program = optarg;
 			break;
 
 		case 'c':
@@ -1712,7 +1712,7 @@
 		*handle = iptc_init(*table);
 
 	/* try to insmod the module if iptc_init failed */
-	if (!*handle && load_xtables_ko(modprobe, 0) != -1)
+	if (!*handle && load_xtables_ko(modprobe_program, 0) != -1)
 		*handle = iptc_init(*table);
 
 	if (!*handle)

Modified: trunk/iptables/libiptc/libiptc.c
===================================================================
--- trunk/iptables/libiptc/libiptc.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/libiptc/libiptc.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -317,7 +317,7 @@
  * is sorted by name.
  */
 static struct list_head *
-iptcc_bsearch_chain_index(const char *name, unsigned int *index, TC_HANDLE_T handle)
+iptcc_bsearch_chain_index(const char *name, unsigned int *idx, TC_HANDLE_T handle)
 {
 	unsigned int pos, end;
 	int res;
@@ -346,7 +346,7 @@
 
 	res = strcmp(name, handle->chain_index[pos]->name);
 	list_pos = &handle->chain_index[pos]->list;
-	(*index)=pos;
+	*idx = pos;
 
 	debug("bsearch Index[%d] name:%s res:%d ",
 	      pos, handle->chain_index[pos]->name, res);
@@ -536,9 +536,9 @@
 {
 	struct list_head *index_ptr, *index_ptr2, *next;
 	struct chain_head *c2;
-	unsigned int index, index2;
+	unsigned int idx, idx2;
 
-	index_ptr = iptcc_bsearch_chain_index(c->name, &index, h);
+	index_ptr = iptcc_bsearch_chain_index(c->name, &idx, h);
 
 	debug("Del chain[%s] c->list:%p index_ptr:%p\n",
 	      c->name, &c->list, index_ptr);
@@ -554,15 +554,15 @@
 		 * is located in the same index bucket.
 		 */
 		c2         = list_entry(next, struct chain_head, list);
-		index_ptr2 = iptcc_bsearch_chain_index(c2->name, &index2, h);
-		if (index != index2) {
+		index_ptr2 = iptcc_bsearch_chain_index(c2->name, &idx2, h);
+		if (idx != idx2) {
 			/* Rebuild needed */
 			return iptcc_chain_index_rebuild(h);
 		} else {
 			/* Avoiding rebuild */
 			debug("Update cindex[%d] with next ptr name:[%s]\n",
-			      index, c2->name);
-			h->chain_index[index]=c2;
+			      idx, c2->name);
+			h->chain_index[idx]=c2;
 			return 0;
 		}
 	}
@@ -962,18 +962,18 @@
 	list_for_each_entry(c, &h->chains, list) {
 		struct rule_head *r;
 		list_for_each_entry(r, &c->rules, list) {
-			struct chain_head *c;
+			struct chain_head *lc;
 			STRUCT_STANDARD_TARGET *t;
 
 			if (r->type != IPTCC_R_JUMP)
 				continue;
 
 			t = (STRUCT_STANDARD_TARGET *)GET_TARGET(r->entry);
-			c = iptcc_find_chain_by_offset(h, t->verdict);
-			if (!c)
+			lc = iptcc_find_chain_by_offset(h, t->verdict);
+			if (!lc)
 				return -1;
-			r->jump = c;
-			c->references++;
+			r->jump = lc;
+			lc->references++;
 		}
 	}
 
@@ -2398,16 +2398,14 @@
 }
 
 
-static void counters_nomap(STRUCT_COUNTERS_INFO *newcounters,
-			   unsigned int index)
+static void counters_nomap(STRUCT_COUNTERS_INFO *newcounters, unsigned int idx)
 {
-	newcounters->counters[index] = ((STRUCT_COUNTERS) { 0, 0});
+	newcounters->counters[idx] = ((STRUCT_COUNTERS) { 0, 0});
 	DEBUGP_C("NOMAP => zero\n");
 }
 
 static void counters_normal_map(STRUCT_COUNTERS_INFO *newcounters,
-				STRUCT_REPLACE *repl,
-				unsigned int index,
+				STRUCT_REPLACE *repl, unsigned int idx,
 				unsigned int mappos)
 {
 	/* Original read: X.
@@ -2417,15 +2415,13 @@
 	 * => Add in X + Y
 	 * => Add in replacement read.
 	 */
-	newcounters->counters[index] = repl->counters[mappos];
+	newcounters->counters[idx] = repl->counters[mappos];
 	DEBUGP_C("NORMAL_MAP => mappos %u \n", mappos);
 }
 
 static void counters_map_zeroed(STRUCT_COUNTERS_INFO *newcounters,
-				STRUCT_REPLACE *repl,
-				unsigned int index,
-				unsigned int mappos,
-				STRUCT_COUNTERS *counters)
+				STRUCT_REPLACE *repl, unsigned int idx,
+				unsigned int mappos, STRUCT_COUNTERS *counters)
 {
 	/* Original read: X.
 	 * Atomic read on replacement: X + Y.
@@ -2434,19 +2430,18 @@
 	 * => Add in Y.
 	 * => Add in (replacement read - original read).
 	 */
-	subtract_counters(&newcounters->counters[index],
+	subtract_counters(&newcounters->counters[idx],
 			  &repl->counters[mappos],
 			  counters);
 	DEBUGP_C("ZEROED => mappos %u\n", mappos);
 }
 
 static void counters_map_set(STRUCT_COUNTERS_INFO *newcounters,
-			     unsigned int index,
-			     STRUCT_COUNTERS *counters)
+                             unsigned int idx, STRUCT_COUNTERS *counters)
 {
 	/* Want to set counter (iptables-restore) */
 
-	memcpy(&newcounters->counters[index], counters,
+	memcpy(&newcounters->counters[idx], counters,
 		sizeof(STRUCT_COUNTERS));
 
 	DEBUGP_C("SET\n");

Modified: trunk/iptables/xtables.c
===================================================================
--- trunk/iptables/xtables.c	2008-04-06 15:41:33 UTC (rev 7445)
+++ trunk/iptables/xtables.c	2008-04-06 15:43:13 UTC (rev 7446)
@@ -46,7 +46,7 @@
 char *lib_dir;
 
 /* the path to command to load kernel module */
-const char *modprobe = NULL;
+const char *modprobe_program = NULL;
 
 /* Keeping track of external matches and targets: linked lists.  */
 struct xtables_match *xtables_matches;
@@ -488,7 +488,7 @@
 		exit(1);
 	}
 
-	load_xtables_ko(modprobe, 1);
+	load_xtables_ko(modprobe_program, 1);
 
 	strcpy(rev.name, name);
 	rev.revision = revision;




More information about the netfilter-cvslog mailing list