Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 01 Nov 2008 19:23:18 -0400
From:      Bryant Eadon <bryant.eadon@gmail.com>
To:        Joe Pellegrino <jdp@elvis.rowan.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: A netgraph question.
Message-ID:  <490CE4E6.5090402@gmail.com>
In-Reply-To: <490CE454.2020800@gmail.com>
References:  <Pine.GSO.4.64.0811011523510.1498@elvis.rowan.edu> <Pine.GSO.4.64.0811011624310.1498@elvis.rowan.edu> <490CE454.2020800@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Bryant Eadon wrote:
> 
> Joe Pellegrino wrote:
>  OK so here it goes. I actually have two seperate questions involving
>> netgraph, I am new to this subject so please bare with me. If there is 
>> a better way to achieve these goals too, please suggest them but I 
>> think netgraph is the way to go.
>>
>> The first part involves allowing a userland program to communicate 
>> with a kernel module, similar to how netlink works in Linux. The 
>> second part involves intercepting network packets and possibly 
>> manipulating them before they are allowed to proceed, similar to how 
>> netfilter works. I believe I can do both of these with the netgraph 
>> (ng_socket and possibly ng_ether). I haven't looked closely at 
>> ng_ether yet so I'll focus on ng_socket.
>>
>> I have been able to create a ng_socket (Control and Data) using the 
>> socket call as described in "All About NetGraphs" and the man page. 
>> I've also been able to 'name' the node using bind. I was able to 
>> verify this using ngctl. I know (from the man page) I should 
>> eventually be able to send/receive using the sendto/recvfrom functions 
>> once the connection is established. But beyond this I don't know how 
>> to proceed. So the question is what are the next steps. For example:
>>
>> Although I see a named netgraph node there are no hooks. ng_socket 
>> says it supports an arbitrary number of hooks so how do I create the 
>> hooks? Then of course how do I connect them.
>>
>> Of course I realize that I proabably need to create a node on the 
>> kernel side so which type of netgraph node would be suggested? How is 
>> it created and then hooked to the ng_socket?
>>
>> Again I am looking to allow some IPC between a userland program and a 
>> kernel module similar to the Linux netlink. I've been through most man 
>> pages and can't seem to find a lot of good documentation or example 
>> code so I am hoping to get some pointers here. BTW If this is the 
>> wrong list please directly to the right place to ask. Thanks in advance.
>>
>> ---jdp
>>
> 
> 
> Have you looked into how "systat -ifstat" works ?

Whoops.  Wrong thread.  Please ignore.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?490CE4E6.5090402>