Search Linux Wireless

[PATCH] iw: Add send callback with optional debug handler

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

 



libnl supports callbacks for send and recv.  This patch enables callbacks
for sent messages and uses the debug callback for the --debug option, as
the recv callbacks do.

Signed-off-by: Sean Robinson <seankrobinson@xxxxxxxxx>
---
 iw.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/iw.c b/iw.c
index 2593481..4c1fcbd 100644
--- a/iw.c
+++ b/iw.c
@@ -259,6 +259,7 @@ static int __handle_cmd(struct nl80211_state
*state, enum id_input idby,
 {
 	const struct cmd *cmd, *match = NULL, *sectcmd;
 	struct nl_cb *cb;
+	struct nl_cb *s_cb;
 	struct nl_msg *msg;
 	int devidx = 0;
 	int err, o_argc;
@@ -380,7 +381,8 @@ static int __handle_cmd(struct nl80211_state
*state, enum id_input idby,
 	}

 	cb = nl_cb_alloc(iw_debug ? NL_CB_DEBUG : NL_CB_DEFAULT);
-	if (!cb) {
+	s_cb = nl_cb_alloc(iw_debug ? NL_CB_DEBUG : NL_CB_DEFAULT);
+	if (!(cb && s_cb)) {
 		fprintf(stderr, "failed to allocate netlink callbacks\n");
 		err = 2;
 		goto out_free_msg;
@@ -404,6 +406,8 @@ static int __handle_cmd(struct nl80211_state
*state, enum id_input idby,
 	if (err)
 		goto out;

+	nl_socket_set_cb(state->nl_sock, s_cb);
+
 	err = nl_send_auto_complete(state->nl_sock, msg);
 	if (err < 0)
 		goto out;
--
1.7.4.1



-- 
Sean Robinson
WiFi Radar - http://wifi-radar.berlios.de
Python WiFi - http://pythonwifi.wikispot.org
pymnl - http://pymnl.wikispot.org
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux