From owner-freebsd-hackers Mon Mar 8 8:57:36 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from cygnus.rush.net (cygnus.rush.net [209.45.245.133]) by hub.freebsd.org (Postfix) with ESMTP id E327E14F04 for ; Mon, 8 Mar 1999 08:57:27 -0800 (PST) (envelope-from bright@cygnus.rush.net) Received: from localhost (bright@localhost) by cygnus.rush.net (8.9.3/8.9.3) with SMTP id LAA13047; Mon, 8 Mar 1999 11:59:26 -0500 (EST) Date: Mon, 8 Mar 1999 11:59:24 -0500 (EST) From: Alfred Perlstein To: CyberPsychotic Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: SOCK_RAW on BSD In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 > #include > #include > #include > #include > #include > > > > > 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