[ap-utils] Patch to make ap-config able to set ESSID on powerpc linux

Daniel E. Eisenbud eisenbud at cbio.mskcc.org
Mon Feb 23 05:54:23 EET 2004


There's an endianness issue in wlan.c that makes ap-config always set
the ESSID to an empty string on powerpc linux.  (This is with a Netgear
ME102, but that's irrelevant.)  The SNMP packet setting the ESSID
specifies that the length of the string is 0, and also sends the
correct string.  I used snmpset to send the same packet with the correct
length, and it worked.

A quick inspection of wlan.c revealed that this was the result of
casting an int pointer to a char pointer.  The attached patch fixes the
problem, but I haven't checked that there aren't other such problems in
the source.  I presume that this is an issue MacOS X and some other
platforms as well.

-Daniel Eisenbud

-- 
Daniel E. Eisenbud
eisenbud at cbio.mskcc.org
Computational Biology Center
Memorial Sloan-Kettering Cancer Center
-------------- next part --------------
--- wlan.c.orig	2004-02-23 03:39:15.323467707 -0500
+++ wlan.c	2004-02-23 03:49:06.974639514 -0500
@@ -140,6 +140,7 @@ void atmel_wireless()
     _("Short"), _("Long")};
     short __rates[4] = { 2, 4, 11, 22 };
     int i, c = 0;
+    char ch;
     unsigned int ap_regdomain;
 
     if (ap_type == ATMEL12350) {
@@ -508,10 +509,10 @@ void atmel_wireless()
 		i++;
 	    }
 	    if (m_essid) {
-		c = strlen(domain);
+		c = ch = strlen(domain);
 		varbinds[i].oid = operESSIDLength;
 		varbinds[i].len_oid = sizeof(operESSIDLength);
-		varbinds[i].value = (char *)&c;
+		varbinds[i].value = (char *)&ch;
 		varbinds[i].len_val = 1;
 		varbinds[i].type = INT_VALUE;
 		i++;


More information about the ap-utils mailing list