static void
interface_set_prefix_address(struct device_prefix_assignment *assignment,
- const struct device_prefix *prefix, struct interface *iface, bool add);
-
-static void interface_trigger_ula_prefix(struct interface *iface,
- const struct device_prefix *prefix, bool enable)
-{
- if (prefix == ula_prefix || (prefix->addr.s6_addr[0] & 0xfe) != 0xfc)
- return;
-
- bool external_ula = false;
- struct device_prefix_assignment *ula_assign = NULL;
- struct device_prefix *c;
- list_for_each_entry(c, &prefixes, head) {
- if (c != ula_prefix && (c->addr.s6_addr[0] & 0xfe) != 0xfc)
- continue;
-
- struct device_prefix_assignment *a;
- list_for_each_entry(a, &c->assignments, head) {
- if (!strcmp(a->name, iface->name)) {
- if (c == ula_prefix)
- ula_assign = a;
- else if (a->enabled)
- external_ula = true;
- }
- }
-
- }
-
- // Remove ULA assignment if there is an externally managed ULA and vice versa
- if (ula_assign && ((enable && !external_ula) || (!enable && external_ula)))
- interface_set_prefix_address(ula_assign, ula_prefix, iface, enable);
-}
-
-
-static void
-interface_set_prefix_address(struct device_prefix_assignment *assignment,
const struct device_prefix *prefix, struct interface *iface, bool add)
{
const struct interface *uplink = prefix->iface;
addr.valid_until = now + 7200;
system_add_address(l3_downlink, &addr);
assignment->enabled = false;
-
- interface_trigger_ula_prefix(iface, prefix, true);
} else if (add && (iface->state == IFS_UP || iface->state == IFS_SETUP)) {
system_add_address(l3_downlink, &addr);
if (uplink && uplink->l3_dev.dev) {
system_update_ipv6_mtu(l3_downlink, mtu);
}
assignment->enabled = true;
-
- interface_trigger_ula_prefix(iface, prefix, false);
}
}
list_add(&c->head, &prefix->assignments);
}
+ bool assigned_any = false;
struct list_head assign_later = LIST_HEAD_INIT(assign_later);
vlist_for_each_element(&interfaces, iface, node) {
if (iface->config_ip.assignment_length < 48 ||
}
list_add_tail(&c->head, &assign_later);
}
+
+ if (c->assigned != -1)
+ assigned_any = true;
}
// Then try to assign all other + failed custom assignments
netifd_log_message(L_WARNING, "Failed to assign subprefix "
"of size %hhu for %s\n", c->length, c->name);
free(c);
+ } else {
+ assigned_any = true;
}
}
list_for_each_entry(c, &prefix->assignments, head)
if ((iface = vlist_find(&interfaces, c->name, iface, node)))
interface_set_prefix_address(c, prefix, iface, true);
+
+ if (!assigned_any)
+ netifd_log_message(L_WARNING, "You have delegated IPv6-prefixes but haven't assigned them "
+ "to any interface. Did you forget to set option ip6assign on your lan-interfaces?");
}