network: prohibit to set MTUBytes= and UseMTU= simultaneously

This commit is contained in:
Yu Watanabe 2018-08-13 16:12:56 +09:00
parent 55dc8c4a82
commit 7169cdc8b9
2 changed files with 7 additions and 0 deletions

View File

@ -1167,6 +1167,7 @@
<listitem>
<para>When true, the interface maximum transmission unit
from the DHCP server will be used on the current link.
If <varname>MTUBytes=</varname> is set, then this setting is ignored.
Defaults to false.</para>
</listitem>
</varlistentry>

View File

@ -281,6 +281,12 @@ static int network_load_one(Manager *manager, const char *filename) {
if (network->ip_masquerade)
network->ip_forward |= ADDRESS_FAMILY_IPV4;
if (network->mtu > 0 && network->dhcp_use_mtu) {
log_warning("MTUBytes= in [Link] section and UseMTU= in [DHCP] section are set in %s. "
"Disabling UseMTU=.", filename);
network->dhcp_use_mtu = false;
}
LIST_PREPEND(networks, manager->networks, network);
r = hashmap_ensure_allocated(&manager->networks_by_name, &string_hash_ops);