]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: don't fail on various config parse errors
authorLennart Poettering <lennart@poettering.net>
Wed, 9 Sep 2020 21:06:40 +0000 (23:06 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 9 Sep 2020 21:43:16 +0000 (23:43 +0200)
We typically don't fail on config parse errors (to maximize compat),
let's not do this in these cases either.

src/network/netdev/macsec.c
src/network/netdev/wireguard.c
src/network/networkd-fdb.c

index 6fc316b3a0e3cad842fc740380f69f8a6c0d43b6..2776605b1c05ffdc27c0987f6efdfa0d1dbc5947 100644 (file)
@@ -851,10 +851,12 @@ int config_parse_macsec_key_id(
                 log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse KeyId \"%s\": %m", rvalue);
                 return 0;
         }
-        if (l > MACSEC_KEYID_LEN)
-                return log_syntax(unit, LOG_WARNING, filename, line, 0,
-                                  "Specified KeyId is larger then the allowed maximum (%zu > %u), ignoring: %s",
-                                  l, MACSEC_KEYID_LEN, rvalue);
+        if (l > MACSEC_KEYID_LEN) {
+                log_syntax(unit, LOG_WARNING, filename, line, 0,
+                           "Specified KeyId is larger then the allowed maximum (%zu > %u), ignoring: %s",
+                           l, MACSEC_KEYID_LEN, rvalue);
+                return 0;
+        }
 
         dest = a ? a->sa.key_id : b->sa.key_id;
         memcpy_safe(dest, p, l);
index d15ab845ffd9a7c38ea49225adf0b3f8978d39b8..f833cfb61afb64038536348c1e9958cd561ea294 100644 (file)
@@ -492,13 +492,17 @@ static int wireguard_decode_key_and_warn(
                 (void) warn_file_is_world_accessible(filename, NULL, unit, line);
 
         r = unbase64mem_full(rvalue, strlen(rvalue), true, &key, &len);
-        if (r < 0)
-                return log_syntax(unit, LOG_WARNING, filename, line, r,
+        if (r < 0) {
+                log_syntax(unit, LOG_WARNING, filename, line, r,
                            "Failed to decode wireguard key provided by %s=, ignoring assignment: %m", lvalue);
-        if (len != WG_KEY_LEN)
-                return log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL),
+                return 0;
+        }
+        if (len != WG_KEY_LEN) {
+                log_syntax(unit, LOG_WARNING, filename, line, 0,
                            "Wireguard key provided by %s= has invalid length (%zu bytes), ignoring assignment.",
                            lvalue, len);
+                return 0;
+        }
 
         memcpy(ret, key, WG_KEY_LEN);
         return 0;
index 4fb0f632dfd48ff0788bec2cf85c9b7d1e6d5c77..628c3988accd5db2d1b7f2d6c3c16844179e7e00 100644 (file)
@@ -292,10 +292,12 @@ int config_parse_fdb_destination(
                 return log_oom();
 
         r = in_addr_from_string_auto(rvalue, &fdb_entry->family, &fdb_entry->destination_addr);
-        if (r < 0)
-                return log_syntax(unit, LOG_WARNING, filename, line, r,
-                                  "FDB destination IP address is invalid, ignoring assignment: %s",
-                                  rvalue);
+        if (r < 0) {
+                log_syntax(unit, LOG_WARNING, filename, line, r,
+                           "FDB destination IP address is invalid, ignoring assignment: %s",
+                           rvalue);
+                return 0;
+        }
 
         fdb_entry = NULL;