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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to