Hi David

On Sun, 2010-11-21 at 22:59 -0500, Ward, David - 0663 - MITLL wrote:
> On 11/02/2010 12:37 PM, Inaky Perez-Gonzalez wrote: 
> > > Hi Inaky,
> > >
> > > Just politely checking in to see if you (or anyone else) has any
> > time
> > > to look at this.  I really appreciate your help.
> > 
> > I haven't had the time yet, I am sorry.
> > 
> > 
> > 
> 
> Inaky,
> 
> Can you or someone else from Intel please allocate a few minutes to
> testing your 5150 card under Linux?  It has been over a month since
> any progress was made on this, and I am continuing to pay for CLEAR
> service which I cannot use, as I have to run Linux on this laptop for
> work.  I appreciate Intel's commitment to supporting their products
> under Linux.

Ok, so finally I had some time to look over this. I don't have new 
info, but other things I found that could be culprit.

When I was trying to reproduce on my 5150 setup, the daemon kept
quitting on me and 'wimaxcu connect network 2' -- it turned out the
daemon was masking fatal errors, one of them introduced in the latest
release, some of them reported by another person.

So the tip of the source in git has a few patches (attached) which I'd
would like to ask you to try. They are probably not the cure, but I want
to rule out that was the issue.

When I had this applied, I was able to connect here in Portland with my
5150. I need to run another test in the other test machine I have where
the 5150 is fully connected (both the USB and PCI devices) to see if
there are any changes in that, but I don't know if I'll be able to get
that machine before Thanksgiving.

Sorry for the big lags on looking into this, and thanks for your
patience.


>From 6435becb440cd66098adf9424f99a5099935bbea Mon Sep 17 00:00:00 2001
From: Paul Donohue <[email protected]>
Date: Tue, 5 Oct 2010 11:38:52 -0700
Subject: [PATCH 1/9] wimax-network-service: 64-bit fixes

Correct assorted 64-bit issues.

Signed-off-by: Paul Donohue <[email protected]>
---
 .../Common/L4Common/SourceControl/BitmanCommon.h   |    4 ++++
 .../Common/L4Common/SourceControl/CommonTypes.h    |    2 ++
 .../OSAgnostic/Common/L5Common/L5CommonUtils.c     |    2 +-
 .../Product/AppSrvInfra/L5SocketsDispatcher.c      |    7 ++++---
 .../Linux/OSAL/Primitives/wimax_osal_basictypes.h  |    3 ++-
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/InfraStack/OSAgnostic/Common/L4Common/SourceControl/BitmanCommon.h b/InfraStack/OSAgnostic/Common/L4Common/SourceControl/BitmanCommon.h
index bdb48dc..874df35 100644
--- a/InfraStack/OSAgnostic/Common/L4Common/SourceControl/BitmanCommon.h
+++ b/InfraStack/OSAgnostic/Common/L4Common/SourceControl/BitmanCommon.h
@@ -67,6 +67,10 @@
 #define MASK_1 (0xFFFFFFFFFFFFFFFF)
 #define MASK_2 (0xFFFFFFFFFFFFFFFE)
 #define MASK_4 (0xFFFFFFFFFFFFFFFC)
+#elif __x86_64__
+#define MASK_1 (0xFFFFFFFFFFFFFFFF)
+#define MASK_2 (0xFFFFFFFFFFFFFFFE)
+#define MASK_4 (0xFFFFFFFFFFFFFFFC)
 #else
 #define MASK_1 (0xFFFFFFFF)
 #define MASK_2 (0xFFFFFFFE)
diff --git a/InfraStack/OSAgnostic/Common/L4Common/SourceControl/CommonTypes.h b/InfraStack/OSAgnostic/Common/L4Common/SourceControl/CommonTypes.h
index b410c38..f8aba19 100644
--- a/InfraStack/OSAgnostic/Common/L4Common/SourceControl/CommonTypes.h
+++ b/InfraStack/OSAgnostic/Common/L4Common/SourceControl/CommonTypes.h
@@ -91,6 +91,8 @@ typedef const char*	PCSTR;
 /// when you need to hold both a pointer and a number
 #ifdef WIN64
 typedef UINT64 POINTER_AND_UINT;
+#elif __x86_64__
+typedef UINT64 POINTER_AND_UINT;
 #else
 typedef UINT POINTER_AND_UINT;
 #endif
diff --git a/InfraStack/OSAgnostic/Common/L5Common/L5CommonUtils.c b/InfraStack/OSAgnostic/Common/L5Common/L5CommonUtils.c
index 840a89c..229a2e1 100644
--- a/InfraStack/OSAgnostic/Common/L5Common/L5CommonUtils.c
+++ b/InfraStack/OSAgnostic/Common/L5Common/L5CommonUtils.c
@@ -182,7 +182,7 @@ L5_RESULT L5_COMMON_UTILS_SendControlMessage(
 
 	result = l5_common_utils_ActuallySendMessage( Socket, pMessage );
 
-	TRACE(TR_MOD_SERVICE, TR_SEV_NOTICE, "Result of ActuallySendMessage is %d %d", result);
+	TRACE(TR_MOD_SERVICE, TR_SEV_NOTICE, "Result of ActuallySendMessage is %d", result);
 
 	return result;
 }
diff --git a/InfraStack/OSAgnostic/Product/AppSrvInfra/L5SocketsDispatcher.c b/InfraStack/OSAgnostic/Product/AppSrvInfra/L5SocketsDispatcher.c
index aa3a58c..33618cc 100644
--- a/InfraStack/OSAgnostic/Product/AppSrvInfra/L5SocketsDispatcher.c
+++ b/InfraStack/OSAgnostic/Product/AppSrvInfra/L5SocketsDispatcher.c
@@ -61,7 +61,8 @@ typedef struct
 	L5_CONNECTION L5Conn;			// Can be NULL before handshake
 
 	// Is this an active slot?
-	BOOL bActive;
+	// Updated using OSAL_atomic_exchange, so this must be a LONG not a BOOL
+	LONG bActive;
 
 	// Connections from both sides
 	SOCKETS_CLIENT_ID Socket;
@@ -702,7 +703,7 @@ void l5_sockets_dispatcher_HandleNewConnection( SOCKETS_CLIENT_ID Socket, void**
 	// XXX SEH error handling
 	OSAL_init_critical_section( &(pConn->csSendReceive) );
 	OSAL_init_critical_section( &(pConn->csHandlingRequest) );
-	OSAL_atomic_exchange( (LPLONG)&(pConn->bActive), TRUE );
+	OSAL_atomic_exchange( &(pConn->bActive), TRUE );
 
 	*context = pConn;
 
@@ -1034,7 +1035,7 @@ void l5_sockets_dispatcher_DisconnectClient( tL5SocketsDispatcherConnection *pCo
 			L5_DISPATCHER_Disconnect( pConn->L5Conn );
 		}
 
-		OSAL_atomic_exchange( (LPLONG)&(pConn->bActive), FALSE );
+		OSAL_atomic_exchange( &(pConn->bActive), FALSE );
 
 		OSAL_exit_critical_section( &(pConn->csHandlingRequest) );
 		OSAL_delete_critical_section(&pConn->csSendReceive);
diff --git a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_basictypes.h b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_basictypes.h
index 1085c4b..f13fade 100644
--- a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_basictypes.h
+++ b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_basictypes.h
@@ -39,6 +39,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <sys/stat.h>
+#include <pthread.h>
 
 #if 0
 #include <sys/socket.h>
@@ -90,7 +91,7 @@ typedef void* OSAL_critical_section;
 
 typedef int pid_t;
 
-typedef int OSAL_thread_t;
+typedef pthread_t OSAL_thread_t;
 
 typedef void * OSAL_event_t;
 
-- 
1.6.6.1

>From bb496da3c393e415ae85917d66e3bf0610303c11 Mon Sep 17 00:00:00 2001
From: Paul Donohue <[email protected]>
Date: Tue, 5 Oct 2010 16:40:55 -0400
Subject: [PATCH 2/9] cleanup: fix struct packing and type casting issues

cleanup: fix struct packing and type casting issues

Signed-off-by: Paul Donohue <[email protected]>
---
 .../Common/CommonServices/VersionUtils.h           |    4 +++-
 .../Common/L5Common/IndicatorsSubscribers.c        |   10 +++++-----
 InfraStack/OSAgnostic/Common/L5Common/L5Common.h   |    1 +
 .../Product/AppSrvInfra/L5SocketsDispatcher.c      |    2 +-
 .../WiMax/Agents/NDnS/APDO/NDnSAgent_APDO_CBs.c    |    4 ++--
 .../WiMax/Agents/NDnS/Source/NDnSAgent_Internals.h |    4 ++--
 .../Agents/Supplicant/Source/SupplicantAgent.c     |    2 +-
 .../Agents/Supplicant/Source/ds/driver_broadcom.h  |    8 ++++----
 .../WiMax/Wrappers/Include/wmxSDK_Msc_2.h          |    9 ++++++++-
 .../WiMax/Wrappers/Include/wmxSDK_Nds_1.h          |    3 ++-
 .../WiMax/Wrappers/Include/wmxSDK_Nds_3.h          |    6 ++++++
 .../WiMax/Wrappers/Include/wmxSDK_Nds_Cmn.h        |    4 ++++
 .../OSAgnostic/WiMax/Wrappers/NDnS/wmxSDK_Coex_1.c |    2 +-
 .../InfraStackModules/CommonAPIHeaders/WiMaxType.h |    4 +++-
 .../Linux/OSAL/Primitives/wimax_osal_linux_types.h |    2 +-
 .../Linux/OSAL/Primitives/wimax_osal_trace.c       |    2 +-
 .../OSDependent/Linux/wimaxcu/wimaxcu_scan_op.c    |    4 ++--
 17 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/InfraStack/OSAgnostic/Common/CommonServices/VersionUtils.h b/InfraStack/OSAgnostic/Common/CommonServices/VersionUtils.h
index 2b881eb..526f8f4 100644
--- a/InfraStack/OSAgnostic/Common/CommonServices/VersionUtils.h
+++ b/InfraStack/OSAgnostic/Common/CommonServices/VersionUtils.h
@@ -51,6 +51,7 @@ typedef struct _wmx_Version_t
 	UINT32	revision;
 	UINT32	branch;
 } wmx_Version_t, *wmx_pVersion_t;
+#pragma pack( pop )
 
 typedef char* wmx_ModuleName_t;
 typedef char* wmx_pVersionStr_t;
@@ -62,6 +63,7 @@ typedef struct _wmx_VersionEntry_t
 	wmx_ModuleName_t moduleName;
 	wmx_Version_t version;
 } wmx_VersionEntry_t, *wmx_pVersionEntry_t;
+#pragma pack( pop )
 
 
 BOOL VersionUtils_Init();
@@ -73,4 +75,4 @@ EXPORT void GetFullVersionString(char *str, wmx_Version_t version);
 EXTERN_C EXPORT VERSION_RESULT ValidateVersion(wmx_ModuleName_t moduleName, wmx_Version_t actualVersion, wmx_Version_t expectedVersion);
 
 
-#endif // _VERSION_UTILS_H
\ No newline at end of file
+#endif // _VERSION_UTILS_H
diff --git a/InfraStack/OSAgnostic/Common/L5Common/IndicatorsSubscribers.c b/InfraStack/OSAgnostic/Common/L5Common/IndicatorsSubscribers.c
index 41bb044..53559af 100644
--- a/InfraStack/OSAgnostic/Common/L5Common/IndicatorsSubscribers.c
+++ b/InfraStack/OSAgnostic/Common/L5Common/IndicatorsSubscribers.c
@@ -153,7 +153,7 @@ EXPORT void SendIndicationToSubscribers( UINT32 internalRequestID, void *_buffer
 	SendIndData *buffer = _buffer;
 	ListItem* handle;
 	L5_TARGET_ID targetID;
-	ULONG_PTR data;
+	L5_TARGET_ID data;
 	L5_RESULT res;
 	IndicatorSubscribers *indSubscribers;
 	List tempList;
@@ -174,12 +174,12 @@ EXPORT void SendIndicationToSubscribers( UINT32 internalRequestID, void *_buffer
 		handle = CreateIterator(&(indSubscribers->subscribersList));
 //		handle = Iterator_GetNext(&(indSubscribers->subscribersList), handle, (void**)&targetID);
 		handle = Iterator_GetNext(&(indSubscribers->subscribersList), handle, (void**)(&data));
-		targetID = (int) data; 
+		targetID = data;
 		while (handle != NULL)
 		{
 			List_AddItem(&tempList, (void *)targetID);
 			handle = Iterator_GetNext(&(indSubscribers->subscribersList), handle, (void**)(&data));
-    		targetID = (int)data; ////
+    		targetID = data; ////
 
 	//		handle = Iterator_GetNext(&(indSubscribers->subscribersList), handle, (void**)&targetID);
 		}
@@ -189,7 +189,7 @@ EXPORT void SendIndicationToSubscribers( UINT32 internalRequestID, void *_buffer
 		//iterate the temp list and send the targets indication:
 		handle = CreateIterator(&tempList);
 		handle = Iterator_GetNext(&tempList, handle, (void**)(&data));
-    	targetID = (int) data;
+    	targetID = data;
 
 	//	handle = Iterator_GetNext(&tempList, handle, (void**)&targetID);
 		while (handle != NULL)
@@ -219,7 +219,7 @@ EXPORT void SendIndicationToSubscribers( UINT32 internalRequestID, void *_buffer
 	//		handle = Iterator_GetNext(&tempList, handle, (void**)&targetID);
 
 			handle = Iterator_GetNext(&tempList, handle, (void**)(&data));
-    		targetID = (int) data;
+    		targetID = data;
 
 
 			// TODO - XXX - check L5_COMMON_UTILS_IsTargetNotExist
diff --git a/InfraStack/OSAgnostic/Common/L5Common/L5Common.h b/InfraStack/OSAgnostic/Common/L5Common/L5Common.h
index 037ccd5..6050052 100644
--- a/InfraStack/OSAgnostic/Common/L5Common/L5Common.h
+++ b/InfraStack/OSAgnostic/Common/L5Common/L5Common.h
@@ -282,5 +282,6 @@ typedef struct _tL5DispatcherFunctions
 extern tL5DispatcherFunctions *GetL5Funcs();
 extern tUtilityFunctions *GetUtilsFuncs();
 
+#pragma pack(pop)
 
 #endif
diff --git a/InfraStack/OSAgnostic/Product/AppSrvInfra/L5SocketsDispatcher.c b/InfraStack/OSAgnostic/Product/AppSrvInfra/L5SocketsDispatcher.c
index 33618cc..a7346a3 100644
--- a/InfraStack/OSAgnostic/Product/AppSrvInfra/L5SocketsDispatcher.c
+++ b/InfraStack/OSAgnostic/Product/AppSrvInfra/L5SocketsDispatcher.c
@@ -61,7 +61,7 @@ typedef struct
 	L5_CONNECTION L5Conn;			// Can be NULL before handshake
 
 	// Is this an active slot?
-	// Updated using OSAL_atomic_exchange, so this must be a LONG not a BOOL
+	// Updated using OSAL_atomic_exchange(), so this must be a LONG not a BOOL
 	LONG bActive;
 
 	// Connections from both sides
diff --git a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/APDO/NDnSAgent_APDO_CBs.c b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/APDO/NDnSAgent_APDO_CBs.c
index 5e9fcbc..75d5786 100644
--- a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/APDO/NDnSAgent_APDO_CBs.c
+++ b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/APDO/NDnSAgent_APDO_CBs.c
@@ -487,8 +487,8 @@ void NDnSAgent_HandleApdoLinkStatus(wmx_ApdoLinkStatus_t linkStatus)
 	lastConnectedStatus = Ndns_GetLastConnectedState();	
 
 	// Check if the link status has changed
-	if (linkStatus == APDO_linkUp && lastConnectedStatus == FALSE ||
-		linkStatus == APDO_linkDown && lastConnectedStatus == TRUE)
+	if ((linkStatus == APDO_linkUp && lastConnectedStatus == FALSE) ||
+		(linkStatus == APDO_linkDown && lastConnectedStatus == TRUE))
 	{
 		return; // No change in the link status
 	}
diff --git a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent_Internals.h b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent_Internals.h
index e247d28..da7a344 100644
--- a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent_Internals.h
+++ b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent_Internals.h
@@ -200,8 +200,8 @@ typedef struct _wmx_NDnS_Context_t
 	wmx_ConnectStatus_t connectStatus;
 	int  DummyForCompilerHappy3;
 	TinyFSM_t fsm;
-	L4C_Task scheduledTask;
-	wmx_ScheduledTaskData_t scheduledTaskData;	
+	LONG scheduledTask;  // Updated using OSAL_atomic_exchange(), so this must be a LONG not an L4C_Task
+	wmx_ScheduledTaskData_t scheduledTaskData;
 	wmx_Status_t scanStatus;
 	wmx_LinkLossType_t linkLossType;
 	wmx_ScanType_t currentScanType;
diff --git a/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c b/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c
index 1eeae5b..3948615 100644
--- a/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c
+++ b/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c
@@ -482,7 +482,7 @@ wmx_Status_t InitSupplicantLibrary(VOID)
 	eap_ctx.eap_config.password_len = 8;
 	eap_ctx.eap_config.ca_cert = (u8 *) os_strdup("ca.pem");
 	eap_ctx.eap_config.fragment_size = TLS_MAX_SIZE;
-	eap_ctx.eap_config.eap_methods = eap_methods;
+	eap_ctx.eap_config.eap_methods = &eap_methods;
 
 	memset(&eap_cb, 0, sizeof(eap_cb));
 	eap_cb.get_config = peer_get_config;
diff --git a/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/ds/driver_broadcom.h b/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/ds/driver_broadcom.h
index 8973978..72f6384 100644
--- a/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/ds/driver_broadcom.h
+++ b/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/ds/driver_broadcom.h
@@ -20,15 +20,15 @@ typedef s8 int8;
 typedef	unsigned char	bool;			/* consistent w/BOOL */
 
 /* require default structure packing */
-#if !defined(__GNUC__)
-#pragma pack(push,8)
-#endif
+//#if !defined(__GNUC__)
+//#pragma pack(push,8)
+//#endif
 
 /* enable structure packing */
 #if defined(__GNUC__)
 #define	PACKED	__attribute__((packed))
 #else
-#pragma pack(1)
+#pragma pack(push,1)
 #define	PACKED
 #endif
 
diff --git a/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Msc_2.h b/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Msc_2.h
index 33b3336..236217d 100644
--- a/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Msc_2.h
+++ b/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Msc_2.h
@@ -87,6 +87,7 @@ typedef struct _wmx_ModelType_t
 	UINT32	modelTypeID;
 	char	modelTypeName[WMX_MODEL_TYPE_NAME_MAX_LENGTH];
 } wmx_ModelType_t, *wmx_pModelType_t;
+#pragma pack( pop )
 
 /// <summary>
 /// A constant specifying the maximal length of the manufacturer string.
@@ -102,6 +103,7 @@ typedef struct _wmx_Manufacturer_t
 	UINT32	manufacturerID;
 	char	manufacturerName[WMX_MANUFACTURER_NAME_MAX_LENGTH];
 } wmx_Manufacturer_t, *wmx_pManufacturer_t;
+#pragma pack( pop )
 
 /// <summary>
 /// Definition of a struct that holds the manufacturer ID and string. 
@@ -111,6 +113,7 @@ typedef struct _wmx_DevicePID_t
 {
 	UINT32	productID;	
 } wmx_DevicePID_t, *wmx_pDevicePID_t;
+#pragma pack( pop )
 
 /// <summary>
 /// A constant specifying the maximal length of the serial number string.
@@ -125,6 +128,7 @@ typedef struct _wmx_SerialNumber_t
 {	
 	char	serialNumber[WMX_SERIAL_NUMBER_MAX_LENGTH];
 } wmx_SerialNumber_t, *wmx_pSerialNumber_t;
+#pragma pack( pop )
 
 
 
@@ -140,6 +144,7 @@ typedef struct _wmx_SerialNumber_t
 //	UINT32	TotalTxBytes;
 //	UINT32	TotalTxPackets;
 //} wmx_Statistics_t, *wmx_pStatistics_t;
+//#pragma pack( pop )
 
 
 /// <summary>
@@ -153,6 +158,7 @@ typedef struct _wmx_SfStatistics_t
 	UINT32	noReceivedBytes;
 	UINT32	noTransmittedBytes;
 } wmx_SfStatistics_t, *wmx_pSfStatistics_t;
+#pragma pack( pop )
 
 /// <summary>
 /// A constant specifying the maximal length of the strings in the wmx_DeviceVersion_t struct.
@@ -171,6 +177,7 @@ typedef struct _wmx_DeviceVersion_t
 	char	BoardName[WMX_DEVICE_VERSION_MAX_LENGTH];
 	char	Software[WMX_DEVICE_VERSION_MAX_LENGTH];
 } wmx_DeviceVersion_t, *wmx_pDeviceVersion_t;
+#pragma pack( pop )
 
 
 
@@ -230,4 +237,4 @@ wmx_Status_t WMX_WRAPPER_API WMX_EXT_CALL_CONV wmx_GetDeviceDetailsEx(	wmx_MacAd
 wmx_Status_t WMX_WRAPPER_API WMX_EXT_CALL_CONV wmx_GetDeviceVersion( wmx_pDeviceVersion_t pDeviceVersion	);
 
 wmx_Status_t WMX_WRAPPER_API WMX_EXT_CALL_CONV wmx_ResetDevice( );
-#endif // _WMX_SDK_MSC_2_H
\ No newline at end of file
+#endif // _WMX_SDK_MSC_2_H
diff --git a/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_1.h b/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_1.h
index 9a7863f..7fb5817 100644
--- a/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_1.h
+++ b/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_1.h
@@ -235,6 +235,7 @@ typedef struct _wmx_Statistics_t
 	UINT32	TotalTxBytes;
 	UINT32	TotalTxPackets;
 } wmx_Statistics_t, *wmx_pStatistics_t;
+#pragma pack( pop )
 
 /// <summary>
 /// Type definition for a structure giving a detailed info on a system state.
@@ -671,4 +672,4 @@ wmx_Status_t WMX_WRAPPER_API WMX_EXT_CALL_CONV wmx_IsAssociated(wmx_pAssociate_t
 wmx_Status_t WMX_WRAPPER_API WMX_EXT_CALL_CONV wmx_GetSpLockStatus(wmx_pSpLock_t pSpLockStatus);
 wmx_Status_t wmx_CmdSpLockUnLock(wmx_SpLockCode_t SpLockCode);
 
-#endif // _WMX_SDK_NDS_1_H
\ No newline at end of file
+#endif // _WMX_SDK_NDS_1_H
diff --git a/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_3.h b/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_3.h
index 05fc677..2bb463d 100644
--- a/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_3.h
+++ b/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_3.h
@@ -110,6 +110,7 @@ typedef struct _wmx_SLA_t
 	wmx_LinkSpeed_t		downLinkSpeed;
 	UINT32				agreementLevel;
 } wmx_SLA_t, *wmx_pSLA_t;
+#pragma pack( pop )
 
 #define WMX_SUBSCRIBER_NAME_MAX_SIZE 100
 #define WMX_SUBSCRIBER_ID_MAX_SIZE 256
@@ -125,6 +126,7 @@ typedef struct _wmx_SubscriberInfo_t
 	BOOL					userCredRequired;
 	//////////////////
 } wmx_SubscriberInfo_t, *wmx_pSubscriberInfo_t;
+#pragma pack( pop )
 
 /// <summary>
 /// Type definition for a struct containing information of a specific NSP.
@@ -149,6 +151,7 @@ typedef struct _wmx_NSP_t
 	wmx_SubscriberInfo_t	subscribers[WMX_NSP_SUBSCRIBERS_MAX_NUM];		// The list of subscribers associated with this NSP on this device.
 	UINT32					numOfSubscribers;
 } wmx_NSP_t, *wmx_pNSP_t;
+#pragma pack( pop )
 
 // TODO: Add description
 #pragma pack( push, 1 )
@@ -158,6 +161,7 @@ typedef struct _wmx_ContactInformation_t
 	UINT32	uriType; //TODO - don't forget to validate the values 0-255
 	char	text[MAX_SIZE_OF_STRING_BUFFER];
 } wmx_ContactInformation_t, *wmx_pContactInformation_t;
+#pragma pack( pop )
 
 /// <summary>
 /// Type definition for an enum specifying the possible outcomes of a scan cycle.
@@ -224,6 +228,7 @@ typedef struct _wmx_UserLinkStatus_t
 	wmx_LinkSpeed_t				downLinkSpeed;
 	wmx_BSid_t					bsId;
 } wmx_UserLinkStatus_t, *wmx_pUserLinkStatus_t;
+#pragma pack( pop )
 
 #pragma pack( push, 1 )
 typedef struct _wmx_UserStatistics_t
@@ -234,6 +239,7 @@ typedef struct _wmx_UserStatistics_t
 	UINT32	TotalTxBytes;
 	UINT32	TotalTxPackets;
 } wmx_UserStatistics_t, *wmx_pUserStatistics_t;
+#pragma pack( pop )
 
 /// <summary>
 /// A constant specifying the maximal length of a NSPs structs vector (in terms of the number of wmx_NSP_t structs the vector can contain).
diff --git a/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_Cmn.h b/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_Cmn.h
index 2dc5f37..21fdf62 100644
--- a/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_Cmn.h
+++ b/InfraStack/OSAgnostic/WiMax/Wrappers/Include/wmxSDK_Nds_Cmn.h
@@ -435,6 +435,7 @@ typedef struct _wmx_RfSwitchesStatus_t
 	wmx_RfStatus_t swRfStatus;
 	wmx_RfStatus_t hwRfStatus;
 }wmx_RfSwitchesStatus_t, *wmx_pRfSwitchesStatus_t;
+#pragma pack( pop )
 
 /// <summary>
 /// A struct in which the API will place information (such as URLs, VoIP numbers, �) that are relevant to the
@@ -446,6 +447,7 @@ typedef struct _wmx_APDOContactInfo_t
 {
 	char	contactDetails[MAX_CONTACT_DETAILS_SIZE];
 } wmx_APDOContactInfo_t, *wmx_pAPDOContactInfo_t;
+#pragma pack( pop )
 
 /// <summary>
 /// A struct in which the API will place information which is needed in the package update process.
@@ -460,6 +462,7 @@ typedef struct _wmx_PackageInfo_t
 	BOOL	mandatoryUpdate;                     /**< (TRUE = mandatory FALSE, optional) */
 	BOOL	warnUser;                            /**< (TRUE = warn user, FALSE = no user warning */
 } wmx_PackageInfo_t, *wmx_pPackageInfo_t;
