[PATCH RFC] Revert "generic: write back netdev MAC-address to device-tree"
Bjørn Mork
bjorn at mork.no
Sat Jan 7 04:44:21 PST 2023
Christian Marangi <ansuelsmth at gmail.com> writes:
> On Sat, Jan 07, 2023 at 01:05:42PM +0100, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal at milecki.pl>
>>
>> This reverts commit cd39aba402ea7e7a11e173b0b5aa96e42bf1f2ac.
>>
>> Adding "mac-address" property to the device tree seems to be done to
>> allow reading it using procfs (/proc/device-tree/). It seems like a hack
>> without a proper explanation WHY do we need that.
>>
>> Reading MAC address can be done other ways including fs based:
>> cat /sys/class/net/<foo>/address
>>
>> Cc: David Bauer <mail at david-bauer.net>
>> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
>> ---
>> David, everyone,
>>
>> it seems this patch never ended up being sent upstream and it sits in
>> our tree without actual explanation why do we need that.
>>
>> I was wondering if we can just drop it?
>
> I remember me dropping the patch when nvmem was introduced but that
> caused some regression as some script still used the procfs way... we
> should find and fix the affected script before dropping this.
>
> (hoping a simple grep is enough)
>From package/base-files/files/lib/functions/system.sh:
get_mac_label_dt() {
local basepath="/proc/device-tree"
local macdevice="$(cat "$basepath/aliases/label-mac-device" 2>/dev/null)"
local macaddr
[ -n "$macdevice" ] || return
macaddr=$(get_mac_binary "$basepath/$macdevice/mac-address" 0 2>/dev/null)
[ -n "$macaddr" ] || macaddr=$(get_mac_binary "$basepath/$macdevice/local-mac-address" 0 2>/dev/null)
echo $macaddr
}
Bjørn
More information about the openwrt-devel
mailing list