1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-01 05:47:04 +03:00

network-generator: allow specifying MAC address without MTU

Also, don't panic when both optional arguments are empty. This should
make the syntax compatible-ish with the dracut one from dracut.cmdline(7).

Resolves: #29855
(cherry picked from commit cc5244716baac64e92a1aac5d118c41ac7f82a00)
(cherry picked from commit c3a17ab2fa2eeeab67c3f1085eb9c69630bbd191)
This commit is contained in:
Frantisek Sumsal 2023-11-06 17:46:59 +01:00 committed by Luca Boccassi
parent 4d25f6ce58
commit ce8212b9cf

View File

@ -505,11 +505,13 @@ static int parse_cmdline_ip_mtu_mac(Context *context, const char *ifname, int fa
else
mtu = strndupa_safe(value, p - value);
r = network_set_mtu(context, ifname, family, mtu);
if (r < 0)
return r;
if (!isempty(mtu)) {
r = network_set_mtu(context, ifname, family, mtu);
if (r < 0)
return r;
}
if (!p)
if (!p || isempty(p + 1))
return 0;
r = network_set_mac_address(context, ifname, p + 1);