+#pragma pack( pop )
 
 typedef enum _wmx_SPLockStatus_t
 {
@@ -507,5 +510,6 @@ typedef struct _wmx_InstallationInfo_t
 	char	fwVersion[MAX_INSTALLAION_VERSION_SIZE];		 
 	char	hwVersion[MAX_INSTALLAION_VERSION_SIZE];
 } wmx_InstallationInfo_t, *wmx_pInstallationInfo_t;
+#pragma pack( pop )
 
 #endif // _WMX_SDK_NDS_CMN_H
diff --git a/InfraStack/OSAgnostic/WiMax/Wrappers/NDnS/wmxSDK_Coex_1.c b/InfraStack/OSAgnostic/WiMax/Wrappers/NDnS/wmxSDK_Coex_1.c
index 97bd45c..beac961 100644
--- a/InfraStack/OSAgnostic/WiMax/Wrappers/NDnS/wmxSDK_Coex_1.c
+++ b/InfraStack/OSAgnostic/WiMax/Wrappers/NDnS/wmxSDK_Coex_1.c
@@ -64,7 +64,7 @@ wmx_Status_t wmx_SetCoexistenceMode(wmx_CoexistenceMode_t coexMode)
 		if (coexMode == WMX_MODE_CM && UserCall){
 			TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "SetCoexistanceMode recieved set CM mode in CM mode.");
 			if (act_thread_coexHandler!=NULL){
-				OSAL_kill_thread(&act_thread_coexHandler);
+				OSAL_kill_thread(act_thread_coexHandler);
 				retStatus = WMX_ST_OK;
 			}
 			// setting fall to xor key to zero so we never fall to xor even when driver falls and brings itself up
diff --git a/InfraStack/OSDependent/Linux/InfraStackModules/CommonAPIHeaders/WiMaxType.h b/InfraStack/OSDependent/Linux/InfraStackModules/CommonAPIHeaders/WiMaxType.h
index 9afb111..4c56ab9 100644
--- a/InfraStack/OSDependent/Linux/InfraStackModules/CommonAPIHeaders/WiMaxType.h
+++ b/InfraStack/OSDependent/Linux/InfraStackModules/CommonAPIHeaders/WiMaxType.h
@@ -305,7 +305,7 @@ typedef struct _WIMAX_API_RF_SWITCHES_STATUS
 	{
 		UINT32                structureSize;                          /**< size of this structure. */
 		WIMAX_API_PROFILE_ID  profileID;                              /**< profile ID. Profile id 0 is reserve to connection without specifying a user account. */
-		char	                profileName[MAX_SIZE_OF_STRING_BUFFER]; /**< profile name. */ 
+		WIMAX_CHAR            profileName[MAX_SIZE_OF_STRING_BUFFER]; /**< profile name. */ 
 	} WIMAX_API_PROFILE_INFO, *WIMAX_API_PROFILE_INFO_P;
 	
 	/// Device version
@@ -467,6 +467,8 @@ typedef struct _WIMAX_API_RF_SWITCHES_STATUS
 	} WIMAX_API_INTERFACE_INFO, *WIMAX_API_INTERFACE_INFO_P;
 #endif
 
+#pragma pack( pop )
+
 /// The statuses provided by this API can generally be mapped to movements along the SDK common state machine. The indications may provide further detailed information using the API�s arguments when relevant.
 /// \param[in] pDeviceId - Pointer to Device Identifier passed on open of device.
 /// \param[in] deviceStatus - The device Status value
diff --git a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_linux_types.h b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_linux_types.h
index 99b01f6..364c511 100644
--- a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_linux_types.h
+++ b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_linux_types.h
@@ -105,7 +105,7 @@ typedef unsigned long long UINT64;
 
 typedef unsigned int DWORD;
 
-typedef int INT_PTR;
+typedef int * INT_PTR;
 
 
 typedef char INT8;
diff --git a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_trace.c b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_trace.c
index 26e2a91..6ced165 100644
--- a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_trace.c
+++ b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_trace.c
@@ -173,7 +173,7 @@ void osallog(char *ch, int flush)
 		}
 	}
 	// write into file
-	fprintf(log, ch);
+	fprintf(log, "%s", ch);
 	// put extra to log next line to build
 	//fprintf(log,"\n");
 	if (flush == 1)
diff --git a/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_scan_op.c b/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_scan_op.c
index 2f438ab..7d7b0a5 100644
--- a/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_scan_op.c
+++ b/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_scan_op.c
@@ -468,7 +468,7 @@ int wimaxcu_get_network_list(WIMAX_API_DEVICE_ID_P p_device_id, CMD_ARGS scan_mo
 
 	} else if (scan_mode == CMD_SCAN_ARG_WIDE) {
 		// Get User Connect Mode
-		int userConnectMode;
+		WIMAX_API_CONNECTION_MODE userConnectMode;
 		wmxStatus = GetConnectionMode(p_device_id, &userConnectMode);
 		if (WIMAX_API_RET_SUCCESS != wmxStatus) {
 			PrintWmxStatus(wmxStatus);
@@ -904,4 +904,4 @@ int wimaxcu_stop_scan(WIMAX_API_DEVICE_ID_P p_device_id)
 		}
 			
 	}
-}
\ No newline at end of file
+}
-- 
1.6.6.1

>From 3bf826a20047b1d5071369ec0b8bdbc4efe30a22 Mon Sep 17 00:00:00 2001
From: Inaky Perez-Gonzalez <[email protected]>
Date: Tue, 5 Oct 2010 15:55:33 -0700
Subject: [PATCH 3/9] Fix pthread_mutex_unlock duplicate call in OSALTrace()

Fix pthread_mutex_unlock duplicate call in OSALTrace(), i.e. second
pthread_mutex_unlock() called against already unlocked mutex. glibc
tolerant to this inconsistency, but uClibc not.

Signed-off-by: Leonid Lisovskiy <[email protected]>
Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
---
 .../Linux/OSAL/Primitives/wimax_osal_trace.c       |   24 ++++++++-----------
 1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_trace.c b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_trace.c
index 6ced165..cbdd24f 100644
--- a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_trace.c
+++ b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_trace.c
@@ -53,7 +53,7 @@ int g_iloglevel = 2;
 int g_iloglevelreadflag = 0;
 
 // to avoid multi tread environment to log the thread
-pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 /*
  *
@@ -97,23 +97,19 @@ pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 void OSALTrace(char *szformat, ...)
 {
-	time_t currTime;
-        struct tm timeinfo;
-
 	// log type should be 0 to 4 default value will assign info
 	if (g_OsalTraceInfo.loglevel > g_iloglevel
 	    || g_OsalTraceInfo.loglevel < 0) {
-		// release the lock if get any errors
-		pthread_mutex_unlock(&g_mutex);
-		return;
+		goto out;
 	}
 	// if argument path  null....
 	if (szformat == NULL) {
-		// release the lock if get any errors
-		pthread_mutex_unlock(&g_mutex);
-		return;
+		goto out;
 	}
 
+	time_t currTime;
+        struct tm timeinfo;
+
 	va_list args;
 	static char Buffer[EGIHT_X_BUFFER] = { 0 };
 	static char outBuffer[EGIHT_X_BUFFER] = { 0 };
@@ -137,6 +133,10 @@ void OSALTrace(char *szformat, ...)
 	sprintf(outBuffer, "%s\n", Buffer);
 
 	osallog(outBuffer, 1);
+
+out:
+	// release the lock once done
+	pthread_mutex_unlock(&g_mutex);
 }
 
 /*
@@ -167,8 +167,6 @@ void osallog(char *ch, int flush)
             log = fopen(OSALTRACE_FILE, "wt");
 		if (!log) {
 			syslog(LOG_ERR, "wimaxd[osal] - can not open logfile (%s) for writing.\n", OSALTRACE_FILE);
-			// release the lock if get any errors
-			pthread_mutex_unlock(&g_mutex);
 			return;	// bail out if we can't log
 		}
 	}
@@ -182,8 +180,6 @@ void osallog(char *ch, int flush)
 #ifdef OSAL_CONSOLE
 	printf(ch);
 #endif
-	// release the lock once done with log
-	pthread_mutex_unlock(&g_mutex);
 
 	// fclose(log);
 }
-- 
1.6.6.1

>From 763bfcc760083c2f2731f97578e053a945d5e19d Mon Sep 17 00:00:00 2001
From: Inaky Perez-Gonzalez <[email protected]>
Date: Tue, 5 Oct 2010 15:58:06 -0700
Subject: [PATCH 4/9] Fix a lot of warnings about undefined malloc/free

Signed-off-by: Leonid Lisovskiy <[email protected]>
Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
---
 .../OSAgnostic/Common/CommonServices/Messenger.c   |    1 +
 .../OSAgnostic/Common/CommonServices/Queue.c       |    1 +
 .../Common/CommonServices/VersionHandshake.c       |    1 +
 .../OSAgnostic/Common/L5Common/EventSubscribers.c  |    1 +
 .../Common/L5Common/IndicatorsSubscribers.c        |    1 +
 .../Common/WrappersCommon/WrappersUtils.c          |    1 +
 .../OSAgnostic/Product/AppSrvInfra/L4MsgProxy.c    |    1 +
 .../OSAgnostic/Product/AppSrvInfra/L5Dispatcher.c  |    1 +
 8 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/InfraStack/OSAgnostic/Common/CommonServices/Messenger.c b/InfraStack/OSAgnostic/Common/CommonServices/Messenger.c
index 54c920e..20168bb 100644
--- a/InfraStack/OSAgnostic/Common/CommonServices/Messenger.c
+++ b/InfraStack/OSAgnostic/Common/CommonServices/Messenger.c
@@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 ***************************************************************************/
 #include <unistd.h>
+#include <stdlib.h>
 #include "wimax_osal_primitives.h"
 
 #include "Messenger.h"
diff --git a/InfraStack/OSAgnostic/Common/CommonServices/Queue.c b/InfraStack/OSAgnostic/Common/CommonServices/Queue.c
index b5f27f1..5323001 100644
--- a/InfraStack/OSAgnostic/Common/CommonServices/Queue.c
+++ b/InfraStack/OSAgnostic/Common/CommonServices/Queue.c
@@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 ***************************************************************************/
 #include <unistd.h>
+#include <stdlib.h>
 #include "wimax_osal_primitives.h"
 #include "Queue.h"
 #include "CommonServices.h"
diff --git a/InfraStack/OSAgnostic/Common/CommonServices/VersionHandshake.c b/InfraStack/OSAgnostic/Common/CommonServices/VersionHandshake.c
index bc53cf9..1c49cea 100644
--- a/InfraStack/OSAgnostic/Common/CommonServices/VersionHandshake.c
+++ b/InfraStack/OSAgnostic/Common/CommonServices/VersionHandshake.c
@@ -30,6 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
 ***************************************************************************/
 // Project
 #include <unistd.h>
+#include <stdlib.h>
 #include "PipeHandlerInternal.h"
 #include "VersionUtils.h"
 #include "L5OpCodes.h"	
diff --git a/InfraStack/OSAgnostic/Common/L5Common/EventSubscribers.c b/InfraStack/OSAgnostic/Common/L5Common/EventSubscribers.c
index 9262520..d6fa160 100644
--- a/InfraStack/OSAgnostic/Common/L5Common/EventSubscribers.c
+++ b/InfraStack/OSAgnostic/Common/L5Common/EventSubscribers.c
@@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 ***************************************************************************/
 #include <unistd.h>
+#include <stdlib.h>
 #include "EventSubscribers.h"
 
 #include "CommonServices.h"
diff --git a/InfraStack/OSAgnostic/Common/L5Common/IndicatorsSubscribers.c b/InfraStack/OSAgnostic/Common/L5Common/IndicatorsSubscribers.c
index 53559af..97e7b8e 100644
--- a/InfraStack/OSAgnostic/Common/L5Common/IndicatorsSubscribers.c
+++ b/InfraStack/OSAgnostic/Common/L5Common/IndicatorsSubscribers.c
@@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 ***************************************************************************/
 #include <unistd.h>
+#include <stdlib.h>
 #include "IndicatorsSubscribers.h"
 
 #include "CommonServices.h"
diff --git a/InfraStack/OSAgnostic/Common/WrappersCommon/WrappersUtils.c b/InfraStack/OSAgnostic/Common/WrappersCommon/WrappersUtils.c
index c0a40e3..6df4dcd 100644
--- a/InfraStack/OSAgnostic/Common/WrappersCommon/WrappersUtils.c
+++ b/InfraStack/OSAgnostic/Common/WrappersCommon/WrappersUtils.c
@@ -30,6 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
 ***************************************************************************/
 #include "wimax_osal_primitives.h"
 #include <unistd.h>
+#include <stdlib.h>
 #include "Services_Ctrl.h"
 #include "WrappersUtils.h"
 #include "WrappersCommon.h"
diff --git a/InfraStack/OSAgnostic/Product/AppSrvInfra/L4MsgProxy.c b/InfraStack/OSAgnostic/Product/AppSrvInfra/L4MsgProxy.c
index 2ca1915..cfd965c 100644
--- a/InfraStack/OSAgnostic/Product/AppSrvInfra/L4MsgProxy.c
+++ b/InfraStack/OSAgnostic/Product/AppSrvInfra/L4MsgProxy.c
@@ -30,6 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
 ***************************************************************************/
 //#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union
 #include <unistd.h>
+#include <stdlib.h>
 
 #include "Services_Ctrl.h"
 #include "L5Common.h"
