From owner-freebsd-net@FreeBSD.ORG Wed May 24 21:00:11 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 42E7216A465 for ; Wed, 24 May 2006 21:00:11 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from grunt5.ihug.co.nz (grunt5.ihug.co.nz [203.109.254.45]) by mx1.FreeBSD.org (Postfix) with ESMTP id 725BC43D48 for ; Wed, 24 May 2006 21:00:10 +0000 (GMT) (envelope-from thompsa@freebsd.org) Received: from 203-109-251-39.static.bliink.ihug.co.nz (heff.fud.org.nz) [203.109.251.39] by grunt5.ihug.co.nz with smtp (Exim 3.35 #1 (Debian)) id 1Fj0Se-00021z-00; Thu, 25 May 2006 09:00:09 +1200 Received: by heff.fud.org.nz (Postfix, from userid 1001) id CCC571CC1F; Thu, 25 May 2006 09:00:07 +1200 (NZST) Date: Thu, 25 May 2006 09:00:07 +1200 From: Andrew Thompson To: freebsd-net@freebsd.org Message-ID: <20060524210007.GB68191@heff.fud.org.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11 Subject: interface notifications X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 May 2006 21:00:12 -0000 Hi, I want to bring up the idea again of announcing all interfaces on creation/insert rather than just physical ones as it is right now. The difference will be that pseudo interfaces will be reported to devd and this lets actions be taken in userland. Anyone care to test. Andrew Index: etc/devd.conf =================================================================== RCS file: /home/ncvs/src/etc/devd.conf,v retrieving revision 1.32 diff -u -p -r1.32 devd.conf --- etc/devd.conf 16 Mar 2006 17:42:27 -0000 1.32 +++ etc/devd.conf 3 Apr 2006 00:21:00 -0000 @@ -28,17 +28,19 @@ options { # override these general rules. # -# For ethernet like devices start configuring the interface. Due to -# a historical accident, this script is called pccard_ether. +# Configure the interface on attach. Due to a historical accident, this +# script is called pccard_ether. # -attach 0 { - media-type "ethernet"; - action "/etc/pccard_ether $device-name start"; +notify 0 { + match "system" "IFNET"; + match "type" "ATTACH"; + action "/etc/pccard_ether $subsystem start"; }; -detach 0 { - media-type "ethernet"; - action "/etc/pccard_ether $device-name stop"; +notify 0 { + match "system" "IFNET"; + match "type" "DETACH"; + action "/etc/pccard_ether $subsystem stop"; }; # Index: sys/net/if.c =================================================================== RCS file: /home/ncvs/src/sys/net/if.c,v retrieving revision 1.255 diff -u -p -r1.255 if.c --- sys/net/if.c 21 Mar 2006 14:31:18 -0000 1.255 +++ sys/net/if.c 3 Apr 2006 00:22:22 -0000 @@ -505,6 +505,7 @@ if_attach(struct ifnet *ifp) if_attachdomain1(ifp); EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp); + devctl_notify("IFNET", ifp->if_xname, "ATTACH", NULL); /* Announce the interface. */ rt_ifannouncemsg(ifp, IFAN_ARRIVAL); @@ -682,6 +683,7 @@ if_detach(struct ifnet *ifp) /* Announce that the interface is gone. */ rt_ifannouncemsg(ifp, IFAN_DEPARTURE); EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); + devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL); IF_AFDATA_LOCK(ifp); for (dp = domains; dp; dp = dp->dom_next) {