mirror of
https://github.com/systemd/systemd
synced 2024-07-22 10:44:58 +00:00
network/address: make Address= in [Network] support an empty string
Closes #30485.
This commit is contained in:
parent
b993e7e72e
commit
a61738b3a6
|
@ -662,6 +662,9 @@ Table=1234</programlisting></para>
|
|||
number of dynamically created network interfaces with the same network configuration and
|
||||
automatic address range assignment.</para>
|
||||
|
||||
<para>If an empty string is specified, then the all previous assignments in both [Network] and
|
||||
[Address] sections are cleared.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v211"/>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
|
@ -1994,10 +1994,16 @@ int config_parse_address(
|
|||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (streq(section, "Network"))
|
||||
if (streq(section, "Network")) {
|
||||
if (isempty(rvalue)) {
|
||||
/* If an empty string specified in [Network] section, clear previously assigned addresses. */
|
||||
network->addresses_by_section = ordered_hashmap_free_with_destructor(network->addresses_by_section, address_free);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* we are not in an Address section, so use line number instead. */
|
||||
r = address_new_static(network, filename, line, &n);
|
||||
else
|
||||
} else
|
||||
r = address_new_static(network, filename, section_line, &n);
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
|
|
Loading…
Reference in a new issue