diff --git a/InfraStack/OSAgnostic/Product/AppSrvInfra/L5Dispatcher.c b/InfraStack/OSAgnostic/Product/AppSrvInfra/L5Dispatcher.c
index acf6e58..8ce4c9a 100644
--- a/InfraStack/OSAgnostic/Product/AppSrvInfra/L5Dispatcher.c
+++ b/InfraStack/OSAgnostic/Product/AppSrvInfra/L5Dispatcher.c
@@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
 // OSAL
 #include "wimax_osal_primitives.h"
 #include <unistd.h>
+#include <stdlib.h>
 
 // Project
 #include "L5Dispatcher.h"
-- 
1.6.6.1

>From f901c5c17b15ae979cca5a3da7247404ffc8995e Mon Sep 17 00:00:00 2001
From: Alexander Gordeev <[email protected]>
Date: Wed, 6 Oct 2010 14:53:22 +0400
Subject: [PATCH 5/9] remove duplicate typedef for u8

This typedef is already in eap_peer/util/common.h, no need to declare
it one more time.

Signed-off-by: Alexander Gordeev <[email protected]>
---
 .../WiMax/Wrappers/Supplicant/wmxSDK_Sup_Impl.c    |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/InfraStack/OSAgnostic/WiMax/Wrappers/Supplicant/wmxSDK_Sup_Impl.c b/InfraStack/OSAgnostic/WiMax/Wrappers/Supplicant/wmxSDK_Sup_Impl.c
index a33680c..8f55917 100644
--- a/InfraStack/OSAgnostic/WiMax/Wrappers/Supplicant/wmxSDK_Sup_Impl.c
+++ b/InfraStack/OSAgnostic/WiMax/Wrappers/Supplicant/wmxSDK_Sup_Impl.c
@@ -47,7 +47,6 @@
 #include "NDnSAgent.h"
 
 
-typedef unsigned char u8;
 #define TLS_IMPLEMENTATION Arm1
 
 /* the supplicant calls the tls_ methods, so we make sure the declarations match to what it expects. */ 
-- 
1.6.6.1

>From c23d28bd5e8adf7186bc393a50ec784fc3b2528c Mon Sep 17 00:00:00 2001
From: Inaky Perez-Gonzalez <[email protected]>
Date: Tue, 23 Nov 2010 15:52:18 -0800
Subject: [PATCH 6/9] wimaxcu: fix array size

Array size declaration for 'cmd_args' was of the wrong size, thus
throwing a warning.

Reported-by: Andrey Kononov <[email protected]>
Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
---
 .../OSDependent/Linux/wimaxcu/wimaxcu_defs.h       |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_defs.h b/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_defs.h
index aa6df57..534848b 100644
--- a/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_defs.h
+++ b/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_defs.h
@@ -210,7 +210,7 @@ struct cu_cmd_specs
 
 	char *default_arg;	// eg. scan [preferred]
 
-	cmd_arg_map cmd_args[6];	// Maximum number of arguments any of cmds can accept (un-used ones will be either NULL or empty strings)
+	cmd_arg_map cmd_args[7];	// Maximum number of arguments any of cmds can accept (un-used ones will be either NULL or empty strings)
 
 	size_3_string_array scan_connect_mode_options[2];
 	char *cmd_mode_options[2];
-- 
1.6.6.1

>From fc06cfd00b80e54fb178ffae51050675f42501b9 Mon Sep 17 00:00:00 2001
From: Inaky Perez-Gonzalez <[email protected]>
Date: Tue, 23 Nov 2010 15:55:37 -0800
Subject: [PATCH 7/9] supplicant: fix invocation of eap_peer_sm_init()

