Skip to contentSkip to conversation

mac80211: add support for userspace to handle auth frames on adhoc ifaces

PATCH Superseded Will Hawkins 3 participants 12 messages Jun 13, 2012 – Jun 14, 2012 mac80211

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: add support for userspace to handle auth frames on adhoc ifaces

Hello all!

This patch allows userspace applications to use nl80211 to register for AUTH frames received on adhoc interfaces.

Thanks,
Will

---

net/mac80211/main.c +3 -1
index d81c178..4467162 100644
@@ -455,7 +455,9 @@ static const struct ieee80211_txrx_stypes
 ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
        [NL80211_IFTYPE_ADHOC] = {
                .tx = 0xffff,
-               .rx = BIT(IEEE80211_STYPE_ACTION >> 4),
+               .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+                       BIT(IEEE80211_STYPE_AUTH >> 4) |
+                       BIT(IEEE80211_STYPE_DEAUTH >> 4),
        },
        [NL80211_IFTYPE_STATION] = {
                .tx = 0xffff,
maintainer
#1 lore raw
Quoted 9 lines · Will Hawkins

Hello all!

This patch allows userspace applications to use nl80211 to register for AUTH frames received on adhoc interfaces.

Thanks,
Will

Thanks for the patch. Can I get you to write a better commit log? :-)

You should remove the "Hello" and "Thanks" portions, they shouldn't go into the kernel's commit log after all. And then, even if I already know, please explain in the commit log why you're making this change so the reason gets recorded in the kernel's commit log.

Thanks,
johannes

#3 lore raw
In reply to Will Hawkins
Quoted 4 lines · Will Hawkins

Hello all!

This patch allows userspace applications to use nl80211 to register for AUTH frames received on adhoc interfaces.

Hi,

I just have a question here : when auth frames are not delivered to userspace, mac80211 will respond to them, and also uses them to detect node reboot. If you register for auth frames, mac80211 will still send auth frames as soon as a new station is seen, which might be confusing for user space. Is that ok to do this ? Or should userspace have more control over how mac80211 sends auth frames ?

There is also another thing to consider if you want to send auth frames from userspace, as CMD_FRAME requires a frequency, which in IBSS mode, can change anytime without userspace being notified. If you only have to answer to received auth frames, this is easier as you can reuse the frequency given by nl80211 when receiving the auth frame. But if you want to send a auth frame independently, how do you get the frequency to use ?

I ask because i was currently trying to move the node reboot detection from the kernel to userspace, and i currently only fixed these problems by ugly hacks.

maintainer
#4 lore raw
Quoted 6 lines · Nicolas Cavallari

I just have a question here : when auth frames are not delivered to userspace, mac80211 will respond to them, and also uses them to detect node reboot. If you register for auth frames, mac80211 will still send auth frames as soon as a new station is seen, which might be confusing for user space. Is that ok to do this ? Or should userspace have more control over how mac80211 sends auth frames ?

Please read the code. If userspace registers for them, mac80211 will never do anything with the frame.

Quoted 7 lines

There is also another thing to consider if you want to send auth frames from userspace, as CMD_FRAME requires a frequency, which in IBSS mode, can change anytime without userspace being notified. If you only have to answer to received auth frames, this is easier as you can reuse the frequency given by nl80211 when receiving the auth frame. But if you want to send a auth frame independently, how do you get the frequency to use ?

You check the BSS info, that's trivial.

johannes

#5 lore raw
Quoted 11 lines · Johannes Berg
Quoted 6 lines · Nicolas Cavallari

I just have a question here : when auth frames are not delivered to userspace, mac80211 will respond to them, and also uses them to detect node reboot. If you register for auth frames, mac80211 will still send auth frames as soon as a new station is seen, which might be confusing for user space. Is that ok to do this ? Or should userspace have more control over how mac80211 sends auth frames ?

Please read the code. If userspace registers for them, mac80211 will never do anything with the frame.

I didn't say the contrary. But if you read ieee80211_ibss_finish_sta(), you see that mac80211 sends auth frames to each discovered station, even if userspace want to handle auth frames. This seems strange to be able to receive and handle auth frames from userspace while mac80211 sends them behind userspace's back.

Quoted 10 lines
Quoted 8 lines

There is also another thing to consider if you want to send auth frames from userspace, as CMD_FRAME requires a frequency, which in IBSS mode, can change anytime without userspace being notified. If you only have to answer to received auth frames, this is easier as you can reuse the frequency given by nl80211 when receiving the auth frame. But if you want to send a auth frame independently, how do you get the frequency to use ?

You check the BSS info, that's trivial.

There is no GET_BSS from userspace. when merging IBSS, only the new BSSID is notified. The only way to get this info from userspace would be to dump the scan result and check the "we joined that ibss" flag, and this isn't race-free. That, or using fixed_freq.

