Search Linux Wireless

[PATCH 6/9] wmediumd: fix RX message with cookie

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

 



From: Johannes Berg <johannes.berg@xxxxxxxxx>

The cookie message needs to be built properly, fix the code to
do this, otherwise a client with WMEDIUMD_CTL_RX_ALL_FRAMES
doesn't know its own messages. The code was just completely
broken in all kinds of ways.

---
 wmediumd/wmediumd.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/wmediumd/wmediumd.c b/wmediumd/wmediumd.c
index aa169e1602be..afc4f16d9ae9 100644
--- a/wmediumd/wmediumd.c
+++ b/wmediumd/wmediumd.c
@@ -606,11 +606,12 @@ static void send_cloned_frame_msg(struct wmediumd *ctx, struct client *src,
 
 	list_for_each_entry(client, &ctx->clients, list) {
 		if (client->flags & WMEDIUMD_CTL_RX_ALL_FRAMES) {
-			if (!cmsg) {
-				cmsg = nlmsg_convert(nlmsg_hdr(msg));
-				if (!cmsg)
-					continue;
-				nla_put_u64(msg, HWSIM_ATTR_COOKIE, cookie);
+			if (src == client && !cmsg) {
+				struct nlmsghdr *nlh = nlmsg_hdr(msg);
+
+				cmsg = nlmsg_inherit(nlh);
+				nlmsg_append(cmsg, nlmsg_data(nlh), nlmsg_datalen(nlh), 0);
+				assert(nla_put_u64(cmsg, HWSIM_ATTR_COOKIE, cookie) == 0);
 			}
 			wmediumd_send_to_client(ctx, client,
 						src == client ? cmsg : msg);
-- 
2.26.2




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux