network-generator: also copy drop-ins for networkd.conf from credential

Follow-up for 1a30285590.
This commit is contained in:
Yu Watanabe 2024-04-16 11:57:23 +09:00
parent 11fc03dfff
commit e12e16e9f7
3 changed files with 17 additions and 13 deletions

View File

@ -128,13 +128,15 @@
<variablelist class='system-credentials'>
<varlistentry>
<term><varname>network.netdev.*</varname></term>
<term><varname>network.conf.*</varname></term>
<term><varname>network.link.*</varname></term>
<term><varname>network.netdev.*</varname></term>
<term><varname>network.network.*</varname></term>
<listitem><para>These credentials should contain valid
<citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>
configuration data. From each matching credential a separate file is created. Example: a passed
credential <filename>network.link.50-foobar</filename> will be copied into a configuration file

View File

@ -138,20 +138,21 @@
</varlistentry>
<varlistentry>
<term><varname>network.netdev.*</varname></term>
<term><varname>network.conf.*</varname></term>
<term><varname>network.link.*</varname></term>
<term><varname>network.netdev.*</varname></term>
<term><varname>network.network.*</varname></term>
<listitem>
<para>Configures network devices. Read by
<citerefentry><refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. These
credentials directly translate to a matching <filename>*.netdev</filename>,
<filename>*.link</filename> or <filename>*.network</filename> file. Example: the contents of a
credential <filename>network.link.50-foobar</filename> will be copied into a file
<filename>50-foobar.link</filename>. See
<citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
These credentials should contain valid
<citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details.</para>
configuration data. From each matching credential a separate file is created. Example: the contents
of a credential <filename>network.link.50-foobar</filename> will be copied into a file
<filename>50-foobar.link</filename>.</para>
<para>Note that the resulting files are created world-readable, it's hence recommended to not include
secrets in these credentials, but supply them via separate credentials directly to

View File

@ -234,9 +234,10 @@ static int run(int argc, char *argv[]) {
RET_GATHER(ret, context_save(&context));
static const PickUpCredential table[] = {
{ "network.link.", NETWORK_UNIT_DIRECTORY, ".link" },
{ "network.netdev.", NETWORK_UNIT_DIRECTORY, ".netdev" },
{ "network.network.", NETWORK_UNIT_DIRECTORY, ".network" },
{ "network.conf.", "/run/systemd/networkd.conf.d/", ".conf" },
{ "network.link.", NETWORK_UNIT_DIRECTORY, ".link" },
{ "network.netdev.", NETWORK_UNIT_DIRECTORY, ".netdev" },
{ "network.network.", NETWORK_UNIT_DIRECTORY, ".network" },
};
RET_GATHER(ret, pick_up_credentials(table, ELEMENTSOF(table)));