#2 lore raw
In reply to Johannes Berg
Quoted 9 lines · Johannes Berg
Quoted 8 lines · Will Hawkins

Hello all!

This patch allows userspace applications to use nl80211 to register for AUTH frames received on adhoc interfaces.

Thanks,
Will

Quoted 8 lines
Quoted 1 line

Thanks for the patch. Can I get you to write a better commit log? :-)

You should remove the "Hello" and "Thanks" portions, they shouldn't go into the kernel's commit log after all. And then, even if I already know, please explain in the commit log why you're making this change so the reason gets recorded in the kernel's commit log.

I submitted a v2 of this patch with a better commit log. Thanks for the handholding. I'm obviously still new at this!

Will

Quoted 10 lines

Thanks,
johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to Nicolas Cavallari
Quoted 28 lines · Nicolas Cavallari
Quoted 11 lines · Johannes Berg
Quoted 6 lines · Nicolas Cavallari

I just have a question here : when auth frames are not delivered to userspace, mac80211 will respond to them, and also uses them to detect node reboot. If you register for auth frames, mac80211 will still send auth frames as soon as a new station is seen, which might be confusing for user space. Is that ok to do this ? Or should userspace have more control over how mac80211 sends auth frames ?

Please read the code. If userspace registers for them, mac80211 will never do anything with the frame.

I didn't say the contrary. But if you read ieee80211_ibss_finish_sta(), you see that mac80211 sends auth frames to each discovered station, even if userspace want to handle auth frames. This seems strange to be able to receive and handle auth frames from userspace while mac80211 sends them behind userspace's back.

Quoted 9 lines
Quoted 8 lines

There is also another thing to consider if you want to send auth frames from userspace, as CMD_FRAME requires a frequency, which in IBSS mode, can change anytime without userspace being notified. If you only have to answer to received auth frames, this is easier as you can reuse the frequency given by nl80211 when receiving the auth frame. But if you want to send a auth frame independently, how do you get the frequency to use ?

Quoted 7 lines
Quoted 1 line

You check the BSS info, that's trivial.

There is no GET_BSS from userspace. when merging IBSS, only the new BSSID is notified. The only way to get this info from userspace would be to dump the scan result and check the "we joined that ibss" flag, and this isn't race-free. That, or using fixed_freq.

I've only coded for situations where I am joined to an ibss with a fixed_freq so I've never encountered this problem.

Will

maintainer
#7 lore raw
In reply to Nicolas Cavallari
Quoted 10 lines · Nicolas Cavallari
Quoted 9 lines · Johannes Berg
Quoted 6 lines · Nicolas Cavallari

I just have a question here : when auth frames are not delivered to userspace, mac80211 will respond to them, and also uses them to detect node reboot. If you register for auth frames, mac80211 will still send auth frames as soon as a new station is seen, which might be confusing for user space. Is that ok to do this ? Or should userspace have more control over how mac80211 sends auth frames ?

Quoted 8 lines
Quoted 2 lines

Please read the code. If userspace registers for them, mac80211 will never do anything with the frame.

I didn't say the contrary. But if you read ieee80211_ibss_finish_sta(), you see that mac80211 sends auth frames to each discovered station, even if userspace want to handle auth frames. This seems strange to be able to receive and handle auth frames from userspace while mac80211 sends them behind userspace's back.

Oops, sorry, yes. I forgot all about that code!

I suppose we'd have to check whether userspace is handling authentication?

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

There is also another thing to consider if you want to send auth frames from userspace, as CMD_FRAME requires a frequency, which in IBSS mode, can change anytime without userspace being notified. If you only have to answer to received auth frames, this is easier as you can reuse the frequency given by nl80211 when receiving the auth frame. But if you want to send a auth frame independently, how do you get the frequency to use ?

Quoted 6 lines
Quoted 1 line

You check the BSS info, that's trivial.

There is no GET_BSS from userspace. when merging IBSS, only the new BSSID is notified. The only way to get this info from userspace would be to dump the scan result and check the "we joined that ibss" flag, and this isn't race-free. That, or using fixed_freq.

Yeah, I guess that's true -- we should probably just allow not giving a frequency attribute at all and then it only works if you're connected/... but uses the right frequency.

johannes

#8 lore raw
Quoted 20 lines · Johannes Berg
Quoted 10 lines · Nicolas Cavallari
Quoted 9 lines · Johannes Berg
Quoted 6 lines · Nicolas Cavallari

I just have a question here : when auth frames are not delivered to userspace, mac80211 will respond to them, and also uses them to detect node reboot. If you register for auth frames, mac80211 will still send auth frames as soon as a new station is seen, which might be confusing for user space. Is that ok to do this ? Or should userspace have more control over how mac80211 sends auth frames ?

Quoted 8 lines
Quoted 2 lines

Please read the code. If userspace registers for them, mac80211 will never do anything with the frame.

