From owner-freebsd-questions@FreeBSD.ORG Thu Jan 15 09:43:38 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ABDC106564A; Thu, 15 Jan 2009 09:43:38 +0000 (UTC) (envelope-from yonyossef.lists@gmail.com) Received: from mail-ew0-f30.google.com (mail-ew0-f30.google.com [209.85.219.30]) by mx1.freebsd.org (Postfix) with ESMTP id 583468FC0A; Thu, 15 Jan 2009 09:43:37 +0000 (UTC) (envelope-from yonyossef.lists@gmail.com) Received: by ewy11 with SMTP id 11so333883ewy.19 for ; Thu, 15 Jan 2009 01:43:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:references:subject :date:message-id:mime-version:content-type:content-transfer-encoding :x-mailer:thread-index:x-mimeole:in-reply-to; bh=xsPT3d+0IL9XY84ltFV3bhmX7EL0o5yfqCDtWJlUfdE=; b=YJQGLN2nxQ8UzJdTFa65fUo01S81FSbZadP8vjaS4/svkgFEzz5/WLTX37eXuiKzhb CxV61HMzmJUXBMl4sQ9whhPwToXJP+x2OG04oLAr2ix9oc3AVhLxL+IwfWojXwT1W6RU pWlJ/Ro/LzyYteCx9XkvYbGKM48k+LlSOBYwA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:references:subject:date:message-id:mime-version :content-type:content-transfer-encoding:x-mailer:thread-index :x-mimeole:in-reply-to; b=B+dbKfOKpzihT95cWp3SVljEdMkMcZj9RO2CPp2vGVsvY7VxVCPyD9jR6R0Wc3Gd+w H+u6w4P/O+JteIxRWlY6duzhCsE7XGP9zxyn17Wm0gBD84FiTgJ1/VU4kdpSBOcqYsDq zR1ixULmpSegWCGpm84KaJbTR03LjYbsQr8d0= Received: by 10.66.220.12 with SMTP id s12mr3117666ugg.22.1232012616311; Thu, 15 Jan 2009 01:43:36 -0800 (PST) Received: from mtllpt03 (DSL212-235-20-133.bb.netvision.net.il [212.235.20.133]) by mx.google.com with ESMTPS id k1sm1314945ugf.3.2009.01.15.01.43.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 15 Jan 2009 01:43:35 -0800 (PST) From: "Yony Yossef" To: "'H.fazaeli'" , "Yony Yossef" References: <20def4870901140009y1f007108y92797d5f79ffac08@mail.gmail.com> <496E11B7.3010608@sepehrs.com> <000b01c9768e$745aa160$220f000a@mtl.com> <496EF30E.4010304@sepehrs.com> <000c01c976ec$87e040b0$220f000a@mtl.com> <496F012A.2040807@sepehrs.com> Date: Thu, 15 Jan 2009 11:43:38 +0200 Message-ID: <001601c976f5$c015f7a0$220f000a@mtl.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acl282dJkYXRPzzTRvu2fMZek88u+AAACrCg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 In-Reply-To: <496F012A.2040807@sepehrs.com> Cc: freebsd-net@freebsd.org, freebsd-questions@freebsd.org, Yony Yossef Subject: RE: howto determine network device unit number? device.hints? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 09:43:38 -0000 > Yony Yossef wrote: > > Thanks for the explanation. > > > > So there's no way to determine this in advance.. > > > What do you mean by 'in advance'? Assuming a fixed hardware > configuration, when the kernel is loaded, you know all the > interface names and can rename them, i.e., in rc.local. >From the beginning: I have a FreeBSD7 machine with two network cards, both carry the same device name "mtnic". My driver is a kernel module loaded manualy using kldload. Upon load, the driver registers the net device by the name "mtnic", that is what you see in ifconfig. Problem is, this unit number is not constant and changing arbitrarily every time I reload the driver (card A unit number=0 & card B un=1 or the other way around). Therefore, IP assignment to mtnic0 by /etc/rc.conf may assign an interface with an IP belongs to another subnet, since rc.conf is not changing. Of course I can keep my own MAC-to-interface mapping and rename the interfaces after I load the driver. It doesn't sound like a reasonable solution though. Plus, I still don't understand why the unit number should change at all, instead of being determined according to the card PCI location or some other constant. Yony > > > I must build a script that contains my own mapping between MAC > > addresses and the wanted interface names and run it after > each driver > > load, rename the interfaces if necessary. > > > I do not quite understand your requirement. Can you please explain? > Do you need a script that works on multiple machines with > different hardwares? > > > It seems quite wrong, don't you agree? > > > > And how come the unit number is given an arbitrary value? > Is there a > > good reason for that? > > > > Yony