* libnetfilter_conntrack endian issue
@ 2008-07-29 10:24 Albert Veli
2008-07-29 11:52 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Albert Veli @ 2008-07-29 10:24 UTC (permalink / raw)
To: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 747 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: endian.patch --]
[-- Type: text/x-diff; name=endian.patch, Size: 496 bytes --]
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: libnetfilter_conntrack endian issue
2008-07-29 10:24 libnetfilter_conntrack endian issue Albert Veli
@ 2008-07-29 11:52 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2008-07-29 11:52 UTC (permalink / raw)
To: Albert Veli; +Cc: netfilter-devel
Albert Veli wrote:
> 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.
Applied. Thanks Albert.
--
"Los honestos son inadaptados sociales" -- Les Luthiers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-29 11:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-29 10:24 libnetfilter_conntrack endian issue Albert Veli
2008-07-29 11:52 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.