Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jul 2001 11:05:14 -0400 (EDT)
From:      <fygrave@mail.scorpions.net>
To:        <freebsd-hackers@freebsd.org>
Subject:   IPPROTO_RAW funkness
Message-ID:  <Pine.LNX.4.33.0107081103080.14258-100000@mail.scorpions.net>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.33.0107081103080.14258-100000>