]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #14761 from keszybz/link-network-no-match
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 4 Feb 2020 11:26:37 +0000 (20:26 +0900)
committerGitHub <noreply@github.com>
Tue, 4 Feb 2020 11:26:37 +0000 (20:26 +0900)
Refuse .network and .link files with no matches

1  2 
src/udev/net/link-config.c

index e1a25a54a6870f442fc251ecf0b15338b1852380,dfe9b9f31307fbca589326afda89d10ea8993ac2..bcf9be1a0d918e33c19d65ea64f91f03cec2bb79
@@@ -160,13 -160,17 +160,14 @@@ int link_load_one(link_config_ctx *ctx
          if (r < 0)
                  return r;
  
 -        if (link->speed > UINT_MAX)
 -                return -ERANGE;
 -
          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);