diff options
Diffstat (limited to 'src/odhcpd.h')
-rw-r--r-- | src/odhcpd.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/odhcpd.h b/src/odhcpd.h index e346e97..38ee020 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -160,6 +160,8 @@ struct dhcp_assignment { struct list_head head; struct list_head lease_list; + void (*dhcp_free_cb)(struct dhcp_assignment *a); + struct interface *iface; struct lease *lease; @@ -302,6 +304,20 @@ extern struct avl_tree interfaces; #define RA_MANAGED_MFLAG 1 #define RA_MANAGED_NO_AFLAG 2 +inline static void free_assignment(struct dhcp_assignment *a) +{ + if (a->head.next) + list_del(&a->head); + + if (a->lease_list.next) + list_del(&a->lease_list); + + if (a->dhcp_free_cb) + a->dhcp_free_cb(a); + + free(a->hostname); + free(a); +} // Exported main functions int odhcpd_register(struct odhcpd_event *event); @@ -354,7 +370,6 @@ int dhcpv6_ia_setup_interface(struct interface *iface, bool enable); void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c, time_t now, dhcpv6_binding_cb_handler_t func, void *arg); void dhcpv6_ia_write_statefile(void); -void dhcpv6_ia_free_assignment(struct dhcp_assignment *c); int netlink_add_netevent_handler(struct netevent_handler *hdlr); ssize_t netlink_get_interface_addrs(const int ifindex, bool v6, @@ -376,7 +391,6 @@ int dhcpv6_init(void); int ndp_init(void); #ifdef DHCPV4_SUPPORT int dhcpv4_init(void); -void dhcpv4_free_assignment(struct dhcp_assignment *a); int dhcpv4_setup_interface(struct interface *iface, bool enable); #endif |