From owner-freebsd-current@FreeBSD.ORG  Tue Jul 25 17:39:31 2006
Return-Path: <owner-freebsd-current@FreeBSD.ORG>
X-Original-To: freebsd-current@freebsd.org
Delivered-To: freebsd-current@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 11ED816A50D
	for <freebsd-current@freebsd.org>; Tue, 25 Jul 2006 17:39:31 +0000 (UTC)
	(envelope-from jmg@hydrogen.funkthat.com)
Received: from hydrogen.funkthat.com (gate.funkthat.com [69.17.45.168])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B368743D70
	for <freebsd-current@freebsd.org>; Tue, 25 Jul 2006 17:39:28 +0000 (GMT)
	(envelope-from jmg@hydrogen.funkthat.com)
Received: from hydrogen.funkthat.com (v56wxwg9ccbl6xfz@localhost.funkthat.com
	[127.0.0.1])
	by hydrogen.funkthat.com (8.13.6/8.13.3) with ESMTP id k6PHdRtK066272; 
	Tue, 25 Jul 2006 10:39:27 -0700 (PDT)
	(envelope-from jmg@hydrogen.funkthat.com)
Received: (from jmg@localhost)
	by hydrogen.funkthat.com (8.13.6/8.13.3/Submit) id k6PHdOvj066271;
	Tue, 25 Jul 2006 10:39:24 -0700 (PDT) (envelope-from jmg)
Date: Tue, 25 Jul 2006 10:39:24 -0700
From: John-Mark Gurney <gurney_j@resnet.uoregon.edu>
To: Fredrik Lindberg <fli+freebsd-current@shapeshifter.se>
Message-ID: <20060725173924.GR96589@funkthat.com>
Mail-Followup-To: Fredrik Lindberg <fli+freebsd-current@shapeshifter.se>,
	freebsd-current@freebsd.org
References: <44C61470.3070005@shapeshifter.se>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <44C61470.3070005@shapeshifter.se>
User-Agent: Mutt/1.4.2.1i
X-Operating-System: FreeBSD 5.4-RELEASE-p6 i386
X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31  96 7A 22 B3 D8 56 36 F4
X-Files: The truth is out there
X-URL: http://resnet.uoregon.edu/~gurney_j/
X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html
Cc: freebsd-current@freebsd.org
Subject: Re: Extending EVFILT_NETDEV to support ip-address changes
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: John-Mark Gurney <gurney_j@resnet.uoregon.edu>
List-Id: Discussions about the use of FreeBSD-current
	<freebsd-current.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>, 
	<mailto:freebsd-current-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current>
List-Post: <mailto:freebsd-current@freebsd.org>
List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
	<mailto:freebsd-current-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 25 Jul 2006 17:39:31 -0000

Fredrik Lindberg wrote this message on Tue, Jul 25, 2006 at 14:54 +0200:
> I have a suggestion to add support for ip-address changes to the
> kqueue (EVFILT_NETDEV) system.
> The infrastructure for EVFILT_NETDEV is already in place and this
> only introduce NOTE_NEWADDR and NOTE_DELADDR and minor modifications
> to the interface ioctl handler.
> 
> The purpose is not to replicate the functionality of the
> routing socket, but to provide a low overhead mechanism for
> monitoring a given interface for address changes.
> No information about the event is sent through the kqueue system,
> instead it will be up to the caller to query the system (if wanted)
> to obtain information about the current state of the interface
> that is being monitored.
> 
> I have attached a suggested patch, any thoughts?

Looks basicly good, though you will need to rethink how the filt_netdev
handles the hint.. since right now it just sets kn_data to whatever
hint is..  This is fine when it was simply one of NOTE_LINK{UP,DOWN,INV},
but now that you have an extra flag, the NOTE_DELADDR could make an
app miss the LINK status if it was looking at data instead of fflags..

Plus, are you sure everyone that is using NOTE_LINK* are treating them
as a bit mask?  maybe we need to redefine NOTE_LINK* as a mask plus set
of values, since each of the NOTE_LINK* can only be set once...  but
the NOTE_ADDR{NEW,DEL} should probably be flags...

We may want to reverse the naming to NOTE_ADDR{NEW,DEL} so that we have
the more generic first before the more specific...  similar to NOTE_LINK*...

Suffice it to say, this cannot be back ported to RELENG_6 due to API
breakage...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."