]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Change set_ieee8021x driver op to use parameters structure
authorJouni Malinen <j@w1.fi>
Sat, 12 Dec 2009 21:32:44 +0000 (23:32 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 12 Dec 2009 21:32:44 +0000 (23:32 +0200)
This makes it easier to extent the set of parameters passed to
this driver wrapper function.

hostapd/driver_i.h
hostapd/hostapd.c
hostapd/hostapd.h
hostapd/ieee802_1x.c
src/drivers/driver.h
src/drivers/driver_atheros.c
src/drivers/driver_bsd.c
src/drivers/driver_hostap.c
src/drivers/driver_madwifi.c

index d684cf7b0a19634bba2e79b202515722ff45b8bb..a6d89c15d44ba5620874168012ab8375aa253011 100644 (file)
@@ -63,12 +63,11 @@ hostapd_driver_deinit(struct hostapd_data *hapd)
 }
 
 static inline int
-hostapd_set_ieee8021x(const char *ifname, struct hostapd_data *hapd,
-                     int enabled)
+hostapd_set_ieee8021x(struct hostapd_data *hapd, struct wpa_bss_params *params)
 {
        if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
                return 0;
-       return hapd->driver->set_ieee8021x(ifname, hapd->drv_priv, enabled);
+       return hapd->driver->set_ieee8021x(hapd->drv_priv, params);
 }
 
 static inline int
index 53f3a3b30baeda2ea44461b4fb66af9f1673bd85..e1fb6e709394bc9a8bdf5601f772a2c008f99a44 100644 (file)
@@ -177,7 +177,9 @@ int hostapd_reload_config(struct hostapd_iface *iface)
        }
 
        if (hapd->conf->ieee802_1x || hapd->conf->wpa)
-               hostapd_set_ieee8021x(hapd->conf->iface, hapd, 1);
+               hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
+       else
+               hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
 
        hostapd_config_free(oldconf);
 
@@ -1486,3 +1488,14 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd,
 
        return 0;
 }
+
+
+int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
+                             int enabled)
+{
+       struct wpa_bss_params params;
+       os_memset(&params, 0, sizeof(params));
+       params.ifname = ifname;
+       params.enabled = enabled;
+       return hostapd_set_ieee8021x(hapd, &params);
+}
index 7200c2595f03823000f36a357453a185a1faddac..52a46d583ae2d5d009dfefbff73508e73db66bc1 100644 (file)
@@ -187,6 +187,8 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd,
                                 void (*cb)(void *ctx, const u8 *sa,
                                            const u8 *ie, size_t ie_len),
                                 void *ctx);
+int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
+                             int enabled);
 
 int eap_server_register_methods(void);
 
index a5bc0e3139e9eb1a83b3966d0d405b5ae141ee96..322026c8837308126e7745e94e8accc03d2e9cfb 100644 (file)
@@ -236,7 +236,7 @@ ieee802_1x_group_alloc(struct hostapd_data *hapd, const char *ifname)
                            NULL, 0, key->key[key->idx], key->len[key->idx]))
                printf("Could not set dynamic VLAN WEP encryption key.\n");
 
-       hostapd_set_ieee8021x(ifname, hapd, 1);
+       hostapd_set_drv_ieee8021x(hapd, ifname, 1);
 
        return key;
 }
@@ -1664,7 +1664,7 @@ int ieee802_1x_init(struct hostapd_data *hapd)
                return -1;
 
        if ((hapd->conf->ieee802_1x || hapd->conf->wpa) &&
-           hostapd_set_ieee8021x(hapd->conf->iface, hapd, 1))
+           hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1))
                return -1;
 
 #ifndef CONFIG_NO_RADIUS
@@ -1696,7 +1696,7 @@ void ieee802_1x_deinit(struct hostapd_data *hapd)
 
        if (hapd->driver != NULL &&
            (hapd->conf->ieee802_1x || hapd->conf->wpa))
-               hostapd_set_ieee8021x(hapd->conf->iface, hapd, 0);
+               hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
 
        eapol_auth_deinit(hapd->eapol_auth);
        hapd->eapol_auth = NULL;
