Added a new driver wrapper, "none", for RADIUS server only configuration
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 1 Oct 2008 11:07:55 +0000 (14:07 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 1 Oct 2008 11:07:55 +0000 (14:07 +0300)
This can be used to limit hostapd code size and clean up debug output for
configurations that do not use hostapd to control AP functionality.

hostapd/ChangeLog
hostapd/Makefile
hostapd/defconfig
hostapd/driver_none.c [new file with mode: 0644]
hostapd/drivers.c
hostapd/hostapd.conf

index 54045ac..742464a 100644 (file)
@@ -15,6 +15,8 @@ ChangeLog for hostapd
          authenticate or (re)associate request frames dropping association)
        * added support for using SHA256-based stronger key derivation for WPA2
          (IEEE 802.11w)
+       * added new "driver wrapper" for RADIUS-only configuration
+         (driver=none in hostapd.conf; CONFIG_DRIVER_NONE=y in .config)
 
 2008-08-10 - v0.6.4
        * added peer identity into EAP-FAST PAC-Opaque and skip Phase 2
index 6ba505d..2580a44 100644 (file)
@@ -139,6 +139,11 @@ CFLAGS += -DCONFIG_DRIVER_TEST
 OBJS += driver_test.o
 endif
 
+ifdef CONFIG_DRIVER_NONE
+CFLAGS += -DCONFIG_DRIVER_NONE
+OBJS += driver_none.o
+endif
+
 ifdef CONFIG_L2_PACKET
 ifdef CONFIG_DNET_PCAP
 ifdef CONFIG_L2_FREEBSD
index 82173a7..709fb07 100644 (file)
@@ -35,6 +35,9 @@ CONFIG_DRIVER_HOSTAP=y
 #CFLAGS += -I/usr/local/include
 #LIBS += -L/usr/local/lib
 
+# Driver interface for no driver (e.g., RADIUS server only)
+#CONFIG_DRIVER_NONE=y
+
 # IEEE 802.11F/IAPP
 CONFIG_IAPP=y
 
diff --git a/hostapd/driver_none.c b/hostapd/driver_none.c
new file mode 100644 (file)
index 0000000..96e7e64
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * hostapd / Driver interface for RADIUS server only (no driver)
+ * Copyright (c) 2008, Atheros Communications
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include "includes.h"
+
+#include "hostapd.h"
+#include "driver.h"
+
+
+struct none_driver_data {
+       struct hostapd_data *hapd;
+};
+
+
+static void * none_driver_init(struct hostapd_data *hapd)
+{
+       struct none_driver_data *drv;
+
+       drv = os_zalloc(sizeof(struct none_driver_data));
+       if (drv == NULL) {
+               wpa_printf(MSG_ERROR, "Could not allocate memory for none "
+                          "driver data");
+               return NULL;
+       }
+       drv->hapd = hapd;
+
+       return drv;
+}
+
+
+static void none_driver_deinit(void *priv)
+{
+       struct none_driver_data *drv = priv;
+
+       os_free(drv);
+}
+
+
+static int none_driver_send_ether(void *priv, const u8 *dst, const u8 *src,
+                                 u16 proto, const u8 *data, size_t data_len)
+{
+       return 0;
+}
+
+
+const struct wpa_driver_ops wpa_driver_none_ops = {
+       .name = "none",
+       .init = none_driver_init,
+       .deinit = none_driver_deinit,
+       .send_ether = none_driver_send_ether,
+};
index a2c79e5..3006190 100644 (file)
@@ -36,6 +36,9 @@ extern struct wpa_driver_ops wpa_driver_wired_ops; /* driver_wired.c */
 #ifdef CONFIG_DRIVER_TEST
 extern struct wpa_driver_ops wpa_driver_test_ops; /* driver_test.c */
 #endif /* CONFIG_DRIVER_TEST */
+#ifdef CONFIG_DRIVER_NONE
+extern struct wpa_driver_ops wpa_driver_none_ops; /* driver_none.c */
+#endif /* CONFIG_DRIVER_NONE */
 
 
 struct wpa_driver_ops *hostapd_drivers[] =
@@ -61,5 +64,8 @@ struct wpa_driver_ops *hostapd_drivers[] =
 #ifdef CONFIG_DRIVER_TEST
        &wpa_driver_test_ops,
 #endif /* CONFIG_DRIVER_TEST */
+#ifdef CONFIG_DRIVER_NONE
+       &wpa_driver_none_ops,
+#endif /* CONFIG_DRIVER_NONE */
        NULL
 };
index 75895af..874a159 100644 (file)
@@ -10,9 +10,9 @@ interface=wlan0
 # included in a bridge. This parameter is not used with Host AP driver.
 #bridge=br0
 
-# Driver interface type (hostap/wired/madwifi/prism54/test/nl80211/bsd);
+# Driver interface type (hostap/wired/madwifi/prism54/test/none/nl80211/bsd);
 # default: hostap)
-# Use driver=test if building hostapd as a standalone RADIUS server that does
+# Use driver=none if building hostapd as a standalone RADIUS server that does
 # not control any wireless/wired driver.
 # driver=hostap