* [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE @ 2013-01-08 9:17 Arend van Spriel 2013-01-08 9:17 ` [PATCH] iw: additional mac parameter for add interface primitive Arend van Spriel 2013-01-16 22:17 ` [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE Johannes Berg 0 siblings, 2 replies; 5+ messages in thread From: Arend van Spriel @ 2013-01-08 9:17 UTC (permalink / raw) To: Johannes Berg Cc: Linux Wireless List, Arend van Spriel, Jouni Malinen, Greg Goldman, Jithu Jance As per email discussion Jouni Malinen pointed out that: "P2P message exchanges can be executed on the current operating channel of any operation (both P2P and non-P2P station). These can be on 5 GHz and even on 60 GHz (so yes, you _can_ do GO Negotiation on 60 GHz). As an example, it would be possible to receive a GO Negotiation Request frame on a 5 GHz only radio and then to complete GO Negotiation on that band. This can happen both when connected to a P2P group (through client discoverability mechanism) and when connected to a legacy AP (assuming the station receive Probe Request frame from full scan in the beginning of P2P device discovery)." This means that P2P messages can be sent over different radio devices. However, these should use the same P2P device address so it should be able to provision this from user-space. This patch adds a parameter for this to struct vif_params which should only be used during creation of the P2P device interface. Cc: Jouni Malinen <j@w1.fi> Cc: Greg Goldman <ggoldman@broadcom.com> Cc: Jithu Jance <jithu@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> --- Hi Johannes, Best wishes. Found this patch catching dust on my shelf/branch. Cleaning up in 2013 so here you have it :-) Regards, Arend --- include/net/cfg80211.h | 4 ++++ net/wireless/nl80211.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index e5f085c..f9e4833 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -281,9 +281,13 @@ struct ieee80211_supported_band { /** * struct vif_params - describes virtual interface parameters * @use_4addr: use 4-address frames + * @macaddr: address to use for this virtual interface. This will only + * be used for non-netdevice interfaces. If this parameter is set + * to zero address the driver may determine the address as needed. */ struct vif_params { int use_4addr; + u8 macaddr[ETH_ALEN]; }; /** diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 9bd8340..42858eb 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2079,6 +2079,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) !(rdev->wiphy.interface_modes & (1 << type))) return -EOPNOTSUPP; + if (type == NL80211_IFTYPE_P2P_DEVICE && info->attrs[NL80211_ATTR_MAC]) + nla_memcpy(¶ms.macaddr[0], info->attrs[NL80211_ATTR_MAC], + ETH_ALEN); + if (info->attrs[NL80211_ATTR_4ADDR]) { params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); err = nl80211_valid_4addr(rdev, NULL, params.use_4addr, type); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] iw: additional mac parameter for add interface primitive 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 2013-01-16 22:17 ` [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE Johannes Berg 1 sibling, 0 replies; 5+ messages in thread From: Arend van Spriel @ 2013-01-08 9:17 UTC (permalink / raw) To: Johannes Berg; +Cc: Linux Wireless List, Arend van Spriel 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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE 2013-01-08 9:17 [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE Arend van Spriel 2013-01-08 9:17 ` [PATCH] iw: additional mac parameter for add interface primitive Arend van Spriel @ 2013-01-16 22:17 ` Johannes Berg 2013-01-21 9:54 ` Arend van Spriel 1 sibling, 1 reply; 5+ messages in thread From: Johannes Berg @ 2013-01-16 22:17 UTC (permalink / raw) To: Arend van Spriel Cc: Linux Wireless List, Jouni Malinen, Greg Goldman, Jithu Jance On Tue, 2013-01-08 at 10:17 +0100, Arend van Spriel wrote: > As per email discussion Jouni Malinen pointed out that: > > "P2P message exchanges can be executed on the current operating channel > of any operation (both P2P and non-P2P station). These can be on 5 GHz > and even on 60 GHz (so yes, you _can_ do GO Negotiation on 60 GHz). > > As an example, it would be possible to receive a GO Negotiation Request > frame on a 5 GHz only radio and then to complete GO Negotiation on that > band. This can happen both when connected to a P2P group (through client > discoverability mechanism) and when connected to a legacy AP (assuming > the station receive Probe Request frame from full scan in the beginning > of P2P device discovery)." > > This means that P2P messages can be sent over different radio devices. > However, these should use the same P2P device address so it should be > able to provision this from user-space. This patch adds a parameter for > this to struct vif_params which should only be used during creation of > the P2P device interface. > > Cc: Jouni Malinen <j@w1.fi> > Cc: Greg Goldman <ggoldman@broadcom.com> > Cc: Jithu Jance <jithu@broadcom.com> > Signed-off-by: Arend van Spriel <arend@broadcom.com> > --- > Hi Johannes, > > Best wishes. Found this patch catching dust on my shelf/branch. Cleaning > up in 2013 so here you have it :-) :-) > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -2079,6 +2079,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) > !(rdev->wiphy.interface_modes & (1 << type))) > return -EOPNOTSUPP; > > + if (type == NL80211_IFTYPE_P2P_DEVICE && info->attrs[NL80211_ATTR_MAC]) > + nla_memcpy(¶ms.macaddr[0], info->attrs[NL80211_ATTR_MAC], > + ETH_ALEN); It seems like this might need a capability parameter or something, so wpa_s knows this will take effect. OTOH, wpa_s can query the MAC address afterwards, so it's not really needed, so I applied it. (I changed the subject to say "configure", "determine" seems a bit vague to me, the way I read it it could possibly also mean "allow to get" it) I would also like to see a mac80211 change though to make it take effect there. johannes ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE 2013-01-16 22:17 ` [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE Johannes Berg @ 2013-01-21 9:54 ` Arend van Spriel 2013-01-21 10:02 ` Johannes Berg 0 siblings, 1 reply; 5+ messages in thread From: Arend van Spriel @ 2013-01-21 9:54 UTC (permalink / raw) To: Johannes Berg Cc: Linux Wireless List, Jouni Malinen, Greg Goldman, Jithu Jance On 01/16/2013 11:17 PM, Johannes Berg wrote: > On Tue, 2013-01-08 at 10:17 +0100, Arend van Spriel wrote: >> --- a/net/wireless/nl80211.c >> +++ b/net/wireless/nl80211.c >> @@ -2079,6 +2079,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) >> !(rdev->wiphy.interface_modes & (1 << type))) >> return -EOPNOTSUPP; >> >> + if (type == NL80211_IFTYPE_P2P_DEVICE && info->attrs[NL80211_ATTR_MAC]) >> + nla_memcpy(¶ms.macaddr[0], info->attrs[NL80211_ATTR_MAC], >> + ETH_ALEN); > > It seems like this might need a capability parameter or something, so > wpa_s knows this will take effect. OTOH, wpa_s can query the MAC address > afterwards, so it's not really needed, so I applied it. Not sure if I can follow. I did submit wpa_s patch for flagging the P2P device capability. Are you suggesting an additional flag here to indicate whether the MAC address can be configured by wpa_s? > (I changed the subject to say "configure", "determine" seems a bit vague > to me, the way I read it it could possibly also mean "allow to get" it) Potaitoe, Patatoe, fine by me ;-) > I would also like to see a mac80211 change though to make it take effect > there. See what I can do. I guess it does involve mac80211 device drivers as well, right? Gr. AvS > johannes > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE 2013-01-21 9:54 ` Arend van Spriel @ 2013-01-21 10:02 ` Johannes Berg 0 siblings, 0 replies; 5+ messages in thread From: Johannes Berg @ 2013-01-21 10:02 UTC (permalink / raw) To: Arend van Spriel Cc: Linux Wireless List, Jouni Malinen, Greg Goldman, Jithu Jance On Mon, 2013-01-21 at 10:54 +0100, Arend van Spriel wrote: > >> + if (type == NL80211_IFTYPE_P2P_DEVICE && info->attrs[NL80211_ATTR_MAC]) > >> + nla_memcpy(¶ms.macaddr[0], info->attrs[NL80211_ATTR_MAC], > >> + ETH_ALEN); > > > > It seems like this might need a capability parameter or something, so > > wpa_s knows this will take effect. OTOH, wpa_s can query the MAC address > > afterwards, so it's not really needed, so I applied it. > > Not sure if I can follow. I did submit wpa_s patch for flagging the P2P > device capability. Are you suggesting an additional flag here to > indicate whether the MAC address can be configured by wpa_s? Yes, or maybe it's not needed as wpa_s could read the address back after the interface is created, and see whether it stuck. Right now, for example, with mac80211 it wouldn't be used at all. > > I would also like to see a mac80211 change though to make it take effect > > there. > > See what I can do. I guess it does involve mac80211 device drivers as > well, right? Oh, I think there's no mac80211 driver using P2P device yet. :-) I have a patch for iwlwifi but I'm not merging it until wpa_s gets "more ready" johannes ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-21 10:02 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-01-08 9:17 [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE Arend van Spriel 2013-01-08 9:17 ` [PATCH] iw: additional mac parameter for add interface primitive Arend van Spriel 2013-01-16 22:17 ` [PATCH] nl80211: allow user-space to determine address for P2P_DEVICE Johannes Berg 2013-01-21 9:54 ` Arend van Spriel 2013-01-21 10:02 ` Johannes Berg
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.