]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-manager.c
network: set DynamicUser= to systemd-networkd.service
[thirdparty/systemd.git] / src / network / networkd-manager.c
index 749b87f336dd70cb1fad396685f29d925adb6cb1..f02b13e28be01fec1419716cfc86cb893a5161a7 100644 (file)
@@ -3,19 +3,6 @@
   This file is part of systemd.
 
   Copyright 2013 Tom Gundersen <teg@jklm.no>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
  ***/
 
 #include <sys/socket.h>
@@ -144,7 +131,7 @@ int manager_connect_bus(Manager *m) {
         if (m->bus)
                 return 0;
 
-        r = bus_open_system_watch_bind(&m->bus);
+        r = bus_open_system_watch_bind_with_description(&m->bus, "bus-api-network");
         if (r < 0)
                 return log_error_errno(r, "Failed to connect to bus: %m");
 
@@ -168,7 +155,7 @@ int manager_connect_bus(Manager *m) {
         if (r < 0)
                 return log_error_errno(r, "Failed to add network enumerator: %m");
 
-        r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.network1", 0, NULL, NULL);
+        r = bus_request_name_async_may_reload_dbus(m->bus, NULL, "org.freedesktop.network1", 0, NULL);
         if (r < 0)
                 return log_error_errno(r, "Failed to request name: %m");
 
@@ -233,7 +220,7 @@ static int manager_udev_process_link(Manager *m, struct udev_device *device) {
 static int manager_dispatch_link_udev(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
         Manager *m = userdata;
         struct udev_monitor *monitor = m->udev_monitor;
-        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+        _cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
 
         device = udev_monitor_receive_device(monitor);
         if (!device)
@@ -1380,7 +1367,7 @@ static void dhcp6_prefixes_hash_func(const void *p, struct siphash *state) {
 static int dhcp6_prefixes_compare_func(const void *_a, const void *_b) {
         const struct in6_addr *a = _a, *b = _b;
 
-        return memcmp(&a, &b, sizeof(*a));
+        return memcmp(a, b, sizeof(*a));
 }
 
 static const struct hash_ops dhcp6_prefixes_hash_ops = {
@@ -1389,7 +1376,7 @@ static const struct hash_ops dhcp6_prefixes_hash_ops = {
 };
 
 int manager_new(Manager **ret, sd_event *event) {
-        _cleanup_manager_free_ Manager *m = NULL;
+        _cleanup_(manager_freep) Manager *m = NULL;
         int r;
 
         m = new0(Manager, 1);
@@ -1444,8 +1431,7 @@ int manager_new(Manager **ret, sd_event *event) {
 
         (void) routing_policy_load_rules(m->state_file, &m->rules_saved);
 
-        *ret = m;
-        m = NULL;
+        *ret = TAKE_PTR(m);
 
         return 0;
 }
@@ -1498,7 +1484,6 @@ void manager_free(Manager *m) {
         sd_bus_unref(m->bus);
         sd_bus_slot_unref(m->prepare_for_sleep_slot);
         sd_bus_slot_unref(m->connected_slot);
-        sd_event_source_unref(m->bus_retry_event_source);
 
         free(m->dynamic_timezone);
         free(m->dynamic_hostname);
@@ -1825,7 +1810,7 @@ int manager_set_timezone(Manager *m, const char *tz) {
                 return log_oom();
 
         if (!m->bus || sd_bus_is_ready(m->bus) <= 0) {
-                log_info("Not connected to system bus, not setting hostname.");
+                log_info("Not connected to system bus, not setting timezone.");
                 return 0;
         }