libnetfilter_conntrack endian issue
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
src/conntrack/api.c +1 -1
@@ -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 );
Quoted 18 lines · Albert Veli
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 protocolThe problem was in
libnetfilter_conntrack-0.0.96/src/conntrack/api.c. See attached endian.patch. Innfct_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. Replaceconst
u_int8_t*family = data;with
const
u_int32_t*family = data;
Quoted 7 lines
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.
Applied. Thanks Albert.
Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers