Date: Mon, 08 Mar 1999 09:31:06 -0800 From: Mike Smith <mike@smith.net.au> To: CyberPsychotic <fygrave@tigerteam.net> Cc: freebsd-hackers@freebsd.org Subject: Re: SOCK_RAW on BSD Message-ID: <199903081731.JAA06930@dingo.cdrom.com> In-Reply-To: Your message of "Mon, 08 Mar 1999 18:52:01 %2B0500." <Pine.GSO.4.05.9903081847190.9775-100000@kyrnet.kg>
index | next in thread | previous in thread | raw e-mail
> Hello people,
> here I've been playing with RAW sockets on FreeBSD and got stumbled abit.
> Any ideas why code bellow does't seem to get anything passed by kernel.
> (I read manual pages and /sys/netinet/raw_ip.c but neither place mention any
> incompatibilies with other systems. This piece would work fine on Linux
> platforms).
There is no mention ofincompatabilities with other systems because
there are none; the BSD stack is the reference implementation with
which all other implementations are compatible or incompatible.
In this case, you are being tripped up by the bogus way that Linux does
packet capture. To achieve your goals in a portable fashion, you
should use a portable packet capture library like libpcap.
As for using code from a Linux utility like tcplog - now you know why
the rest of the world laughs at Linux - when there's a way to do it
hard or wrong or just plain weird, they'll do it.
>
> #include <stdio.h>
> #include <netdb.h>
> #include <sys/socket.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
>
>
>
>
> void main(void) {
>
> char buf[10000];
> int s,rdln;
> s=socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
> while(1)
> {
> rdln=read(s, buf, 9999);
> printf("got pack len: %i\n",rdln);
> }
> }
>
>
>
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
>
--
\\ Sometimes you're ahead, \\ Mike Smith
\\ sometimes you're behind. \\ mike@smith.net.au
\\ The race is long, and in the \\ msmith@freebsd.org
\\ end it's only with yourself. \\ msmith@cdrom.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903081731.JAA06930>
