* [PATCH pve-network] sdn: controller: fallback to interface mac if no master
@ 2026-02-13 6:33 Hannes Laimer
2026-02-18 9:56 ` Gabriel Goller
0 siblings, 1 reply; 2+ messages in thread
From: Hannes Laimer @ 2026-02-13 6:33 UTC (permalink / raw)
To: pve-devel
For IPv6 underlays, we can't directly use the IP for the router-id.
Therefore, `get_router_id` derives a unique ID from the last 4 bytes of
the interface MAC.
However, the current MAC retrieval logic only checks the master device.
This fails for standalone interfaces that do not have a master, such as
`dummy_` interfaces used for fabrics.
Update `read_iface_mac` to fall back to the interface's own address if
no master address is found.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
src/PVE/Network/SDN/Controllers/Plugin.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Network/SDN/Controllers/Plugin.pm b/src/PVE/Network/SDN/Controllers/Plugin.pm
index d70e518..cab036a 100644
--- a/src/PVE/Network/SDN/Controllers/Plugin.pm
+++ b/src/PVE/Network/SDN/Controllers/Plugin.pm
@@ -105,7 +105,9 @@ sub on_update_hook {
sub read_iface_mac {
my ($iface) = @_;
- return PVE::Tools::file_read_firstline("/sys/class/net/$iface/master/address");
+ my $mac = PVE::Tools::file_read_firstline("/sys/class/net/$iface/master/address");
+ return $mac if $mac;
+ return PVE::Tools::file_read_firstline("/sys/class/net/$iface/address");
}
sub get_router_id {
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH pve-network] sdn: controller: fallback to interface mac if no master
2026-02-13 6:33 [PATCH pve-network] sdn: controller: fallback to interface mac if no master Hannes Laimer
@ 2026-02-18 9:56 ` Gabriel Goller
0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Goller @ 2026-02-18 9:56 UTC (permalink / raw)
To: Hannes Laimer; +Cc: pve-devel
On 13.02.2026 07:33, Hannes Laimer wrote:
> For IPv6 underlays, we can't directly use the IP for the router-id.
> Therefore, `get_router_id` derives a unique ID from the last 4 bytes of
> the interface MAC.
>
> However, the current MAC retrieval logic only checks the master device.
> This fails for standalone interfaces that do not have a master, such as
> `dummy_` interfaces used for fabrics.
>
> Update `read_iface_mac` to fall back to the interface's own address if
> no master address is found.
>
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
LGTM!
Consider:
Reviewed-by: Gabriel Goller <g.goller@proxmox.com>
> src/PVE/Network/SDN/Controllers/Plugin.pm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/PVE/Network/SDN/Controllers/Plugin.pm b/src/PVE/Network/SDN/Controllers/Plugin.pm
> index d70e518..cab036a 100644
> --- a/src/PVE/Network/SDN/Controllers/Plugin.pm
> +++ b/src/PVE/Network/SDN/Controllers/Plugin.pm
> @@ -105,7 +105,9 @@ sub on_update_hook {
>
> sub read_iface_mac {
> my ($iface) = @_;
> - return PVE::Tools::file_read_firstline("/sys/class/net/$iface/master/address");
> + my $mac = PVE::Tools::file_read_firstline("/sys/class/net/$iface/master/address");
> + return $mac if $mac;
> + return PVE::Tools::file_read_firstline("/sys/class/net/$iface/address");
> }
>
> sub get_router_id {
> --
> 2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-18 9:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-13 6:33 [PATCH pve-network] sdn: controller: fallback to interface mac if no master Hannes Laimer
2026-02-18 9:56 ` Gabriel Goller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.