[systemd-commits] 2 commits - man/systemd-networkd.service.xml man/udev.xml src/shared

Tom Gundersen tomegun at kemper.freedesktop.org
Thu Feb 20 14:28:33 PST 2014


 man/systemd-networkd.service.xml |   77 +++++++++++++++++++++++++++++++++++++--
 man/udev.xml                     |   32 +++++++++++++++-
 src/shared/net-util.c            |    5 +-
 3 files changed, 109 insertions(+), 5 deletions(-)

New commits:
commit a03c5fd2d86c4e3f758a5ca0d98638e5c8bd8d8d
Author: Tom Gundersen <teg at jklm.no>
Date:   Thu Feb 20 23:26:07 2014 +0100

    man: networkd/udev - add to [Match] documentation

diff --git a/man/systemd-networkd.service.xml b/man/systemd-networkd.service.xml
index 04fedc5..69157b1 100644
--- a/man/systemd-networkd.service.xml
+++ b/man/systemd-networkd.service.xml
@@ -96,6 +96,45 @@
                         <filename>.netdev</filename>; other extensions are ignored. Virtual
                         network devices are created as soon as networkd is started.</para>
 
+                        <para>A virtual network device is only created if the
+                        <literal>[Match]</literal> section matches the current
+                        environment, or if the section is empty. The following keys are accepted:</para>
+
+                        <variablelist class='network-directives'>
+                                <varlistentry>
+                                        <term><varname>Host</varname></term>
+                                        <listitem>
+                                                <para>Matches against the hostname or machine ID of the
+                                                host. See <literal>ConditionHost=</literal> in
+                                                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                                                for details.
+                                                </para>
+                                        </listitem>
+                                </varlistentry>
+                                <varlistentry>
+                                        <term><varname>Virtualization</varname></term>
+                                        <listitem>
+                                                <para>Checks whether the system is executed in a virtualized
+                                                environment and optionally test whether it is a specific
+                                                implementation. See <literal>ConditionVirtualization=</literal> in
+                                                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                                                for details.
+                                                </para>
+                                        </listitem>
+                                </varlistentry>
+                                <varlistentry>
+                                        <term><varname>KernelCommandLine</varname></term>
+                                        <listitem>
+                                                <para>Checks whether a specific kernel command line option is
+                                                set (or if prefixed with the exclamation mark unset). See
+                                                <literal>ConditionKernelCommandLine=</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
                         keys:</para>
 
@@ -158,7 +197,8 @@
                                         <term><varname>Path</varname></term>
                                         <listitem>
                                                 <para>The persistent path, as exposed by the udev
-                                                property <literal>ID_PATH</literal>.</para>
+                                                property <literal>ID_PATH</literal>. May contain shell
+                                                style globs.</para>
                                         </listitem>
                                 </varlistentry>
                                 <varlistentry>
@@ -181,7 +221,40 @@
                                         <term><varname>Name</varname></term>
                                         <listitem>
                                                 <para>The device name, as exposed by the udev property
-                                                <literal>INTERFACE</literal>.</para>
+                                                <literal>INTERFACE</literal>. May contain shell style
+                                                globs.</para>
+                                        </listitem>
+                                </varlistentry>
+                                <varlistentry>
+                                        <term><varname>Host</varname></term>
+                                        <listitem>
+                                                <para>Matches against the hostname or machine ID of the
+                                                host. See <literal>ConditionHost=</literal> in
+                                                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                                                for details.
+                                                </para>
+                                        </listitem>
+                                </varlistentry>
+                                <varlistentry>
+                                        <term><varname>Virtualization</varname></term>
+                                        <listitem>
+                                                <para>Checks whether the system is executed in a virtualized
+                                                environment and optionally test whether it is a specific
+                                                implementation. See <literal>ConditionVirtualization=</literal> in
+                                                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                                                for details.
+                                                </para>
+                                        </listitem>
+                                </varlistentry>
+                                <varlistentry>
+                                        <term><varname>KernelCommandLine</varname></term>
+                                        <listitem>
+                                                <para>Checks whether a specific kernel command line option is
+                                                set (or if prefixed with the exclamation mark unset). See
+                                                <literal>ConditionKernelCommandLine=</literal> in
+                                                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                                                for details.
+                                                </para>
                                         </listitem>
                                 </varlistentry>
                         </variablelist>
diff --git a/man/udev.xml b/man/udev.xml
index c053a86..3dd2b48 100644
--- a/man/udev.xml
+++ b/man/udev.xml
@@ -799,7 +799,8 @@
         <varlistentry>
           <term><varname>Path</varname></term>
           <listitem>
-            <para>The persistent path, as exposed by the udev property <literal>ID_PATH</literal>.</para>
+            <para>The persistent path, as exposed by the udev property <literal>ID_PATH</literal>.
+            May contain shell style globs.</para>
           </listitem>
         </varlistentry>
         <varlistentry>
@@ -815,6 +816,35 @@
             <para>The device type, as exposed by the udev property <literal>DEVTYPE</literal>.</para>
           </listitem>
         </varlistentry>
+        <varlistentry>
+          <term><varname>Host</varname></term>
+          <listitem>
+            <para>Matches against the hostname or machine ID of the
+            host. See <literal>ConditionHost=</literal> in
+            <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+            for details.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term><varname>Virtualization</varname></term>
+          <listitem>
+            <para>Checks whether the system is executed in a virtualized
+            environment and optionally test whether it is a specific
+            implementation. See <literal>ConditionVirtualization=</literal> in
+            <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+            for details.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term><varname>KernelCommandLine</varname></term>
+          <listitem>
+            <para>Checks whether a specific kernel command line option is
+            set (or if prefixed with the exclamation mark unset). See
+            <literal>ConditionKernelCommandLine=</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>

commit f28964e353e4bfb83990742be6f258cdcc78c03a
Author: Tom Gundersen <teg at jklm.no>
Date:   Thu Feb 20 22:55:42 2014 +0100

    net-util: match - allow globbing
    
    For now support globbing for interface name and path.

diff --git a/src/shared/net-util.c b/src/shared/net-util.c
index 06c50b5..6008a41 100644
--- a/src/shared/net-util.c
+++ b/src/shared/net-util.c
@@ -22,6 +22,7 @@
 #include <netinet/ether.h>
 #include <linux/if.h>
 #include <arpa/inet.h>
+#include <fnmatch.h>
 
 #include "net-util.h"
 #include "log.h"
@@ -56,7 +57,7 @@ bool net_match_config(const struct ether_addr *match_mac,
         if (match_mac && (!dev_mac || memcmp(match_mac, ether_aton(dev_mac), ETH_ALEN)))
                 return 0;
 
-        if (match_path && !streq_ptr(match_path, dev_path))
+        if (match_path && (!dev_path || fnmatch(match_path, dev_path, 0)))
                 return 0;
 
         if (match_driver && !streq_ptr(match_driver, dev_driver))
@@ -65,7 +66,7 @@ bool net_match_config(const struct ether_addr *match_mac,
         if (match_type && !streq_ptr(match_type, dev_type))
                 return 0;
 
-        if (match_name && !streq_ptr(match_name, dev_name))
+        if (match_name && (!dev_path || fnmatch(match_name, dev_name, 0)))
                 return 0;
 
         return 1;



More information about the systemd-commits mailing list