Date: Mon, 8 Mar 1999 11:59:24 -0500 (EST) From: Alfred Perlstein <bright@cygnus.rush.net> To: CyberPsychotic <fygrave@tigerteam.net> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: SOCK_RAW on BSD Message-ID: <Pine.BSF.3.96.990308115737.1330F-100000@cygnus.rush.net> In-Reply-To: <Pine.GSO.4.05.9903081847190.9775-100000@kyrnet.kg>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 8 Mar 1999, CyberPsychotic wrote: > 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). If you are trying to capture packets you should look at 'bpf', if you are trying to capture packets in a portable fashion, look at the library 'pcap' -Alfred man bpf man pcap > > > #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 > 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.BSF.3.96.990308115737.1330F-100000>