]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
driver_wired: Move STA entry processing away from driver wrapper
authorJouni Malinen <j@w1.fi>
Sat, 12 Dec 2009 18:39:25 +0000 (20:39 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 12 Dec 2009 18:39:25 +0000 (20:39 +0200)
Get rid of hostapd/sta_info.h dependency by introducing a new driver
callback function for hostapd.

hostapd/drv_callbacks.c
src/drivers/driver.h
src/drivers/driver_wired.c

index 031c290f24fc622402676add01d3e84f56fd9acd..af9c4c8b050ef21b06b6dd33046c7ddadba0480b 100644 (file)
@@ -237,6 +237,27 @@ void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
 }
 
 
+int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr)
+{
+       struct sta_info *sta = ap_get_sta(hapd, addr);
+       if (sta)
+               return 0;
+
+       wpa_printf(MSG_DEBUG, "Data frame from unknown STA " MACSTR
+                  " - adding a new STA", MAC2STR(addr));
+       sta = ap_sta_add(hapd, addr);
+       if (sta) {
+               hostapd_new_assoc_sta(hapd, sta, 0);
+       } else {
+               wpa_printf(MSG_DEBUG, "Failed to add STA entry for " MACSTR,
+                          MAC2STR(addr));
+               return -1;
+       }
+
+       return 0;
+}
+
+
 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                        const u8 *ie, size_t ielen)
 {
index c4e7b73fa70c918d94e64ba283cb45be132ecb4a..c889ba9f3c6149a6641589f39b4b2dd723532fd2 100644 (file)
@@ -1918,6 +1918,7 @@ void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
                       const u8 *buf, size_t len, int ack);
 void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
                                 const struct ieee80211_hdr *hdr, size_t len);
+int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr);
 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                        const u8 *ie, size_t ielen);
 void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
index 61ec1e5a33c824477eddc58845b106e54d890c63..68c34fecd551f5754d681ba8f962e7f144852f1f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant - wired Ethernet driver interface
- * Copyright (c) 2005-2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
  * Copyright (c) 2004, Gunter Burchardt <tira@isx.de>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -30,7 +30,6 @@
 
 #ifdef HOSTAPD
 #include "eloop.h"
-#include "../../hostapd/sta_info.h"
 #endif /* HOSTAPD */
 
 #ifdef _MSC_VER
@@ -94,26 +93,6 @@ struct dhcp_message {
 };
 
 
-static void wired_possible_new_sta(struct hostapd_data *hapd, u8 *addr)
-{
-       struct sta_info *sta;
-
-       sta = ap_get_sta(hapd, addr);
-       if (sta)
-               return;
-
-       wpa_printf(MSG_DEBUG, "Data frame from unknown STA " MACSTR
-                  " - adding a new STA", MAC2STR(addr));
-       sta = ap_sta_add(hapd, addr);
-       if (sta) {
-               hostapd_new_assoc_sta(hapd, sta, 0);
-       } else {
-               wpa_printf(MSG_DEBUG, "Failed to add STA entry for " MACSTR,
-                          MAC2STR(addr));
-       }
-}
-
-
 static void handle_data(struct hostapd_data *hapd, unsigned char *buf,
                        size_t len)
 {
@@ -135,7 +114,7 @@ static void handle_data(struct hostapd_data *hapd, unsigned char *buf,
                case ETH_P_PAE:
                        wpa_printf(MSG_MSGDUMP, "Received EAPOL packet");
                        sa = hdr->src;
-                       wired_possible_new_sta(hapd, sa);
+                       hostapd_notif_new_sta(hapd, sa);
 
                        pos = (u8 *) (hdr + 1);
                        left = len - sizeof(*hdr);
@@ -193,7 +172,7 @@ static void handle_dhcp(int sock, void *eloop_ctx, void *sock_ctx)
        wpa_printf(MSG_MSGDUMP, "Got DHCP broadcast packet from " MACSTR,
                   MAC2STR(mac_address));
 
-       wired_possible_new_sta(hapd, mac_address);
+       hostapd_notif_new_sta(hapd, mac_address);
 }