From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id 491205A0276; Fri, 12 Apr 2024 00:18:00 +0200 (CEST) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH] conf: Don't fail if the template interface doesn't have a MAC address Date: Fri, 12 Apr 2024 00:18:00 +0200 Message-ID: <20240411221800.548166-1-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: LQBKNX4DNZJ7XEIIF3GBJPOAE63VEHYF X-Message-ID-Hash: LQBKNX4DNZJ7XEIIF3GBJPOAE63VEHYF X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ...simply resort to using locally-administered address (LAA) as host-side source, instead. Pick 02:00:00:00:00:00, to make it clear that we don't actually care about that address, and also to matchthe 00 (Administratively Assigned Identifier) quadrant of SLAP (RFC 8948). Otherwise, pasta refuses to start if the template is a tun or Wireguard interface. Link: https://bugs.passt.top/show_bug.cgi?id=49 Link: https://github.com/containers/podman/issues/22320 Signed-off-by: Stefano Brivio --- conf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/conf.c b/conf.c index 90d3436..3f30725 100644 --- a/conf.c +++ b/conf.c @@ -629,10 +629,12 @@ static unsigned int conf_ip4(unsigned int ifi, if_indextoname(ifi, ifname), strerror(-rc)); return 0; } + + if (MAC_IS_ZERO(mac)) + memcpy(mac, MAC_LAA, ETH_ALEN); } - if (IN4_IS_ADDR_UNSPECIFIED(&ip4->addr) || - MAC_IS_ZERO(mac)) + if (IN4_IS_ADDR_UNSPECIFIED(&ip4->addr)) return 0; return ifi; @@ -688,11 +690,13 @@ static unsigned int conf_ip6(unsigned int ifi, if_indextoname(ifi, ifname), strerror(-rc)); return 0; } + + if (MAC_IS_ZERO(mac)) + memcpy(mac, MAC_LAA, ETH_ALEN); } if (IN6_IS_ADDR_UNSPECIFIED(&ip6->addr) || - IN6_IS_ADDR_UNSPECIFIED(&ip6->addr_ll) || - MAC_IS_ZERO(mac)) + IN6_IS_ADDR_UNSPECIFIED(&ip6->addr_ll)) return 0; return ifi; -- 2.43.0