Lines Matching refs:lease

30 static DHCPLease *dhcp_lease_free(DHCPLease *lease) {  in dhcp_lease_free()  argument
31 if (!lease) in dhcp_lease_free()
34 if (lease->server) { in dhcp_lease_free()
35 …hashmap_remove_value(lease->server->bound_leases_by_address, UINT32_TO_PTR(lease->address), lease); in dhcp_lease_free()
36 … hashmap_remove_value(lease->server->bound_leases_by_client_id, &lease->client_id, lease); in dhcp_lease_free()
37 …hashmap_remove_value(lease->server->static_leases_by_address, UINT32_TO_PTR(lease->address), lease in dhcp_lease_free()
38 … hashmap_remove_value(lease->server->static_leases_by_client_id, &lease->client_id, lease); in dhcp_lease_free()
41 free(lease->client_id.data); in dhcp_lease_free()
42 return mfree(lease); in dhcp_lease_free()
957 _cleanup_(dhcp_lease_freep) DHCPLease *lease = NULL; in prepare_new_lease()
959 lease = new(DHCPLease, 1); in prepare_new_lease()
960 if (!lease) in prepare_new_lease()
963 *lease = (DHCPLease) { in prepare_new_lease()
971 lease->client_id.data = memdup(client_id->data, client_id->length); in prepare_new_lease()
972 if (!lease->client_id.data) in prepare_new_lease()
975 memcpy(lease->chaddr, chaddr, hlen); in prepare_new_lease()
977 *ret_lease = TAKE_PTR(lease); in prepare_new_lease()
1002 _cleanup_(dhcp_lease_freep) DHCPLease *lease = NULL; in server_ack_request()
1004 r = prepare_new_lease(&lease, address, &req->client_id, in server_ack_request()
1010 lease->server = server; /* This must be set just before hashmap_put(). */ in server_ack_request()
1012 …map_ensure_put(&server->bound_leases_by_client_id, &dhcp_lease_hash_ops, &lease->client_id, lease); in server_ack_request()
1016 …= hashmap_ensure_put(&server->bound_leases_by_address, NULL, UINT32_TO_PTR(lease->address), lease); in server_ack_request()
1020 TAKE_PTR(lease); in server_ack_request()
1036 DHCPLease *lease; in dhcp_server_cleanup_expired_leases() local
1046 HASHMAP_FOREACH(lease, server->bound_leases_by_client_id) in dhcp_server_cleanup_expired_leases()
1047 if (lease->expiration < time_now) { in dhcp_server_cleanup_expired_leases()
1048 log_dhcp_server(server, "CLEAN (0x%x)", be32toh(lease->address)); in dhcp_server_cleanup_expired_leases()
1049 dhcp_lease_free(lease); in dhcp_server_cleanup_expired_leases()
1422 DHCPLease *lease; in sd_dhcp_server_forcerenew() local
1429 HASHMAP_FOREACH(lease, server->bound_leases_by_client_id) { in sd_dhcp_server_forcerenew()
1430 k = server_send_forcerenew(server, lease->address, lease->gateway, in sd_dhcp_server_forcerenew()
1431 lease->htype, lease->hlen, lease->chaddr); in sd_dhcp_server_forcerenew()
1632 _cleanup_(dhcp_lease_freep) DHCPLease *lease = NULL; in sd_dhcp_server_set_static_lease()
1654 lease = new(DHCPLease, 1); in sd_dhcp_server_set_static_lease()
1655 if (!lease) in sd_dhcp_server_set_static_lease()
1658 *lease = (DHCPLease) { in sd_dhcp_server_set_static_lease()
1662 lease->client_id.data = memdup(client_id, client_id_size); in sd_dhcp_server_set_static_lease()
1663 if (!lease->client_id.data) in sd_dhcp_server_set_static_lease()
1666 lease->server = server; /* This must be set just before hashmap_put(). */ in sd_dhcp_server_set_static_lease()
1668 …ap_ensure_put(&server->static_leases_by_client_id, &dhcp_lease_hash_ops, &lease->client_id, lease); in sd_dhcp_server_set_static_lease()
1671 … hashmap_ensure_put(&server->static_leases_by_address, NULL, UINT32_TO_PTR(lease->address), lease); in sd_dhcp_server_set_static_lease()
1675 TAKE_PTR(lease); in sd_dhcp_server_set_static_lease()