index 4825cb550ecaa79b9e0c907e20a2ec33fa8ffb48..0362e1a625918556b20e9bb6bf267aff9c6b2e57 100644 (file)
@@ -481,6 +481,14 @@ struct wpa_init_params {
 };
 
 
+struct wpa_bss_params {
+       /** Interface name (for multi-SSID/VLAN support) */
+       const char *ifname;
+       /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
+       int enabled;
+};
+
+
 /**
  * struct wpa_driver_ops - Driver interface API definition
  *
@@ -1084,16 +1092,17 @@ struct wpa_driver_ops {
 
        /**
         * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
-        * @ifname: Interface name (for multi-SSID/VLAN support)
         * @priv: Private driver interface data
-        * @enabled: 1 = enable, 0 = disable
+        * @params: BSS parameters
         * Returns: 0 on success, -1 on failure
         *
         * This is an optional function to configure the kernel driver to
-        * enable/disable 802.1X support. This can be left undefined (set to
-        * %NULL) if IEEE 802.1X support is always enabled.
+        * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
+        * can be left undefined (set to %NULL) if IEEE 802.1X support is
+        * always enabled and the driver uses set_beacon() to set WPA/RSN IE
+        * for Beacon frames.
         */
-       int (*set_ieee8021x)(const char *ifname, void *priv, int enabled);
+       int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
 
        /**
         * set_privacy - Enable/disable privacy (AP only)
index 1de3a71e3a09e2ebdaaf241562be2f9802929869..ce9f98379db89c88755fcf6f5f79e04de6455246 100644 (file)
@@ -306,11 +306,12 @@ madwifi_set_iface_flags(void *priv, int dev_up)
 }
 
 static int
-madwifi_set_ieee8021x(const char *ifname, void *priv, int enabled)
+madwifi_set_ieee8021x(void *priv, struct wpa_bss_params *params)
 {
        struct madwifi_driver_data *drv = priv;
        struct hostapd_data *hapd = drv->hapd;
        struct hostapd_bss_config *conf = hapd->conf;
+       int enabled = params->enabled;
 
        wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);
 
index a495f5f6e62e1eeaa0da74a69c21e3c240905fd4..ebc8fd7e6237a1bf13108e781af5e955de0a01ab 100644 (file)
@@ -323,11 +323,12 @@ bsd_set_iface_flags(void *priv, int dev_up)
 }
 
 static int
-bsd_set_ieee8021x(const char *ifname, void *priv, int enabled)
+bsd_set_ieee8021x(void *priv, struct wpa_bss_params *params)
 {
        struct bsd_driver_data *drv = priv;
        struct hostapd_data *hapd = drv->hapd;
        struct hostapd_bss_config *conf = hapd->conf;
+       int enabled = params->enabled;
 
        wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);
 
index f470568c36cd1c369f49e49e61c05b348519e585..be9435c04f6ca3db25a09ae83dfb0e2370d3d666 100644 (file)
@@ -542,9 +542,10 @@ static int hostap_ioctl_prism2param(void *priv, int param, int value)
 }
 
 
-static int hostap_set_ieee8021x(const char *ifname, void *priv, int enabled)
+static int hostap_set_ieee8021x(void *priv, struct wpa_bss_params *params)
 {
        struct hostap_driver_data *drv = priv;
+       int enabled = params->enabled;
 
        /* enable kernel driver support for IEEE 802.1X */
        if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_IEEE_802_1X, enabled)) {
index 5af69a61b764dc5c60a0488ba89d760581cb540d..53f7a75f41e311040c74ccdd421d6d0c7c0ac2ba 100644 (file)
@@ -351,11 +351,12 @@ madwifi_set_iface_flags(void *priv, int dev_up)
 }
 
 static int
-madwifi_set_ieee8021x(const char *ifname, void *priv, int enabled)
+madwifi_set_ieee8021x(void *priv, struct wpa_bss_params *params)
 {
        struct madwifi_driver_data *drv = priv;
        struct hostapd_data *hapd = drv->hapd;
        struct hostapd_bss_config *conf = hapd->conf;
+       int enabled = params->enabled;
 
        wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);