Reject UDP probes when their timeout cannot be scheduled
This commit is contained in:
1 parent
4a00da31da
commit
a6444725da
2 files changed
+9
-3
No files matched your search
@@ -1787,6 +1787,12 @@ int etcp_send_ping_to_socket(struct UTUN_INSTANCE* instance, struct ETCP_SOCKET*
|
||||
u_free(ctx);
|
||||
return -6;
|
||||
}
|
||||
ctx->timeout_timer = uasync_set_timeout(instance->ua, timeout_ms * 10, ctx, ping_timeout_cbk, "ping_timeout");
|
||||
if (!ctx->timeout_timer) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "UDP ping timeout allocation failed socket=%s nonce=%016llx timeout=%d",
|
||||
e_sock->name, (unsigned long long)ctx->nonce, timeout_ms);
|
||||
u_free(ctx->user_data); u_free(ctx); return -7;
|
||||
}
|
||||
if (instance->pending_pings == NULL) {
|
||||
instance->pending_pings = ctx;
|
||||
} else {
|
||||
@@ -1794,7 +1800,6 @@ int etcp_send_ping_to_socket(struct UTUN_INSTANCE* instance, struct ETCP_SOCKET*
|
||||
while (last->next) last = last->next;
|
||||
last->next = ctx;
|
||||
}
|
||||
ctx->timeout_timer = uasync_set_timeout(instance->ua, timeout_ms * 10, ctx, ping_timeout_cbk, "ping_timeout");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -489,8 +489,9 @@ int etcp_send_ping(struct UTUN_INSTANCE* instance, const uint8_t* peer_pubkey_bi
|
||||
etcp_ping_callback_t cb, void* user_arg,
|
||||
const uint8_t* user_data, size_t user_data_len);
|
||||
|
||||
// шлёт пинг на addr используя pubkey. в пакет помещает user_data[user_len]. при получении ответа или таймауте вызывает callback.
|
||||
// flags: ETCP_PING_FLAG_SEND_RTT — user_data содержит RTT для peer
|
||||
/* Шлёт UDP PING на addr с peer_pubkey_bin, копируя user_data[user_data_len].
|
||||
* 0 — принят, callback позже по ответу/таймауту; <0 — ошибка без callback и без pending-записи.
|
||||
* Отмена/удаление сокета также не вызывает callback. flags: ETCP_PING_FLAG_SEND_RTT — данные содержат RTT для peer. */
|
||||
int etcp_send_ping_to_socket(struct UTUN_INSTANCE* instance, struct ETCP_SOCKET* e_sock,
|
||||
const uint8_t* peer_pubkey_bin, const struct sockaddr_storage* addr,
|
||||
int timeout_ms, etcp_ping_callback_t cb, void* user_arg,
|
||||
|
||||
Reference in new issue
Block a user