conf: Don't fail if the template interface doesn't have a MAC address
...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 match the 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 <sbrivio@redhat.com>
This commit is contained in:
12
conf.c
12
conf.c
@@ -629,10 +629,12 @@ static unsigned int conf_ip4(unsigned int ifi,
|
|||||||
if_indextoname(ifi, ifname), strerror(-rc));
|
if_indextoname(ifi, ifname), strerror(-rc));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MAC_IS_ZERO(mac))
|
||||||
|
memcpy(mac, MAC_LAA, ETH_ALEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IN4_IS_ADDR_UNSPECIFIED(&ip4->addr) ||
|
if (IN4_IS_ADDR_UNSPECIFIED(&ip4->addr))
|
||||||
MAC_IS_ZERO(mac))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ifi;
|
return ifi;
|
||||||
@@ -688,11 +690,13 @@ static unsigned int conf_ip6(unsigned int ifi,
|
|||||||
if_indextoname(ifi, ifname), strerror(-rc));
|
if_indextoname(ifi, ifname), strerror(-rc));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MAC_IS_ZERO(mac))
|
||||||
|
memcpy(mac, MAC_LAA, ETH_ALEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IN6_IS_ADDR_UNSPECIFIED(&ip6->addr) ||
|
if (IN6_IS_ADDR_UNSPECIFIED(&ip6->addr) ||
|
||||||
IN6_IS_ADDR_UNSPECIFIED(&ip6->addr_ll) ||
|
IN6_IS_ADDR_UNSPECIFIED(&ip6->addr_ll))
|
||||||
MAC_IS_ZERO(mac))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ifi;
|
return ifi;
|
||||||
|
1
util.h
1
util.h
@@ -91,6 +91,7 @@
|
|||||||
#define PORT_IS_EPHEMERAL(port) ((port) >= PORT_EPHEMERAL_MIN)
|
#define PORT_IS_EPHEMERAL(port) ((port) >= PORT_EPHEMERAL_MIN)
|
||||||
|
|
||||||
#define MAC_ZERO ((uint8_t [ETH_ALEN]){ 0 })
|
#define MAC_ZERO ((uint8_t [ETH_ALEN]){ 0 })
|
||||||
|
#define MAC_LAA ((uint8_t [ETH_ALEN]){ BIT(1), 0, 0, 0, 0, 0 })
|
||||||
#define MAC_IS_ZERO(addr) (!memcmp((addr), MAC_ZERO, ETH_ALEN))
|
#define MAC_IS_ZERO(addr) (!memcmp((addr), MAC_ZERO, ETH_ALEN))
|
||||||
|
|
||||||
#ifndef __bswap_constant_16
|
#ifndef __bswap_constant_16
|
||||||
|
Reference in New Issue
Block a user