public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pve-network] sdn: controller: prevent invalid router-id generation from zero mac
@ 2026-02-13  6:38 Hannes Laimer
  2026-02-18  9:54 ` Gabriel Goller
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Laimer @ 2026-02-13  6:38 UTC (permalink / raw)
  To: pve-devel

When a standard loopback interface is used, the retrieved MAC is
typically 00:00:00:00:00:00. This causes the router-id generation logic
to produce "0.0.0.0", which is an invalid BGP ID.

Explicitly check for a zero MAC address and fail with a descriptive
error.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 src/PVE/Network/SDN/Controllers/Plugin.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/PVE/Network/SDN/Controllers/Plugin.pm b/src/PVE/Network/SDN/Controllers/Plugin.pm
index d70e518..54d6402 100644
--- a/src/PVE/Network/SDN/Controllers/Plugin.pm
+++ b/src/PVE/Network/SDN/Controllers/Plugin.pm
@@ -118,6 +118,11 @@ sub get_router_id {
 
     die "can't autofind a router-id value from ip or mac" if !$mac;
 
+    if ($mac eq '00:00:00:00:00:00') {
+        die "Interface $iface has a zero MAC address. Cannot derive a BGP router-id. "
+            . "Please use a dummy interface or assign an IPv4 address to $iface.\n";
+    }
+
     my @mac_bytes = split(':', $mac);
     return
         hex($mac_bytes[2]) . "."
-- 
2.47.3





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH pve-network] sdn: controller: prevent invalid router-id generation from zero mac
  2026-02-13  6:38 [PATCH pve-network] sdn: controller: prevent invalid router-id generation from zero mac Hannes Laimer
@ 2026-02-18  9:54 ` Gabriel Goller
  0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Goller @ 2026-02-18  9:54 UTC (permalink / raw)
  To: Hannes Laimer; +Cc: pve-devel

On 13.02.2026 07:38, Hannes Laimer wrote:
> When a standard loopback interface is used, the retrieved MAC is
> typically 00:00:00:00:00:00. This causes the router-id generation logic
> to produce "0.0.0.0", which is an invalid BGP ID.
> 
> Explicitly check for a zero MAC address and fail with a descriptive
> error.
> 
> 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 | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/PVE/Network/SDN/Controllers/Plugin.pm b/src/PVE/Network/SDN/Controllers/Plugin.pm
> index d70e518..54d6402 100644
> --- a/src/PVE/Network/SDN/Controllers/Plugin.pm
> +++ b/src/PVE/Network/SDN/Controllers/Plugin.pm
> @@ -118,6 +118,11 @@ sub get_router_id {
>  
>      die "can't autofind a router-id value from ip or mac" if !$mac;
>  
> +    if ($mac eq '00:00:00:00:00:00') {
> +        die "Interface $iface has a zero MAC address. Cannot derive a BGP router-id. "
> +            . "Please use a dummy interface or assign an IPv4 address to $iface.\n";
> +    }
> +
>      my @mac_bytes = split(':', $mac);
>      return
>          hex($mac_bytes[2]) . "."
> -- 
> 2.47.3




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-18  9:54 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:38 [PATCH pve-network] sdn: controller: prevent invalid router-id generation from zero mac Hannes Laimer
2026-02-18  9:54 ` Gabriel Goller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal