From owner-freebsd-hackers Thu Jun 7 4:20: 0 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from Awfulhak.org (gw.Awfulhak.org [217.204.245.18]) by hub.freebsd.org (Postfix) with ESMTP id 37EAA37B403 for ; Thu, 7 Jun 2001 04:19:56 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from hak.lan.Awfulhak.org (root@hak.lan.Awfulhak.org [172.16.0.12]) by Awfulhak.org (8.11.3/8.11.3) with ESMTP id f57BJrt40917; Thu, 7 Jun 2001 12:19:54 +0100 (BST) (envelope-from brian@lan.Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.11.3/8.11.3) with ESMTP id f57BJr766008; Thu, 7 Jun 2001 12:19:53 +0100 (BST) (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200106071119.f57BJr766008@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Poul-Henning Kamp Cc: Brooks Davis , hackers@FreeBSD.ORG, brian@Awfulhak.org Subject: Re: cloning network interfaces In-Reply-To: Message from Poul-Henning Kamp of "Wed, 06 Jun 2001 23:16:57 +0200." <85874.991862217@critter> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 07 Jun 2001 12:19:53 +0100 From: Brian Somers Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > In message <20010606141228.A13639@Odin.AC.HMC.Edu>, Brooks Davis writes: > > >With network devices that are also normal devices the way tun is, > >you do this by just implementing a dev_clone event handler so when the > >user attempts to open a non-existent instance it's created. The problem > >with gif is that there's no device in /dev to open. Since most network > >devices at attached to hardware this usually doesn't matter, but in this > >case it does. > > > >[...] > > > >How would this work anyway? > > > >Comments, thoughts, ideas? > > The quick and dirty way: > > Make a clone handler despite the fact that there is no /dev > entry needed. You don't actually have to create a dev entry > in the clone handler, you could just create the gif_interface. > > Applications would then: > > stat("/dev/gif345") /* Ignore error */ > system("ifconfig gif345 bla bla bla"); > > The slower but less dirty: > > Make a sysctl which returns an integer which is the next > free gif device. > > The really slow and very dirty: > > Implement cloning in ifconfig. Maybe a reasonable alternative would be to have a /dev/if_gif device with ioctls for creating and destroying interfaces. ifconfig(8) could be taught to create (and maybe even to delete) them. > -- > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > phk@FreeBSD.ORG | TCP/IP since RFC 956 > FreeBSD committer | BSD since 4.3-tahoe > Never attribute to malice what can adequately be explained by incompetence. -- Brian Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message