All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: "Johannes Berg" <johannes@sipsolutions.net>
Cc: "Linux Wireless List" <linux-wireless@vger.kernel.org>,
	"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH] iw: additional mac parameter for add interface primitive
Date: Tue, 8 Jan 2013 10:17:28 +0100	[thread overview]
Message-ID: <1357636648-4012-2-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1357636648-4012-1-git-send-email-arend@broadcom.com>

When adding a P2P Device interface user-space may provide the
address for it. This should allow user-space to exchange P2P
messages over multiple radios using the same address.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 interface.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/interface.c b/interface.c
index 26e72dc..f03c079 100644
--- a/interface.c
+++ b/interface.c
@@ -168,6 +168,7 @@ static int handle_interface_add(struct nl80211_state *state,
 	char *name;
 	char *mesh_id = NULL;
 	enum nl80211_iftype type;
+	unsigned char mac_addr[ETH_ALEN];
 	int tpset;
 
 	if (argc < 1)
@@ -207,6 +208,14 @@ static int handle_interface_add(struct nl80211_state *state,
 				fprintf(stderr, "flags error\n");
 				return 2;
 			}
+		} else if (strcmp(argv[0], "mac") == 0) {
+			argc--;
+			argv++;
+			if (mac_addr_a2n(mac_addr, argv[0])) {
+				fprintf(stderr, "invalid mac address\n");
+				return 2;
+			}
+			NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
 		} else {
 			return 1;
 		}
@@ -224,14 +233,14 @@ static int handle_interface_add(struct nl80211_state *state,
  nla_put_failure:
 	return -ENOBUFS;
 }
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [mac <MAC address>]",
 	NL80211_CMD_NEW_INTERFACE, 0, CIB_PHY, handle_interface_add,
 	"Add a new virtual interface with the given configuration.\n"
 	IFACE_TYPES "\n\n"
 	"The flags are only used for monitor interfaces, valid flags are:\n"
 	VALID_FLAGS "\n\n"
 	"The mesh_id is used only for mesh mode.");
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [mac <MAC address>]",
 	NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL);
 
 static int handle_interface_del(struct nl80211_state *state,
-- 
1.7.10.4



  reply	other threads:[~2013-01-08  9:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08  9:17 [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE Arend van Spriel
2013-01-08  9:17 ` Arend van Spriel [this message]
2013-01-16 22:17 ` Johannes Berg
2013-01-21  9:54   ` Arend van Spriel
2013-01-21 10:02     ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357636648-4012-2-git-send-email-arend@broadcom.com \
    --to=arend@broadcom.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.