netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libnetfilter_conntrack PATCH] conntrack: bsf: Do not return -1 on failure
@ 2024-04-26 14:44 Phil Sutter
  2024-05-02 23:05 ` Phil Sutter
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2024-04-26 14:44 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

Return values of the filter add functions are used to update an array
cursor, so sanely return 0 in error case.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/conntrack/bsf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/conntrack/bsf.c b/src/conntrack/bsf.c
index 48fd4fafbc3e5..1e78bad9b40ec 100644
--- a/src/conntrack/bsf.c
+++ b/src/conntrack/bsf.c
@@ -336,7 +336,7 @@ add_state_filter_cta(struct sock_filter *this,
 	s = stack_create(sizeof(struct jump), 3 + 32);
 	if (s == NULL) {
 		errno = ENOMEM;
-		return -1;
+		return 0;
 	}
 
 	jt = 1;
@@ -403,7 +403,7 @@ add_state_filter(struct sock_filter *this,
 
 	if (cta[proto].cta_protoinfo == 0 && cta[proto].cta_state == 0) {
 		errno = ENOTSUP;
-		return -1;
+		return 0;
 	}
 
 	return add_state_filter_cta(this,
@@ -448,7 +448,7 @@ bsf_add_proto_filter(const struct nfct_filter *f, struct sock_filter *this)
 	s = stack_create(sizeof(struct jump), 3 + 255);
 	if (s == NULL) {
 		errno = ENOMEM;
-		return -1;
+		return 0;
 	}
 
 	jt = 1;
@@ -520,7 +520,7 @@ bsf_add_addr_ipv4_filter(const struct nfct_filter *f,
 	s = stack_create(sizeof(struct jump), 3 + 127);
 	if (s == NULL) {
 		errno = ENOMEM;
-		return -1;
+		return 0;
 	}
 
 	jt = 1;
@@ -605,7 +605,7 @@ bsf_add_addr_ipv6_filter(const struct nfct_filter *f,
 	s = stack_create(sizeof(struct jump), 3 + 80);
 	if (s == NULL) {
 		errno = ENOMEM;
-		return -1;
+		return 0;
 	}
 
 	jf = 1;
@@ -704,7 +704,7 @@ bsf_add_mark_filter(const struct nfct_filter *f, struct sock_filter *this)
 	s = stack_create(sizeof(struct jump), 3 + 127);
 	if (s == NULL) {
 		errno = ENOMEM;
-		return -1;
+		return 0;
 	}
 
 	jt = 1;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [libnetfilter_conntrack PATCH] conntrack: bsf: Do not return -1 on failure
  2024-04-26 14:44 [libnetfilter_conntrack PATCH] conntrack: bsf: Do not return -1 on failure Phil Sutter
@ 2024-05-02 23:05 ` Phil Sutter
  0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2024-05-02 23:05 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

On Fri, Apr 26, 2024 at 04:44:20PM +0200, Phil Sutter wrote:
> Return values of the filter add functions are used to update an array
> cursor, so sanely return 0 in error case.
> 
> Signed-off-by: Phil Sutter <phil@nwl.cc>

Patch applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-02 23:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-26 14:44 [libnetfilter_conntrack PATCH] conntrack: bsf: Do not return -1 on failure Phil Sutter
2024-05-02 23:05 ` Phil Sutter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).