From ca3349180a25cb10476c14db266786c281868f98 Mon Sep 17 00:00:00 2001 From: "daniil.frolov" <daniil.frolov@demlabs.net> Date: Mon, 19 Aug 2024 19:31:27 +0000 Subject: [PATCH] vpn_fixes-12176_12709 --- modules/service/vpn/dap_chain_net_srv_vpn.c | 4 ++-- modules/service/vpn/include/dap_chain_net_srv_vpn.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/service/vpn/dap_chain_net_srv_vpn.c b/modules/service/vpn/dap_chain_net_srv_vpn.c index 20dafcd7e8..bcc4144f8e 100644 --- a/modules/service/vpn/dap_chain_net_srv_vpn.c +++ b/modules/service/vpn/dap_chain_net_srv_vpn.c @@ -1019,7 +1019,7 @@ static int s_callback_response_success(dap_chain_net_srv_t * a_srv, uint32_t a_u l_srv_session->last_update_ts = time(NULL); if (!l_usage_active->is_grace && l_srv_session->limits_ts <= 0){ char *l_user_key = dap_chain_hash_fast_to_str_new(&l_usage_active->client_pkey_hash); - log_it(L_INFO,"%"DAP_UINT64_FORMAT_U" seconds more for VPN usage for user %s", l_srv_session->limits_ts < 0 ? l_usage_active->receipt->receipt_info.units + l_srv_session->limits_ts : + log_it(L_INFO,"%ld seconds more for VPN usage for user %s", l_srv_session->limits_ts < 0 ? l_usage_active->receipt->receipt_info.units + l_srv_session->limits_ts : l_usage_active->receipt->receipt_info.units, l_user_key); DAP_DELETE(l_user_key); l_srv_session->limits_ts += (time_t)l_usage_active->receipt->receipt_info.units; @@ -1388,7 +1388,7 @@ static void s_update_limits(dap_stream_ch_t * a_ch , a_usage->is_limits_changed = true; if(a_srv_session->limits_ts && a_srv_session->limits_ts < l_current_limit_ts/2 && - !a_usage->receipt_next && !a_usage->is_waiting_first_receipt_sign){ + !a_usage->receipt_next && !a_usage->is_waiting_first_receipt_sign && !a_usage->is_grace){ l_issue_new_receipt = true; } a_srv_session->last_update_ts = time(NULL); diff --git a/modules/service/vpn/include/dap_chain_net_srv_vpn.h b/modules/service/vpn/include/dap_chain_net_srv_vpn.h index dbcbaa095b..a60b0fe719 100644 --- a/modules/service/vpn/include/dap_chain_net_srv_vpn.h +++ b/modules/service/vpn/include/dap_chain_net_srv_vpn.h @@ -72,19 +72,19 @@ typedef struct ch_vpn_pkt { uint32_t addr_size; uint16_t port; uint16_t padding; - } op_connect; + } DAP_ALIGN_PACKED op_connect; struct { // For data transmission, usualy for I/O functions uint32_t data_size; uint32_t padding; - } op_data; + } DAP_ALIGN_PACKED op_data; struct { // We have a problem and we know that! uint32_t code; // I hope we'll have no more than 4B+ problems, not I?? uint32_t padding_padding_padding_damned_padding_nobody_nowhere_uses_this_fild_but_if_wil_change_me_pls_with_an_auto_rename; - } op_problem; + } DAP_ALIGN_PACKED op_problem; struct { uint32_t padding1; uint32_t padding2; - } raw; // Raw access to OP bytes + } DAP_ALIGN_PACKED raw; // Raw access to OP bytes }; } DAP_ALIGN_PACKED header; byte_t data[]; // Binary data nested by packet -- GitLab