[pkg-wpa-devel] r1024 - in /wpasupplicant/trunk/debian: changelog patches/33_wait_for_interface_driver_init.patch patches/series
kelmo-guest at users.alioth.debian.org
kelmo-guest at users.alioth.debian.org
Fri Jan 11 01:20:10 UTC 2008
Author: kelmo-guest
Date: Fri Jan 11 01:20:09 2008
New Revision: 1024
URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1024
Log:
* DO NOT RELEASE.
* Add debian/patches/33_wait_for_interface_driver_init.patch to refactor
driver/interface initialization
- driver_wext init function returns NULL when interface flags cannot be
determined. Most other drivers use this function in their initialization
or or return NULL on similar failure.
- poll on interface initialization, not after several initialization steps
have passed.
- move large block of driver initialization code from
wpa_supplicant_init_iface2() to wpa_supplicant_driver_init(), making
sure these functions do something in case we have waited for interface
to exist.
- wait_for_interface hack (-w command line option) now works as
advertised. (Closes: #350963)
- pending upstream inclusion. We won't ship it unless upstream accepts.
Added:
wpasupplicant/trunk/debian/patches/33_wait_for_interface_driver_init.patch
Modified:
wpasupplicant/trunk/debian/changelog
wpasupplicant/trunk/debian/patches/series
Modified: wpasupplicant/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/changelog?rev=1024&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/changelog (original)
+++ wpasupplicant/trunk/debian/changelog Fri Jan 11 01:20:09 2008
@@ -1,3 +1,23 @@
+wpasupplicant (0.6.2-2) UNRELEASED; urgency=low
+
+ * DO NOT RELEASE.
+ * Add debian/patches/33_wait_for_interface_driver_init.patch to refactor
+ driver/interface initialization
+ - driver_wext init function returns NULL when interface flags cannot be
+ determined. Most other drivers use this function in their initialization
+ or or return NULL on similar failure.
+ - poll on interface initialization, not after several initialization steps
+ have passed.
+ - move large block of driver initialization code from
+ wpa_supplicant_init_iface2() to wpa_supplicant_driver_init(), making
+ sure these functions do something in case we have waited for interface
+ to exist.
+ - wait_for_interface hack (-w command line option) now works as
+ advertised. (Closes: #350963)
+ - pending upstream inclusion. We won't ship it unless upstream accepts.
+
+ -- Kel Modderman <kel at otaku42.de> Fri, 11 Jan 2008 11:18:40 +1000
+
wpasupplicant (0.6.2-1) experimental; urgency=low
* New upstream release.
Added: wpasupplicant/trunk/debian/patches/33_wait_for_interface_driver_init.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/patches/33_wait_for_interface_driver_init.patch?rev=1024&op=file
==============================================================================
--- wpasupplicant/trunk/debian/patches/33_wait_for_interface_driver_init.patch (added)
+++ wpasupplicant/trunk/debian/patches/33_wait_for_interface_driver_init.patch Fri Jan 11 01:20:09 2008
@@ -1,0 +1,206 @@
+--- a/wpa_supplicant/wpa_supplicant.c
++++ b/wpa_supplicant/wpa_supplicant.c
+@@ -1469,38 +1469,104 @@
+
+
+ /**
+- * wpa_supplicant_driver_init - Initialize driver interface parameters
++ * wpa_supplicant_driver_init - Initialize driver interface
+ * @wpa_s: Pointer to wpa_supplicant data
+ * @wait_for_interface: 0 = do not wait for the interface (reports a failure if
+ * the interface is not present), 1 = wait until the interface is available
+ * Returns: 0 on success, -1 on failure
+ *
+- * This function is called to initialize driver interface parameters.
+- * wpa_drv_init() must have been called before this function to initialize the
+- * driver interface.
++ * This function is called to initialize driver interface and driver interface
++ * parameters.
+ */
+ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s,
+ int wait_for_interface)
+ {
++ const char *ifname;
+ static int interface_count = 0;
+
++ /* Initialize driver interface and register driver event handler before
++ * L2 receive handler so that association events are processed before
++ * EAPOL-Key packets if both become available for the same select()
++ * call. */
+ for (;;) {
+- if (wpa_s->driver->send_eapol) {
+- const u8 *addr = wpa_drv_get_mac_addr(wpa_s);
+- if (addr)
+- os_memcpy(wpa_s->own_addr, addr, ETH_ALEN);
+- break;
++ wpa_s->drv_priv = wpa_drv_init(wpa_s, wpa_s->ifname);
++ if (wpa_s->drv_priv == NULL) {
++ if (wait_for_interface) {
++ wpa_printf(MSG_DEBUG, "Waiting for interface "
++ "'%s'...", wpa_s->ifname);
++ os_sleep(5, 0);
++ } else {
++ wpa_printf(MSG_ERROR, "Failed to initialize "
++ "driver interface for '%s'",
++ wpa_s->ifname);
++ return -1;
++ }
+ }
++ else
++ break;
++ }
++
++ if (wpa_drv_set_param(wpa_s, wpa_s->conf->driver_param) < 0) {
++ wpa_printf(MSG_ERROR, "Driver interface rejected "
++ "driver_param '%s'", wpa_s->conf->driver_param);
++ return -1;
++ }
++
++ ifname = wpa_drv_get_ifname(wpa_s);
++ if (ifname && os_strcmp(ifname, wpa_s->ifname) != 0) {
++ wpa_printf(MSG_DEBUG, "Driver interface replaced interface "
++ "name with '%s'", ifname);
++ os_strlcpy(wpa_s->ifname, ifname, sizeof(wpa_s->ifname));
++ }
++
++ if (wpa_supplicant_init_wpa(wpa_s) < 0)
++ return -1;
++
++ wpa_sm_set_ifname(wpa_s->wpa, wpa_s->ifname,
++ wpa_s->bridge_ifname[0] ? wpa_s->bridge_ifname :
++ NULL);
++ wpa_sm_set_fast_reauth(wpa_s->wpa, wpa_s->conf->fast_reauth);
++ wpa_sm_set_eapol(wpa_s->wpa, wpa_s->eapol);
++
++ if (wpa_s->conf->dot11RSNAConfigPMKLifetime &&
++ wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_LIFETIME,
++ wpa_s->conf->dot11RSNAConfigPMKLifetime)) {
++ wpa_printf(MSG_ERROR, "Invalid WPA parameter value for "
++ "dot11RSNAConfigPMKLifetime");
++ return -1;
++ }
++
++ if (wpa_s->conf->dot11RSNAConfigPMKReauthThreshold &&
++ wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_REAUTH_THRESHOLD,
++ wpa_s->conf->dot11RSNAConfigPMKReauthThreshold)) {
++ wpa_printf(MSG_ERROR, "Invalid WPA parameter value for "
++ "dot11RSNAConfigPMKReauthThreshold");
++ return -1;
++ }
++
++ if (wpa_s->conf->dot11RSNAConfigSATimeout &&
++ wpa_sm_set_param(wpa_s->wpa, RSNA_SA_TIMEOUT,
++ wpa_s->conf->dot11RSNAConfigSATimeout)) {
++ wpa_printf(MSG_ERROR, "Invalid WPA parameter value for "
++ "dot11RSNAConfigSATimeout");
++ return -1;
++ }
++
++ if (wpa_s->driver->send_eapol) {
++ const u8 *addr = wpa_drv_get_mac_addr(wpa_s);
++ if (addr)
++ os_memcpy(wpa_s->own_addr, addr, ETH_ALEN);
++ } else {
+ wpa_s->l2 = l2_packet_init(wpa_s->ifname,
+ wpa_drv_get_mac_addr(wpa_s),
+ ETH_P_EAPOL,
+ wpa_supplicant_rx_eapol, wpa_s, 0);
+- if (wpa_s->l2)
+- break;
+- else if (!wait_for_interface)
++ if (wpa_s->l2 == NULL) {
++ wpa_printf(MSG_ERROR, "Failed to open l2_packet "
++ "connection for interface '%s'",
++ wpa_s->ifname);
+ return -1;
+- wpa_printf(MSG_DEBUG, "Waiting for interface..");
+- os_sleep(5, 0);
++ }
+ }
+
+ if (wpa_s->l2 && l2_packet_get_own_addr(wpa_s->l2, wpa_s->own_addr)) {
+@@ -1671,7 +1737,6 @@
+ static int wpa_supplicant_init_iface2(struct wpa_supplicant *wpa_s,
+ int wait_for_interface)
+ {
+- const char *ifname;
+ struct wpa_driver_capa capa;
+
+ wpa_printf(MSG_DEBUG, "Initializing interface (2) '%s'",
+@@ -1684,61 +1749,6 @@
+ eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
+ eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
+
+- /* Initialize driver interface and register driver event handler before
+- * L2 receive handler so that association events are processed before
+- * EAPOL-Key packets if both become available for the same select()
+- * call. */
+- wpa_s->drv_priv = wpa_drv_init(wpa_s, wpa_s->ifname);
+- if (wpa_s->drv_priv == NULL) {
+- wpa_printf(MSG_ERROR, "Failed to initialize driver interface");
+- return -1;
+- }
+- if (wpa_drv_set_param(wpa_s, wpa_s->conf->driver_param) < 0) {
+- wpa_printf(MSG_ERROR, "Driver interface rejected "
+- "driver_param '%s'", wpa_s->conf->driver_param);
+- return -1;
+- }
+-
+- ifname = wpa_drv_get_ifname(wpa_s);
+- if (ifname && os_strcmp(ifname, wpa_s->ifname) != 0) {
+- wpa_printf(MSG_DEBUG, "Driver interface replaced interface "
+- "name with '%s'", ifname);
+- os_strlcpy(wpa_s->ifname, ifname, sizeof(wpa_s->ifname));
+- }
+-
+- if (wpa_supplicant_init_wpa(wpa_s) < 0)
+- return -1;
+-
+- wpa_sm_set_ifname(wpa_s->wpa, wpa_s->ifname,
+- wpa_s->bridge_ifname[0] ? wpa_s->bridge_ifname :
+- NULL);
+- wpa_sm_set_fast_reauth(wpa_s->wpa, wpa_s->conf->fast_reauth);
+- wpa_sm_set_eapol(wpa_s->wpa, wpa_s->eapol);
+-
+- if (wpa_s->conf->dot11RSNAConfigPMKLifetime &&
+- wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_LIFETIME,
+- wpa_s->conf->dot11RSNAConfigPMKLifetime)) {
+- wpa_printf(MSG_ERROR, "Invalid WPA parameter value for "
+- "dot11RSNAConfigPMKLifetime");
+- return -1;
+- }
+-
+- if (wpa_s->conf->dot11RSNAConfigPMKReauthThreshold &&
+- wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_REAUTH_THRESHOLD,
+- wpa_s->conf->dot11RSNAConfigPMKReauthThreshold)) {
+- wpa_printf(MSG_ERROR, "Invalid WPA parameter value for "
+- "dot11RSNAConfigPMKReauthThreshold");
+- return -1;
+- }
+-
+- if (wpa_s->conf->dot11RSNAConfigSATimeout &&
+- wpa_sm_set_param(wpa_s->wpa, RSNA_SA_TIMEOUT,
+- wpa_s->conf->dot11RSNAConfigSATimeout)) {
+- wpa_printf(MSG_ERROR, "Invalid WPA parameter value for "
+- "dot11RSNAConfigSATimeout");
+- return -1;
+- }
+-
+ if (wpa_supplicant_driver_init(wpa_s, wait_for_interface) < 0) {
+ return -1;
+ }
+--- a/src/drivers/driver_wext.c
++++ b/src/drivers/driver_wext.c
+@@ -945,9 +945,10 @@
+
+ drv->mlme_sock = -1;
+
+- if (wpa_driver_wext_get_ifflags(drv, &flags) != 0)
++ if (wpa_driver_wext_get_ifflags(drv, &flags) != 0) {
+ printf("Could not get interface '%s' flags\n", drv->ifname);
+- else if (!(flags & IFF_UP)) {
++ return NULL;
++ } else if (!(flags & IFF_UP)) {
+ if (wpa_driver_wext_set_ifflags(drv, flags | IFF_UP) != 0) {
+ printf("Could not set interface '%s' UP\n",
+ drv->ifname);
Modified: wpasupplicant/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/patches/series?rev=1024&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/patches/series (original)
+++ wpasupplicant/trunk/debian/patches/series Fri Jan 11 01:20:09 2008
@@ -7,3 +7,4 @@
30_scan_even_when_disconnected.patch
31_wpa_gui_qt4_select_any.patch
32_append_mmd_to_default_cflags.patch
+33_wait_for_interface_driver_init.patch
More information about the Pkg-wpa-devel
mailing list