Re: [uCsimm] snmpd from coldfire

From: Tom Walsh (
Date: Tue May 22 2001 - 13:27:34 EDT

Joaquin Garay wrote:
> you're right about the kernel. i'm working too in a sniffer for the
> ucsimm and ported it from a sniffer for linux. doing so, i had to remove
> all 'ntohs' calls because the byteorder in the ucsimm is the same as in
> the ethernet (don't know if little or bi endian but it works fine). what
> i don't know is where is the call.

It is not a "call" it is an inline macro that is defined in
linux/include/asm/byteorder.h. As per the RFC, all information within
the IP header is in Big-Endian ordering, otherwise known as network
ordering. The Motorola processors are Big-Endian, so, the htonX() and
ntohX() functions are essentially NOPs as there is nothing that really
needs to be done, other than type casting / coercion.

You *can* remove the htonX() & ntohX() functions, as a last resort, but
take care to ensure that the correct typecasting is done on the
variable. gcc can do some unexpected things if typecasting is not
carefully observed. Actually, it is the code optimizer in gcc that will
give you headaches.



Tom Walsh - WN3L - Embedded Systems Consultant
'', ''
"Windows? No thanks, I have work to do..."
This message resent by the list server

This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:43 EST