From owner-freebsd-hackers Wed Jun 6 14:17:16 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by hub.freebsd.org (Postfix) with ESMTP id DF39837B403 for ; Wed, 6 Jun 2001 14:17:12 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.3/8.11.3) with ESMTP id f56LGv185876; Wed, 6 Jun 2001 23:16:57 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: Brooks Davis Cc: hackers@FreeBSD.ORG Subject: Re: cloning network interfaces In-Reply-To: Your message of "Wed, 06 Jun 2001 14:12:28 PDT." <20010606141228.A13639@Odin.AC.HMC.Edu> Date: Wed, 06 Jun 2001 23:16:57 +0200 Message-ID: <85874.991862217@critter> From: Poul-Henning Kamp 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. -- 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. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message