Re: [PATCH 1/3] libnfnetlink byte alignment

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

 



Pablo Neira Ayuso wrote:
Patrick McHardy wrote:
Fabian Hugelshofer wrote:
Aligns buffers to maximum alignment of architecture to make the cast of
char pointers to struct pointers more portable.

Signed-off-by: Fabian Hugelshofer <hugelshofer2006@xxxxxx>
They all seem fine to me, but a union might make it look
a bit nicer :)
[...]
Please, use union wherever it is possible. BTW, it seems to me that the
conntrack-tools may suffer from the same portability problem. The
(supposed) fix, which is attached, is ugly but union does not help since
the size of struct nf_conntrack is not known. I do not find a way to do
this cleanly without removing the use of the stack for temporary object
allocation.

As you noted, conntrack-tools can be affected as well. I did not have a look at it before, beacause I don't use it.

I don't see another way with the stack either. Dynamic memory allocation would help, but is not nicer either.

Do you want me to rewrite the patches for libnetfilter-(log|contrack) in the union style? I probably would put the union declaration in the file scope rather than anonymous declarations in the function scope, because it is the same everywhere.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

  Powered by Linux