* [PATCH master] tlv: drop assigned MAC addresses from fixup
@ 2025-08-05 18:53 Ahmad Fatoum
2025-08-06 6:32 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-08-05 18:53 UTC (permalink / raw)
To: barebox; +Cc: Leonard Göhrs, Ahmad Fatoum
A TLV blob may contain more MAC addresses than barebox can assign for
the network devices it knows about. In that case, barebox should assign
as many MAC addresses as it can and fix up the remainder, so the OS can
deal with it.
This got broken during refactoring in reply to upstreaming feedback:
instead of calling string_to_ethaddr on a string, it was called on a
6-byte MAC address.
Swap this to get back the intended behavior.
Fixes: 0b444f05f713 ("common: add barebox TLV support")
Link: https://github.com/linux-automation/meta-lxatac/issues/275
Reported-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
common/tlv/parser.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/common/tlv/parser.c b/common/tlv/parser.c
index 468eeafceda1..fc46092650b1 100644
--- a/common/tlv/parser.c
+++ b/common/tlv/parser.c
@@ -95,8 +95,8 @@ int of_tlv_fixup(struct device_node *root, void *ctx)
list_for_each_entry(addr, ðaddr_list, list) {
char propname[sizeof("address-4294967295")];
- const u8 *enetaddr_a;
- u8 enetaddr_b[ETH_ALEN];
+ const char *enetaddr_tlv_str;
+ u8 enetaddr_tlv[ETH_ALEN];
struct property *pp;
if (!eth_of_get_fixup_node(root, NULL, addr->ethid))
@@ -107,11 +107,11 @@ int of_tlv_fixup(struct device_node *root, void *ctx)
if (!pp)
continue;
- enetaddr_a = of_property_get_value(pp);
- if (string_to_ethaddr(addr->ethaddr, enetaddr_b))
+ enetaddr_tlv_str = of_property_get_value(pp);
+ if (string_to_ethaddr(enetaddr_tlv_str, enetaddr_tlv))
continue;
- if (memcmp(enetaddr_a, enetaddr_b, ETH_ALEN))
+ if (memcmp(enetaddr_tlv, addr->ethaddr, ETH_ALEN))
continue;
of_delete_property(pp);
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH master] tlv: drop assigned MAC addresses from fixup
2025-08-05 18:53 [PATCH master] tlv: drop assigned MAC addresses from fixup Ahmad Fatoum
@ 2025-08-06 6:32 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-08-06 6:32 UTC (permalink / raw)
To: barebox, Ahmad Fatoum; +Cc: Leonard Göhrs
On Tue, 05 Aug 2025 20:53:44 +0200, Ahmad Fatoum wrote:
> A TLV blob may contain more MAC addresses than barebox can assign for
> the network devices it knows about. In that case, barebox should assign
> as many MAC addresses as it can and fix up the remainder, so the OS can
> deal with it.
>
> This got broken during refactoring in reply to upstreaming feedback:
> instead of calling string_to_ethaddr on a string, it was called on a
> 6-byte MAC address.
>
> [...]
Applied, thanks!
[1/1] tlv: drop assigned MAC addresses from fixup
https://git.pengutronix.de/cgit/barebox/commit/?id=2a961db3d91f (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-06 6:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-05 18:53 [PATCH master] tlv: drop assigned MAC addresses from fixup Ahmad Fatoum
2025-08-06 6:32 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox