Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!uunet!in1.uu.net!199.173.153.226!news.kuwait.net!shadows From: shadows@whitefang.com (ShadowS) Newsgroups: comp.unix.bsd.freebsd.misc,comp.protocols.tcp-ip Subject: Re: Q: Raw sockets to buypass tcp/udp? Date: 23 Apr 1997 03:58:46 GMT Organization: Gulfnet Kuwait Lines: 34 Message-ID: <slrn5lr1ss.1d4.shadows@broken.whitefang.com> References: <33551811.6113@snads.lkg.dec.com> <335BAB4D.F11@novit.no> Reply-To: shadows@whitefang.com NNTP-Posting-Host: lets.get.broken.at.whitefang.com X-Newsreader: slrn (0.9.0.0 (BETA) UNIX) Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:39572 comp.protocols.tcp-ip:53247 On Mon, 21 Apr 1997 20:00:45 +0200, Terje Eggestad <terje.eggestad@novit.no> wrote: >Michael C. Cambria wrote: >> >> Hi, >> >> First, I need to be able to send and receive my own "layer 3" packets >> but continue to use the FreeBSD IP. Put simply, I want to replace >> TCP and UDP with my own. What is the proper way to do this? Is it >> even possible? >> >Well if you want to do this from scratch.. >In the IP header there is a flied that say protocol number. If I not >mistaken TCP is 6 UDP is 17, OSPF is 89. What you seems to want to do is >to use your own number here. You need to open a socket, and in teh >listen og connect call use SOCK_RAW as type. I have never attemptet this >myself, but seen this is the code. I do belive you must directly set all >the header fields (IP) directly. :-) Most systems have IP_HDRINCL will allow you to include your own ip header if you wish. Simply open a socket as such: sockd = socket(AF_INET,SOCK_RAW,IPPROTO_TCP); you then should only be writing the tcp header + data. Mind you this doesnt work on all systems, if IP_HDRINCL is not present it could mean that its always included, or never included. Your better off using a modern interface to the lower level network layer like DLPI, BPF, NIT etc etc. -shadows