Monday, May 29, 2017

Re: Can I bind USB/other interface/device number (e.g. cdceX) to particular MAC, USB serial number or the like?

On 05/28/17 22:13, Tinker wrote:
> Hi misc@,
>
> For pluggable devices such as USB NIC:s, is there any way to make
> OpenBSD bind a particular device based on its MAC or USB serial number
> or the like variable, to a particular interface or device filename?

no but ...
...
> (For storage devices there's the DUID-based mounting already though, so
> I guess those are a non-issue.)

right. so we'll ignore those...but that's a hint: there's more than one
way to do things.

> Some things in the OS are specified per interface/device name, e.g. PF
> rules (e.g. "pass in proto tcp from any to cdce0 port 123 rdr-to cdce1
> ..", "match out on cdce0 from 192.168.0.0/16 to any nat-to cdce0"), so
> having the interface numbers garbled on replug may be an unnecessary
> reason to reboot?http://www.providr.com/now/spartans-facts/26/?utm_source=fbkxd&utm_medium=spartan_d_f

My thought would be to have an include file in your pf.conf that defines
a macro to the desired interface to what it happens to be connected as
this moment.

So maybe a hotplugd(8) script that looks at the MAC address (or ...
something else?) of whatever device was just plugged in and create an
entry in /etc/pf/interfaces.inc something like
ext=run0
or
int=run1

as appropriate. Have an 'include "/etc/pf/interfaces.inc" ' in your
pf.conf, and reload pf.conf when a hotplug event takes place.

Nick.

No comments:

Post a Comment