Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Dec 2014 16:36:23 -0700 (MST)
From:      Warren Block <wblock@wonkity.com>
To:        Martin Hanson <greencoppermine@yandex.com>
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>, Ian Smith <smithi@nimnet.asn.au>
Subject:   Re: NICs devices switches "pshycial" place on each boot (SOLVED)
Message-ID:  <alpine.BSF.2.11.1412041615420.88933@wonkity.com>
In-Reply-To: <151421417731675@web18h.yandex.ru>
References:  <1511041417624247@web23g.yandex.ru> <alpine.BSF.2.11.1412031024340.32996@wonkity.com> <212351417642134@web20h.yandex.ru> <alpine.BSF.2.11.1412031601220.13301@wonkity.com> <2659291417665100@web17m.yandex.ru> <alpine.BSF.2.11.1412032119080.86447@wonkity.com> <2704971417669266@web25m.yandex.ru> <20141204180007.Q85722@sola.nimnet.asn.au> <151421417731675@web18h.yandex.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 4 Dec 2014, Martin Hanson wrote:

> I managed to get this working.
>
> It is a dirty hack and I REALLY wish FreeBSD would make documentation
> as high a priority as the guys at OpenBSD.
>
> It is difficult to locate correct and updated documentation, especially
> about devd. Yes, the man page has information about devd, and devd.conf
> even come with examples, but those examples are too sparsome to be of
> any real use when things get just a little bit complicated.
>
> It is extremely frustration to spend hour of hours of wasted time
> getting something to work, not because it doesn't work, but simply
> because you're "throwing stones in the dark" in the hopes of hitting
> the right target - because the correct and comprehensive documentation
> is lacking.
>
> A quality product HAS to have correct, updated and comprehensive
> documentation. This is one point that really makes the OpenBSD guys
> stand out deserving laud applause.

We work at it, but it is difficult to cover everything.  It would be 
nice to have a section in the Handbook on devd.  If you would like to 
submit or work on something like that, I can help (I'm a doc committer).

> attach 100 {
>    device-name "axge[0-9]+";
>    match "vendor" "0x0b95";
>    match "product" "0x1790";
>    match "sernum" "0000249B0DE00C";
>    # We need to wait a little for the interface to get up.
>    action "sleep 3";
>    # We don't know what number the interface has been assigned, but we know it is from axgeX,
>    # so we get the X, use it in "ueX" and then rename the interface which is then bound to the
>    # serialnumber, so the correct card will always get the right interface, ie. our own, not ueX.
>    action "ifconfig ue`echo $device-name | tr -dc '[0-9]'` name olan";
>    action "ifconfig olan inet 192.168.1.1 netmask 255.255.255.0";
> };
>
> I hope someone else might find this useful or perhaps even provide a cleaner approach.

There are several similar ways to deal with the device name.  For 
example:

   action "ifconfig `echo $device-name | sed -e 's/axge/ue/'` name olan inet 192.168.1.1/24";
   action "ifconfig ue${device-name##axge} name olan inet 192.168.1.1/24";

(Untested, and sorry about wrapping.)  Both examples use the shorter 
CIDR notation for the netmask, and set the name and IP address at the 
same time... which ought to work, but I did not test.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.11.1412041615420.88933>