dhcpv6-ia: make free_dhcpv6_assignment static
[project/odhcpd.git] / src / dhcpv6-ia.c
index b0a0ada..35c6ae3 100644 (file)
 #include <arpa/inet.h>
 #include <sys/timerfd.h>
 
 #include <arpa/inet.h>
 #include <sys/timerfd.h>
 
-
+static void free_dhcpv6_assignment(struct dhcpv6_assignment *c);
 static void reconf_timer(struct uloop_timeout *event);
 static struct uloop_timeout reconf_event = {.cb = reconf_timer};
 static uint32_t serial = 0;
 static uint8_t statemd5[16];
 
 static void reconf_timer(struct uloop_timeout *event);
 static struct uloop_timeout reconf_event = {.cb = reconf_timer};
 static uint32_t serial = 0;
 static uint8_t statemd5[16];
 
-
 int dhcpv6_ia_init(void)
 {
        uloop_timeout_set(&reconf_event, 2000);
        return 0;
 }
 
 int dhcpv6_ia_init(void)
 {
        uloop_timeout_set(&reconf_event, 2000);
        return 0;
 }
 
-
-void free_dhcpv6_assignment(struct dhcpv6_assignment *c)
-{
-       if (c->managed_sock.fd.registered) {
-               ustream_free(&c->managed_sock.stream);
-               close(c->managed_sock.fd.fd);
-       }
-
-       if (c->head.next)
-               list_del(&c->head);
-
-       free(c->managed);
-       free(c->hostname);
-       free(c);
-}
-
-
 int setup_dhcpv6_ia_interface(struct interface *iface, bool enable)
 {
        if (!enable && iface->ia_assignments.next) {
 int setup_dhcpv6_ia_interface(struct interface *iface, bool enable)
 {
        if (!enable && iface->ia_assignments.next) {
@@ -146,6 +128,20 @@ int setup_dhcpv6_ia_interface(struct interface *iface, bool enable)
        return 0;
 }
 
        return 0;
 }
 
+static void free_dhcpv6_assignment(struct dhcpv6_assignment *c)
+{
+       if (c->managed_sock.fd.registered) {
+               ustream_free(&c->managed_sock.stream);
+               close(c->managed_sock.fd.fd);
+       }
+
+       if (c->head.next)
+               list_del(&c->head);
+
+       free(c->managed);
+       free(c->hostname);
+       free(c);
+}
 
 static int send_reconf(struct interface *iface, struct dhcpv6_assignment *assign)
 {
 
 static int send_reconf(struct interface *iface, struct dhcpv6_assignment *assign)
 {
@@ -210,7 +206,6 @@ static int send_reconf(struct interface *iface, struct dhcpv6_assignment *assign
        return odhcpd_send(iface->dhcpv6_event.uloop.fd, &assign->peer, &iov, 1, iface);
 }
 
        return odhcpd_send(iface->dhcpv6_event.uloop.fd, &assign->peer, &iov, 1, iface);
 }
 
-
 void dhcpv6_write_statefile(void)
 {
        md5_ctx_t md5;
 void dhcpv6_write_statefile(void)
 {
        md5_ctx_t md5;
@@ -378,7 +373,6 @@ static void apply_lease(struct interface *iface, struct dhcpv6_assignment *a, bo
        }
 }
 
        }
 }
 
-
 // More data was received from TCP connection
 static void managed_handle_pd_data(struct ustream *s, _unused int bytes_new)
 {
 // More data was received from TCP connection
 static void managed_handle_pd_data(struct ustream *s, _unused int bytes_new)
 {
@@ -460,8 +454,6 @@ static void managed_handle_pd_done(struct ustream *s)
                c->reconf_cnt = 1;
 }
 
                c->reconf_cnt = 1;
 }
 
-
-
 static bool assign_pd(struct interface *iface, struct dhcpv6_assignment *assign)
 {
        struct dhcpv6_assignment *c;
 static bool assign_pd(struct interface *iface, struct dhcpv6_assignment *assign)
 {
        struct dhcpv6_assignment *c;
@@ -535,7 +527,6 @@ static bool assign_pd(struct interface *iface, struct dhcpv6_assignment *assign)
        return false;
 }
 
        return false;
 }
 
-
 static bool assign_na(struct interface *iface, struct dhcpv6_assignment *assign)
 {
        // Seed RNG with checksum of DUID
 static bool assign_na(struct interface *iface, struct dhcpv6_assignment *assign)
 {
        // Seed RNG with checksum of DUID
@@ -637,7 +628,6 @@ void dhcpv6_ia_postupdate(struct interface *iface, time_t now)
        dhcpv6_write_statefile();
 }
 
        dhcpv6_write_statefile();
 }
 
-
 static void reconf_timer(struct uloop_timeout *event)
 {
        time_t now = odhcpd_time();
 static void reconf_timer(struct uloop_timeout *event)
 {
        time_t now = odhcpd_time();
@@ -665,7 +655,6 @@ static void reconf_timer(struct uloop_timeout *event)
        uloop_timeout_set(event, 2000);
 }
 
        uloop_timeout_set(event, 2000);
 }
 
-
 static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status,
                const struct dhcpv6_ia_hdr *ia, struct dhcpv6_assignment *a,
                struct interface *iface, bool request)
 static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status,
                const struct dhcpv6_ia_hdr *ia, struct dhcpv6_assignment *a,
                struct interface *iface, bool request)
@@ -870,7 +859,6 @@ static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status,
        return datalen;
 }
 
        return datalen;
 }
 
-
 static void dhcpv6_log(uint8_t msgtype, struct interface *iface, time_t now,
                const char *duidbuf, bool is_pd, struct dhcpv6_assignment *a, int code)
 {
 static void dhcpv6_log(uint8_t msgtype, struct interface *iface, time_t now,
                const char *duidbuf, bool is_pd, struct dhcpv6_assignment *a, int code)
 {
@@ -950,8 +938,6 @@ static void dhcpv6_log(uint8_t msgtype, struct interface *iface, time_t now,
                        duidbuf, iface->ifname, status, leasebuf);
 }
 
                        duidbuf, iface->ifname, status, leasebuf);
 }
 
-
-
 ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface,
                const struct sockaddr_in6 *addr, const void *data, const uint8_t *end)
 {
 ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface,
                const struct sockaddr_in6 *addr, const void *data, const uint8_t *end)
 {