network,udev: add Property= setting in [Match] section

Closes #5665.
This commit is contained in:
Yu Watanabe
2019-07-01 01:24:42 +09:00
parent b38de0e9cc
commit 44005bfb4e
12 changed files with 143 additions and 6 deletions
+1
View File
@@ -24,6 +24,7 @@ Match.OriginalName, config_parse_match_ifnames, 0,
Match.Path, config_parse_match_strv, 0, offsetof(link_config, match_path)
Match.Driver, config_parse_match_strv, 0, offsetof(link_config, match_driver)
Match.Type, config_parse_match_strv, 0, offsetof(link_config, match_type)
Match.Property, config_parse_match_property, 0, offsetof(link_config, match_property)
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(link_config, conditions)
Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(link_config, conditions)
Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(link_config, conditions)
+3 -2
View File
@@ -51,6 +51,7 @@ static void link_config_free(link_config *link) {
strv_free(link->match_driver);
strv_free(link->match_type);
strv_free(link->match_name);
strv_free(link->match_property);
condition_free_list(link->conditions);
free(link->description);
@@ -161,7 +162,7 @@ int link_load_one(link_config_ctx *ctx, const char *filename) {
if (set_isempty(link->match_mac) && strv_isempty(link->match_path) &&
strv_isempty(link->match_driver) && strv_isempty(link->match_type) &&
strv_isempty(link->match_name) && !link->conditions)
strv_isempty(link->match_name) && strv_isempty(link->match_property) && !link->conditions)
log_warning("%s: No valid settings found in the [Match] section. "
"The file will match all interfaces. "
"If that is intended, please add OriginalName=* in the [Match] section.",
@@ -241,7 +242,7 @@ int link_config_get(link_config_ctx *ctx, sd_device *device, link_config **ret)
LIST_FOREACH(links, link, ctx->links) {
if (net_match_config(link->match_mac, link->match_path, link->match_driver,
link->match_type, link->match_name,
link->match_type, link->match_name, link->match_property,
device, NULL, NULL)) {
if (link->match_name) {
unsigned name_assign_type = NET_NAME_UNKNOWN;
+1
View File
@@ -40,6 +40,7 @@ struct link_config {
char **match_driver;
char **match_type;
char **match_name;
char **match_property;
LIST_HEAD(Condition, conditions);
char *description;