[systemd-commits] 2 commits - Makefile.am man/systemd-networkd.service.xml man/udev.xml src/network src/shared src/udev
Tom Gundersen
tomegun at kemper.freedesktop.org
Fri Feb 21 07:04:55 PST 2014
Makefile.am | 2 +-
man/systemd-networkd.service.xml | 20 ++++++++++++++++++++
man/udev.xml | 9 +++++++++
src/network/networkd-netdev-gperf.gperf | 7 ++++---
src/network/networkd-netdev.c | 6 +++---
src/network/networkd-network-gperf.gperf | 1 +
src/network/networkd-network.c | 1 +
src/network/networkd.h | 8 +++++---
src/shared/net-util.c | 4 ++++
src/shared/net-util.h | 1 +
src/udev/net/link-config-gperf.gperf | 1 +
src/udev/net/link-config.c | 6 +++---
src/udev/net/link-config.h | 1 +
13 files changed, 54 insertions(+), 13 deletions(-)
New commits:
commit 74fae4240f670fe5a39a82a71abad367d18caefa
Author: Samuli Suominen <ssuominen at gentoo.org>
Date: Fri Feb 21 16:14:51 2014 +0200
build-sys: make network files respect --rootprefix
With --rootprefix= systemd-udevd gets installed to /lib/systemd, and since
the network configuration is also required during early boot, it should be
available there with it. Using --prefix= is not an option since it would
put everything, including pkg-config files, man pages, documentation, to /
which is not wanted. This commit puts 99-default.link to
/lib/systemd/network/ when required.
diff --git a/Makefile.am b/Makefile.am
index f6c22bd..1fc23f7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -87,7 +87,7 @@ userunitdir=$(prefix)/lib/systemd/user
userpresetdir=$(prefix)/lib/systemd/user-preset
tmpfilesdir=$(prefix)/lib/tmpfiles.d
sysctldir=$(prefix)/lib/sysctl.d
-networkdir=$(prefix)/lib/systemd/network
+networkdir=$(rootprefix)/lib/systemd/network
pkgincludedir=$(includedir)/systemd
systemgeneratordir=$(rootlibexecdir)/system-generators
usergeneratordir=$(prefix)/lib/systemd/user-generators
commit edbb03e95a3c31bf719d5c6c46eec14d0bcb9c8f
Author: Tom Gundersen <teg at jklm.no>
Date: Fri Feb 21 14:51:19 2014 +0100
.network/.netdev/.link: allow to match on architecture
diff --git a/man/systemd-networkd.service.xml b/man/systemd-networkd.service.xml
index 69157b1..91e1392 100644
--- a/man/systemd-networkd.service.xml
+++ b/man/systemd-networkd.service.xml
@@ -133,6 +133,16 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>Architecture</varname></term>
+ <listitem>
+ <para>Checks whether the system is running on a specific
+ architecture. See <literal>ConditionArchitecture=</literal> in
+ <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for details.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>The <literal>[NetDev]</literal> section accepts the following
@@ -257,6 +267,16 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>Architecture</varname></term>
+ <listitem>
+ <para>Checks whether the system is running on a specific
+ architecture. See <literal>ConditionArchitecture=</literal> in
+ <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for details.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>The <literal>[Network]</literal> section accepts the following keys:</para>
diff --git a/man/udev.xml b/man/udev.xml
index 3dd2b48..9e00933 100644
--- a/man/udev.xml
+++ b/man/udev.xml
@@ -845,6 +845,15 @@
for details.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>Architecture</varname></term>
+ <listitem>
+ <para>Checks whether the system is running on a specific
+ architecture. See <literal>ConditionArchitecture=</literal> in
+ <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for details.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>The <literal>[Link]</literal> section accepts the following keys:</para>
diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf
index cdaacb1..7dd47f9 100644
--- a/src/network/networkd-netdev-gperf.gperf
+++ b/src/network/networkd-netdev-gperf.gperf
@@ -15,9 +15,10 @@ struct ConfigPerfItem;
%struct-type
%includes
%%
-Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(NetDev, condition_host)
-Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(NetDev, condition_virt)
-Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(NetDev, condition_kernel)
+Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(NetDev, match_host)
+Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(NetDev, match_virt)
+Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(NetDev, match_kernel)
+Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(NetDev, match_arch)
NetDev.Description, config_parse_string, 0, offsetof(NetDev, description)
NetDev.Name, config_parse_ifname, 0, offsetof(NetDev, name)
NetDev.Kind, config_parse_netdev_kind, 0, offsetof(NetDev, kind)
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 773163d..c3bda6d 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -364,9 +364,9 @@ static int netdev_load_one(Manager *manager, const char *filename) {
return log_oom();
if (net_match_config(NULL, NULL, NULL, NULL, NULL,
- netdev->condition_host, netdev->condition_virt,
- netdev->condition_kernel, NULL, NULL, NULL,
- NULL, NULL) <= 0)
+ netdev->match_host, netdev->match_virt,
+ netdev->match_kernel, netdev->match_arch,
+ NULL, NULL, NULL, NULL, NULL) <= 0)
return 0;
r = hashmap_put(netdev->manager->netdevs, netdev->name, netdev);
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 011f7e9..44aeb9c 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -23,6 +23,7 @@ Match.Name, config_parse_ifname, 0,
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(Network, match_host)
Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(Network, match_virt)
Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(Network, match_kernel)
+Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, match_arch)
Network.Description, config_parse_string, 0, offsetof(Network, description)
Network.Bridge, config_parse_bridge, 0, offsetof(Network, bridge)
Network.Bond, config_parse_bond, 0, offsetof(Network, bond)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 3119471..2e68bec 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -177,6 +177,7 @@ int network_get(Manager *manager, struct udev_device *device, Network **ret) {
network->match_driver, network->match_type,
network->match_name, network->match_host,
network->match_virt, network->match_kernel,
+ network->match_arch,
udev_device_get_sysattr_value(device, "address"),
udev_device_get_property_value(device, "ID_PATH"),
udev_device_get_driver(udev_device_get_parent(device)),
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 8008df5..fb09764 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -71,9 +71,10 @@ struct NetDev {
char *filename;
- Condition *condition_host;
- Condition *condition_virt;
- Condition *condition_kernel;
+ Condition *match_host;
+ Condition *match_virt;
+ Condition *match_kernel;
+ Condition *match_arch;
char *description;
char *name;
@@ -100,6 +101,7 @@ struct Network {
Condition *match_host;
Condition *match_virt;
Condition *match_kernel;
+ Condition *match_arch;
char *description;
NetDev *bridge;
diff --git a/src/shared/net-util.c b/src/shared/net-util.c
index 6008a41..a8a2c44 100644
--- a/src/shared/net-util.c
+++ b/src/shared/net-util.c
@@ -39,6 +39,7 @@ bool net_match_config(const struct ether_addr *match_mac,
Condition *match_host,
Condition *match_virt,
Condition *match_kernel,
+ Condition *match_arch,
const char *dev_mac,
const char *dev_path,
const char *dev_driver,
@@ -54,6 +55,9 @@ bool net_match_config(const struct ether_addr *match_mac,
if (match_kernel && !condition_test_kernel_command_line(match_kernel))
return 0;
+ if (match_arch && !condition_test_architecture(match_arch))
+ return 0;
+
if (match_mac && (!dev_mac || memcmp(match_mac, ether_aton(dev_mac), ETH_ALEN)))
return 0;
diff --git a/src/shared/net-util.h b/src/shared/net-util.h
index a20b62e..908fb22 100644
--- a/src/shared/net-util.h
+++ b/src/shared/net-util.h
@@ -35,6 +35,7 @@ bool net_match_config(const struct ether_addr *match_mac,
Condition *match_host,
Condition *match_virt,
Condition *match_kernel,
+ Condition *match_arch,
const char *dev_mac,
const char *dev_path,
const char *dev_driver,
diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf
index ffc1b27..277ceb5 100644
--- a/src/udev/net/link-config-gperf.gperf
+++ b/src/udev/net/link-config-gperf.gperf
@@ -23,6 +23,7 @@ Match.Type, config_parse_string, 0,
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(link_config, match_host)
Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(link_config, match_virt)
Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(link_config, match_kernel)
+Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(link_config, match_arch)
Link.Description, config_parse_string, 0, offsetof(link_config, description)
Link.MACAddressPolicy, config_parse_mac_policy, 0, offsetof(link_config, mac_policy)
Link.MACAddress, config_parse_hwaddr, 0, offsetof(link_config, mac)
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 15bea4f..e8389c9 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -240,9 +240,9 @@ int link_config_get(link_config_ctx *ctx, struct udev_device *device, link_confi
LIST_FOREACH(links, link, ctx->links) {
- if (net_match_config(link->match_mac, link->match_path,
- link->match_driver, link->match_type, NULL,
- link->match_host, link->match_virt, link->match_kernel,
+ if (net_match_config(link->match_mac, link->match_path, link->match_driver,
+ link->match_type, NULL, link->match_host,
+ link->match_virt, link->match_kernel, link->match_arch,
udev_device_get_sysattr_value(device, "address"),
udev_device_get_property_value(device, "ID_PATH"),
udev_device_get_driver(udev_device_get_parent(device)),
diff --git a/src/udev/net/link-config.h b/src/udev/net/link-config.h
index 0dc156d..9d2eaff 100644
--- a/src/udev/net/link-config.h
+++ b/src/udev/net/link-config.h
@@ -58,6 +58,7 @@ struct link_config {
Condition *match_host;
Condition *match_virt;
Condition *match_kernel;
+ Condition *match_arch;
char *description;
struct ether_addr *mac;
More information about the systemd-commits
mailing list