Remove automatically assigned IPv6 routing table
[project/netifd.git] / ubus.c
diff --git a/ubus.c b/ubus.c
index 794444e..22b75e4 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -140,7 +140,6 @@ netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj,
        if (!iface)
                return UBUS_STATUS_UNKNOWN_ERROR;
 
-       interface_set_dynamic(iface);
        iface->device_config = true;
 
        config = blob_memdup(msg);
@@ -148,6 +147,7 @@ netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj,
                goto error;
 
        interface_add(iface, config);
+       interface_set_dynamic(iface);
 
        // need to look up the interface name again, in case of config update,
        iface = vlist_find(&interfaces, name, iface, node);
@@ -463,6 +463,9 @@ interface_ip_dump_route_list(struct interface_ip_settings *ip, bool enabled)
                if (route->enabled != enabled)
                        continue;
 
+               if ((ip->no_defaultroute == enabled) && !route->mask)
+                       continue;
+
                if ((route->flags & DEVADDR_FAMILY) == DEVADDR_INET4)
                        af = AF_INET;
                else
@@ -659,6 +662,21 @@ netifd_dump_status(struct interface *iface)
                blobmsg_add_string(&b, "device", dev->ifname);
 
        if (iface->state == IFS_UP) {
+               if (iface->updated) {
+                       a = blobmsg_open_array(&b, "updated");
+
+                       if (iface->updated & IUF_ADDRESS)
+                               blobmsg_add_string(&b, NULL, "addresses");
+                       if (iface->updated & IUF_ROUTE)
+                               blobmsg_add_string(&b, NULL, "routes");
+                       if (iface->updated & IUF_PREFIX)
+                               blobmsg_add_string(&b, NULL, "prefixes");
+                       if (iface->updated & IUF_DATA)
+                               blobmsg_add_string(&b, NULL, "data");
+
+                       blobmsg_close_array(&b, a);
+               }
+
                if (iface->ip4table)
                        blobmsg_add_u32(&b, "ip4table", iface->ip4table);
                if (iface->ip6table)