|
|
|
@ -383,10 +383,13 @@ static void route_bgp_send_route(struct ROUTE_BGP* bgp, struct ETCP_CONN* conn, |
|
|
|
|
|
|
|
|
|
|
|
// Первый проход - PUBLIC
|
|
|
|
// Первый проход - PUBLIC
|
|
|
|
while (link) { |
|
|
|
while (link) { |
|
|
|
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, "Sending routine: scanning conn type=%d init=%d", link->conn->type, link->initialized); |
|
|
|
|
|
|
|
|
|
|
|
if (link->conn && link->conn->type == CFG_SERVER_TYPE_PUBLIC && link->initialized) { |
|
|
|
if (link->conn && link->conn->type == CFG_SERVER_TYPE_PUBLIC && link->initialized) { |
|
|
|
struct sockaddr_in* sin = (struct sockaddr_in*)&link->conn->local_addr; |
|
|
|
struct sockaddr_in* sin = (struct sockaddr_in*)&link->conn->local_addr; |
|
|
|
uint32_t ip = *(uint32_t*)&sin->sin_addr; |
|
|
|
uint32_t ip = *(uint32_t*)&sin->sin_addr; |
|
|
|
uint16_t port = sin->sin_port; |
|
|
|
uint16_t port = sin->sin_port; |
|
|
|
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, "Sending routine [public]"); |
|
|
|
route_bgp_send_route_single(bgp, conn, route, ip, port); |
|
|
|
route_bgp_send_route_single(bgp, conn, route, ip, port); |
|
|
|
sent_any = 1; |
|
|
|
sent_any = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -399,6 +402,7 @@ static void route_bgp_send_route(struct ROUTE_BGP* bgp, struct ETCP_CONN* conn, |
|
|
|
if (link->conn && link->conn->type == CFG_SERVER_TYPE_NAT && link->nat_ip && link->initialized) { |
|
|
|
if (link->conn && link->conn->type == CFG_SERVER_TYPE_NAT && link->nat_ip && link->initialized) { |
|
|
|
uint32_t ip = link->nat_ip; |
|
|
|
uint32_t ip = link->nat_ip; |
|
|
|
uint16_t port = link->nat_port; |
|
|
|
uint16_t port = link->nat_port; |
|
|
|
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, "Sending routine [nat]"); |
|
|
|
route_bgp_send_route_single(bgp, conn, route, ip, port); |
|
|
|
route_bgp_send_route_single(bgp, conn, route, ip, port); |
|
|
|
sent_any = 1; |
|
|
|
sent_any = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -407,10 +411,12 @@ static void route_bgp_send_route(struct ROUTE_BGP* bgp, struct ETCP_CONN* conn, |
|
|
|
|
|
|
|
|
|
|
|
// Если нет PUBLIC и NAT - отправляем без endpoint (0.0.0.0:0)
|
|
|
|
// Если нет PUBLIC и NAT - отправляем без endpoint (0.0.0.0:0)
|
|
|
|
if (!sent_any) { |
|
|
|
if (!sent_any) { |
|
|
|
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, "Sending routine [any]"); |
|
|
|
route_bgp_send_route_single(bgp, conn, route, 0, 0); |
|
|
|
route_bgp_send_route_single(bgp, conn, route, 0, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// Для LEARNED маршрутов - используем endpoint из route
|
|
|
|
// Для LEARNED маршрутов - используем endpoint из route
|
|
|
|
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, "Sending routine [learned]"); |
|
|
|
route_bgp_send_route_single(bgp, conn, route,
|
|
|
|
route_bgp_send_route_single(bgp, conn, route,
|
|
|
|
htonl(route->endpoint_ip),
|
|
|
|
htonl(route->endpoint_ip),
|
|
|
|
htons(route->endpoint_port)); |
|
|
|
htons(route->endpoint_port)); |
|
|
|
|