} else if (node_new) {
// Set null-route to avoid routing loops
system_add_route(NULL, &route);
- interface_update_prefix_assignments(prefix_new, true);
+
+ if (!prefix_new->iface || !prefix_new->iface->proto_ip.no_delegation)
+ interface_update_prefix_assignments(prefix_new, true);
} else if (node_old) {
// Remove null-route
interface_update_prefix_assignments(prefix_old, false);
}
if (node_old) {
- list_del(&prefix_old->head);
+ if (prefix_old->head.next)
+ list_del(&prefix_old->head);
free(prefix_old);
}
- if (node_new)
+ if (node_new && (!prefix_new->iface || !prefix_new->iface->proto_ip.no_delegation))
list_add(&prefix_new->head, &prefixes);
}
IFACE_ATTR_IP4TABLE,
IFACE_ATTR_IP6TABLE,
IFACE_ATTR_IP6CLASS,
+ IFACE_ATTR_DELEGATE,
IFACE_ATTR_MAX
};
[IFACE_ATTR_IP4TABLE] = { .name = "ip4table", .type = BLOBMSG_TYPE_STRING },
[IFACE_ATTR_IP6TABLE] = { .name = "ip6table", .type = BLOBMSG_TYPE_STRING },
[IFACE_ATTR_IP6CLASS] = { .name = "ip6class", .type = BLOBMSG_TYPE_ARRAY },
+ [IFACE_ATTR_DELEGATE] = { .name = "delegate", .type = BLOBMSG_TYPE_BOOL },
};
static const struct uci_blob_param_info iface_attr_info[IFACE_ATTR_MAX] = {
DPRINTF("Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur));
}
+ iface->proto_ip.no_delegation = !blobmsg_get_bool_default(tb[IFACE_ATTR_DELEGATE], true);
+
iface->config_autostart = iface->autostart;
iface->dynamic = dynamic;