Date: Wed, 3 Dec 2014 21:27:26 -0700 (MST) From: Warren Block <wblock@wonkity.com> To: Martin Hanson <greencoppermine@yandex.com> Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org> Subject: Re: NICs devices switches "pshycial" place on each boot Message-ID: <alpine.BSF.2.11.1412032119080.86447@wonkity.com> In-Reply-To: <2659291417665100@web17m.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>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 4 Dec 2014, Martin Hanson wrote:
>> It might need a delay before the device is ready. šRunning devd in the
>> foreground like that will show all the detected events.
>
> Indeed that helped.
>
> This is what I got with the output of messages. I don't know how to either give the device another unique name or somehow intercept what is happening so that I can set the device name.
>
> notify 1000 {
> match "system" "USB";
> match "subsystem" "INTERFACE";
> match "vendor" "0x0b95";
> match "product" "0x1790";
> match "sernum" "0000249B0DE00C";
> match "type" "ATTACH";
> action "logger I HAVE ATTACHED A DEVICE!";
> };
I would use three of these sections, one with the serial number of each
interface. So:
action "ifconfig $device-name name wan inet ..."
action "ifconfig $device-name name dmz inet ..."
action "ifconfig $device-name name lan inet ..."
Then the interface names can be easily used in firewall settings.
From owner-freebsd-net@FreeBSD.ORG Thu Dec 4 04:45:12 2014
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by hub.freebsd.org (Postfix) with ESMTPS id D1C10FFE
for <freebsd-net@freebsd.org>; Thu, 4 Dec 2014 04:45:12 +0000 (UTC)
Received: from forward18.mail.yandex.net (forward18.mail.yandex.net
[IPv6:2a02:6b8:0:1402::3])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "forwards.mail.yandex.net",
Issuer "Certum Level IV CA" (verified OK))
by mx1.freebsd.org (Postfix) with ESMTPS id 8166E395
for <freebsd-net@freebsd.org>; Thu, 4 Dec 2014 04:45:12 +0000 (UTC)
Received: from web20g.yandex.ru (web20g.yandex.ru [95.108.253.229])
by forward18.mail.yandex.net (Yandex) with ESMTP id 7758717812D1;
Thu, 4 Dec 2014 07:45:00 +0300 (MSK)
Received: from 127.0.0.1 (localhost [127.0.0.1])
by web20g.yandex.ru (Yandex) with ESMTP id ED6A06AC0839;
Thu, 4 Dec 2014 07:44:59 +0300 (MSK)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.com; s=mail;
t=1417668300; bh=s6AHQKPHa3IvD8x2fBQ5JkRcT0i3Yi0E8kVvp2F/eBI=;
h=From:To:Cc:In-Reply-To:References:Subject:Date;
b=Q9/J1UBPizq+dbzWljtFWujqsLdBOYzus+R0On8I1icbXV8lzb5SQc4t5G4ylPV6Z
5q92SGkw9rzdpHo1/HgGHZmLCKNooyD3Arwn48VBg5j+wF2Qv/fuHQAQXO8UeaRESq
XAmPiwA1NXuHTuDJMl4YjBMr7ha5OAyccmjvV/3E=
Received: from 108.61.122.70.choopa.net (108.61.122.70.choopa.net
[108.61.122.70]) by web20g.yandex.ru with HTTP;
Thu, 04 Dec 2014 07:44:59 +0300
From: Martin Hanson <greencoppermine@yandex.com>
To: Warren Block <wblock@wonkity.com>
In-Reply-To: <alpine.BSF.2.11.1412032119080.86447@wonkity.com>
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>
Subject: Re: NICs devices switches "pshycial" place on each boot
MIME-Version: 1.0
Message-Id: <1032301417668299@web20g.yandex.ru>
X-Mailer: Yamail [ http://yandex.ru ] 5.0
Date: Thu, 04 Dec 2014 05:44:59 +0100
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=koi8-r
Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-net>,
<mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net/>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
<mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Dec 2014 04:45:13 -0000
>> šThis is what I got with the output of messages. I don't know how to either give the device another unique name or somehow intercept what is happening so that I can set the device name.
>>
>> šnotify 1000 {
>> ššššmatch "system" "USB";
>> ššššmatch "subsystem" "INTERFACE";
>> ššššmatch "vendor" "0x0b95";
>> ššššmatch "product" "0x1790";
>> ššššmatch "sernum" "0000249B0DE00C";
>> ššššmatch "type" "ATTACH";
>> ššššaction "logger I HAVE ATTACHED A DEVICE!";
>> š};
>
> I would use three of these sections, one with the serial number of each
> interface. šSo:
>
> action "ifconfig $device-name name wan inet ..."
> action "ifconfig $device-name name dmz inet ..."
> action "ifconfig $device-name name lan inet ..."
>
> Then the interface names can be easily used in firewall settings.
I tried that as well, but $device-name is empty.
If I do this:
notify 1000 {
match "system" "USB";
match "subsystem" "INTERFACE";
match "vendor" "0x0b95";
match "product" "0x1790";
match "sernum" "0000249B0DE00C";
match "type" "ATTACH";
action "logger DEVICE NAME IS: $device-name.";
};
I get:
<SNIP>
Dec 4 05:44:14 gateway1 kernel: ugen7.2: <ASIX Elec. Corp.> at usbus7
Dec 4 05:44:14 gateway1 kernel: axge0: <NetworkInterface> on usbus7
Dec 4 05:44:14 gateway1 devd: Executing 'logger DEVICE NAME IS: .!'
Dec 4 05:44:14 gateway1 martin: DEVICE NAME IS: .!
Dec 4 05:44:15 gateway1 kernel: miibus1: <MII bus> on axge0
Dec 4 05:44:15 gateway1 kernel: rgephy0: <RTL8169S/8110S/8211 1000BASE-T media interface> PHY 3 on miibus1
Dec 4 05:44:15 gateway1 kernel: rgephy0: none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
Dec 4 05:44:15 gateway1 kernel: ue0: <USB Ethernet> on axge0
Dec 4 05:44:15 gateway1 kernel: ue0: Ethernet address: 00:24:9b:0d:e0:0c
Dec 4 05:44:15 gateway1 devd: Executing '/etc/pccard_ether ue0 start'
Dec 4 05:44:15 gateway1 kernel: ue0: link state changed to DOWN
</SNIP>
Notice the "Dec 4 05:44:14 gateway1 martin: DEVICE NAME IS: .!" part.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.11.1412032119080.86447>