Fourth argument was being pass with wrong typing (and luckily it is
not really being used, so it wasn't pulling garbage). Fixed by
creating a null 'struct eap_config' that is passed to
eap_peer_sm_init().

Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
---
 .../Agents/Supplicant/Source/SupplicantAgent.c     |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c b/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c
index 3948615..742c57b 100644
--- a/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c
+++ b/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c
@@ -466,6 +466,12 @@ wmx_Status_t InitSupplicantLibrary(VOID)
 	char answer[MAX_ANSWER_SIZE];
 	void *ft;
 #endif
+	struct eap_config eap_config_null = {
+		.opensc_engine_path = NULL,
+		.pkcs11_engine_path = NULL,
+		.pkcs11_module_path = NULL,
+		.wps = NULL,
+	};
 
 	TRACE(TR_MOD_SUPPLICANT_AGENT, TR_SEV_INFO,"Supplicant: InitSupplicantLibrary (IN)");
 	// init DS status variable
@@ -496,7 +502,7 @@ wmx_Status_t InitSupplicantLibrary(VOID)
 	eap_cb.notify_pending = peer_notify_pending;
 
 	eap_peer_register_methods();
-	eap_ctx.eap = eap_peer_sm_init(&eap_ctx, &eap_cb, &eap_ctx, &eap_ctx.eap_config);
+	eap_ctx.eap = eap_peer_sm_init(&eap_ctx, &eap_cb, &eap_ctx, &eap_config_null);
 	if (eap_ctx.eap == NULL)
 		return WMX_ST_FAIL;
 
-- 
1.6.6.1

>From 339c280e7dea7f0a590b9637bdacaae791c25b06 Mon Sep 17 00:00:00 2001
From: Inaky Perez-Gonzalez <[email protected]>
Date: Tue, 23 Nov 2010 15:56:37 -0800
Subject: [PATCH 8/9] supplicant: Fix eap_methods array setup and declaration

The eap_methods array has to be EAP_VENDOR_IETF:EAP_TYPE_NONE
terminated, thus it has to be one slot bigger than 2. As well, the
proper pointer wasn't set to eap_ctx.eap_config.eap_methods. All
fixed.

Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
---
 .../Agents/Supplicant/Source/SupplicantAgent.c     |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c b/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c
index 742c57b..7cb5196 100644
--- a/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c
+++ b/InfraStack/OSAgnostic/WiMax/Agents/Supplicant/Source/SupplicantAgent.c
@@ -174,7 +174,7 @@ SupplicantData g_SuppData1; //[findme][amirs] buffer for 64bit
 
 SupplicantConfig g_SuppConfig1; //[findme][amirs] buffer for 64bit
 #endif
-static struct eap_method_type eap_methods[2];
+static struct eap_method_type eap_methods[3];
 SupplicantConfig g_SuppConfig;
 
 OSAL_dynlib_t	g_DSlib = NULL;
@@ -480,6 +480,8 @@ wmx_Status_t InitSupplicantLibrary(VOID)
 
 #if defined(WPA_OPEN_SOURCE)
 	memset(&eap_methods, 0, sizeof(eap_methods));
+	eap_methods[2].vendor = EAP_VENDOR_IETF;
+	eap_methods[2].method = EAP_TYPE_NONE;
 	memset(&eap_ctx, 0, sizeof(eap_ctx));
 
 	eap_ctx.eap_config.identity = (u8 *) os_strdup("user");
@@ -488,7 +490,7 @@ wmx_Status_t InitSupplicantLibrary(VOID)
 	eap_ctx.eap_config.password_len = 8;
 	eap_ctx.eap_config.ca_cert = (u8 *) os_strdup("ca.pem");
 	eap_ctx.eap_config.fragment_size = TLS_MAX_SIZE;
-	eap_ctx.eap_config.eap_methods = &eap_methods;
+	eap_ctx.eap_config.eap_methods = eap_methods;
 
 	memset(&eap_cb, 0, sizeof(eap_cb));
 	eap_cb.get_config = peer_get_config;
-- 
1.6.6.1

>From cd0435d6ec9a721188900a811f61d3ea19b58932 Mon Sep 17 00:00:00 2001
From: Inaky Perez-Gonzalez <[email protected]>
Date: Tue, 23 Nov 2010 16:17:56 -0800
Subject: [PATCH 9/9] daemon: don't mask SEGV, just crash and dump core

Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
---
 .../Skeletons/AppSrv/GenericConsole.c              |    5 +--
 .../Skeletons/AppSrv/GenericDaemon.c               |    1 -
 InfraStack/OSDependent/Linux/wimaxcu/wimaxcu.c     |   17 +--------------
 .../OSDependent/Linux/wimaxcu/wimaxcu_main.c       |   22 --------------------
 4 files changed, 3 insertions(+), 42 deletions(-)

diff --git a/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericConsole.c b/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericConsole.c
index 63e8e90..b07b8e0 100644
--- a/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericConsole.c
+++ b/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericConsole.c
@@ -104,7 +104,7 @@ void print_callstack_to_file(int sig, siginfo_t *info, void *secret)
 	// printf("Came here %d\n", __LINE__);
 	char command[MAX_STR_LEN + MAX_FILENAME_LEN];
 	/* Do something useful with siginfo_t */
-  	if ((sig != SIGSEGV) && (sig != SIGINT)) {
+  	if (sig != SIGINT) {
 		syslog(LOG_ERR,"Got signal %d#92", sig);
 		// printf("Came here %d\n", __LINE__);
 		return;
@@ -167,7 +167,7 @@ void console_signal_handler(int sig, siginfo_t *info, void *secret)
 	// printf("First ctrl +c recieived \n");
 	no_of_signals++;
 	
-	if ((sig == SIGSEGV) && (sig == SIGINT)) {
+	if (sig == SIGINT) {
 		syslog(LOG_ERR,"Got signal %d", sig);
 		print_callstack_to_file(sig, info, secret);
 	}
@@ -201,7 +201,6 @@ int main_console(void)
   	sigemptyset (&sa.sa_mask);
   	sa.sa_flags = SA_RESTART | SA_SIGINFO;
 	
-  	sigaction(SIGSEGV, &sa, NULL);
   	sigaction(SIGUSR1, &sa, NULL);   // install our handler
 	sigaction(SIGINT, &sa, NULL);
   	sigaction(SIGTERM, &sa, NULL);   // install our handler
diff --git a/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericDaemon.c b/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericDaemon.c
index bdf6e22..0637790 100644
--- a/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericDaemon.c
+++ b/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericDaemon.c
@@ -254,7 +254,6 @@ int main_daemon(void)
 	sigemptyset (&sa.sa_mask);
 	sa.sa_flags = SA_RESTART | SA_SIGINFO;
 
-	sigaction(SIGSEGV, &sa, NULL);
 	sigaction(SIGUSR1, &sa, NULL);  
 
 	signal(SIGINT, stop_signal_handler);
diff --git a/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu.c b/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu.c
index ad187c4..dfa94db 100644
--- a/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu.c
+++ b/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu.c
@@ -3055,7 +3055,7 @@ void print_callstack_to_file(int sig, siginfo_t *info,
 //	 printf("Came here %d\n", __LINE__);
 	char command[MAX_STR_LEN + MAX_FILENAME_LEN];
 	 /* Do something useful with siginfo_t */
-  	if ((sig != SIGSEGV) && (sig != SIGINT)) {
+  	if (sig != SIGINT) {
 		syslog(LOG_ERR,"Got signal %d#92", sig);
 //		 printf("Came here %d\n", __LINE__);
 		return;
@@ -3136,20 +3136,6 @@ void wimaxcu_signal_handler(int sig, siginfo_t *info,
 	printf("Please check /var/log/wimax folder \n");
 
  	print_callstack_to_file(sig, info, secret);
-	
-	
-	// kalyan
-	// If wimaxcu recieved segmentation fault 
-	// Stack might be corrupted
-	// So it is good idea to just exit
-	// This may recives some system resources hanging
-
-	if(sig == SIGSEGV) {
-		printf("Exit \n");
-		exit(0);
-	}
-		
-
 	wimaxcu_stop_signal_handler(sig);
 	
 }
@@ -3191,7 +3177,6 @@ int main(int argc, char *argv[])
     	sigemptyset (&sa.sa_mask);
     	sa.sa_flags = SA_RESTART | SA_SIGINFO;
 
-    	sigaction(SIGSEGV, &sa, NULL);
     	sigaction(SIGUSR1, &sa, NULL);  
 
     	signal(SIGINT, wimaxcu_stop_signal_handler);
diff --git a/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_main.c b/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_main.c
index faf0f36..d14a2ae 100644
--- a/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_main.c
+++ b/InfraStack/OSDependent/Linux/wimaxcu/wimaxcu_main.c
@@ -330,27 +330,6 @@ void wimaxcu_stop_signal_handler(int sig)
 	
 }
 
-
-void handler(int sig)
-{
-	void *array[10];
-	size_t size;
-	size_t i;
-	char **strings;
-	size = backtrace(array,10);
-	fprintf(stderr,"Error: signal %d: \n",sig);
-	strings = backtrace_symbols (array, size);
-
-	printf ("Obtained %zd stack frames.\n", size);
-     
-       for (i = 0; i < size; i++)
-          printf ("%s\n", strings[i]);
-     
-       free (strings);
-  
-//	backtrace_symbols_fd(array,size,2);
-	exit(1);
-}
 /*
  * Function: main
  * Description: main function calls functions for intialization and 
@@ -402,7 +381,6 @@ int main(int argc, char *argv[])
 	// sleep(1);
 	// Execute the command
 	ret = cmd_handler(&gbl_device_id, &out_cmd);
-	signal(SIGSEGV,handler);
 	// Finalize the SDK
 	wimaxcu_finalize(&gbl_device_id);
 
-- 
1.6.6.1

_______________________________________________
wimax mailing list
[email protected]
http://lists.linuxwimax.org/listinfo/wimax

Reply via email to