All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix definition of NFNL_HEADER_LEN
@ 2005-10-29 13:00 Pablo Neira
  2005-10-31 18:50 ` Harald Welte
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira @ 2005-10-29 13:00 UTC (permalink / raw)
  To: Harald Welte; +Cc: Netfilter Development Mailinglist

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

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

[-- Attachment #2: x --]
[-- Type: text/plain, Size: 834 bytes --]

Index: include/libnfnetlink/libnfnetlink.h
===================================================================
--- include/libnfnetlink/libnfnetlink.h	(revision 4394)
+++ include/libnfnetlink/libnfnetlink.h	(working copy)
@@ -1,6 +1,9 @@
 /* libnfnetlink.h: Header file for generic netfilter netlink interface
  *
  * (C) 2002 Harald Welte <laforge@gnumonks.org>
+ *
+ * 2005-10-29 Pablo Neira Ayuso <pablo@netfilter.org>:
+ * 	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
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-31 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-29 13:00 [PATCH] Fix definition of NFNL_HEADER_LEN Pablo Neira
2005-10-31 18:50 ` Harald Welte

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.