Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jan 2009 11:43:38 +0200
From:      "Yony Yossef" <yonyossef.lists@gmail.com>
To:        "'H.fazaeli'" <fazaeli@sepehrs.com>, "Yony Yossef" <yonyossef.lists@gmail.com>
Cc:        freebsd-net@freebsd.org, freebsd-questions@freebsd.org, Yony Yossef <yonyossef.lists@gmail.com>
Subject:   RE: howto determine network device unit number? device.hints?
Message-ID:  <001601c976f5$c015f7a0$220f000a@mtl.com>
In-Reply-To: <496F012A.2040807@sepehrs.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

> 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<unit
number>", 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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001601c976f5$c015f7a0$220f000a>