Move hostapd_set_drv_ieee8021x() into ap_drv_ops
authorJouni Malinen <j@w1.fi>
Thu, 24 Dec 2009 21:17:11 +0000 (23:17 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 24 Dec 2009 21:17:11 +0000 (23:17 +0200)
hostapd/ap_drv_ops.c
hostapd/hostapd.c
hostapd/hostapd.h
hostapd/ieee802_1x.c

index b771f47..d6401e2 100644 (file)
@@ -129,6 +129,25 @@ static int hostapd_set_sta_flags(struct hostapd_data *hapd,
 }
 
 
+static 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;
+       if (enabled) {
+               params.wpa = hapd->conf->wpa;
+               params.ieee802_1x = hapd->conf->ieee802_1x;
+               params.wpa_group = hapd->conf->wpa_group;
+               params.wpa_pairwise = hapd->conf->wpa_pairwise;
+               params.wpa_key_mgmt = hapd->conf->wpa_key_mgmt;
+               params.rsn_preauth = hapd->conf->rsn_preauth;
+       }
+       return hostapd_set_ieee8021x(hapd, &params);
+}
+
+
 void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
 {
        ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
@@ -139,4 +158,5 @@ void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
        ops->read_sta_data = hostapd_read_sta_data;
        ops->sta_clear_stats = hostapd_sta_clear_stats;
        ops->set_sta_flags = hostapd_set_sta_flags;
+       ops->set_drv_ieee8021x = hostapd_set_drv_ieee8021x;
 }
index 17012e6..4e53a40 100644 (file)
@@ -178,9 +178,9 @@ int hostapd_reload_config(struct hostapd_iface *iface)
        }
 
        if (hapd->conf->ieee802_1x || hapd->conf->wpa)
-               hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
+               hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
        else
-               hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
+               hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
 
        hostapd_config_free(oldconf);
 
@@ -1486,22 +1486,3 @@ 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;
-       if (enabled) {
-               params.wpa = hapd->conf->wpa;
-               params.ieee802_1x = hapd->conf->ieee802_1x;
-               params.wpa_group = hapd->conf->wpa_group;
-               params.wpa_pairwise = hapd->conf->wpa_pairwise;
-               params.wpa_key_mgmt = hapd->conf->wpa_key_mgmt;
-               params.rsn_preauth = hapd->conf->rsn_preauth;
-       }
-       return hostapd_set_ieee8021x(hapd, &params);
-}
index b3f5cb8..3e456f4 100644 (file)
@@ -62,6 +62,8 @@ struct hostapd_driver_ops {
                             const u8 *addr);
        int (*sta_clear_stats)(struct hostapd_data *hapd, const u8 *addr);
        int (*set_sta_flags)(struct hostapd_data *hapd, struct sta_info *sta);
+       int (*set_drv_ieee8021x)(struct hostapd_data *hapd, const char *ifname,
+                                int enabled);
 };
 
 /**
@@ -214,8 +216,6 @@ 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);
 void hostapd_set_driver_ops(struct hostapd_driver_ops *ops);
index 9340709..a6c934a 100644 (file)
@@ -233,7 +233,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_drv_ieee8021x(hapd, ifname, 1);
+       hapd->drv.set_drv_ieee8021x(hapd, ifname, 1);
 
        return key;
 }
@@ -1644,7 +1644,7 @@ int ieee802_1x_init(struct hostapd_data *hapd)
                return -1;
 
        if ((hapd->conf->ieee802_1x || hapd->conf->wpa) &&
-           hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1))
+           hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 1))
                return -1;
 
 #ifndef CONFIG_NO_RADIUS
@@ -1675,7 +1675,7 @@ void ieee802_1x_deinit(struct hostapd_data *hapd)
 
        if (hapd->driver != NULL &&
            (hapd->conf->ieee802_1x || hapd->conf->wpa))
-               hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
+               hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
 
        eapol_auth_deinit(hapd->eapol_auth);
        hapd->eapol_auth = NULL;