From 91228b6efb36c8954e3d23c0801f54ee984d5a0a Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Thu, 30 May 2013 09:37:34 +0200 Subject: [PATCH] IPv6: Log a warning if users have prefixes but haven't assigned them --- interface-ip.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/interface-ip.c b/interface-ip.c index b057fe5..b720eff 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -662,6 +662,7 @@ static void interface_update_prefix_assignments(struct device_prefix *prefix, bo 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 || @@ -684,6 +685,9 @@ static void interface_update_prefix_assignments(struct device_prefix *prefix, bo } list_add_tail(&c->head, &assign_later); } + + if (c->assigned != -1) + assigned_any = true; } // Then try to assign all other + failed custom assignments @@ -700,12 +704,18 @@ static void interface_update_prefix_assignments(struct device_prefix *prefix, bo 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?"); } -- 2.30.2