diff options
author | Dainis Jonitis <dainis.jonitis@ubnt.com> | 2019-04-29 14:40:14 +0300 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2019-05-03 14:51:52 +0200 |
commit | a2dd8d6bd918fb211db491c7dcb1810032f3f8ca (patch) | |
tree | ee6e81ddf764b091231cd6d38eedfb671e23350a /src/ubus.c | |
parent | a17665eaabee92b04b947bb68b8717b18ace6615 (diff) |
treewide: always init interface list heads during initialization
When allocating interface, init dhcpv4_assignments, dhcpv4_fr_ips
and ia_assignments circular list heads to point to self. Avoids
checking whether next pointer is not null all over the place.
Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com>
Diffstat (limited to 'src/ubus.c')
-rw-r--r-- | src/ubus.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -29,7 +29,7 @@ static int handle_dhcpv4_leases(struct ubus_context *ctx, _unused struct ubus_ob a = blobmsg_open_table(&b, "device"); avl_for_each_element(&interfaces, iface, avl) { - if (iface->dhcpv4 != MODE_SERVER || iface->dhcpv4_assignments.next == NULL) + if (iface->dhcpv4 != MODE_SERVER) continue; void *i = blobmsg_open_table(&b, iface->ifname); @@ -122,7 +122,7 @@ static int handle_dhcpv6_leases(_unused struct ubus_context *ctx, _unused struct a = blobmsg_open_table(&b, "device"); avl_for_each_element(&interfaces, iface, avl) { - if (iface->dhcpv6 != MODE_SERVER || iface->ia_assignments.next == NULL) + if (iface->dhcpv6 != MODE_SERVER) continue; void *i = blobmsg_open_table(&b, iface->ifname); |