From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 6 22:07:55 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 934DD16A4CF for ; Fri, 6 Aug 2004 22:07:55 +0000 (GMT) Received: from out001.email.savvis.net (out001.apptix.savvis.net [216.91.32.44]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4406443D55 for ; Fri, 6 Aug 2004 22:07:55 +0000 (GMT) (envelope-from Maksim.Yevmenkin@savvis.net) Received: from s228130hz1ew03.apptix-01.savvis.net ([10.146.4.28]) by out001.email.savvis.net with Microsoft SMTPSVC(6.0.3790.0); Fri, 6 Aug 2004 17:07:54 -0500 Received: from savvis.net ([66.35.239.94]) by s228130hz1ew03.apptix-01.savvis.net with Microsoft SMTPSVC(6.0.3790.0); Fri, 6 Aug 2004 17:07:54 -0500 Message-ID: <41140139.5080803@savvis.net> Date: Fri, 06 Aug 2004 15:07:53 -0700 From: Maksim Yevmenkin User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031207 X-Accept-Language: en-us, en MIME-Version: 1.0 To: cokane@cokane.org References: <346a8022040806145018a5e18@mail.gmail.com> In-Reply-To: <346a8022040806145018a5e18@mail.gmail.com> Content-Type: multipart/mixed; boundary="------------090001030208020407050106" X-OriginalArrivalTime: 06 Aug 2004 22:07:54.0662 (UTC) FILETIME=[D2CC1C60:01C47C01] cc: hackers@freebsd.org Subject: Re: Network interface RUNNING and UP flags X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2004 22:07:55 -0000 This is a multi-part message in MIME format. --------------090001030208020407050106 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit > 2) Is there a way to set this interface flag without assigning an IPv4 > address (or any address for that matter) first? > > Mainly for number two, I would like to be able to run interfaces > bridged together without having to also give all of them addresses. please try the attached (untested!) patch. it should set iff_running flag on the interface as soon as the control device is opened. max --------------090001030208020407050106 Content-Type: text/plain; name="if_tap.c.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="if_tap.c.diff.txt" --- if_tap.c.orig Fri Aug 6 15:02:06 2004 +++ if_tap.c Fri Aug 6 15:04:14 2004 @@ -336,15 +336,15 @@ tapopen(dev, flag, mode, td) struct cdev *dev; int flag; int mode; struct thread *td; { struct tap_softc *tp = NULL; - int error; + int error, s; if ((error = suser(td)) != 0) return (error); if ((dev2unit(dev) & CLONE_UNITMASK) > TAPMAXUNIT) return (ENXIO); @@ -365,14 +365,19 @@ return (EBUSY); } bcopy(tp->arpcom.ac_enaddr, tp->ether_addr, sizeof(tp->ether_addr)); tp->tap_pid = td->td_proc->p_pid; tp->tap_flags |= TAP_OPEN; mtx_unlock(&tp->tap_mtx); + + s = splimp(); + tp->tap_if.if_flags |= IFF_RUNNING; + tp->tap_if.if_flags &= ~IFF_OACTIVE; + splx(s); TAPDEBUG("%s is open. minor = %#x\n", tp->tap_if.if_xname, minor(dev)); return (0); } /* tapopen */ --------------090001030208020407050106--