Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Dec 2008 18:46:46 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Max Laier <max@love2party.net>
Cc:        freebsd-net@freebsd.org, Ferner Cilloniz <fernercc@gmail.com>
Subject:   Re: kernel network
Message-ID:  <alpine.BSF.2.00.0812301837170.40328@fledge.watson.org>
In-Reply-To: <200812301905.57164.max@love2party.net>
References:  <1230637795.4966.20.camel@mobiliare.Belkin> <200812301905.57164.max@love2party.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 30 Dec 2008, Max Laier wrote:

> On Tuesday 30 December 2008 12:49:55 Ferner Cilloniz wrote:
>
>> I do not think I could ever be more tired of this topic but I cannot seem 
>> to understand what to do. I have tried more about a month now to send 
>> arbitrary UDP packets from a kernel module but cannot achieve it. I have 
>> looked at udp_send but found that building a socket* was much to tedious. 
>> Later i looked at in-kernel webservers (http://openketa.sourceforge.net/) 
>> but could not find anything useful.
>>
>> Netgraph is a possibility, but there isn't any documentation on accessing 
>> the network from kernel space.
>>
>> What do you all suggest?
>
> $ man 9 socket

Definitely the preferred solution, if it meets the application model.  Call 
socreate(9) to allocate the socket, sobind(9) if required, calls to sosend(9) 
to generate packets, and soclose(9) when done.  Direct calls to the 
udp_output() and udp_send() functions won't work without a socket context, and 
doing sosend(9) will isolate in-kernel consumers from future changes in UDP 
internals.  ip_output() could be invoked directly to generate IP packets, but 
won't allow you to easily receive replies, 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.2.00.0812301837170.40328>