Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Mar 1996 21:05:49 +4100 (MST)
From:      Danny Dulai <nirva@blookitty.ishiboo.com>
To:        jkh@freebsd.org
Subject:   RAW socket crash
Message-ID:  <199604010405.VAA00477@blookitty.ishiboo.com>
Resent-Message-ID: <19953.828298464@time.cdrom.com>

next in thread | raw e-mail | index | archive | help
ok, im having a lot of problems with raw sockets... they
got so bad that if i run my program, it causes a kernel
panic.

im trying to send a UDP packet, but i need to create my
own packet.  So i crate a socket using this:

socket(AF_INET, SOCK_RAW, IPPROTO_RAW)

and then i create my own ip header and udp header and send them off.

but, if i capture the packet on the way out (tcpdump -x),
i notice that it has an extra IP header tacked on the front
of it... and that headers protocol field is set to 0xff,
which is IPPROTO_RAW. this breaks everything, since other
OSs (freebsd too i guess, never tried) dont know what to
do with the IPPROTO_RAW protocol.

 icmp: flatkitty.ishiboo.com protocol 0 unreachable

that is what tcpdump returned me, flatkitty.ishiboo.com
is a NT machine, altho i got the same thing back with
linux, solaris, irix, aix, and hp-ux.

i checked docs, i checked irc, i checked mailing
list archives, and found recommendation to look at
traceroute. which i did, and found the mysteriously
undocumented IP_HDRINCL setsockopt() option.  I looked
into this in <netinet/in.h> and found this:

#define	IP_HDRINCL		2    /* int; header is included with data */

the comment made me guess that if i setsockopt() it to 0,
it would stop prepending the packet with an IP header.
well, it didnt work... and i got to the point with it that
it seemed like the only thing i could do, so i started
guessing stuff... bad idea.

I just randomly set IP_HDRINCL to 1 instead of 0, and
every time i do it, i get a kernel panic:

panic: m_copym

and then it reboots in 15 seconds or if i hit a key twice.

i have the code that does it and the binary also... i
tried it 3 times, and it rebooted every one of the three
times... i change the 1 back to 0 and it didnt reboot,
it just didnt work like before :(

my OS is FreeBSD 2.1.0-RELEASE installed from the walnut creek cd.

the machine is:

Gigabyte 586/atpe motherboard
Pentium 90mhz overclocked to 100mhz
32 megs ram
Buslogic 946C SCSI 2 pci SCSI card
generic NE2000 Ethernet card, BNC

drives, video and monitor irrelevant

if you can help with the panic problem or the extra header
problem, please do so as soon as you can.

also, if this is fixed in -current, let me know...

also, would you mind explaining -current and -stable and
-RELEASE? i think i have an understanding of the kernel,
but since freebsd also includes more than just the kernel,
would i need to upgrade everything just to use the new kernel?

                                     --Nirva



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604010405.VAA00477>