Add command to set the wds peer bssid using the newly
implemented NL80211_CMD_SET_WDS_PEER.
Signed-off-by: Bill Jordan <[email protected]>
---
interface.c | 31 +++++++++++++++++++++++++++++++
nl80211.h | 3 +++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/interface.c b/interface.c
index a64015f..34ed4cb 100644
--- a/interface.c
+++ b/interface.c
@@ -383,3 +383,34 @@ static int handle_interface_4addr(struct nl80211_state *state,
COMMAND(set, 4addr, "<on|off>",
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)
+{
+ enum nl80211_iftype 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, "<MAC address>",
+ 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
Add command to set the wds peer bssid using the newly
implemented NL80211_CMD_SET_WDS_PEER.
Signed-off-by: Bill Jordan <[email protected]>
---
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, "<on|off>",
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, "<MAC address>",
+ 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
On Wed, 2010-10-06 at 15:33 -0400, Bill Jordan wrote:
> +static int handle_interface_wds_peer(struct nl80211_state *state,
> + struct nl_cb *cb,
> + struct nl_msg *msg,
> + int argc, char **argv)
Please indent that up to just after the opening parenthesis.
> + enum nl80211_iftype mac_addr[ETH_ALEN];
??
interface.c: In function ‘handle_interface_wds_peer’:
interface.c:397: warning: passing argument 1 of ‘mac_addr_a2n’ from incompatible pointer type
iw.h:119: note: expected ‘unsigned char *’ but argument is of type ‘enum nl80211_iftype *’
johannes
On Fri, 2010-10-08 at 10:37 -0400, Bill Jordan wrote:
> Add command to set the wds peer bssid using the newly
> implemented NL80211_CMD_SET_WDS_PEER.
applied, thanks
> Signed-off-by: Bill Jordan <[email protected]>
> ---
> 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, "<on|off>",
> 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, "<MAC address>",
> + 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 */
>