Fix definition of NFNL_HEADER_LEN
PATCH 1/1 Fix definition of NFNL_HEADER_LEN
Hi Harald,
The current definition of NFNL_HEADER_LEN isn't OK. NLMSG_LENGTH already includes the size of the netlink header. We have to use NLMSG_ALIGN instead. NLMSG_LENGTH is a bit misleading, I didn't notice this at first sight either.
BTW, I think that we should add some kind of versioning of libnfnetlink as well, still missing.
cheers,
Pablo
libnfnetlink/libnfnetlink.h +5 -2
@@ -1,6 +1,9 @@/* libnfnetlink.h: Header file for generic netfilter netlink interface * * (C) 2002 Harald Welte <[email protected]> +* +* 2005-10-29 Pablo Neira Ayuso <[email protected]>: +* Fix NFNL_HEADER_LEN */ #ifndef __LIBNFNETLINK_H
@@ -18,8 +21,8 @@#define NLMSG_TAIL (nlh) \ (((void *) (nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)) -#define NFNL_HEADER_LEN (NLMSG_LENGTH(sizeof(struct nlmsghdr)) \ - +NLMSG_LENGTH(sizeof(struct nfgenmsg))) +#define NFNL_HEADER_LEN (NLMSG_ALIGN(sizeof(struct nlmsghdr)) \ + +NLMSG_ALIGN(sizeof(struct nfgenmsg)))#define NFNL_BUFFSIZE 8192
Harald Welte
AppliedQuoted 5 lines · Pablo Neira
Hi Harald,
The current definition of
NFNL_HEADER_LENisn't OK.NLMSG_LENGTHalready includes the size of the netlink header. We have to useNLMSG_ALIGNinstead.NLMSG_LENGTHis a bit misleading, I didn't notice this at first sight either.
thanks, applied.
Quoted 1 line
BTW, I think that we should add some kind of versioning of libnfnetlink as well, still missing.
yes, although I have to admit I don't [yet] know how symbol versioning actually works.
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie