Wired
Gunter Burchardt
gbur
Fri Jun 4 01:58:14 PDT 2004
On 2004-06-04 - 08:59:24, Gunter Burchardt wrote:
> I will start with this point. Its a relative closed issue in source
> code. There I can become acquainted with the source. First i will add a
> struct to hostapd struct that holds all callback functions ond driver
> specific issues (i guess there will be more than one later) and make
> code for initialise this structure. Second i will implement the
> initialisation of this structure for host AP driver. The callback
> function for host ap driver i will put to driver.c . The initialisation
> for ethernet and other drivers comes on later steps.
OK - this part is ready and testet. Next part is to divide Host AP
driver and hostapd functionality. I will start with initialisation
process. There is much Host AP related stuff. I will move it to the new
function hostapd_driver_init() in driver.c .
Is there a hostap-devel mailing list? Its ok to send the patches in
this list or should i send it to your directly?
regards
gunter
-------------- next part --------------
diff -Nur hostap/hostapd/driver.c hostap-0.2.1-patched/hostapd/driver.c
--- hostap/hostapd/driver.c 2004-05-07 03:09:58.000000000 +0200
+++ hostap-0.2.1-patched/hostapd/driver.c 2004-06-04 10:26:54.000000000 +0200
@@ -39,6 +39,43 @@
#include "ieee802_11.h"
+void hostapd_set_sta_authorised(hostapd *hapd, struct sta_info *sta,
+ int authorized)
+{
+ struct prism2_hostapd_param param;
+
+ if (sta->flags & WLAN_STA_PREAUTH)
+ return;
+ memset(¶m, 0, sizeof(param));
+ param.cmd = PRISM2_HOSTAPD_SET_FLAGS_STA;
+ memcpy(param.sta_addr, sta->addr, ETH_ALEN);
+ if (authorized) {
+ sta->flags |= WLAN_STA_AUTHORIZED;
+ param.u.set_flags_sta.flags_or = WLAN_STA_AUTHORIZED;
+ param.u.set_flags_sta.flags_and = ~0;
+ hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
+ HOSTAPD_LEVEL_DEBUG, "authorizing port");
+ } else {
+ sta->flags &= ~WLAN_STA_AUTHORIZED;
+ param.u.set_flags_sta.flags_and = ~WLAN_STA_AUTHORIZED;
+ hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
+ HOSTAPD_LEVEL_DEBUG, "unauthorizing port");
+ }
+
+ if (hostapd_ioctl(hapd, ¶m, sizeof(param)))
+ printf("Could not set station flags for kernel driver.\n");
+}
+
+int hostapd_driver_init(hostapd *hapd)
+{
+ /* In this function we could add more Host AP driver specific
+ * initialisation stuff
+ */
+ hapd->driver.set_sta_authorised_func=hostapd_set_sta_authorised;
+
+ return 0;
+}
+
int hostapd_set_iface_flags(hostapd *hapd, int dev_up)
{
struct ifreq ifr;
diff -Nur hostap/hostapd/driver.h hostap-0.2.1-patched/hostapd/driver.h
--- hostap/hostapd/driver.h 2004-05-07 03:09:58.000000000 +0200
+++ hostap-0.2.1-patched/hostapd/driver.h 2004-06-04 09:47:57.000000000 +0200
@@ -6,6 +6,7 @@
};
+int hostapd_driver_init(hostapd *hapd);
int hostapd_set_iface_flags(hostapd *hapd, int dev_up);
int hostapd_ioctl(hostapd *hapd, struct prism2_hostapd_param *param, int len);
int hostap_ioctl_prism2param(hostapd *hapd, int param, int value);
diff -Nur hostap/hostapd/hostapd.c hostap-0.2.1-patched/hostapd/hostapd.c
--- hostap/hostapd/hostapd.c 2004-06-04 06:20:46.000000000 +0200
+++ hostap-0.2.1-patched/hostapd/hostapd.c 2004-06-04 09:51:35.000000000 +0200
@@ -442,6 +442,11 @@
return -1;
}
+ if (hostapd_driver_init(hapd)) {
+ printf("Host AP driver initialisation failed.\n");
+ return -1;
+ }
+
if (radius_client_init(hapd)) {
printf("RADIUS client initialization failed.\n");
return -1;
diff -Nur hostap/hostapd/hostapd.h hostap-0.2.1-patched/hostapd/hostapd.h
--- hostap/hostapd/hostapd.h 2004-05-07 03:09:58.000000000 +0200
+++ hostap-0.2.1-patched/hostapd/hostapd.h 2004-06-04 09:57:50.000000000 +0200
@@ -44,7 +44,15 @@
extern unsigned char rfc1042_header[6];
-typedef struct hostapd_data {
+typedef struct hostapd_data hostapd;
+
+typedef void driver_set_sta_authorised_func(hostapd *hapd,struct sta_info *sta, int authorized);
+
+struct driver_info {
+ driver_set_sta_authorised_func *set_sta_authorised_func;
+};
+
+struct hostapd_data {
struct hostapd_config *conf;
char *config_fname;
@@ -63,6 +71,7 @@
*/
struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];
+ struct driver_info driver;
u8 *default_wep_key;
u8 default_wep_key_idx;
@@ -97,7 +106,7 @@
time_t michael_mic_failure;
int michael_mic_failures;
int tkip_countermeasures;
-} hostapd;
+};
void hostapd_new_assoc_sta(hostapd *hapd, struct sta_info *sta);
diff -Nur hostap/hostapd/ieee802_1x.c hostap-0.2.1-patched/hostapd/ieee802_1x.c
--- hostap/hostapd/ieee802_1x.c 2004-06-04 06:20:46.000000000 +0200
+++ hostap-0.2.1-patched/hostapd/ieee802_1x.c 2004-06-04 09:59:53.000000000 +0200
@@ -132,29 +132,16 @@
void ieee802_1x_set_sta_authorized(hostapd *hapd, struct sta_info *sta,
int authorized)
{
- struct prism2_hostapd_param param;
-
- if (sta->flags & WLAN_STA_PREAUTH)
- return;
- memset(¶m, 0, sizeof(param));
- param.cmd = PRISM2_HOSTAPD_SET_FLAGS_STA;
- memcpy(param.sta_addr, sta->addr, ETH_ALEN);
- if (authorized) {
- sta->flags |= WLAN_STA_AUTHORIZED;
- param.u.set_flags_sta.flags_or = WLAN_STA_AUTHORIZED;
- param.u.set_flags_sta.flags_and = ~0;
- hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
- HOSTAPD_LEVEL_DEBUG, "authorizing port");
+ if(hapd->driver.set_sta_authorised_func){
+ /* enable port */
+ (*(hapd->driver.set_sta_authorised_func))(hapd,sta,authorized);
+
+ /* start accounting */
accounting_sta_start(hapd, sta);
- } else {
- sta->flags &= ~WLAN_STA_AUTHORIZED;
- param.u.set_flags_sta.flags_and = ~WLAN_STA_AUTHORIZED;
- hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
- HOSTAPD_LEVEL_DEBUG, "unauthorizing port");
+ }else{
+ printf("Could not set authorization state for station " MACSTR "\n",
+ MAC2STR(sta->addr));
}
-
- if (hostapd_ioctl(hapd, ¶m, sizeof(param)))
- printf("Could not set station flags for kernel driver.\n");
}
More information about the Hostap
mailing list