wireless: fix passing bridge name for vlan hotplug pass-through
[project/netifd.git] / ubus.c
diff --git a/ubus.c b/ubus.c
index 4f167641e3a1c6680aa7f490e956ec7848c3f045..db4b3354e21eb3732279fcbb16500d1f36dfc717 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -986,19 +986,27 @@ netifd_handle_iface_prepare(struct ubus_context *ctx, struct ubus_object *obj,
                            struct blob_attr *msg)
 {
        struct interface *iface;
-       struct device *dev;
+       struct device *dev, *bridge_dev = NULL;
        const struct device_hotplug_ops *ops;
 
        iface = container_of(obj, struct interface, ubus);
        dev = iface->main_dev.dev;
        if (!dev)
-               return 0;
+               goto out;
 
        ops = dev->hotplug_ops;
        if (!ops)
-               return 0;
+               goto out;
+
+       ops->prepare(dev, &bridge_dev);
+
+out:
+       blob_buf_init(&b, 0);
+       if (bridge_dev)
+               blobmsg_add_string(&b, "bridge", bridge_dev->ifname);
+       ubus_send_reply(ctx, req, b.head);
 
-       return ops->prepare(dev);
+       return 0;
 }
 
 static int