Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!newsfeed.direct.ca!su-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!rill.news.pipex.net!pipex!tank.news.pipex.net!pipex!news.utell.co.uk!usenet
From: brian@shift.utell.net (Brian Somers)
Newsgroups: comp.unix.bsd.freebsd.misc,comp.protocols.tcp-ip
Subject: Re: Q: Raw sockets to buypass tcp/udp?
Date: 17 Apr 1997 14:56:14 GMT
Organization: Awfulhak Ltd.
Lines: 55
Message-ID: <5j5dme$8j1@ui-gate.utell.co.uk>
References: <33551811.6113@snads.lkg.dec.com>
Reply-To: brian@awfulhak.org, brian@utell.co.uk
NNTP-Posting-Host: shift.utell.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Newsreader: knews 0.9.8
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:39229 comp.protocols.tcp-ip:53097
In article <33551811.6113@snads.lkg.dec.com>,
"Michael C. Cambria" <cambria@snads.lkg.dec.com> writes:
> Hi,
>
> I need to prototype sone networking software. Since I can pick how
> and where this is done, I'm choosing FreeBSD 2.2.1
>
> 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?
man 4 divert
I've just put Ari Suutaris natd program in the ports collection at
ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/net/natd.
It uses divert sockets. The man page is about to be added. If
you want it now, give me a shout, but it's not very technical.
> Second, I need to put my own 802.2 packets (ie. no IP layer) for my
> own "layer 2" on the LAN. What is the proper way to do this?
I'm not sure. You may want to have a look at ipxrouted. If it's
possible, the best pointer will be there.
> In both cases, I need the OS transparently pass thru what I'm sending
> and receiving (if possible.) I've looked thru Stevens "Unix Network
> Programming", the sockets FAQ and briefly at the sources. I've a
> feeling the sources will be the only way, so I'm looking for help
> on where to look first.
>
> For my own "layer 3":
> I've looked at: socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) a bit, since
> "ping" lets one build their own ICMP header and the OS will prefix
> what I send with the IP header. Should this be used? It doesn't
> "feel right" as the protocol I'm using is not ICMP.
>
> I've also considered: socket(PF_INET, SOCK_RAW, IPPROTO_RAW)
> but I'm _guessing_ that this would be the way to send/rcv directly
> on the wire myself (ie. build my own "layer 2").
This is where you read & write ip traffic :( As I said above,
check out ipxrouted for better info. (I bet it uses bpf - not
really what you want to do, 'cos that's not connection orientated).
>
> Thanks for any help, pointers etc.
>
> MikeC
>
--
Brian <brian@awfulhak.org> <brian@freebsd.org>
<http://www.awfulhak.org>
Don't _EVER_ lose your sense of humour !