+void
+interface_add_user(struct interface_user *dep, struct interface *iface)
+{
+ if (!iface) {
+ list_add(&dep->list, &iface_all_users);
+ return;
+ }
+
+ dep->iface = iface;
+ list_add(&dep->list, &iface->users);
+ if (iface->state == IFS_UP)
+ dep->cb(dep, iface, IFEV_UP);
+}
+
+void
+interface_remove_user(struct interface_user *dep)
+{
+ list_del_init(&dep->list);
+ dep->iface = NULL;
+}
+
+static void
+interface_alias_cb(struct interface_user *dep, struct interface *iface, enum interface_event ev)
+{
+ struct interface *alias = container_of(dep, struct interface, parent_iface);
+ struct device *dev = iface->l3_dev.dev;
+
+ switch (ev) {
+ case IFEV_UP:
+ if (!dev)
+ return;
+
+ interface_set_main_dev(alias, dev);
+ interface_set_available(alias, true);
+ break;
+ case IFEV_DOWN:
+ interface_set_available(alias, false);
+ interface_set_main_dev(alias, NULL);
+ break;
+ case IFEV_FREE:
+ interface_remove_user(dep);
+ break;
+ case IFEV_RELOAD:
+ break;
+ }
+}
+