public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netlink: fix append of whole original message on negative ack.
@ 2008-10-23 18:17 M Lammertink
  2008-10-23 20:45 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: M Lammertink @ 2008-10-23 18:17 UTC (permalink / raw)
  To: linux-kernel

From: Michel Lammertink <mlammertink <at> ti-wmc.nl>
Signed-off-by: Michel Lammertink <mlammertink <at> ti-wmc.nl>

Netlink can return an negative acknowledgement, which AFAICT should include an error code and the whole original message. This patch fixes the size argument given to the __nlmsg_put call. Without this patch only the original header was attached.
---

Can anyone explain to me why struct nlmsgerr contains an int error and the nlmsghdr struct. The comment in netlink_ack states that the whole message should be appended. Why not only include an int error in struct nlmsgerr and just append the original message?

Comments appreciated.

diff -uprN linux-2.6.27.3.orig/net/netlink/af_netlink.c linux-2.6.27.3/net/netlink/af_netlink.c
--- linux-2.6.27.3.orig/net/netlink/af_netlink.c	2008-10-23 18:01:54.000000000 +0200
+++ linux-2.6.27.3/net/netlink/af_netlink.c	2008-10-23 18:04:22.000000000 +0200
@@ -1656,7 +1656,7 @@ void netlink_ack(struct sk_buff *in_skb,
 	}
 
 	rep = __nlmsg_put(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
-			  NLMSG_ERROR, sizeof(struct nlmsgerr), 0);
+			  NLMSG_ERROR, payload, 0);
 	errmsg = nlmsg_data(rep);
 	errmsg->error = err;
 	memcpy(&errmsg->msg, nlh, err ? nlh->nlmsg_len : sizeof(*nlh));

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

end of thread, other threads:[~2008-10-23 21:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-23 18:17 [PATCH] netlink: fix append of whole original message on negative ack M Lammertink
2008-10-23 20:45 ` David Miller
2008-10-23 20:55   ` Evgeniy Polyakov
2008-10-23 21:02   ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox