[Snort-devel] Re: [Snort-users] Multiple IP address matching

James Hoagland hoagland at ...60...
Fri Sep 22 12:00:41 EDT 2000


At 10:02 PM +0700 9/22/00, Fyodor wrote:
>Thanks for the code snapshot, I think we will reuse parts of it for our
>implementation :), I just have a little comment regarding following piece:
>
>~ :
>~ :	    /* since PC's store things the "wrong" way, shuffle the bytes into
>~ :	       the right order */
>~ :#ifndef WORDS_BIGENDIAN
>~ :	    cur->netmask = htonl(cur->netmask);
>~ :#endif
>~ :
>
>As far as I know on big-endian machines hton*/htoh* functions do nothing
>(since bigendian bitstream matches network bitstream order) so you can
>remove `#ifndef/#endif' statement here.
>
>from /usr/include/sys/byteorder.h on solaris/sparc 7 machine, I have
>around:
>
>#if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(lint)
>/* big-endian */
>#define ntohl(x)        (x)
>#define ntohs(x)        (x)
>#define htonl(x)        (x)
>#define htons(x)        (x)
>#elif !defined(ntohl) /* little-endian */
>..
>#endif
>
>
>Are things any different anywhere else?

Actually that part of the code is directly from GenHomenet().

Actually, it is an #ifndef, not an #ifdef, so I think that code only 
is run on little endian machines, where it is needed.

Regards,

   Jim
-- 
|*   Jim Hoagland, Associate Researcher, Silicon Defense    *|
|*               hoagland at ...60...                *|
|*  Voice: (707) 445-4355 x13          Fax: (707) 445-4222  *|



More information about the Snort-devel mailing list