Skip to contentSkip to conversation

build: don't suppress various warnings

PATCH In review Pablo Neira Ayuso 1 participant 5 messages May 18, 2023 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/3 build: don't suppress various warnings

From: Sam James <[email protected]>

These will become fatal with Clang 16 and GCC 14 anyway, but let's address the real problem (followup commit).

We do have to keep one wrt yyerror() & const char * though, but the issue is contained to the code Bison generates.

---
posted via https://bugzilla.netfilter.org/show_bug.cgi?id=1637

 src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/Makefile.am +1 -1
index a1a91a0c8df6..2986ab3b4d4f 100644
@@ -61,7 +61,7 @@ conntrackd_SOURCES += systemd.c
 endif
 
 # yacc and lex generate dirty code
-read_config_yy.o read_config_lex.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations -Wno-implicit-function-declaration -Wno-nested-externs -Wno-undef -Wno-redundant-decls -Wno-sign-compare
+read_config_yy.o read_config_lex.o: AM_CFLAGS += -Wno-incompatible-pointer-types -Wno-discarded-qualifiers
 
 conntrackd_LDADD = ${LIBMNL_LIBS} ${LIBNETFILTER_CONNTRACK_LIBS} \
 		   ${libdl_LIBS} ${LIBNFNETLINK_LIBS}
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH 1/2 conntrack: do not ignore errors coming from the kernel

Do not ignore error from kernel for command invocation.

e42ea65e9c93 ("conntrack: introduce new -A command") ignores CT_ADD in print_stats, which should not be required.

---
 src/conntrack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/conntrack.c +2 -2
index 23eaf274a78a..926213a27efc 100644
@@ -2886,7 +2886,7 @@ static int print_stats(const struct ct_cmd *cmd)
 		fprintf(stderr, "%s v%s (conntrack-tools): ",PROGNAME,VERSION);
 		fprintf(stderr, exit_msg[cmd->cmd], counter);
 		if (counter == 0 &&
-		    !(cmd->command & (CT_LIST | EXP_LIST | CT_ADD)))
+		    !(cmd->command & (CT_LIST | EXP_LIST)))
 			return -1;
 	}
 
@@ -3835,7 +3835,7 @@ int main(int argc, char *argv[])
 			exit_error(OTHER_PROBLEM, "OOM");
 
 		do_parse(cmd, argc, argv);
-		do_command_ct(argv[0], cmd, sock);
+		res |= do_command_ct(argv[0], cmd, sock);
 		res = print_stats(cmd);
 		free(cmd);
 	}
Signature · 1 line
2.30.2
author maintainer
#2 lore raw

PATCH 2/3 network: Fix -Wstrict-prototypes

In reply to Pablo Neira Ayuso

From: Sam James <[email protected]>

---
posted via https://bugzilla.netfilter.org/show_bug.cgi?id=1637

 src/network.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/network.c +1 -1
index 13db37c96bb0..2560d97bab06 100644
@@ -113,7 +113,7 @@ void nethdr_track_update_seq(uint32_t seq)
 	STATE_SYNC(last_seq_recv) = seq;
 }
 
-int nethdr_track_is_seq_set()
+int nethdr_track_is_seq_set(void)
 {
 	return local_seq_set;
 }
Signature · 1 line
2.30.2
author maintainer
#3 lore raw

PATCH 2/2 conntrack: do not silence EEXIST error, use NLM_F_EXCL

In reply to Pablo Neira Ayuso

Instead of silencing EEXIST error with -A/--add, unset NLM_F_EXCL netlink flag.

This patch revisits e42ea65e9c93 ("conntrack: introduce new -A command").

---
 src/conntrack.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
src/conntrack.c +5 -3
index 926213a27efc..b9fcf8e44ee2 100644
@@ -3219,6 +3219,7 @@ static int do_command_ct(const char *progname, struct ct_cmd *cmd,
 	struct nfct_mnl_socket *modifier_sock = &_modifier_sock;
 	struct nfct_mnl_socket *event_sock = &_event_sock;
 	struct nfct_filter_dump *filter_dump;
+	uint16_t nl_flags = 0;
 	int res = 0;
 
 	switch(cmd->command) {
@@ -3305,14 +3306,15 @@ static int do_command_ct(const char *progname, struct ct_cmd *cmd,
 			nfct_set_attr(cmd->tmpl.ct, ATTR_CONNLABELS,
 					xnfct_bitmask_clone(cmd->tmpl.label_modify));
 
+		if (cmd->command == CT_CREATE)
+			nl_flags = NLM_F_EXCL;
+
 		res = nfct_mnl_request(sock, NFNL_SUBSYS_CTNETLINK, cmd->family,
 				       IPCTNL_MSG_CT_NEW,
-				       NLM_F_CREATE | NLM_F_ACK | NLM_F_EXCL,
+				       NLM_F_CREATE | NLM_F_ACK | nl_flags,
 				       NULL, cmd->tmpl.ct, NULL);
 		if (res >= 0)
 			counter++;
-		else if (errno == EEXIST && cmd->command == CT_ADD)
-			res = 0;
 		break;
 
 	case EXP_CREATE:
Signature · 1 line
2.30.2
author maintainer
#4 lore raw
In reply to Pablo Neira Ayuso
Quoted 7 lines · Pablo Neira Ayuso

From: Sam James <[email protected]>

These will become fatal with Clang 16 and GCC 14 anyway, but let's address the real problem (followup commit).

We do have to keep one wrt yyerror() & const char * though, but the issue is contained to the code Bison generates.

Scratch this, this one is old, sorry for the noise.