Compare commits
3 Commits
90198bcbea
...
91e50467f5
Author | SHA1 | Date |
---|---|---|
Yu Watanabe | 91e50467f5 | |
Zbigniew Jędrzejewski-Szmek | dade734917 | |
Zbigniew Jędrzejewski-Szmek | e519e20ae1 |
|
@ -164,10 +164,10 @@ int network_verify(Network *network) {
|
|||
strv_isempty(network->match_path) && strv_isempty(network->match_driver) &&
|
||||
strv_isempty(network->match_type) && strv_isempty(network->match_name) &&
|
||||
strv_isempty(network->match_property) && strv_isempty(network->match_ssid) && !network->conditions)
|
||||
log_warning("%s: No valid settings found in the [Match] section. "
|
||||
"The file will match all interfaces. "
|
||||
"If that is intended, please add Name=* in the [Match] section.",
|
||||
network->filename);
|
||||
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"%s: No valid settings found in the [Match] section, ignoring file. "
|
||||
"To match all interfaces, add Name=* in the [Match] section.",
|
||||
network->filename);
|
||||
|
||||
/* skip out early if configuration does not match the environment */
|
||||
if (!condition_test_list(network->conditions, NULL, NULL, NULL))
|
||||
|
|
|
@ -122,11 +122,18 @@ static int test_load_config(Manager *manager) {
|
|||
static void test_network_get(Manager *manager, sd_device *loopback) {
|
||||
Network *network;
|
||||
const struct ether_addr mac = ETHER_ADDR_NULL;
|
||||
int r;
|
||||
|
||||
/* let's assume that the test machine does not have a .network file
|
||||
that applies to the loopback device... */
|
||||
assert_se(network_get(manager, loopback, "lo", NULL, &mac, &mac, 0, NULL, NULL, &network) == -ENOENT);
|
||||
assert_se(!network);
|
||||
/* Let's hope that the test machine does not have a .network file that applies to loopback device…
|
||||
* But it is still possible, so let's allow that case too. */
|
||||
r = network_get(manager, loopback, "lo", NULL, &mac, &mac, 0, NULL, NULL, &network);
|
||||
if (r == -ENOENT)
|
||||
/* The expected case */
|
||||
assert_se(!network);
|
||||
else if (r >= 0)
|
||||
assert_se(network);
|
||||
else
|
||||
assert_not_reached("bad error!");
|
||||
}
|
||||
|
||||
static void test_address_equality(void) {
|
||||
|
|
|
@ -162,11 +162,12 @@ int link_load_one(link_config_ctx *ctx, const char *filename) {
|
|||
|
||||
if (set_isempty(link->match_mac) && set_isempty(link->match_permanent_mac) &&
|
||||
strv_isempty(link->match_path) && strv_isempty(link->match_driver) && strv_isempty(link->match_type) &&
|
||||
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.",
|
||||
strv_isempty(link->match_name) && strv_isempty(link->match_property) && !link->conditions) {
|
||||
log_warning("%s: No valid settings found in the [Match] section, ignoring file. "
|
||||
"To match all interfaces, add OriginalName=* in the [Match] section.",
|
||||
filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!condition_test_list(link->conditions, NULL, NULL, NULL)) {
|
||||
log_debug("%s: Conditions do not match the system environment, skipping.", filename);
|
||||
|
|
Loading…
Reference in New Issue