libnetfilter_conntrack endian issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

I run contrack-tools on a big-endian arm machine and had a problem:

$ conntrack -L
conntrack v0.9.7: Operation failed: Address family not supported by protocol

The problem was in libnetfilter_conntrack-0.0.96/src/conntrack/api.c.
See attached endian.patch. In nfct_build_query() the *data argument is
converted into a u_int8_t*. This works for little-endian but not for
big-endian. The fix is a one-liner. Replace

 const u_int8_t *family = data;

with

 const u_int32_t *family = data;

After the patch it works:

$ conntrack -L
conntrack v0.9.7: 0 flow entries has been shown.

I also tested the patch on my little-endian laptop and it doesn't seem
to cause any regression there. Just wanted to let you guys know.


Best regards,

Albert
diff -urN libnetfilter_conntrack-0.0.96-org/src/conntrack/api.c libnetfilter_conntrack-0.0.96/src/conntrack/api.c
--- libnetfilter_conntrack-0.0.96-org/src/conntrack/api.c	2008-07-02 15:25:38.000000000 +0200
+++ libnetfilter_conntrack-0.0.96/src/conntrack/api.c	2008-07-29 11:42:43.000000000 +0200
@@ -455,7 +455,7 @@
 		     unsigned int size)
 {
 	struct nfnlhdr *req = buffer;
-	const u_int8_t *family = data;
+	const u_int32_t *family = data;
 
 	assert(ssh != NULL);
 	assert(data != NULL);

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux