Date: Mon, 22 Dec 2008 13:37:24 +0000 (GMT) From: Robert Watson <rwatson@FreeBSD.org> To: Bruce Simpson <bms@incunabulum.net> Cc: freebsd-net@freebsd.org, Ferner Cilloniz <fernercc@gmail.com> Subject: Re: sending arbitrary UDP packets from kernel module Message-ID: <alpine.BSF.1.10.0812221335390.45959@fledge.watson.org> In-Reply-To: <494EE7D9.5060000@incunabulum.net> References: <1229738406.5614.17.camel@mobiliare.Belkin> <494EE7D9.5060000@incunabulum.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 22 Dec 2008, Bruce Simpson wrote: > Ferner Cilloniz wrote: > >> So i have done some research and reading and found that i need to call >> either udp_send or udp_output. Can anyone help me out with providing the >> proper arguments to these functions so i may call them and send arbitrary >> UDP packets from a kernel module? > > The NFS and BOOTP code would be the first place to look, it has a rather > shonky way of creating a socket in-kernel so that an INPCB will be created, > allowing you to send and receive UDP datagrams. Fire up KScope or similar > and look at how it does it. I would encourage this approach, if the application model works with it, as it allows using the existing socket infrastruture to reserve the port/ip tuple and avoid conflicts with userspace, use existing buffering on the receive side, etc. Robert N M Watson Computer Laboratory University of Cambridge
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.1.10.0812221335390.45959>