From owner-freebsd-net@FreeBSD.ORG  Mon Mar 26 21:23:47 2007
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
X-Original-To: freebsd-net@freebsd.org
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id AAE4316A403
	for <freebsd-net@freebsd.org>; Mon, 26 Mar 2007 21:23:47 +0000 (UTC)
	(envelope-from bms@FreeBSD.org)
Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com
	[66.111.4.29]) by mx1.freebsd.org (Postfix) with ESMTP id 7B6FE13C4B7
	for <freebsd-net@freebsd.org>; Mon, 26 Mar 2007 21:23:47 +0000 (UTC)
	(envelope-from bms@FreeBSD.org)
Received: from compute1.internal (compute1.internal [10.202.2.41])
	by out1.messagingengine.com (Postfix) with ESMTP id A8D2220ABAE;
	Mon, 26 Mar 2007 17:23:47 -0400 (EDT)
Received: from heartbeat2.messagingengine.com ([10.202.2.161])
	by compute1.internal (MEProxy); Mon, 26 Mar 2007 17:23:47 -0400
X-Sasl-enc: 5mdvDMtD6itqdbGqzVC28IiSJ0n2o+DDqBtXHKd6oHDQ 1174944227
Received: from [192.168.123.18]
	(82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254])
	by mail.messagingengine.com (Postfix) with ESMTP id 470B719DEF;
	Mon, 26 Mar 2007 17:23:47 -0400 (EDT)
Message-ID: <460839E1.8080408@FreeBSD.org>
Date: Mon, 26 Mar 2007 22:23:45 +0100
From: "Bruce M. Simpson" <bms@FreeBSD.org>
User-Agent: Thunderbird 1.5.0.9 (X11/20070125)
MIME-Version: 1.0
To: Cristian KLEIN <cristi@net.utcluj.ro>
References: <46081CB9.6030109@net.utcluj.ro>
In-Reply-To: <46081CB9.6030109@net.utcluj.ro>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: freebsd-net@freebsd.org
Subject: Re: GRE with key
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 26 Mar 2007 21:23:47 -0000

Cristian KLEIN wrote:
> Hello everybody,
>
> I am new to FreeBSD kernel hacking, so please excuse my perhaps stupid
> questions.
>
> I would like to add key support to gre(4). I have already been able to
> use gre(4) with a hardcoded key. The single thing remaining to do is to
> transfer the key from ifconfig(8). The key is an uint32_t and I haven't
> found a way to transfer it without modifying ifconfig(8).
>   
Excellent. Thanks for volunteering to do this!
> My question is, which is the "BSD-style" to achieve the above? Solutions
> I came up with are as follows:
> 1) Use SIOCSDRVSPEC / SIOCGDRVSPEC
> 2) Add SIOCSGREKEY / SIOCGGREKEY
> 3) [Probably to ugly to be mentioned, but requires fairy few
> modifications.] Add a sysctl MIB which is read when calling "ifconfig
> ... create".
>   
If I were doing this, I would add the code to ifconfig.c where the other 
tunnel stuff lives, and go for option number 2. Feel free to modify 
ifconfig to accomodate the the new options.
> Another thing I wanted to ask is, which function of ifconfig(8) should I
> modify to display the GRE key?
>   
Look at how af_status_tunnel() works and consider adding it there.

Regards,
BMS