IPv6: Log a warning if users have prefixes but haven't assigned them
authorSteven Barth <steven@midlink.org>
Thu, 30 May 2013 07:37:34 +0000 (09:37 +0200)
committerSteven Barth <steven@midlink.org>
Thu, 30 May 2013 07:37:34 +0000 (09:37 +0200)
interface-ip.c

index b057fe56f0c61376cf964d374e6e543e867860e7..b720eff5539834887bddcd3ce5cb7e72a3a56cbf 100644 (file)
@@ -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?");
 }