summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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>2008-01-15 13:01:46 +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>2008-01-15 13:01:46 +0000
commitba364998484de5a3ed37b843a8e34eacb2a21953 (patch)
tree30b97d5c20633b4cd5cdb9addebd36a481066fe6
parent4ddee9e2555817bd94521677e808caed665c3393 (diff)
Max Kellermann <max@duempel.org>:
fix shadow warnings by renaming variables or making them local
-rw-r--r--ChangeLog3
-rw-r--r--src/alarm.c1
-rw-r--r--src/conntrack.c18
-rw-r--r--src/network.c12
-rw-r--r--src/state_helper.c4
-rw-r--r--src/state_helper_tcp.c4
6 files changed, 22 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 8da214c..c9de1ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,9 @@ o add support for tagged vlan interfaces in the config file, e.g. eth0.1
o improve alarm framework based on suggestions from Max Kellerman
Max Kellermann <max@duempel.org>:
+
+o fix shadow warnings by renaming variables or making them local
+
= conntrackd =
o resolve global variable "alarm" conflict with alarm() function in unistd.h.
o enable gcc warnings, including -Werror
diff --git a/src/alarm.c b/src/alarm.c
index 8d3ae48..2c65ef3 100644
--- a/src/alarm.c
+++ b/src/alarm.c
@@ -16,7 +16,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <unistd.h>
#include <stdlib.h>
#include <sys/time.h>
#include "linux_list.h"
diff --git a/src/conntrack.c b/src/conntrack.c
index 4f5fd0b..28340c1 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -144,7 +144,6 @@ static char commands_v_options[NUMBER_OF_CMD][NUMBER_OF_OPT] =
static LIST_HEAD(proto_list);
static unsigned int options;
-static unsigned int command;
#define CT_COMPARISON (CT_OPT_PROTO | CT_OPT_ORIG | CT_OPT_REPL | CT_OPT_MARK |\
CT_OPT_SECMARK)
@@ -212,9 +211,9 @@ void exit_error(enum exittype status, char *msg, ...)
}
static void
-generic_cmd_check(int command, int options)
+generic_cmd_check(int command, int local_options)
{
- if (cmd_need_param[command] == 0 && !options)
+ if (cmd_need_param[command] == 0 && !local_options)
exit_error(PARAMETER_PROBLEM,
"You need to supply parameters to `-%c'\n",
cmdflags[command]);
@@ -231,7 +230,7 @@ static int bit2cmd(int command)
return i;
}
-void generic_opt_check(int options,
+void generic_opt_check(int local_options,
int num_opts,
char *optset,
const char *optflg[])
@@ -239,7 +238,7 @@ void generic_opt_check(int options,
int i;
for (i = 0; i < num_opts; i++) {
- if (!(options & (1<<i))) {
+ if (!(local_options & (1<<i))) {
if (optset[i] == 1)
exit_error(PARAMETER_PROBLEM,
"You need to supply the "
@@ -334,24 +333,24 @@ static struct parse_parameter {
};
static int
-do_parse_parameter(const char *str, size_t strlen, unsigned int *value,
+do_parse_parameter(const char *str, size_t str_length, unsigned int *value,
int parse_type)
{
int i, ret = 0;
struct parse_parameter *p = &parse_array[parse_type];
- if (strncasecmp(str, "SRC_NAT", strlen) == 0) {
+ if (strncasecmp(str, "SRC_NAT", str_length) == 0) {
printf("skipping SRC_NAT, use --src-nat instead\n");
return 1;
}
- if (strncasecmp(str, "DST_NAT", strlen) == 0) {
+ if (strncasecmp(str, "DST_NAT", str_length) == 0) {
printf("skipping DST_NAT, use --dst-nat instead\n");
return 1;
}
for (i = 0; i < p->size; i++)
- if (strncasecmp(str, p->parameter[i], strlen) == 0) {
+ if (strncasecmp(str, p->parameter[i], str_length) == 0) {
*value |= p->value[i];
ret = 1;
break;
@@ -670,6 +669,7 @@ int main(int argc, char *argv[])
struct nf_expect *exp = (struct nf_expect *) __exp;
int l3protonum;
union ct_address ad;
+ unsigned int command;
memset(__obj, 0, sizeof(__obj));
memset(__exptuple, 0, sizeof(__exptuple));
diff --git a/src/network.c b/src/network.c
index a20c1e0..8f1dc94 100644
--- a/src/network.c
+++ b/src/network.c
@@ -96,12 +96,12 @@ static char *tx_buf;
#define HEADERSIZ 28 /* IP header (20 bytes) + UDP header 8 (bytes) */
-int mcast_buffered_init(struct mcast_conf *conf)
+int mcast_buffered_init(struct mcast_conf *mconf)
{
- int mtu = conf->mtu - HEADERSIZ;
+ int mtu = mconf->mtu - HEADERSIZ;
/* default to Ethernet MTU 1500 bytes */
- if (conf->mtu == 0)
+ if (mconf->mtu == 0)
mtu = 1500 - HEADERSIZ;
tx_buf = malloc(mtu);
@@ -199,12 +199,12 @@ int handle_netmsg(struct nethdr *net)
int mcast_track_seq(u_int32_t seq, u_int32_t *exp_seq)
{
- static int seq_set = 0;
+ static int local_seq_set = 0;
int ret = 1;
/* netlink sequence tracking initialization */
- if (!seq_set) {
- seq_set = 1;
+ if (!local_seq_set) {
+ local_seq_set = 1;
goto out;
}
diff --git a/src/state_helper.c b/src/state_helper.c
index eba9d8f..de4cf48 100644
--- a/src/state_helper.c
+++ b/src/state_helper.c
@@ -35,10 +35,10 @@ int state_helper_verdict(int type, struct nf_conntrack *ct)
return ST_H_REPLICATE;
}
-void state_helper_register(struct state_replication_helper *h, int state)
+void state_helper_register(struct state_replication_helper *h, int h_state)
{
if (helper[h->proto] == NULL)
helper[h->proto] = h;
- helper[h->proto]->state |= (1 << state);
+ helper[h->proto]->state |= (1 << h_state);
}
diff --git a/src/state_helper_tcp.c b/src/state_helper_tcp.c
index af714dc..e0a51ee 100644
--- a/src/state_helper_tcp.c
+++ b/src/state_helper_tcp.c
@@ -22,8 +22,8 @@
static int tcp_verdict(const struct state_replication_helper *h,
const struct nf_conntrack *ct)
{
- u_int8_t state = nfct_get_attr_u8(ct, ATTR_TCP_STATE);
- if (h->state & (1 << state))
+ u_int8_t t_state = nfct_get_attr_u8(ct, ATTR_TCP_STATE);
+ if (h->state & (1 << t_state))
return ST_H_REPLICATE;
return ST_H_SKIP;