From owner-freebsd-questions@FreeBSD.ORG Sat Nov 1 23:23:30 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16BE81065678 for ; Sat, 1 Nov 2008 23:23:30 +0000 (UTC) (envelope-from bryant.eadon@gmail.com) Received: from mail-gx0-f13.google.com (mail-gx0-f13.google.com [209.85.217.13]) by mx1.freebsd.org (Postfix) with ESMTP id 8E5B18FC14 for ; Sat, 1 Nov 2008 23:23:29 +0000 (UTC) (envelope-from bryant.eadon@gmail.com) Received: by gxk6 with SMTP id 6so351736gxk.19 for ; Sat, 01 Nov 2008 16:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Ag66O5zo+R0nNAJpU0H+ImLb/GvXEXaLmSz7gdxt25Q=; b=muLB/SooQEjltFLBKdfP8IWxgnVWCYVA8zqPKGv9ahavJ/KLJpSnRLFQRTQ9Er78el dueUgaT1wrtHkIEfDF4BQFypHH3ZJk9/ZXTQRm+N78FdLIrxfXreGGvLg7a2VCwidqP4 zw8ubLXCeCVFG+oMnKnxv5MD3U5qOJPz/FMyM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=efV3WZNA8aQF+7TFU7FrfYn9MIwDJO1HWI/ODd/ypvS0guSSjCgqa9ySyVSOSk1DTN zlENuC4wduF5PW4sZQjXykj7eoyyjCNqp+v7k4AINorf7vThzTFSIUoz9n9K3fzMcGxW KIQNSTI7Kkqf4T0Zn13mifQP1fW2sZW9jHyfA= Received: by 10.151.155.5 with SMTP id h5mr19049857ybo.211.1225581808873; Sat, 01 Nov 2008 16:23:28 -0700 (PDT) Received: from ?192.168.1.4? (itsf207.itsnpt.com [64.119.85.207]) by mx.google.com with ESMTPS id k47sm4841548rnd.2.2008.11.01.16.23.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 01 Nov 2008 16:23:28 -0700 (PDT) Message-ID: <490CE4E6.5090402@gmail.com> Date: Sat, 01 Nov 2008 19:23:18 -0400 From: Bryant Eadon User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Joe Pellegrino References: <490CE454.2020800@gmail.com> In-Reply-To: <490CE454.2020800@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: A netgraph question. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bryant.eadon@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2008 23:23:30 -0000 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.