Restart NAT check when client address changes in INIT_REQUEST
This commit is contained in:
1 parent
a3063ea47a
commit
3625a4e5d5
3 files changed
+18
-1
No files matched your search
@@ -18,6 +18,8 @@
|
||||
#include "crc32.h"
|
||||
#include "etcp.h"
|
||||
#include "route_node.h"
|
||||
#include "route_bgp.h"
|
||||
#include "route_ping.h"
|
||||
#include "../lib/memory_pool.h"
|
||||
#include "../lib/u_async.h"
|
||||
#include "../lib/debug_config.h"
|
||||
@@ -1354,6 +1356,12 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "Failed to reinsert link after addr change");
|
||||
goto ec_fr;
|
||||
}
|
||||
// Cancel pending NAT check and reset status
|
||||
if (link->etcp->instance->bgp) {
|
||||
route_ping_cancel_for_conn(link->etcp->instance->bgp, link->etcp);
|
||||
}
|
||||
link->nat_check_status = NAT_CHECK_NONE;
|
||||
link->nat_type = NAT_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
// Link exists - reuse it for recovery
|
||||
@@ -1483,6 +1491,10 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CONNECTION, "[%s] Link %p (local_id=%d) initialized and marked as UP (server)", link->etcp->log_name, link, link->local_link_id);
|
||||
start_keepalive_timer(link);
|
||||
loadbalancer_link_ready(link);
|
||||
// Restart NAT check after link is up (e.g. after address change or reinit)
|
||||
if (link->etcp->instance->bgp) {
|
||||
route_bgp_start_link_nat_check(link->etcp->instance->bgp, link);
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
|
||||
@@ -113,7 +113,6 @@ static void route_bgp_broadcast_withdraw(struct ROUTE_BGP* bgp, uint64_t node_id
|
||||
// Приём пакетов
|
||||
// ============================================================================
|
||||
|
||||
void route_bgp_start_link_nat_check(struct ROUTE_BGP* bgp, struct ETCP_LINK* link);
|
||||
static void route_bgp_handle_nat_info(struct ROUTE_BGP* bgp, struct ETCP_CONN* from_conn, const uint8_t* data, size_t len);
|
||||
static void route_bgp_handle_nat_check_req(struct ROUTE_BGP* bgp, struct ETCP_CONN* from_conn, const uint8_t* data, size_t len);
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ struct BGP_NAT_CHECK_REQ {
|
||||
} __attribute__((packed));
|
||||
|
||||
struct route_ping_pending;
|
||||
struct ETCP_LINK;
|
||||
|
||||
struct ROUTE_BGP {
|
||||
struct UTUN_INSTANCE* instance;
|
||||
@@ -200,6 +201,11 @@ void route_bgp_set_nat_check_local(struct ROUTE_BGP* bgp, int allow);
|
||||
*/
|
||||
void route_bgp_request_nat_check_all(struct ROUTE_BGP* bgp);
|
||||
|
||||
/**
|
||||
* @brief Запускает NAT check для одного линка.
|
||||
*/
|
||||
void route_bgp_start_link_nat_check(struct ROUTE_BGP* bgp, struct ETCP_LINK* link);
|
||||
|
||||
/* Аргумент callback NAT check */
|
||||
struct nat_check_arg {
|
||||
struct ETCP_LINK* link;
|
||||
|
||||
Reference in new issue
Block a user