diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2020-11-14 14:50:39 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-11-23 13:56:48 +0100 |
commit | 1d370b2c182505ff8033fccbebcc56621d305220 (patch) | |
tree | 6f3457cbd20e8453269fd93c85801ddddb0a82a4 /src/network | |
parent | 207194c67f57afde62fc2d49c3ddf4502f02dcd0 (diff) | |
download | systemd-1d370b2c182505ff8033fccbebcc56621d305220.tar.gz |
networkd/dhcp6: allow layer3 devices without MAC
Devices with multicast but without mac addresses i.e. tun devices
are not getting setuped correctly:
$ ip tuntap add mode tun dev tun0
$ ip addr show tun0
16: tun0: <NO-CARRIER,POINTOPOINT,MULTICAST,NOARP,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 500
link/none
$ cat /etc/systemd/network/tun0.network
[Match]
Name = tun0
[Network]
Address=192.168.1.1/32
$ ./systemd-networkd
tun0: DHCP6 CLIENT: Failed to set identifier: Invalid argument
tun0: Failed
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-dhcp-common.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 2537561265..c338c775a7 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -58,9 +58,16 @@ void network_adjust_dhcp(Network *network) { } } +static struct DUID fallback_duid = { .type = DUID_TYPE_EN }; DUID* link_get_duid(Link *link) { if (link->network->duid.type != _DUID_TYPE_INVALID) return &link->network->duid; + else if (link->hw_addr.length == 0 && + (link->manager->duid.type == DUID_TYPE_LLT || + link->manager->duid.type == DUID_TYPE_LL)) + /* Fallback to DUID that works without mac addresses. + * This is useful for tunnel devices without mac address. */ + return &fallback_duid; else return &link->manager->duid; } |