chiark / gitweb /
test: always use assert_se in tests
[elogind.git] / src / network / networkd-address.c
index aa7927ff78b85e10092135fb9a0d4c08d35232fd..a63773928f4aa7d5a31f174c76b475c79fa899c5 100644 (file)
@@ -95,7 +95,7 @@ void address_free(Address *address) {
 
 int address_drop(Address *address, Link *link,
                  sd_rtnl_message_handler_t callback) {
-        _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+        _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
         int r;
 
         assert(address);
@@ -105,7 +105,8 @@ int address_drop(Address *address, Link *link,
         assert(link->manager);
         assert(link->manager->rtnl);
 
-        r = sd_rtnl_message_addr_new(RTM_DELADDR, link->ifindex, address->family, &req);
+        r = sd_rtnl_message_new_addr(link->manager->rtnl, &req, RTM_DELADDR,
+                                     link->ifindex, address->family);
         if (r < 0) {
                 log_error("Could not allocate RTM_DELADDR message: %s",
                           strerror(-r));
@@ -139,7 +140,7 @@ int address_drop(Address *address, Link *link,
 
 int address_configure(Address *address, Link *link,
                       sd_rtnl_message_handler_t callback) {
-        _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+        _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
         int r;
 
         assert(address);
@@ -149,8 +150,8 @@ int address_configure(Address *address, Link *link,
         assert(link->manager);
         assert(link->manager->rtnl);
 
-        r = sd_rtnl_message_addr_new(RTM_NEWADDR, link->ifindex,
-                        address->family, &req);
+        r = sd_rtnl_message_new_addr(link->manager->rtnl, &req, RTM_NEWADDR,
+                                     link->ifindex, address->family);
         if (r < 0) {
                 log_error("Could not allocate RTM_NEWADDR message: %s",
                           strerror(-r));
@@ -274,6 +275,13 @@ int config_parse_broadcast(const char *unit,
         if (r < 0)
                 return r;
 
+        if (n->family == AF_INET6) {
+                log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+                           "Broadcast is not valid for IPv6 addresses, "
+                           "ignoring assignment: %s", address);
+                return 0;
+        }
+
         r = net_parse_inaddr(address, &n->family, &n->broadcast);
         if (r < 0) {
                 log_syntax(unit, LOG_ERR, filename, line, EINVAL,