On Fri, Jan 7, 2022 at 9:32 PM Andrew Lunn <andrew@xxxxxxx> wrote: > > > > You should be thinking of this in more general terms. You want to > > > design a system that will work for any vendors laptop and dock. > > > > > > You need to describe the two interfaces using some sort of bus > > > address, be it PCIe, USB, or a platform device address as used by > > > device tree etc. > > > > > > Let the kernel do whatever it wants with MAC addresses for these two > > > interfaces. The only requirement you have is that the laptop internal > > > interface gets the vendor allocated MAC address, and that the dock get > > > some sort of MAC address, even if it is random. > > > > Those laptops and docks are designed to have duplicated MACs. I don't > > understand why but that's why Dell/HP/Lenovo did. > > But it also sounds like the design is broken. So the question is, is > it possible to actually implement it correctly, without breaking > networking for others with sane laptop/docks/USB dongles. It's possible, just stick to whitelist and never over generalize the device matching rule. > > > What if the kernel just abstract the hardware/firmware as intended, no > > matter how stupid it is, and let userspace to make the right policy? > > Which is exactly what is being suggested here. The kernel gives the > laptop internal interface its MAC address from ACPI or where ever, and > the dock which has no MAC address gets a random MAC address. That is > the normal kernel abstract. Userspace, in the form of udev, can then > change the MAC addresses in whatever way it wants. That's not what I mean. I mean the kernel should do what firmware/hardware expects kernel should do - copy the MAC from ACPI to the external NIC in the dock. Then the userspace can assign a random MAC to external interface if internal interface is already up. > > > But power users may also need to use corporate network to work as > > Aaron mentioned. > > Packets from unregistered MAC can be filtered under corporate network, > > and that's why MAC pass-through is a useful feature that many business > > laptops have. > > Depends on the cooperate network, but power users generally know more > than the IT department, and will just make their machine work, copying > the 802.3x certificate where ever it needs to go, us ebtables to > mangle the MAC address, build their own little network with an RPi > acting as a gateway doing NAT and MAC address translation, etc. That's true, but as someone who work closely with other Distro folks, we really should make this feature works for (hopefully) everyone. Kai-Heng > > Andrew