From owner-freebsd-net@FreeBSD.ORG Thu Dec 13 12:09:03 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ECDF8912; Thu, 13 Dec 2012 12:09:03 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from mail.ipfw.ru (unknown [IPv6:2a01:4f8:120:6141::2]) by mx1.freebsd.org (Postfix) with ESMTP id 81ACD8FC14; Thu, 13 Dec 2012 12:09:02 +0000 (UTC) Received: from [2a02:6b8:0:401:222:4dff:fe50:cd2f] (helo=dhcp170-36-red.yandex.net) by mail.ipfw.ru with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.76 (FreeBSD)) (envelope-from ) id 1Tj7eR-000Ef6-Mw; Thu, 13 Dec 2012 16:12:31 +0400 Message-ID: <50C9C55A.5090900@ipfw.ru> Date: Thu, 13 Dec 2012 16:08:58 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120627 Thunderbird/13.0.1 MIME-Version: 1.0 To: Andriy Gapon Subject: Re: ng_ether naming References: <50C9C012.8020306@FreeBSD.org> In-Reply-To: <50C9C012.8020306@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@FreeBSD.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2012 12:09:04 -0000 On 13.12.2012 15:46, Andriy Gapon wrote: > > ng_ether uses if_xname for naming its nodes. > This could be troublesome for mapping interface names to their ng_ether companions > in the face of interface renaming capability. Especially given that interface > renaming and ng_ether _module_ loading may happen in an arbitrary order. > > I am not sure how to solve this best. > > One possibility is to use if_dname+if_dunit combination for ng_ether naming. This > should be stable and available for querying. This behavior should also be > backward compatible with ng_ether being compiled into kernel (if_dname+if_dunit == > if_xname before any renaming could occur). > > Another possibility is to do ng_ether renaming when its interface is renamed. > This seems nicer but appears to be more work and more intrusive, because > interfaces would have to know about their ng_ether nodes. Not exactly. You can register for ifnet_departure_event and ifnet_arrival_event. Interface renaming is done via sending departure event with old name and arrvial event with new one. > > What do you think? > Thank you. > > And just in case: > $ ifconfig -l > net0 lo0 > $ ngctl list > There are 2 total nodes: > Name: re0 Type: ether ID: 00000001 Num hooks: 0 > Name: ngctl11353 Type: socket ID: 00000003 Num hooks: 0 > -- WBR, Alexander