5

I have two Asix USB to ethernet adapters. The FreeBSD determines those as ue1 and ue2 adapters.

The problem is, that on reboot, sometimes the interface ue1 become ue2 and viceversa, which pretty much screws my network configuration. The both adapters have the very similar MAC, and might be the issue when system tries to recognize it.

On the Linux systems, I previously sorted this out by setting static udev rules by adapters mac address. How I can achieve the similar in Freebsd? I know it is related to devd but I'm not sure how to manage it, so the adapters get 'static' name.

usbconfig 
ugen0.1: <DWCOTG OTG Root HUB> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.2: <vendor 0x0424 product 0x9514> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (2mA)
ugen0.3: <vendor 0x0424 product 0xec00> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)
ugen0.4: <ASIX Elec. Corp. AX88179> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (248mA)
ugen0.5: <ASIX Elec. Corp. AX88179> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (248mA)


usbconfig -d ugen0.5 dump_device_desc
ugen0.5: <ASIX Elec. Corp. AX88179> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (248mA)

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0210 
  bDeviceClass = 0x00ff  <Vendor specific>
  bDeviceSubClass = 0x00ff 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0040 
  idVendor = 0x0b95 
  idProduct = 0x1790 
  bcdDevice = 0x0100 
  iManufacturer = 0x0001  <ASIX Elec. Corp.>
  iProduct = 0x0002  <AX88179>
  iSerialNumber = 0x0003  <00000000000114>
  bNumConfigurations = 0x0001 

ugen0.4: <ASIX Elec. Corp. AX88179> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (248mA)

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0210 
  bDeviceClass = 0x00ff  <Vendor specific>
  bDeviceSubClass = 0x00ff 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0040 
  idVendor = 0x0b95 
  idProduct = 0x1790 
  bcdDevice = 0x0100 
  iManufacturer = 0x0001  <ASIX Elec. Corp.>
  iProduct = 0x0002  <AX88179>
  iSerialNumber = 0x0003  <00000000000013>
  bNumConfigurations = 0x0001 
  • 1
    I don't know the answer to your question, but it isn't the similarity of the MAC addresses that causes the issue. It is the fact that are the same "kind" of device (ue) coupled with the fact that the USB probe isn't guaranteed to see the devices in the same order – Fox Jan 16 '18 at 8:03
  • That was my blind guess. And yes, you are correct. – fugitive Jan 16 '18 at 11:14
1

The solution I suggest is call a script on attach that looks at the mac adress and renames the device.

     attach 0 {
             device-name "(ue)[0-9]+";
             action "yourscript $device-name";
     };

Untested:

#!/bin/sh

MAC=`ifconfig $1 | grep ether`

INBOUND_MAC="foo"
OUTBOUND_MAC="bla"

if [ "$MAC" == "$INBOUND_MAC" ]; then
ifconfig $1 name inbound
else
ifconfig $2 name outbound
fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.