From owner-freebsd-net@FreeBSD.ORG Thu Dec 4 04:27:29 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 16781CAA for ; Thu, 4 Dec 2014 04:27:29 +0000 (UTC) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B63281A0 for ; Thu, 4 Dec 2014 04:27:28 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.9/8.14.9) with ESMTP id sB44RQmn097624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 3 Dec 2014 21:27:26 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.9/8.14.9/Submit) with ESMTP id sB44RQeh097621; Wed, 3 Dec 2014 21:27:26 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Wed, 3 Dec 2014 21:27:26 -0700 (MST) From: Warren Block To: Martin Hanson Subject: Re: NICs devices switches "pshycial" place on each boot In-Reply-To: <2659291417665100@web17m.yandex.ru> Message-ID: References: <1511041417624247@web23g.yandex.ru> <212351417642134@web20h.yandex.ru> <2659291417665100@web17m.yandex.ru> User-Agent: Alpine 2.11 (BSF 23 2013-08-11) MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Wed, 03 Dec 2014 21:27:26 -0700 (MST) Content-Type: TEXT/PLAIN; charset=koi8-r; format=flowed Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 04:27:29 -0000 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: 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 ; 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 ; 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 To: Warren Block In-Reply-To: References: <1511041417624247@web23g.yandex.ru> <212351417642134@web20h.yandex.ru> <2659291417665100@web17m.yandex.ru> 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" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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: Dec 4 05:44:14 gateway1 kernel: ugen7.2: at usbus7 Dec 4 05:44:14 gateway1 kernel: axge0: 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: on axge0 Dec 4 05:44:15 gateway1 kernel: rgephy0: 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: 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 Notice the "Dec 4 05:44:14 gateway1 martin: DEVICE NAME IS: .!" part.