|
|
|
|
@ -20,6 +20,7 @@
|
|
|
|
|
#define CONN_MAX_SOCKET_CANDIDATES 8 |
|
|
|
|
|
|
|
|
|
struct conn_probe_ctx { |
|
|
|
|
struct conn_probe_ctx* next; /* linked list in nq->connectivity.probe_list */ |
|
|
|
|
struct UTUN_INSTANCE* instance; |
|
|
|
|
struct NODEINFO_Q* nq; |
|
|
|
|
uint8_t addr_type; // ADDR_TYPE_*
|
|
|
|
|
@ -248,7 +249,8 @@ static void conn_probe_finish(struct conn_probe_ctx* ctx, int ok) {
|
|
|
|
|
if (!ctx) return; |
|
|
|
|
if (ctx->nq) { |
|
|
|
|
struct NODE_CONNECTIVITY* c = &ctx->nq->connectivity; |
|
|
|
|
if (c->probe_ctx == ctx) c->probe_ctx = NULL; |
|
|
|
|
struct conn_probe_ctx** p = (struct conn_probe_ctx**)&c->probe_list; |
|
|
|
|
while (*p) { if (*p == ctx) { *p = ctx->next; break; } p = &(*p)->next; } |
|
|
|
|
|
|
|
|
|
switch (ctx->addr_type) { |
|
|
|
|
case ADDR_TYPE_INTERFACE: |
|
|
|
|
@ -352,7 +354,8 @@ void route_connectivity_probe_node(struct UTUN_INSTANCE* instance, struct NODEIN
|
|
|
|
|
ctx->timeout_ms = CONN_PROBE_TIMEOUT_MS; |
|
|
|
|
ctx->best_across_sockets = 65535; |
|
|
|
|
|
|
|
|
|
nq->connectivity.probe_ctx = ctx; |
|
|
|
|
ctx->next = (struct conn_probe_ctx*)nq->connectivity.probe_list; |
|
|
|
|
nq->connectivity.probe_list = ctx; |
|
|
|
|
pend++; |
|
|
|
|
conn_probe_start_series(ctx); |
|
|
|
|
} |
|
|
|
|
@ -411,7 +414,8 @@ void route_connectivity_probe_node(struct UTUN_INSTANCE* instance, struct NODEIN
|
|
|
|
|
ctx->timeout_ms = CONN_PROBE_TIMEOUT_MS; |
|
|
|
|
ctx->best_across_sockets = 65535; |
|
|
|
|
|
|
|
|
|
nq->connectivity.probe_ctx = ctx; |
|
|
|
|
ctx->next = (struct conn_probe_ctx*)nq->connectivity.probe_list; |
|
|
|
|
nq->connectivity.probe_list = ctx; |
|
|
|
|
pend++; |
|
|
|
|
conn_probe_start_series(ctx); |
|
|
|
|
} |
|
|
|
|
@ -433,10 +437,9 @@ void route_connectivity_cancel_node(struct UTUN_INSTANCE* instance, struct NODEI
|
|
|
|
|
if (!instance || !nq) return; |
|
|
|
|
nq->connectivity.probe_status = PROBE_STATUS_NONE; |
|
|
|
|
nq->connectivity.pending_count = 0; |
|
|
|
|
if (nq->connectivity.probe_ctx) { |
|
|
|
|
((struct conn_probe_ctx*)nq->connectivity.probe_ctx)->nq = NULL; |
|
|
|
|
nq->connectivity.probe_ctx = NULL; |
|
|
|
|
} |
|
|
|
|
struct conn_probe_ctx* ctx = (struct conn_probe_ctx*)nq->connectivity.probe_list; |
|
|
|
|
while (ctx) { ctx->nq = NULL; ctx = ctx->next; } |
|
|
|
|
nq->connectivity.probe_list = NULL; |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, "connectivity probe cancelled for node %016llx", (unsigned long long)nq->node.node_id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|