network/netdev: replace old NetDev object with newer one on reload

Then, when a .netdev file of a stacked netdev is modified, the netdev
can be reconfigured with the updated setting by something like the
following way:
```
ip link del vlan99
networkctl reload
```

Note, removing the vlan interface in the above example may not be necessary,
e.g. when only VLAN flags, egress mapping, or ingress mapping are updated.
But, it is necessary when VLAN ID is updated.

Closes #9627.
Closes #27177.
Closes #34907.
Replaces #22557.
This commit is contained in:
Yu Watanabe
2024-10-31 05:30:40 +09:00
parent 890bd7225a
commit b3ae4e8622
3 changed files with 80 additions and 2 deletions
+2
View File
@@ -118,6 +118,7 @@ typedef struct NetDev {
char *filename;
char **dropins;
Hashmap *stats_by_path;
LIST_HEAD(Condition, conditions);
@@ -218,6 +219,7 @@ void netdev_detach(NetDev *netdev);
int netdev_set_ifindex_internal(NetDev *netdev, int ifindex);
int netdev_load(Manager *manager);
int netdev_reload(Manager *manager);
int netdev_load_one(Manager *manager, const char *filename, NetDev **ret);
void netdev_drop(NetDev *netdev);
void netdev_enter_failed(NetDev *netdev);