chiark / gitweb /
networkd: add support for Uplink Failure Detection
[elogind.git] / src / network / networkd-network.c
index c39ba6dfa25fdcf7ce7e685b11b5b9e2f7042701..0ba0c75714c9eb0cb49475af307f7a70ff298695 100644 (file)
@@ -22,7 +22,6 @@
 #include <ctype.h>
 #include <net/if.h>
 
-#include "path-util.h"
 #include "conf-files.h"
 #include "conf-parser.h"
 #include "util.h"
@@ -196,10 +195,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);
@@ -209,6 +208,7 @@ void network_free(Network *network) {
         strv_free(network->ntp);
         strv_free(network->dns);
         strv_free(network->domains);
+        strv_free(network->bind_carrier);
 
         netdev_unref(network->bridge);
 
@@ -626,7 +626,7 @@ int config_parse_llmnr(
         assert(filename);
         assert(lvalue);
         assert(rvalue);
-        assert(data);
+        assert(llmnr);
 
         /* Our enum shall be a superset of booleans, hence first try
          * to parse as boolean, and then as enum */
@@ -650,3 +650,46 @@ int config_parse_llmnr(
 
         return 0;
 }
+
+int config_parse_ipv6token(
+                const char* unit,
+                const char *filename,
+                unsigned line,
+                const char *section,
+                unsigned section_line,
+                const char *lvalue,
+                int ltype,
+                const char *rvalue,
+                void *data,
+                void *userdata) {
+
+        union in_addr_union buffer;
+        struct in6_addr *token = data;
+        int r;
+
+        assert(filename);
+        assert(lvalue);
+        assert(rvalue);
+        assert(token);
+
+        r = in_addr_from_string(AF_INET6, rvalue, &buffer);
+        if (r < 0) {
+                log_syntax(unit, LOG_ERR, filename, line, -r, "Failed to parse IPv6 token, ignoring: %s", rvalue);
+                return 0;
+        }
+
+        r = in_addr_is_null(AF_INET6, &buffer);
+        if (r < 0) {
+                log_syntax(unit, LOG_ERR, filename, line, -r, "IPv6 token can not be the ANY address, ignoring: %s", rvalue);
+                return 0;
+        }
+
+        if ((buffer.in6.s6_addr32[0] | buffer.in6.s6_addr32[1]) != 0) {
+                log_syntax(unit, LOG_ERR, filename, line, EINVAL, "IPv6 token can not be longer than 64 bits, ignoring: %s", rvalue);
+                return 0;
+        }
+
+        *token = buffer.in6;
+
+        return 0;
+}