From 351d690f1a09e062ef951ac406ee571e1f1fe3e6 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 18 Nov 2020 13:38:17 +0100 Subject: wireless: fix passing bridge name for vlan hotplug pass-through When preparing the interface for hotplug add, pass the bridge device back to the caller, since it may not match the original device Signed-off-by: Felix Fietkau --- ubus.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'ubus.c') diff --git a/ubus.c b/ubus.c index 4f16764..db4b335 100644 --- 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 -- cgit v1.2.1