Add a common location in the network stack to store the original MAC address for an interface. It will be preserved even if the working MAC address has changed due to being manually set w/ `ifconfig', or being part of a lagg(4). Discussed on freebsd-hackers@ in thread "Common storage of original MAC address": https://lists.freebsd.org/pipermail/freebsd-hackers/2014-August/thread.html#45822 https://lists.freebsd.org/pipermail/freebsd-hackers/2014-September/thread.html#45955
Created attachment 148347 [details] Patch to add common storage of original MAC address 194386.patch - Patch to implement the desired functionality, as discussed on freebsd-hackers@.
Brooks / Allan / John - since you all chimed in on the thread where this was designed, could one of you review this and submit it for me? Thanks!
Urk. https://svnweb.freebsd.org/base?view=revision&revision=274231 just made it into -HEAD. It removes 'struct arpcom', which slightly... destroys this patch. And just after I harassed jhb@ at the DevSummit about submitting it for me! :-( glebius@ - how do you suggest I rework this patch in light of your removal of 'struct arpcom'?
Ravi, I grabbed the PR to not forget about the problem and address during my ifnet work, that I am doing in head.
Thanks Gleb.
any news? because will be great to have a way to "reset" the mac address, maybe through ifconfig. thanks
Gleb, My understanding is that (the bulk of?) your "struct ifnet" work is done. When do you think you could get to this? Thanks!
Unfortunately no. And it is likely that it won't be done before 11.0-RELEASE. https://wiki.freebsd.org/projects/ifnet
Re-worked diff: https://reviews.freebsd.org/D10609
A commit references this bug: Author: rpokala Date: Wed May 10 22:13:48 UTC 2017 New revision: 318160 URL: https://svnweb.freebsd.org/changeset/base/318160 Log: Persistently store NIC's hardware MAC address, and add a way to retrive it The MAC address reported by `ifconfig ${nic} ether' does not always match the address in the hardware, as reported by the driver during attach. In particular, NICs which are components of a lagg(4) interface all report the same MAC. When attaching, the NIC driver passes the MAC address it read from the hardware as an argument to ether_ifattach(). Keep a second copy of it, and create ioctl(SIOCGHWADDR) to return it. Teach `ifconfig' to report it along with the active MAC address. PR: 194386 Reviewed by: glebius MFC after: 1 week Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D10609 Changes: head/sbin/ifconfig/af_link.c head/sys/net/if.c head/sys/net/if_ethersubr.c head/sys/net/if_var.h head/sys/sys/sockio.h
A commit references this bug: Author: rpokala Date: Wed May 17 05:53:25 UTC 2017 New revision: 318397 URL: https://svnweb.freebsd.org/changeset/base/318397 Log: MFC r318160, 318176: Persistently store NIC's hardware MAC address, and add a way to retrive it The MAC address reported by `ifconfig ${nic} ether' does not always match the address in the hardware, as reported by the driver during attach. In particular, NICs which are components of a lagg(4) interface all report the same MAC. When attaching, the NIC driver passes the MAC address it read from the hardware as an argument to ether_ifattach(). Keep a second copy of it, and create ioctl(SIOCGHWADDR) to return it. Teach `ifconfig' to report it along with the active MAC address. PR: 194386 Changes: _U stable/11/ stable/11/sbin/ifconfig/af_link.c stable/11/sys/net/if.c stable/11/sys/net/if_ethersubr.c stable/11/sys/net/if_var.h stable/11/sys/sys/sockio.h
A commit references this bug: Author: rpokala Date: Wed May 17 22:29:26 UTC 2017 New revision: 318430 URL: https://svnweb.freebsd.org/changeset/base/318430 Log: MFC r318160, 318176: Persistently store NIC's hardware MAC address, and add a way to retrive it NOTE: Due to restructuring, the merges didn't apply cleanly; the resulting change is almost identical to what went into stable/11, but in some cases in different locations. The MAC address reported by `ifconfig ${nic} ether' does not always match the address in the hardware, as reported by the driver during attach. In particular, NICs which are components of a lagg(4) interface all report the same MAC. When attaching, the NIC driver passes the MAC address it read from the hardware as an argument to ether_ifattach(). Keep a second copy of it, and create ioctl(SIOCGHWADDR) to return it. Teach `ifconfig' to report it along with the active MAC address. PR: 194386 Changes: _U stable/10/ stable/10/sbin/ifconfig/af_link.c stable/10/sys/net/if.c stable/10/sys/net/if_ethersubr.c stable/10/sys/net/if_var.h stable/10/sys/sys/sockio.h
A commit references this bug: Author: rpokala Date: Thu May 18 23:41:18 UTC 2017 New revision: 318504 URL: https://svnweb.freebsd.org/changeset/base/318504 Log: Persistently store NIC's hardware MAC address, and add a way to retrive it jhb pointed out that (struct ifnet) is part of the network driver KBI, and thus the offsets of internal fields must not change. Therefore, move the new "if_hw_addr" field to the end, and consume one of the "if_pspare"s; that's what they're there for. The new field replaces the *last* element of that array; that way, offsetof(if_pspare) and offsetof(if_ispare) are unchanged compared to before r318397. PR: 194386 Reviewed by: jhb Pointyhat to: rpokala Sponsored by: Panasas Changes: stable/11/sys/net/if_var.h
A commit references this bug: Author: rpokala Date: Thu May 18 23:41:34 UTC 2017 New revision: 318505 URL: https://svnweb.freebsd.org/changeset/base/318505 Log: Persistently store NIC's hardware MAC address, and add a way to retrive it jhb pointed out that (struct ifnet) is part of the network driver KBI, and thus the offsets of internal fields must not change. Therefore, move the new "if_hw_addr" field to the end, and consume one of the "if_pspare"s; that's what they're there for. Because netmap on stable/10 uses "if_pspare[0]", the new field replaces the *last* element of that array; that way, offsetof(if_pspare) is unchanged compared to before r318430. PR: 194386 Reviewed by: jhb Pointyhat to: rpokala Sponsored by: Panasas Changes: stable/10/sys/net/if_var.h