[OpenAFS-devel] AF_INET byte order

Mike Polek mike@pictage.com
Mon, 12 Mar 2007 18:48:22 -0700


In case anyone cares, we use afsmonitor here to monitor our servers.
I wrote a nifty little script that runs afsmonitor in a SCREEN
and is constantly reporting on the state of the afs server
so that we can track it with Nagios. It works great.
We've had the utility running continuously on all of our
fileservers since about 2002 with no major problems.

I originally wrote the utility because we had challenges
back in the old days where one fileserver would
stop responding, and suddenly the whole cell would lock up.
We used this little monitor to firewall off the server port
on the machine to make it look like the server disappeared
instead of having the clients think it's there and lock up.
I don't think it's needed any more... but we keep it as a
safety precaution.

Cheers,
Mike

Jeffrey Altman wrote:
> Douglas E. Engert wrote:
> 
>>Well on Solaris 10 (Sparc), AF_INET is defines as 2 and in some of
>>the header files where they use  ...->sin_family = AF_INET;
>>
>>But in /usr/include/portocols/routed.h they do:
>>#define RIP_AF_INET htons(AF_INET)
>>to use in a RIPv2  struct netinfo { ...
>>from RFC 2453.
>>
>>   "Unless otherwise specified, fields contain binary integers,
>>   in network byte order, with the most-significant octet
>>   first (big-endian)"
>>
>>So on Solaris at least it looks like you store it in the
>>local format. If you want to send it over the netwotk, then
>>in network byte order.
> 
> 
> That would be true for any data structure that you are going to send
> across a network to a peer because you don't know what architecture
> the peer is.  That is why we agree upon a network byte order.
> 
> afsmonitor is not sending this data structure across the network.
> Its using the values locally for producing sockets that can be used
> to communicate with the servers.  htons() does not apply in this case.
> 
> My guess is that no one has ever used afsmonitor on Linux on x86
> successfully.
> 
> Jeffrey Altman
>