diff --git a/dongle.c b/dongle.c
index b4bbf50a74b9ea7f458e47e7fbaff7422d324e84..6ffeceb97d33e95c0514a1f22a9b7c7122c5c653 100644
--- a/dongle.c
+++ b/dongle.c
@@ -18,7 +18,7 @@
 
 struct ubus_context *global_ctx;
 int debug;
-char *global_ip_addr;
+struct device *global_dev;
 
 struct uloop_timeout timeout = { .cb = devices_status };
 static struct option long_options[] = {
@@ -118,7 +118,7 @@ int add_device(struct device *new_dev)
 			if (rv)
 				goto fail;
 
-			global_ip_addr = dev->ip;
+			global_dev= dev;
 
 		} else if (dev->ubus_obj && !dev->ip) {
 			unpublish_ubus_object(global_ctx, dev->ubus_obj);
@@ -144,7 +144,7 @@ int add_device(struct device *new_dev)
 		if (rv)
 			goto fail;
 
-		global_ip_addr = new_dev->ip;
+		global_dev = new_dev;
 	}
 
 	return 0;