]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-manager.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / network / networkd-manager.c
index 1e82c87d367168304cc1e1568c1fb32eef6938f3..fc9ef74016368900eca5a528a4637ec6c16ff331 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -48,7 +49,7 @@ const char* const network_dirs[] = {
         "/etc/systemd/network",
         "/run/systemd/network",
         "/usr/lib/systemd/network",
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
         "/lib/systemd/network",
 #endif
         NULL};
@@ -1142,8 +1143,12 @@ static int manager_save(Manager *m) {
                                 goto fail;
                 }
 
-                fprintf(f, "from=%s%s/%hhu to=%s%s/%hhu tos=%hhu fwmark=%"PRIu32"/%"PRIu32" table=%hhu", space ? " " : "", from_str,
-                        rule->from_prefixlen, space ? " " : "", to_str, rule->to_prefixlen, rule->tos, rule->fwmark, rule->fwmask, rule->table);
+                fprintf(f, "from=%s%s/%hhu to=%s%s/%hhu tos=%hhu fwmark=%"PRIu32"/%"PRIu32" table=%"PRIu32,
+                        space ? " " : "", from_str, rule->from_prefixlen,
+                        space ? " " : "", to_str, rule->to_prefixlen,
+                        rule->tos,
+                        rule->fwmark, rule->fwmask,
+                        rule->table);
 
                 fputc('\n', f);
         }
@@ -1454,8 +1459,14 @@ int manager_rtnl_enumerate_rules(Manager *m) {
                 return r;
 
         r = sd_netlink_call(m->rtnl, req, 0, &reply);
-        if (r < 0)
+        if (r < 0) {
+                if (r == -EOPNOTSUPP) {
+                        log_debug("FIB Rules are not supported by the kernel. Ignoring.");
+                        return 0;
+                }
+
                 return r;
+        }
 
         for (rule = reply; rule; rule = sd_netlink_message_next(rule)) {
                 int k;