From owner-freebsd-net@FreeBSD.ORG Fri Dec 14 17:38:09 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 10554BA7; Fri, 14 Dec 2012 17:38:09 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2822C8FC0C; Fri, 14 Dec 2012 17:38:07 +0000 (UTC) Received: by mail-bk0-f54.google.com with SMTP id je9so1843321bkc.13 for ; Fri, 14 Dec 2012 09:38:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=ef82+PJpHFiKg7pL+eTCyosgplcl4cXmoyU7iOhq+pQ=; b=Dr69lFtkn61Jo6YKl4c/IsMtytoZ50dzTWV1yy9WR/jNyUpdEvF8MDSDoRCQR791NL U8mzVE1XMXZnHVwt3yiEDPi0wXt9lNk2rCDt6IPsGxSiKNH04Ebp56nXoGJpGJLxd2w/ +VBh1ob7BqDFPf5dMqrGIU2JoBR64v6P91AO5SaXkeeC1f8IJSdnzS8T2VCp0cjh2Zi9 vdBHb8uQA9Uw++VAkTI+ipfBwn+chKMvXGvxhlC8kVNS8SZZjMz7CyH3PXwyIRY74phe AjOZe3Lx7u1OJ261QNjxoicG3GwmzTASmO1aP3OM+VJ7EdKqIklyQB2HmvmbkFoJ66WK 9Mug== Received: by 10.204.13.28 with SMTP id z28mr3098107bkz.113.1355506686920; Fri, 14 Dec 2012 09:38:06 -0800 (PST) Received: from [10.0.0.3] ([93.152.184.10]) by mx.google.com with ESMTPS id u3sm5281348bkw.9.2012.12.14.09.38.05 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Dec 2012 09:38:06 -0800 (PST) Subject: Re: ng_ether naming Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Content-Type: text/plain; charset=iso-8859-1 From: Nikolay Denev In-Reply-To: <50CB5B8A.8030703@FreeBSD.org> Date: Fri, 14 Dec 2012 19:38:03 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <75277A1B-B434-4220-A800-9004C29DA92A@gmail.com> References: <50C9C012.8020306@FreeBSD.org> <50C9C55A.5090900@ipfw.ru> <50CA0161.1060000@FreeBSD.org> <50CB5B8A.8030703@FreeBSD.org> To: Andriy Gapon X-Mailer: Apple Mail (2.1499) Cc: =?iso-8859-1?Q?Ermal_Lu=E7i?= , freebsd-net , "Alexander V. Chernikov" 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: Fri, 14 Dec 2012 17:38:09 -0000 On Dec 14, 2012, at 7:02 PM, Andriy Gapon wrote: > on 13/12/2012 20:57 Ermal Lu=E7i said the following: >>=20 >>=20 >>=20 >> On Thu, Dec 13, 2012 at 5:25 PM, Andriy Gapon > > wrote: >>=20 >> on 13/12/2012 14:08 Alexander V. Chernikov said the following: >>> On 13.12.2012 15:46, Andriy Gapon wrote: >>>>=20 >>>> 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. >>>>=20 >>>> I am not sure how to solve this best. >>>>=20 >>>> 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 =3D=3D >>>> if_xname before any renaming could occur). >>>>=20 >>>> 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. >>>=20 >>> Not exactly. You can register for ifnet_departure_event and = ifnet_arrival_event. >>>=20 >>> Interface renaming is done via sending departure event with old name = and arrvial >>> event with new one. >>=20 >> Good to know. Thank you! >>=20 >>=20 >> So which approach sounds better? >> Or maybe there is even a better one? >>=20 >>=20 >> The best is interface event handling. >> Just recopy the new name from if_xname and should be done. >=20 > There is one problem with the current code which would automatically = apply to the > interface renaming handling. > ng_ether does not do any validation or "normalization" of if_xname and = the name > can contain symbols which are prohibited in a netgraph name, such as = '.' for example. > ng_name_node would fail and warning would be logged but a node would = stay unnamed. > I am a bit reluctant to write "netgraph name escaping" code myself. = Perhaps it > already exists in some place? >=20 > --=20 > Andriy Gapon > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" Hi, Some time ago I had similar issue : = http://lists.freebsd.org/pipermail/freebsd-net/2011-February/027982.html The patch is also in : kern/154850 -- Nikolay=