summaryrefslogtreecommitdiffhomepage
path: root/src/ubus.c
diff options
context:
space:
mode:
authorDainis Jonitis <dainis.jonitis@ubnt.com>2019-04-29 14:40:14 +0300
committerHans Dedecker <dedeckeh@gmail.com>2019-05-03 14:51:52 +0200
commita2dd8d6bd918fb211db491c7dcb1810032f3f8ca (patch)
treeee6e81ddf764b091231cd6d38eedfb671e23350a /src/ubus.c
parenta17665eaabee92b04b947bb68b8717b18ace6615 (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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ubus.c b/src/ubus.c
index 1bb8237..e9c5b6f 100644
--- a/src/ubus.c
+++ b/src/ubus.c
@@ -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);