Message ID | 1465306963-22464-1-git-send-email-jonathan@wizery.com |
---|---|
State | Changes Requested |
Headers | show |
Hi hostap community, I need your help! I have the following scenario: Raspberry Pi3 with built-in wifi is acting as Access Point using hostap, which is bridged to ppp0. I know it's 21st century, but this is a requirement! I have a wifi enabled device that connects to the Access Point. I need to trigger a ppp connection to dial out every time a wifi device is connected to the AP. Do you think this is feasible? I appreciate your help on this. Vojkan
On Tue, Jun 07, 2016 at 04:42:38PM +0300, Jonathan Afek wrote: > The BSS supplicant command returns a 0 len reply on a failure > when the BSS isn't in the DB or if the command has invalid params. It sounds fine to return FAIL on invalid params, but BSS-not-found is not really a failure and I think the empty response for used here by design. Changing that now could result in breaking existing users. > This patch make the function wpa_supplicant_ctrl_iface_bss() > return -1 on failures instead of 0 and therefore the BSS command > will return FAIL on failures. > This is important since when using udp control interfaces > sending a 0 len reply does not send a reply at all and the > control interface can wait forever (or until a timeout is reached) > for a reply. Maybe the UDP control interface backend should be fixed instead? > diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c > @@ -4448,7 +4448,7 @@ static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s, > if ((ctmp = os_strchr(cmd + 6, '-')) == NULL) { > wpa_printf(MSG_INFO, "Wrong BSS range " > "format"); > - return 0; > + return -1; This looks fine.. > @@ -4530,7 +4530,7 @@ static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s, > } > > if (bss == NULL) > - return 0; > + return -1; This could potentially break existing users that might expect an empty response at the end of the iteration.
On Tue, Jun 07, 2016 at 09:51:47AM -0400, Vojkan Zivkovic wrote: > Raspberry Pi3 with built-in wifi is acting as Access Point using hostap, which is bridged to ppp0. I know it's 21st century, but this is a requirement! > I have a wifi enabled device that connects to the Access Point. I need to trigger a ppp connection to dial out every time a wifi device is connected to the AP. > Do you think this is feasible? hostapd sends out an event message on the control interface whenever a station associates with the AP. It should be possible to use hostapd_cli with the -a command line argument to listen to those events and run a script that can start/stop the PPP connection based on station connection/disconnection.
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index e75f1ae..2ff47cb 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -4448,7 +4448,7 @@ static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s, if ((ctmp = os_strchr(cmd + 6, '-')) == NULL) { wpa_printf(MSG_INFO, "Wrong BSS range " "format"); - return 0; + return -1; } if (*(cmd + 6) == '-') @@ -4530,7 +4530,7 @@ static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s, } if (bss == NULL) - return 0; + return -1; if (bsslast == NULL) bsslast = bss;
The BSS supplicant command returns a 0 len reply on a failure when the BSS isn't in the DB or if the command has invalid params. This patch make the function wpa_supplicant_ctrl_iface_bss() return -1 on failures instead of 0 and therefore the BSS command will return FAIL on failures. This is important since when using udp control interfaces sending a 0 len reply does not send a reply at all and the control interface can wait forever (or until a timeout is reached) for a reply. Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com> --- wpa_supplicant/ctrl_iface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)