Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!arisia!roo!chamomile!akhale From: akhale@chamomile.uucp (Abhijit Khale) Newsgroups: comp.unix.wizards Subject: Re: Raw Sockets and IP Datagrams Keywords: Confused Message-ID: <430@roo.UUCP> Date: 8 Jun 90 03:21:55 GMT References: Sender: news@parc.xerox.com Reply-To: akhale@chamomile.UUCP (Abhijit Khale) Organization: Xerox Palo Alto Research Center Lines: 38 In article jamesp@wacsvax.uwa.oz (James Pinakis) writes: >I'm trying to write programs which communicate via IP datagrams using the >raw socket interface in SunOS 4.0.3. . >Now I find that in received datagrams, the TOTAL LENGTH field contains only >the length of the data part and does not include the length of the header >as specified in the RFC. Yes. What happens is : the ipintr() [IP input] routines subtract the header length from the total length field before switching the packet up to the higher layer protocol (normally tcp or udp). In the case of a raw socket it just gets handed to the raw socket processing routines which eventually pass it up to the user process. > Also, it appears the HEADER CHECKSUM contains >zero. In 4.0.3, thats what will happen. In 4.1, you should get the correct header checksum provided the packet hasnt been fragmented and reassembled. Obviously the IP layer is changing these fields, but this isn't >mentioned in the manual entry (which in fact says "Received datagrams are >returned with the IP header and options intact"). Is this normal behaviour or >am I experiencing something peculiar? This is "normal". However, there seems to be no reason why the total length field should be changed for a raw IP socket. That should probably be regarded as a bug. Its less clear whether the checksum should be passed up as is [ There doesnt seem to be any reason why the checksum should be recomputed for a fragmented/reassembled packet]. Now if you really want raw packets, use NIT :-) Abhijit Khale akhale@parc.xerox.com akhale@jerico.usc.edu Computer Science Lab, Xerox PARC University of Southern California