}
}
+void
+interface_ip_update_start(struct interface *iface)
+{
+ interface_clear_dns(iface);
+ vlist_update(&iface->proto_route);
+ vlist_update(&iface->proto_addr);
+}
+
+void
+interface_ip_update_complete(struct interface *iface)
+{
+ vlist_flush(&iface->proto_route);
+ vlist_flush(&iface->proto_addr);
+}
+
void
interface_ip_init(struct interface *iface)
{
return UBUS_STATUS_INVALID_ARGUMENT;
up = blobmsg_get_bool(tb[NOTIFY_LINK_UP]);
- if (up) {
- if (!tb[NOTIFY_IFNAME])
- return UBUS_STATUS_INVALID_ARGUMENT;
-
- if (!state->l3_dev.dev) {
- device_add_user(&state->l3_dev,
- device_get(blobmsg_data(tb[NOTIFY_IFNAME]), true));
- device_claim(&state->l3_dev);
- state->proto.iface->l3_dev = &state->l3_dev;
- }
- state->proto.proto_event(&state->proto, IFPEV_UP);
- } else {
+ if (!up) {
state->proto.proto_event(&state->proto, IFPEV_LINK_LOST);
+ return 0;
}
+ if (!tb[NOTIFY_IFNAME])
+ return UBUS_STATUS_INVALID_ARGUMENT;
+
+ if (!state->l3_dev.dev) {
+ device_add_user(&state->l3_dev,
+ device_get(blobmsg_data(tb[NOTIFY_IFNAME]), true));
+ device_claim(&state->l3_dev);
+ state->proto.iface->l3_dev = &state->l3_dev;
+ }
+
+ interface_ip_update_start(state->proto.iface);
+
if ((cur = tb[NOTIFY_ADDR_EXT]) != NULL)
addr_ext = blobmsg_get_bool(cur);
if ((cur = tb[NOTIFY_DNS]) != NULL)
interface_add_dns_server_list(state->proto.iface, cur);
+ interface_ip_update_complete(state->proto.iface);
+
+ state->proto.proto_event(&state->proto, IFPEV_UP);
+
return 0;
}
#define vlist_init(tree, cmp, update, type, node, key) \
__vlist_init(tree, cmp, update, offsetof(type, key) - offsetof(type, node))
+static inline void vlist_update(struct vlist_tree *tree)
+{
+ tree->version++;
+}
+
void vlist_add(struct vlist_tree *tree, struct vlist_node *node);
void vlist_delete(struct vlist_tree *tree, struct vlist_node *node);
void vlist_flush(struct vlist_tree *tree);