Skip to contentSkip to conversation

Ignore `configure~`

PATCH New Jeremy Sowden 1 participant 2 messages Sep 3, 2023 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Ignore `configure~`

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index d919db16bd13..d1226dbe89f5 100644
@@ -11,6 +11,7 @@ Makefile.in
 /build-aux/
 /config.*
 /configure
+/configure~
 /libtool
 /stamp-h1
 
Signature · 1 line
2.40.1
#1 lore raw

PATCH 2/2 conntrack: fix BPF for filtering IPv6 addresses

Each address in the filter is matched one 32-bit word at a time. If any of the first three words don't match, we jump to the end of the filter. If the last word does match, we jump to the end of the filter. However, this is not right:
it means that if any of the first three words of an address don't match, all subsequent addresses will be skipped. Instead, jump to the next address.

Fix formatting of nfct_bsf_cmp_k_stack.

---
 src/conntrack/bsf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/conntrack/bsf.c +4 -4
index 35cc8b7690c0..48fd4fafbc3e 100644
@@ -163,7 +163,7 @@ struct jump {
 
 static int
 nfct_bsf_cmp_k_stack(struct sock_filter *this, int k, 
-	       int jump_true, int pos, struct stack *s)
+		     int jump_true, int pos, struct stack *s)
 {
 	struct sock_filter __code = {
 		.code	= BPF_JMP|BPF_JEQ|BPF_K,
@@ -640,8 +640,8 @@ bsf_add_addr_ipv6_filter(const struct nfct_filter *f,
 					      j);
 			if (k < 3) {
 				j += nfct_bsf_cmp_k_stack_jf(this, ip,
-						jf - j - 1,
-						j, s);
+							     (3 - k) * 3 + 1,
+							     j, s);
 			} else {
 				/* last word: jump if true */
 				j += nfct_bsf_cmp_k_stack(this, ip, jf - j,
@@ -655,7 +655,7 @@ bsf_add_addr_ipv6_filter(const struct nfct_filter *f,
 			this[jmp.line].jt += jmp.jt + j;
 		}
 		if (jmp.jf) {
-			this[jmp.line].jf += jmp.jf + j;
+			this[jmp.line].jf += jmp.jf;
 		}
 	}
 
Signature · 1 line
2.40.1