Merge pull request #29827 from yuwata/network-install-default-configs

network: add meson option to install default configs
This commit is contained in:
Lennart Poettering 2023-11-03 11:37:04 +01:00 committed by GitHub
commit fe1f83e559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 60 additions and 23 deletions

10
NEWS
View File

@ -305,6 +305,16 @@ CHANGES WITH 255 in spe:
link-local addressing if ip=link-local is specified on the kernel
command line.
* The prefix of the configuration files generated by the network
generator from the kernel command line is now prefixed with '70-',
to make them have higher precedence over the default configuration
files.
* Added -Ddefault-network=BOOL meson option, to make install more
default .network files, which match more generic setups, e.g.
89-ethernet.network matches all Ethernet interfaces and enables both
DHCPv4 and DHCPv6 clients.
Changes in systemd-analyze:
* "systemd-analyze plot" has gained tooltips on each unit name with

View File

@ -40,8 +40,8 @@
<filename>/etc/systemd/network</filename>. All configuration files are collectively sorted and
processed in alphanumeric order, regardless of the directories in which they live. However, files
with identical filenames replace each other. It is recommended that each filename is prefixed with
a number (e.g. <filename>10-eth0.link</filename>). Otherwise, the default
<filename>.link</filename> files or those generated by
a number smaller than <literal>70</literal> (e.g. <filename>10-eth0.link</filename>). Otherwise, the
default <filename>.link</filename> files or those generated by
<citerefentry><refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
may take precedence over user configured files. Files in <filename>/etc/</filename> have the
highest priority, files in <filename>/run/</filename> take precedence over files with the same name

View File

@ -46,8 +46,8 @@
<filename>/etc/systemd/network</filename>. All configuration files are collectively sorted and
processed in alphanumeric order, regardless of the directories in which they live. However, files
with identical filenames replace each other. It is recommended that each filename is prefixed with
a number (e.g. <filename>10-vlan.netdev</filename>). Otherwise, <filename>.netdev</filename> files
generated by
a number smaller than <literal>70</literal> (e.g. <filename>10-vlan.netdev</filename>). Otherwise,
<filename>.netdev</filename> files generated by
<citerefentry><refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
may take precedence over user configured files. Files in <filename>/etc/</filename> have the
highest priority, files in <filename>/run/</filename> take precedence over files with the same name

View File

@ -44,8 +44,8 @@
<filename>/etc/systemd/network</filename>. All configuration files are collectively sorted and
processed in alphanumeric order, regardless of the directories in which they live. However, files
with identical filenames replace each other. It is recommended that each filename is prefixed with
a number (e.g. <filename>10-eth0.network</filename>). Otherwise, the default
<filename>.network</filename> files or those generated by
a number smaller than <literal>70</literal> (e.g. <filename>10-eth0.network</filename>). Otherwise, the
default <filename>.network</filename> files or those generated by
<citerefentry><refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
may take precedence over user configured files. Files in <filename>/etc/</filename> have the highest
priority, files in <filename>/run/</filename> take precedence over files with the same name under

View File

@ -130,6 +130,8 @@ option('homed', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : '
description : 'install the systemd-homed stack')
option('networkd', type : 'boolean',
description : 'install the systemd-networkd stack')
option('default-network', type : 'boolean', value : true,
description : 'install default .network files')
option('timedated', type : 'boolean',
description : 'install the systemd-timedated daemon')
option('timesyncd', type : 'boolean',

View File

@ -16,6 +16,5 @@ Property=ID_NET_AUTO_LINK_LOCAL_ONLY=1
[Network]
LinkLocalAddressing=yes
DHCP=no
IPv6AcceptRA=no
MulticastDNS=yes

View File

@ -27,4 +27,5 @@ DHCPServer=yes
IPMasquerade=both
LLDP=yes
EmitLLDP=customer-bridge
IPv6AcceptRA=no
IPv6SendRA=yes

View File

@ -26,4 +26,5 @@ DHCPServer=yes
IPMasquerade=both
LLDP=yes
EmitLLDP=customer-bridge
IPv6AcceptRA=no
IPv6SendRA=yes

View File

@ -26,4 +26,5 @@ DHCPServer=yes
IPMasquerade=both
LLDP=yes
EmitLLDP=customer-bridge
IPv6AcceptRA=no
IPv6SendRA=yes

View File

@ -17,3 +17,5 @@ WLANInterfaceType=ad-hoc
[Network]
LinkLocalAddressing=yes
IPv6AcceptRA=no
MulticastDNS=yes

View File

@ -17,3 +17,5 @@ WLANInterfaceType=ap
Address=0.0.0.0/24
DHCPServer=yes
IPMasquerade=both
IPv6AcceptRA=no
IPv6SendRA=yes

View File

@ -1,22 +1,41 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_NETWORKD') == 1
install_data('80-6rd-tunnel.network',
'80-container-host0.network',
'80-container-vb.network',
'80-container-ve.network',
'80-container-vz.network',
'80-ethernet.network.example',
'80-vm-vt.network',
'80-wifi-adhoc.network',
'80-wifi-ap.network.example',
'80-wifi-station.network.example',
install_dir : networkdir)
install_data(
'80-6rd-tunnel.network',
'80-container-host0.network',
'80-container-vb.network',
'80-container-ve.network',
'80-container-vz.network',
'80-vm-vt.network',
'80-wifi-adhoc.network',
install_dir : networkdir)
if install_sysconfdir
install_emptydir(sysconfdir / 'systemd/network')
example_network_files = files(
'80-auto-link-local.network.example',
'89-ethernet.network.example',
'80-wifi-ap.network.example',
'80-wifi-station.network.example',
)
if get_option('default-network')
foreach f : example_network_files
install_data(
f,
rename : fs.replace_suffix(f, ''),
install_dir : networkdir)
endforeach
else
install_data(
example_network_files,
install_dir : networkdir)
endif
endif
install_data('99-default.link',
install_dir : networkdir)
if install_sysconfdir
install_emptydir(sysconfdir / 'systemd/network')
endif

View File

@ -33,7 +33,7 @@ static int network_save(Network *network, const char *dest_dir) {
if (asprintf(&p, "%s/%s-%s.network",
dest_dir,
isempty(network->ifname) ? "91" : "90",
isempty(network->ifname) ? "71" : "70",
isempty(network->ifname) ? "default" : network->ifname) < 0)
return log_oom();
@ -59,7 +59,7 @@ static int netdev_save(NetDev *netdev, const char *dest_dir) {
netdev_dump(netdev, f);
if (asprintf(&p, "%s/90-%s.netdev", dest_dir, netdev->ifname) < 0)
if (asprintf(&p, "%s/70-%s.netdev", dest_dir, netdev->ifname) < 0)
return log_oom();
r = conservative_rename(temp_path, p);
@ -86,7 +86,7 @@ static int link_save(Link *link, const char *dest_dir) {
if (asprintf(&p, "%s/%s-%s.link",
dest_dir,
!isempty(link->ifname) ? "90" : !hw_addr_is_null(&link->mac) ? "91" : "92",
!isempty(link->ifname) ? "70" : !hw_addr_is_null(&link->mac) ? "71" : "72",
link->filename) < 0)
return log_oom();