[OpenAFS-devel] AF_INET byte order

Kristen J. Webb kwebb@teradactyl.com
Wed, 07 Mar 2007 11:28:25 -0700


This is a cryptographically signed message in MIME format.

--------------ms060805080006070202050105
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Jim,

I just got your second message while I was working on this so here
is more gory details.

Kris

Our build environment is complex and does some of its own determining
of endian.  To convince myself that I am not mad, I found a very
simple client/server example at:

http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzab6/rzab6xconoserver.htm

After a quick cut and past and a very simple makefile:

all: client server

client: client.c
         cc client.c -o client


server: server.c
         cc server.c -o server

I was able to build with a few changes

#define NETDB_MAX_HOST_NAME_LENGTH 256

void main -> int main

And run this sample on i386/Linux.  When I change the
lines for sin_family for htons the code fails
with the same error I mentioned earlier (EAFNOSUPPORT).

Running a fem more test I discovered that no matter
what value I put in for sin_family on the server (bind) it
worked.  The error was on the client connect call,
where it definitely was no happy when htons(AF_INET)
was used.

-- 
Mr. Kristen J. Webb
Teradactyl LLC.

PHONE: 1-505-242-1091
EMAIL: kwebb@teradactyl.com
VISIT: http://www.teradactyl.com

  	Home of the

  True incremental Backup System

--------------ms060805080006070202050105
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIINGjCC
A2IwggLLoAMCAQICEAvaCxfBP4mOqwl0erTOLjMwDQYJKoZIhvcNAQECBQAwXzELMAkGA1UE
BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAxIFB1Ymxp
YyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk4MDUxMjAwMDAwMFoXDTA4
MDUxMjIzNTk1OVowgcwxFzAVBgNVB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