Remove MLME code from build if none of the enabled drivers need it
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 8 Jan 2009 16:40:14 +0000 (18:40 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 8 Jan 2009 16:40:14 +0000 (18:40 +0200)
hostapd/Makefile
hostapd/ap_list.h
hostapd/beacon.h
hostapd/ieee802_11.h
hostapd/ieee802_11_auth.c
hostapd/wme.h

index 58e83fe..e25b7c9 100644 (file)
@@ -39,10 +39,10 @@ LIBS += -lws2_32
 endif
 
 OBJS = hostapd.o ieee802_1x.o eapol_sm.o \
-       ieee802_11.o config.o ieee802_11_auth.o accounting.o \
+       config.o ieee802_11_auth.o accounting.o \
        sta_info.o wpa.o ctrl_iface.o \
-       drivers.o preauth.o pmksa_cache.o beacon.o \
-       hw_features.o wme.o ap_list.o \
+       drivers.o preauth.o pmksa_cache.o \
+       hw_features.o \
        mlme.o vlan_init.o wpa_auth_ie.o
 
 OBJS += ../src/utils/eloop.o
@@ -101,6 +101,7 @@ CFLAGS += -DCONFIG_IEEE80211N
 endif
 
 ifdef CONFIG_DRIVER_HOSTAP
+NEED_MLME=y
 CFLAGS += -DCONFIG_DRIVER_HOSTAP
 OBJS += driver_hostap.o
 endif
@@ -122,6 +123,7 @@ OBJS += driver_prism54.o
 endif
 
 ifdef CONFIG_DRIVER_NL80211
+NEED_MLME=y
 CFLAGS += -DCONFIG_DRIVER_NL80211
 OBJS += driver_nl80211.o radiotap.o
 LIBS += -lnl
@@ -140,6 +142,7 @@ CONFIG_L2_FREEBSD=y
 endif
 
 ifdef CONFIG_DRIVER_TEST
+NEED_MLME=y
 CFLAGS += -DCONFIG_DRIVER_TEST
 OBJS += driver_test.o
 endif
@@ -502,6 +505,11 @@ ifdef NEED_BASE64
 OBJS += ../src/utils/base64.o
 endif
 
+ifdef NEED_MLME
+OBJS += beacon.o wme.o ap_list.o ieee802_11.o
+CFLAGS += -DNEED_MLME
+endif
+
 ifdef CONFIG_NO_STDOUT_DEBUG
 CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
 endif
index 93704f8..2ac9edf 100644 (file)
@@ -63,8 +63,19 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
                            struct ieee80211_mgmt *mgmt,
                            struct ieee802_11_elems *elems,
                            struct hostapd_frame_info *fi);
+#ifdef NEED_MLME
 int ap_list_init(struct hostapd_iface *iface);
 void ap_list_deinit(struct hostapd_iface *iface);
+#else /* NEED_MLME */
+static inline int ap_list_init(struct hostapd_iface *iface)
+{
+       return 0;
+}
+
+static inline void ap_list_deinit(struct hostapd_iface *iface)
+{
+}
+#endif /* NEED_MLME */
 int ap_list_reconfig(struct hostapd_iface *iface,
                     struct hostapd_config *oldconf);
 
index 18e0da2..5cf06ca 100644 (file)
 
 void handle_probe_req(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
                      size_t len);
+#ifdef NEED_MLME
 void ieee802_11_set_beacon(struct hostapd_data *hapd);
 void ieee802_11_set_beacons(struct hostapd_iface *iface);
+#else /* NEED_MLME */
+static inline void ieee802_11_set_beacon(struct hostapd_data *hapd)
+{
+}
+
+static inline void ieee802_11_set_beacons(struct hostapd_iface *iface)
+{
+}
+#endif /* NEED_MLME */
 
 #endif /* BEACON_H */
index ca8ef93..91f5728 100644 (file)
@@ -38,11 +38,31 @@ void ieee802_11_mgmt(struct hostapd_data *hapd, u8 *buf, size_t len,
 void ieee802_11_mgmt_cb(struct hostapd_data *hapd, u8 *buf, size_t len,
                        u16 stype, int ok);
 void ieee802_11_print_ssid(char *buf, const u8 *ssid, u8 len);
+#ifdef NEED_MLME
 void ieee80211_michael_mic_failure(struct hostapd_data *hapd, const u8 *addr,
                                   int local);
 int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
 int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
                           char *buf, size_t buflen);
+#else /* NEED_MLME */
+static inline void ieee80211_michael_mic_failure(struct hostapd_data *hapd,
+                                                const u8 *addr, int local)
+{
+}
+
+static inline int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf,
+                                    size_t buflen)
+{
+       return 0;
+}
+
+static inline int ieee802_11_get_mib_sta(struct hostapd_data *hapd,
+                                        struct sta_info *sta,
+                                        char *buf, size_t buflen)
+{
+       return 0;
+}
+#endif /* NEED_MLME */
 u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
                           int probe);
 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid);
index 9aba1fe..ebde436 100644 (file)
@@ -453,11 +453,13 @@ hostapd_acl_recv_radius(struct radius_msg *msg, struct radius_msg *req,
        hostapd_set_radius_acl_auth(hapd, query->addr, cache->accepted,
                                    cache->session_timeout);
 #else /* CONFIG_DRIVER_RADIUS_ACL */
+#ifdef NEED_MLME
        /* Re-send original authentication frame for 802.11 processing */
        wpa_printf(MSG_DEBUG, "Re-sending authentication frame after "
                   "successful RADIUS ACL query");
        ieee802_11_mgmt(hapd, query->auth_msg, query->auth_msg_len,
                        WLAN_FC_STYPE_AUTH, NULL);
+#endif /* NEED_MLME */
 #endif /* CONFIG_DRIVER_RADIUS_ACL */
 
  done:
index 4ee281a..27d363c 100644 (file)
@@ -122,7 +122,15 @@ struct ieee80211_mgmt;
 
 u8 * hostapd_eid_wme(struct hostapd_data *hapd, u8 *eid);
 int hostapd_eid_wme_valid(struct hostapd_data *hapd, u8 *eid, size_t len);
+#ifdef NEED_MLME
 int hostapd_wme_sta_config(struct hostapd_data *hapd, struct sta_info *sta);
+#else /* NEED_MLME */
+static inline int hostapd_wme_sta_config(struct hostapd_data *hapd,
+                                        struct sta_info *sta)
+{
+       return 0;
+}
+#endif /* NEED_MLME */
 void hostapd_wme_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
                        size_t len);