Path: utzoo!attcan!uunet!cs.utexas.edu!usc!ucselx!bionet!arisia!roo!chamomile!akhale From: akhale@chamomile.uucp (Abhijit Khale) Newsgroups: comp.unix.wizards Subject: Re: Datagrams Outside the Kernel Message-ID: <468@roo.UUCP> Date: 2 Jul 90 20:20:40 GMT References: <8009@inco.UUCP> <414@minya.UUCP> Sender: news@parc.xerox.com Reply-To: akhale@chamomile.parc.xerox.com (Abhijit Khale) Organization: Computer Sciences Lab, Xerox Palo Alto Research Center Lines: 40 In article <414@minya.UUCP> jc@minya.UUCP (John Chambers) writes: >In article <8009@inco.UUCP>, mack@inco.UUCP (Dave Mack) writes: >> >> I have question which may (or may not) be worthy of this august >> assemblage. >> >> I have a program running in user context which has a datagram (IP, >> for example) in a buffer. I need to hand this datagram over to >> the kernel in such a way that it gets transmitted to whatever >> Internet address lurks in the IP header. >> >> I also need to solve the inverse problem: getting a datagram in >> its raw form from the kernel when it arrives at my machine. I missed the original article, but .. Use raw IP sockets. These allow you to get a datagram in its raw form when it arrives at the machine [ Actually when all fragments of that datagram arrive. ]. You will also get the header. Raw IP sockets can also be used to send out IP packets with a particular header. Not all fields in the IP header can be manipulated, though. You cannot set the src addr to an addr not that of the machine. Also, the TTL and the checksum ( obviously ) are filled in by the system. > >I'll second this request. I've been asked whether I can build an >application which, in effect, "volunteers" to handle any IP address >that the kernel doesn't know what to do with. In perusing TFM, I >haven't found any hint that this is possible. Does any extant IP >implementation supply a hook that allows this? A raw socket would enable you to do that. [ I think so anyway, since I am not sure I understand your question fully ]. man 4 ip will tell you more about how to open a raw socket. Abhijit akhale@parc.xerox.com