interface: when interface properties change, reinitialise
authorJames Haggerty <[email protected]>
Mon, 10 Mar 2025 23:46:12 +0000 (10:46 +1100)
committerFelix Fietkau <[email protected]>
Wed, 28 May 2025 22:24:55 +0000 (00:24 +0200)
Without this, when the ip addresses on an interface changed it
would no longer interact correctly with the interface.

Addresses #20

Signed-off-by: Felix Fietkau <[email protected]>
interface.c

index e2f0ce9a4e1c2ea65199b419b851fc09a2d2e24d..340878ee00f605608a9f35c5990c5a11ca75920c 100644 (file)
@@ -462,12 +462,16 @@ iface_update_cb(struct vlist_tree *tree, struct vlist_node *node_new,
        struct interface *if_new = container_of_safe(node_new, struct interface, node);
 
        if (if_old && if_new) {
-               if (!iface_equal(if_old, if_new))
+               bool equal = iface_equal(if_old, if_new);
+               if (!equal)
                        cache_cleanup(if_old);
                free(if_old->addrs.v4);
                if_old->addrs = if_new->addrs;
                if_old->ifindex = if_new->ifindex;
                free(if_new);
+
+               if (!equal)
+                       interface_start(if_old);
                return;
        }