I didn't say the contrary. But if you read ieee80211_ibss_finish_sta(), you see that mac80211 sends auth frames to each discovered station, even if userspace want to handle auth frames. This seems strange to be able to receive and handle auth frames from userspace while mac80211 sends them behind userspace's back.

Quoted 4 lines

Oops, sorry, yes. I forgot all about that code!

I suppose we'd have to check whether userspace is handling authentication?

Could use the control_port flag to check for that condition?

Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

There is also another thing to consider if you want to send auth frames from userspace, as CMD_FRAME requires a frequency, which in IBSS mode, can change anytime without userspace being notified. If you only have to answer to received auth frames, this is easier as you can reuse the frequency given by nl80211 when receiving the auth frame. But if you want to send a auth frame independently, how do you get the frequency to use ?

Quoted 6 lines
Quoted 1 line

You check the BSS info, that's trivial.

There is no GET_BSS from userspace. when merging IBSS, only the new BSSID is notified. The only way to get this info from userspace would be to dump the scan result and check the "we joined that ibss" flag, and this isn't race-free. That, or using fixed_freq.

Yeah, I guess that's true -- we should probably just allow not giving a frequency attribute at all and then it only works if you're connected/... but uses the right frequency.

johannes

maintainer
#9 lore raw
Quoted 22 lines · Will Hawkins
Quoted 20 lines · Johannes Berg
Quoted 18 lines · Nicolas Cavallari
Quoted 11 lines · Johannes Berg
Quoted 6 lines · Nicolas Cavallari

I just have a question here : when auth frames are not delivered to userspace, mac80211 will respond to them, and also uses them to detect node reboot. If you register for auth frames, mac80211 will still send auth frames as soon as a new station is seen, which might be confusing for user space. Is that ok to do this ? Or should userspace have more control over how mac80211 sends auth frames ?

Please read the code. If userspace registers for them, mac80211 will never do anything with the frame.

I didn't say the contrary. But if you read ieee80211_ibss_finish_sta(), you see that mac80211 sends auth frames to each discovered station, even if userspace want to handle auth frames. This seems strange to be able to receive and handle auth frames from userspace while mac80211 sends them behind userspace's back.

Quoted 6 lines
Quoted 4 lines

Oops, sorry, yes. I forgot all about that code!

I suppose we'd have to check whether userspace is handling authentication?

Could use the control_port flag to check for that condition?

Not really, that's not necessarily the same thing -- I think we might want to also allow to offload open auth to userspace.

I think it wouldn't be difficult to notify mac80211 about frame registrations so it can keep track for this purpose?

johannes

#10 lore raw
Quoted 30 lines · Johannes Berg
Quoted 22 lines · Will Hawkins
Quoted 20 lines · Johannes Berg
Quoted 18 lines · Nicolas Cavallari
Quoted 11 lines · Johannes Berg
Quoted 6 lines · Nicolas Cavallari

I just have a question here : when auth frames are not delivered to userspace, mac80211 will respond to them, and also uses them to detect node reboot. If you register for auth frames, mac80211 will still send auth frames as soon as a new station is seen, which might be confusing for user space. Is that ok to do this ? Or should userspace have more control over how mac80211 sends auth frames ?

Please read the code. If userspace registers for them, mac80211 will never do anything with the frame.

I didn't say the contrary. But if you read ieee80211_ibss_finish_sta(), you see that mac80211 sends auth frames to each discovered station, even if userspace want to handle auth frames. This seems strange to be able to receive and handle auth frames from userspace while mac80211 sends them behind userspace's back.

Quoted 6 lines
Quoted 4 lines

Oops, sorry, yes. I forgot all about that code!

I suppose we'd have to check whether userspace is handling authentication?

Could use the control_port flag to check for that condition?

Quoted 7 lines

Not really, that's not necessarily the same thing -- I think we might want to also allow to offload open auth to userspace.

I think it wouldn't be difficult to notify mac80211 about frame registrations so it can keep track for this purpose?

johannes

I am happy to code something like this up. I've already taken a look at it and don't think it will be too big of a problem. I am going to be AFK until Monday so I won't get to it until then. I hope that's not a problem.

Will

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#11 lore raw
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines

Oops, sorry, yes. I forgot all about that code!

I suppose we'd have to check whether userspace is handling authentication?

Could use the control_port flag to check for that condition?

Not really, that's not necessarily the same thing -- I think we might want to also allow to offload open auth to userspace.

Quoted 8 lines
Quoted 4 lines

I think it wouldn't be difficult to notify mac80211 about frame registrations so it can keep track for this purpose?

johannes

I am happy to code something like this up. I've already taken a look at it and don't think it will be too big of a problem. I am going to be AFK until Monday so I won't get to it until then. I hope that's not a problem.

No problem, take your time! I'm not in any hurry with this feature :-)

johannes