[PATCH] adding wpa_common.h

Leonardo Maccari maccari-thisaintpartofmyaddress- at lenst.det.unifi.it
Thu Nov 17 05:50:10 EST 2005


I'm back trying to link wpa_supplicant with hostapd code, with the aim of
having a supplicant SM working into hostapd code (final aim is have WPA
over WDS). This is a little patch I spoke about a few weeks ago that makes
things easier, it moves some definitions common to wpa_supplicant and
hostapd code into a common file wpa_common.h. There are a few definitions
in the new file but they might become more with time.

with this and a few more diffs I was able to do something like:

 struct wpa_sm_ctx * ctx;
 ctx = malloc(sizeof(*ctx));
 if (ctx == NULL) {
	 printf("Failed to allocate WPA context.\n");
	 return -1;
 }

 initialize_supplicant_interface(ctx);

into hostapd.c, now I'm thinkng how to port all the functions needed by
wpa_sm_ctx. as said before it would be easier if files in different
packages could have different names (wpa.c has the same name in
wpa_supplicant and hostapd, it would be easier if it was named wpa_s.c and
wpa_a.c or whatever), that would save some rename or hardlink for
compilation.

ciao,
leonardo.

-- 
   Key fingerprint = 3129 C583 F03B 2E73 0115  C040 3489 0185 B592 19FE
 Obviously -thisaintpartofmyaddress- is not part of my real email address 

-------------- next part --------------
Only in hostapd-0.4.6-dev/: .config
diff --exclude defconfig --exclude '*.swp' --exclude cscope.out --exclude tags -u hostapd-0.4.6/ieee802_1x.h hostapd-0.4.6-dev/ieee802_1x.h
--- hostapd-0.4.6/ieee802_1x.h	2005-08-29 06:05:12.000000000 +0200
+++ hostapd-0.4.6-dev/ieee802_1x.h	2005-11-17 11:18:14.568460880 +0100
@@ -1,23 +1,6 @@
 #ifndef IEEE802_1X_H
 #define IEEE802_1X_H
 
-/* IEEE Std 802.1X-REV-d11, 7.2 */
-
-struct ieee802_1x_hdr {
-	u8 version;
-	u8 type;
-	u16 length;
-	/* followed by length octets of data */
-} __attribute__ ((packed));
-
-#define EAPOL_VERSION 2
-
-enum { IEEE802_1X_TYPE_EAP_PACKET = 0,
-       IEEE802_1X_TYPE_EAPOL_START = 1,
-       IEEE802_1X_TYPE_EAPOL_LOGOFF = 2,
-       IEEE802_1X_TYPE_EAPOL_KEY = 3,
-       IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
-};
 
 /* draft-congdon-radius-8021x-20.txt */
 
@@ -43,9 +26,6 @@
 	 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
 } __attribute__ ((packed));
 
-enum { EAPOL_KEY_TYPE_RC4 = 1, EAPOL_KEY_TYPE_RSN = 2,
-       EAPOL_KEY_TYPE_WPA = 254 };
-
 
 void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
 			size_t len);
Common subdirectories: hostapd-0.4.6/logwatch and hostapd-0.4.6-dev/logwatch
Only in hostapd-0.4.6-dev/: wpa_common.h
diff --exclude defconfig --exclude '*.swp' --exclude cscope.out --exclude tags -u hostapd-0.4.6/wpa.h hostapd-0.4.6-dev/wpa.h
--- hostapd-0.4.6/wpa.h	2005-06-26 20:27:44.000000000 +0200
+++ hostapd-0.4.6-dev/wpa.h	2005-11-17 11:32:37.745238064 +0100
@@ -1,14 +1,14 @@
 #ifndef WPA_H
 #define WPA_H
 
-#define WPA_NONCE_LEN 32
+#include "wpa_common.h"
+
 #define WPA_PMK_LEN PMK_LEN
-#define WPA_REPLAY_COUNTER_LEN 8
 #define WPA_GMK_LEN 32
 #define WPA_GTK_MAX_LEN 32
-#define WPA_KEY_RSC_LEN 8
 #define PMKID_LEN 16
 
+
 struct rsn_pmksa_cache {
 	struct rsn_pmksa_cache *next, *hnext;
 	u8 pmkid[PMKID_LEN];
-------------- next part --------------
Only in wpa_supplicant-0.4.6-dev/: .config
Common subdirectories: wpa_supplicant-0.4.6/doc and wpa_supplicant-0.4.6-dev/doc
Common subdirectories: wpa_supplicant-0.4.6/examples and wpa_supplicant-0.4.6-dev/examples
Only in wpa_supplicant-0.4.6-dev/: wpa_common.h
Common subdirectories: wpa_supplicant-0.4.6/wpa_gui and wpa_supplicant-0.4.6-dev/wpa_gui
Common subdirectories: wpa_supplicant-0.4.6/wpa_gui-qt4 and wpa_supplicant-0.4.6-dev/wpa_gui-qt4
diff --exclude defconfig --exclude '*.swp' --exclude cscope.out --exclude tags -u wpa_supplicant-0.4.6/wpa.h wpa_supplicant-0.4.6-dev/wpa.h
--- wpa_supplicant-0.4.6/wpa.h	2005-10-02 01:34:36.000000000 +0200
+++ wpa_supplicant-0.4.6-dev/wpa.h	2005-11-17 11:28:05.963555160 +0100
@@ -16,29 +16,10 @@
 #define WPA_H
 
 #include "defs.h"
+#include "wpa_common.h"
 
 #define BIT(n) (1 << (n))
 
-struct ieee802_1x_hdr {
-	u8 version;
-	u8 type;
-	u16 length;
-	/* followed by length octets of data */
-} __attribute__ ((packed));
-
-#define EAPOL_VERSION 2
-
-enum { IEEE802_1X_TYPE_EAP_PACKET = 0,
-       IEEE802_1X_TYPE_EAPOL_START = 1,
-       IEEE802_1X_TYPE_EAPOL_LOGOFF = 2,
-       IEEE802_1X_TYPE_EAPOL_KEY = 3,
-       IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
-};
-
-enum { EAPOL_KEY_TYPE_RC4 = 1, EAPOL_KEY_TYPE_RSN = 2,
-       EAPOL_KEY_TYPE_WPA = 254 };
-
-
 #define WPA_CAPABILITY_PREAUTH BIT(0)
 
 #define GENERIC_INFO_ELEM 0xdd
diff --exclude defconfig --exclude '*.swp' --exclude cscope.out --exclude tags -u wpa_supplicant-0.4.6/wpa_i.h wpa_supplicant-0.4.6-dev/wpa_i.h
--- wpa_supplicant-0.4.6/wpa_i.h	2005-09-12 22:16:15.000000000 +0200
+++ wpa_supplicant-0.4.6-dev/wpa_i.h	2005-11-17 11:27:09.184186936 +0100
@@ -15,10 +15,6 @@
 #ifndef WPA_I_H
 #define WPA_I_H
 
-#define WPA_NONCE_LEN 32
-#define WPA_REPLAY_COUNTER_LEN 8
-
-
 struct rsn_pmksa_candidate;
 
 /**


More information about the HostAP mailing list