net: support globbing and disjunction in Match logic
Match{Name,OrginalName,Type,Driver,Path} can now take a space-separated glob of matches.
This commit is contained in:
@@ -68,10 +68,10 @@ const sd_bus_vtable network_vtable[] = {
|
||||
SD_BUS_PROPERTY("Description", "s", NULL, offsetof(Network, description), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("SourcePath", "s", NULL, offsetof(Network, filename), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("MatchMAC", "as", property_get_ether_addrs, offsetof(Network, match_mac), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("MatchPath", "s", NULL, offsetof(Network, match_path), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("MatchDriver", "s", NULL, offsetof(Network, match_driver), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("MatchType", "s", NULL, offsetof(Network, match_type), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("MatchName", "s", NULL, offsetof(Network, match_name), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("MatchPath", "as", NULL, offsetof(Network, match_path), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("MatchDriver", "as", NULL, offsetof(Network, match_driver), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("MatchType", "as", NULL, offsetof(Network, match_type), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("MatchName", "as", NULL, offsetof(Network, match_name), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
|
||||
SD_BUS_VTABLE_END
|
||||
};
|
||||
|
||||
@@ -16,10 +16,10 @@ struct ConfigPerfItem;
|
||||
%includes
|
||||
%%
|
||||
Match.MACAddress, config_parse_hwaddr, 0, offsetof(Network, match_mac)
|
||||
Match.Path, config_parse_string, 0, offsetof(Network, match_path)
|
||||
Match.Driver, config_parse_string, 0, offsetof(Network, match_driver)
|
||||
Match.Type, config_parse_string, 0, offsetof(Network, match_type)
|
||||
Match.Name, config_parse_ifname, 0, offsetof(Network, match_name)
|
||||
Match.Path, config_parse_strv, 0, offsetof(Network, match_path)
|
||||
Match.Driver, config_parse_strv, 0, offsetof(Network, match_driver)
|
||||
Match.Type, config_parse_strv, 0, offsetof(Network, match_type)
|
||||
Match.Name, config_parse_ifnames, 0, offsetof(Network, match_name)
|
||||
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)
|
||||
|
||||
@@ -196,10 +196,10 @@ void network_free(Network *network) {
|
||||
free(network->filename);
|
||||
|
||||
free(network->match_mac);
|
||||
free(network->match_path);
|
||||
free(network->match_driver);
|
||||
free(network->match_type);
|
||||
free(network->match_name);
|
||||
strv_free(network->match_path);
|
||||
strv_free(network->match_driver);
|
||||
strv_free(network->match_type);
|
||||
strv_free(network->match_name);
|
||||
|
||||
free(network->description);
|
||||
free(network->dhcp_vendor_class_identifier);
|
||||
|
||||
@@ -100,10 +100,10 @@ struct Network {
|
||||
char *name;
|
||||
|
||||
struct ether_addr *match_mac;
|
||||
char *match_path;
|
||||
char *match_driver;
|
||||
char *match_type;
|
||||
char *match_name;
|
||||
char **match_path;
|
||||
char **match_driver;
|
||||
char **match_type;
|
||||
char **match_name;
|
||||
|
||||
Condition *match_host;
|
||||
Condition *match_virt;
|
||||
|
||||
Reference in New Issue
Block a user