All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfnetlink: Fix calculation of minimum message length
@ 2005-12-03 16:52 Yasuyuki KOZAKAI
  0 siblings, 0 replies; 2+ messages in thread
From: Yasuyuki KOZAKAI @ 2005-12-03 16:52 UTC (permalink / raw)
  To: netfilter-devel; +Cc: laforge, kaber

[-- Attachment #1: Type: Text/Plain, Size: 140 bytes --]

Hi,

At least, valid nfnetlink message should have nlmsghdr and nfgenmsg.

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>

[-- Attachment #2: 02-nfnetlink.patch --]
[-- Type: Text/Plain, Size: 1028 bytes --]

[NETFILTER] nfnetlink: Fix calculation of minimum message length

At least, valid nfnetlink message should have nlmsghdr and nfgenmsg.

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>

---
commit 83535e538f30e66a20c040ff2c20170c0df23b0e
tree 90af221810d8ed68de2fa38d13a34088d35d1fa6
parent b80e4873d096c32b1c941b66cbfdaf1cf9bf8d8d
author Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Sun, 27 Nov 2005 02:49:03 +0900
committer Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Sun, 27 Nov 2005 02:49:03 +0900

 net/netfilter/nfnetlink.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index a60c59b..9805514 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -162,7 +162,7 @@ nfnetlink_check_attributes(struct nfnetl
 		return -EINVAL;
 	}
 
-	min_len = NLMSG_ALIGN(sizeof(struct nfgenmsg));
+	min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
 	if (unlikely(nlh->nlmsg_len < min_len))
 		return -EINVAL;
 

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

* Re: [PATCH] nfnetlink: Fix calculation of minimum message length
       [not found] <200512031652.jB3GqhbB021984@toshiba.co.jp>
@ 2005-12-04 15:28 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2005-12-04 15:28 UTC (permalink / raw)
  To: Yasuyuki KOZAKAI; +Cc: laforge, netfilter-devel

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

Yasuyuki KOZAKAI wrote:
> Hi,
> 
> At least, valid nfnetlink message should have nlmsghdr and nfgenmsg.

Also applied, thanks. I've also changed the check in
nfnetlink_rcv_msg(), which was a self-built construct for NLMSG_SPACE.

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

[NETFILTER] nfnetlink: Fix calculation of minimum message length

At least, valid nfnetlink message should have nlmsghdr and nfgenmsg.

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 1ec1f9de65434db4bac6141e25c5b8a6b5110e4f
tree 0eaed90532d67c3ba3281628bfbd256f5cc1163d
parent e512e47b2238a9e367f05a36b4ac2ba53f5ad12e
author Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Sun, 04 Dec 2005 16:26:36 +0100
committer Patrick McHardy <kaber@trash.net> Sun, 04 Dec 2005 16:26:36 +0100

 net/netfilter/nfnetlink.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index a60c59b..95fdf04 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -162,7 +162,7 @@ nfnetlink_check_attributes(struct nfnetl
 		return -EINVAL;
 	}
 
-	min_len = NLMSG_ALIGN(sizeof(struct nfgenmsg));
+	min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
 	if (unlikely(nlh->nlmsg_len < min_len))
 		return -EINVAL;
 
@@ -236,8 +236,7 @@ static inline int nfnetlink_rcv_msg(stru
 	}
 
 	/* All the messages must at least contain nfgenmsg */
-	if (nlh->nlmsg_len < 
-			NLMSG_LENGTH(NLMSG_ALIGN(sizeof(struct nfgenmsg)))) {
+	if (nlh->nlmsg_len < NLMSG_SPACE(sizeof(struct nfgenmsg))) {
 		DEBUGP("received message was too short\n");
 		return 0;
 	}

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

end of thread, other threads:[~2005-12-04 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200512031652.jB3GqhbB021984@toshiba.co.jp>
2005-12-04 15:28 ` [PATCH] nfnetlink: Fix calculation of minimum message length Patrick McHardy
2005-12-03 16:52 Yasuyuki KOZAKAI

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.