Return-path: Received: from mail-qy0-f174.google.com ([209.85.216.174]:61941 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757976Ab0JHOhx (ORCPT ); Fri, 8 Oct 2010 10:37:53 -0400 Received: by qyk1 with SMTP id 1so21524qyk.19 for ; Fri, 08 Oct 2010 07:37:53 -0700 (PDT) From: Bill Jordan To: "John W. Linville" , Johannes Berg Cc: linux-wireless@vger.kernel.org, Bill Jordan Subject: [PATCH] iw: new command to set the wds peer Date: Fri, 8 Oct 2010 10:37:39 -0400 Message-Id: <1286548659-22176-1-git-send-email-bjordan@rajant.com> In-Reply-To: <1286441799.3657.29.camel@jlt3.sipsolutions.net> References: <1286441799.3657.29.camel@jlt3.sipsolutions.net> Sender: linux-wireless-owner@vger.kernel.org List-ID: Add command to set the wds peer bssid using the newly implemented NL80211_CMD_SET_WDS_PEER. Signed-off-by: Bill Jordan --- interface.c | 31 +++++++++++++++++++++++++++++++ nl80211.h | 3 +++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/interface.c b/interface.c index a64015f..2dd43e3 100644 --- a/interface.c +++ b/interface.c @@ -383,3 +383,34 @@ static int handle_interface_4addr(struct nl80211_state *state, COMMAND(set, 4addr, "", NL80211_CMD_SET_INTERFACE, 0, CIB_NETDEV, handle_interface_4addr, "Set interface 4addr (WDS) mode.\n"); + +static int handle_interface_wds_peer(struct nl80211_state *state, + struct nl_cb *cb, + struct nl_msg *msg, + int argc, char **argv) +{ + unsigned char mac_addr[ETH_ALEN]; + + if (argc < 1) + return 1; + + if (mac_addr_a2n(mac_addr, argv[0])) { + fprintf(stderr, "invalid mac address\n"); + return 2; + } + + argc--; + argv++; + + if (argc) + return 1; + + NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); + + return 0; + nla_put_failure: + return -ENOBUFS; +} +COMMAND(set, peer, "", + NL80211_CMD_SET_WDS_PEER, 0, CIB_NETDEV, handle_interface_wds_peer, + "Set interface wds peer.\n"); diff --git a/nl80211.h b/nl80211.h index f0518b0..35a9681 100644 --- a/nl80211.h +++ b/nl80211.h @@ -387,6 +387,8 @@ * of any other interfaces, and other interfaces will again take * precedence when they are used. * + * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. + * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ @@ -489,6 +491,7 @@ enum nl80211_commands { NL80211_CMD_NOTIFY_CQM, NL80211_CMD_SET_CHANNEL, + NL80211_CMD_SET_WDS_PEER, /* add new commands above here */ -- 1.7.2.3