mirror of
https://github.com/systemd/systemd.git
synced 2025-03-23 10:50:16 +03:00
network: also reload .netdev files
This commit is contained in:
parent
7f06b3e1b9
commit
e272b62136
@ -757,9 +757,10 @@ int netdev_load_one(Manager *manager, const char *filename) {
|
||||
NetDev *n = hashmap_get(netdev->manager->netdevs, netdev->ifname);
|
||||
|
||||
assert(n);
|
||||
log_netdev_warning_errno(netdev, r,
|
||||
"The setting Name=%s in %s conflicts with the one in %s, ignoring",
|
||||
netdev->ifname, netdev->filename, n->filename);
|
||||
if (!streq(netdev->filename, n->filename))
|
||||
log_netdev_warning_errno(netdev, r,
|
||||
"The setting Name=%s in %s conflicts with the one in %s, ignoring",
|
||||
netdev->ifname, netdev->filename, n->filename);
|
||||
|
||||
/* Clear ifname before netdev_free() is called. Otherwise, the NetDev object 'n' is
|
||||
* removed from the hashmap 'manager->netdevs'. */
|
||||
@ -828,14 +829,15 @@ int netdev_load_one(Manager *manager, const char *filename) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int netdev_load(Manager *manager) {
|
||||
int netdev_load(Manager *manager, bool reload) {
|
||||
_cleanup_strv_free_ char **files = NULL;
|
||||
char **f;
|
||||
int r;
|
||||
|
||||
assert(manager);
|
||||
|
||||
hashmap_clear_with_destructor(manager->netdevs, netdev_unref);
|
||||
if (!reload)
|
||||
hashmap_clear_with_destructor(manager->netdevs, netdev_unref);
|
||||
|
||||
r = conf_files_list_strv(&files, ".netdev", NULL, 0, NETWORK_DIRS);
|
||||
if (r < 0)
|
||||
|
@ -156,7 +156,7 @@ extern const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX];
|
||||
/* For casting the various netdev kinds into a netdev */
|
||||
#define NETDEV(n) (&(n)->meta)
|
||||
|
||||
int netdev_load(Manager *manager);
|
||||
int netdev_load(Manager *manager, bool reload);
|
||||
int netdev_load_one(Manager *manager, const char *filename);
|
||||
void netdev_drop(NetDev *netdev);
|
||||
|
||||
|
@ -204,6 +204,10 @@ static int bus_method_reload(sd_bus_message *message, void *userdata, sd_bus_err
|
||||
if (r == 0)
|
||||
return 1; /* Polkit will call us back */
|
||||
|
||||
r = netdev_load(manager, true);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = network_reload(manager);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -1856,7 +1856,7 @@ int manager_load_config(Manager *m) {
|
||||
/* update timestamp */
|
||||
paths_check_timestamp(NETWORK_DIRS, &m->network_dirs_ts_usec, true);
|
||||
|
||||
r = netdev_load(m);
|
||||
r = netdev_load(m, false);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user