summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-20 19:39:49 +0100
committerTom Gundersen <teg@jklm.no>2014-02-20 21:50:34 +0100
commit2cc412b59353576cece2d5b30c6a39c70552f0a0 (patch)
treedc8257a5b09b0ceca44ddda74d9df20f825e9842 /src/udev
parentb77c08e06b67d5b1dd8aaf67b732e93851d8ae43 (diff)
network/link: Match - filter on kernel cmdline, host and virt
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/net/link-config-gperf.gperf31
-rw-r--r--src/udev/net/link-config.c1
-rw-r--r--src/udev/net/link-config.h4
3 files changed, 22 insertions, 14 deletions
diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf
index 950fb15286..ffc1b27a1d 100644
--- a/src/udev/net/link-config-gperf.gperf
+++ b/src/udev/net/link-config-gperf.gperf
@@ -16,17 +16,20 @@ struct ConfigPerfItem;
%struct-type
%includes
%%
-Match.MACAddress, config_parse_hwaddr, 0, offsetof(link_config, match_mac)
-Match.Path, config_parse_string, 0, offsetof(link_config, match_path)
-Match.Driver, config_parse_string, 0, offsetof(link_config, match_driver)
-Match.Type, config_parse_string, 0, offsetof(link_config, match_type)
-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)
-Link.NamePolicy, config_parse_name_policy, 0, offsetof(link_config, name_policy)
-Link.Name, config_parse_ifname, 0, offsetof(link_config, name)
-Link.Alias, config_parse_ifalias, 0, offsetof(link_config, alias)
-Link.MTU, config_parse_unsigned, 0, offsetof(link_config, mtu)
-Link.SpeedMBytes, config_parse_unsigned, 0, offsetof(link_config, speed)
-Link.Duplex, config_parse_duplex, 0, offsetof(link_config, duplex)
-Link.WakeOnLan, config_parse_wol, 0, offsetof(link_config, wol)
+Match.MACAddress, config_parse_hwaddr, 0, offsetof(link_config, match_mac)
+Match.Path, config_parse_string, 0, offsetof(link_config, match_path)
+Match.Driver, config_parse_string, 0, offsetof(link_config, match_driver)
+Match.Type, config_parse_string, 0, offsetof(link_config, match_type)
+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)
+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)
+Link.NamePolicy, config_parse_name_policy, 0, offsetof(link_config, name_policy)
+Link.Name, config_parse_ifname, 0, offsetof(link_config, name)
+Link.Alias, config_parse_ifalias, 0, offsetof(link_config, alias)
+Link.MTU, config_parse_unsigned, 0, offsetof(link_config, mtu)
+Link.SpeedMBytes, config_parse_unsigned, 0, offsetof(link_config, speed)
+Link.Duplex, config_parse_duplex, 0, offsetof(link_config, duplex)
+Link.WakeOnLan, config_parse_wol, 0, offsetof(link_config, wol)
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 587eeefada..15bea4f4ca 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -242,6 +242,7 @@ int link_config_get(link_config_ctx *ctx, struct udev_device *device, link_confi
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,
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 4fc8963114..0dc156d401 100644
--- a/src/udev/net/link-config.h
+++ b/src/udev/net/link-config.h
@@ -23,6 +23,7 @@
#include "ethtool-util.h"
+#include "condition-util.h"
#include "libudev.h"
#include "util.h"
#include "list.h"
@@ -54,6 +55,9 @@ struct link_config {
char *match_path;
char *match_driver;
char *match_type;
+ Condition *match_host;
+ Condition *match_virt;
+ Condition *match_kernel;
char *description;
struct ether_addr *mac;