+static void netns_updown(bool start)
+{
+ struct ubus_context *ctx = ubus_connect(NULL);
+ static struct blob_buf req;
+ uint32_t id;
+ pid_t pid = getpid();
+
+ if (!ctx)
+ return;
+
+ blob_buf_init(&req, 0);
+ blobmsg_add_string(&req, "jail", opts.name);
+ blobmsg_add_u32(&req, "pid", pid);
+ blobmsg_add_u8(&req, "start", start);
+
+ if (ubus_lookup_id(ctx, "network", &id) ||
+ ubus_invoke(ctx, id, "netns_updown", req.head, NULL, NULL, 3000))
+ INFO("ubus request failed\n");
+
+ blob_buf_free(&req);
+ ubus_free(ctx);
+}
+