chiark / gitweb /
networkd: add link-sense and simplify state-machine a bit
[elogind.git] / src / network / networkd-address.c
index 4c321dc454e0a41fabd38259a0a927f8319d3467..8f16a8c6c15851f9cb5b6c0a72f358d6c9881b6b 100644 (file)
@@ -79,7 +79,12 @@ int address_configure(Address *address, Link *link,
         _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *req = NULL;
         int r;
 
+        assert(address);
+        assert(address->family == AF_INET || address->family == AF_INET6);
+        assert(link);
+        assert(link->ifindex > 0);
         assert(link->manager);
+        assert(link->manager->rtnl);
 
         r = sd_rtnl_message_addr_new(RTM_NEWADDR, link->ifindex,
                         address->family, address->prefixlen,
@@ -125,8 +130,6 @@ int address_configure(Address *address, Link *link,
                 return r;
         }
 
-        link->rtnl_messages ++;
-
         return 0;
 }
 
@@ -152,6 +155,12 @@ int config_parse_address(const char *unit,
         assert(rvalue);
         assert(data);
 
+        if (streq(section, "Network")) {
+                /* we are not in an Address section, so treat
+                 * this as the special '0' section */
+                section_line = 0;
+        }
+
         r = address_new(network, section_line, &n);
         if (r < 0)
                 return r;
@@ -206,7 +215,6 @@ int config_parse_label(const char *unit,
                 void *userdata) {
         Network *network = userdata;
         _cleanup_address_free_ Address *n = NULL;
-        _cleanup_free_ char *address = NULL;
         char *label;
         int r;