Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Aug 1999 18:58:11 -0400 (EDT)
From:      Bosko Milekic <bmilekic@dsuper.net>
To:        lists@idle.za.org
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Raw Packet code containing security bits
Message-ID:  <Pine.OSF.4.05.9908161829490.6210-100000@oracle.dsuper.net>

next in thread | raw e-mail | index | archive | help

Hello Andrew,

        When filling your struct ip *iphead, try replacing:

        iphead->ip_len = htons(length);

        with:

        iphead->ip_len = length;

	or, for portability reasons, you may want to do something like:

#ifdef LINUX || OpenBSD21
#define BO(x) htons(x)
#else
#define BO(x) (x)
#endif

And, when filling the ip packet length, do a: iphead->ip_len = BO(length);

This is a byte-order issue that has often caused confusion for Linux
people...

/usr/include/machine/endian.h provides some insight...

/Bosko.

> I wonder if anyone here could perhaps of be assistance, Im currently
> playing with implementing certain things in trusted bsd to do with ip
> security classes and how the system responds to security bits, and
> implementing certain things the stack etc.  However my first piece of
> test
> code playing with raw packets to test how things respond to packets with
> the security bit set, doesnt seem to want to work.  This code compiles
> fine, however when I try and run it it says invalid argument when it
> tries
> to send the packet.  If anyone could give me any insight as to why this
> code doesnt run properly, it would be much appreciated, and would
> certainly help me in my efforts to continue expanding trusted bsd.
>
> Ive included the code below...
>
> Thanks
> Andrew

[snipped]


<----- - - . .
  Bosko Milekic   <bmilekic@dsuper.net>   http://www.dsuper.net/~bmilekic/
  Network Operations - Delphi SuperNet, an Internet Direct company
  +1.514.281.7500 (vox) / +1.514.281.6599 (fax) / http://www.dsuper.net/
                                                            . . - - -----> 



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.4.05.9908161829490.6210-100000>