From owner-freebsd-hackers Sun Jul 8 8: 6:29 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.scorpions.net (mail.scorpions.net [207.13.229.11]) by hub.freebsd.org (Postfix) with ESMTP id 7E07237B403 for ; Sun, 8 Jul 2001 08:06:26 -0700 (PDT) (envelope-from fygrave@mail.scorpions.net) Received: from localhost (fygrave@localhost) by mail.scorpions.net (8.11.4/8.11.4) with ESMTP id f68F5Es14264 for ; Sun, 8 Jul 2001 11:05:14 -0400 Date: Sun, 8 Jul 2001 11:05:14 -0400 (EDT) From: To: Subject: IPPROTO_RAW funkness Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi folks, Just noticed 2 interesting things while reading ip/icmp datagrams off the IPPROTO_RAW socket (i.g.): int on =1; sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); setsockopt(sock, IPPROTO_IP, IP_HDRINCL, (char *)&on, sizeof(on)) < 0); /* works without sockopt too! */ ... recvfrom(sock, ...); 1. ip->ip_off bits get cleaned (even if DF, reserved bits are in original datagram.) 2. ip->ip_len is ip->ip_hl<<2 bytes off (i.g. contains the length of the data itself, without the header length). Just curious if there was any reason behind to have raw socket behaving this way, or just something is overlooked? (or I am messing something up :)) FreeBSD boozo 4.3-STABLE FreeBSD 4.3-STABLE #1: Thu Jun 14 23:04:01 ICT 2001 root@boozo:/usr/src/sys/compile/BOOZO i386 (the snapshot was fetched at the same day when the kernel was built). cheers, -Fyodor -- http://www.notlsd.net PGP fingerprint = 56DD 1511 DDDA 56D7 99C7 B288 5CE5 A713 0969 A4D1 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message