1
This commit is contained in:
1 parent
07e4f6f086
commit
c76646a39a
1 file changed
+9
-31
+9
-31
@@ -78,21 +78,7 @@ static char* nodeinfo_format(const uint8_t* data, size_t len) {
|
||||
// ============================================================================
|
||||
|
||||
static void route_bgp_broadcast_withdraw(struct ROUTE_BGP* bgp, uint64_t node_id, uint64_t wd_source, struct ETCP_CONN* exclude) {
|
||||
if (!bgp) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_BGP, "bgp is NULL");
|
||||
return;
|
||||
}
|
||||
struct NODEINFO_Q* nq = route_bgp_get_node(bgp, node_id);
|
||||
if (!nq) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_BGP, "node not found for broadcast (already purged)");
|
||||
nq = NULL;
|
||||
}
|
||||
if (nq && wd_source != 0 && nq->paths) {
|
||||
}
|
||||
if (nq && nq->paths && queue_entry_count(nq->paths) == 0) {
|
||||
if (bgp->instance && bgp->instance->rt) route_delete(bgp->instance->rt, nq);
|
||||
nq->dirty = 1;
|
||||
}
|
||||
if (!bgp) { DEBUG_ERROR(DEBUG_CATEGORY_BGP, "bgp is NULL"); return; }
|
||||
struct BGP_WITHDRAW_PACKET* pkt = u_calloc(1, sizeof(struct BGP_WITHDRAW_PACKET));
|
||||
if (!pkt) return;
|
||||
pkt->cmd = ETCP_ID_ROUTE_ENTRY;
|
||||
@@ -186,8 +172,7 @@ static void route_bgp_receive_cbk(struct ETCP_CONN* from_conn, struct ll_entry*
|
||||
// ============================================================================
|
||||
|
||||
// Callback для готовности ETCP соединения - отправляет маршруты
|
||||
static void route_bgp_on_conn_up(struct ETCP_CONN* conn, void* arg)
|
||||
{
|
||||
static void route_bgp_on_conn_up(struct ETCP_CONN* conn, void* arg) {
|
||||
(void)arg;
|
||||
if (conn && conn->instance && conn->instance->bgp) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BGP ON UP %s", conn->log_name);
|
||||
@@ -196,8 +181,7 @@ static void route_bgp_on_conn_up(struct ETCP_CONN* conn, void* arg)
|
||||
}
|
||||
}
|
||||
|
||||
static void route_bgp_on_conn_down(struct ETCP_CONN* conn, void* arg)
|
||||
{
|
||||
static void route_bgp_on_conn_down(struct ETCP_CONN* conn, void* arg) {
|
||||
(void)arg;
|
||||
if (conn && conn->instance && conn->instance->bgp) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BGP ON DOWN %s", conn->log_name);
|
||||
@@ -207,8 +191,7 @@ static void route_bgp_on_conn_down(struct ETCP_CONN* conn, void* arg)
|
||||
}
|
||||
|
||||
// Callback для новых ETCP соединений - устанавливает ready callback
|
||||
static void route_bgp_etcp_conn_cbk(struct ETCP_CONN* conn, void* arg)
|
||||
{
|
||||
static void route_bgp_etcp_conn_cbk(struct ETCP_CONN* conn, void* arg) {
|
||||
(void)arg;
|
||||
if (conn && conn->instance && conn->instance->bgp) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BGP SET CBKS %s", conn->log_name);
|
||||
@@ -218,8 +201,7 @@ static void route_bgp_etcp_conn_cbk(struct ETCP_CONN* conn, void* arg)
|
||||
}
|
||||
}
|
||||
|
||||
struct ROUTE_BGP* route_bgp_init(struct UTUN_INSTANCE* instance)
|
||||
{
|
||||
struct ROUTE_BGP* route_bgp_init(struct UTUN_INSTANCE* instance) {
|
||||
if (!instance) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_BGP, "route_bgp_init: instance is NULL");
|
||||
return NULL;
|
||||
@@ -283,8 +265,7 @@ struct ROUTE_BGP* route_bgp_init(struct UTUN_INSTANCE* instance)
|
||||
return bgp;
|
||||
}
|
||||
|
||||
void route_bgp_destroy(struct UTUN_INSTANCE* instance)
|
||||
{
|
||||
void route_bgp_destroy(struct UTUN_INSTANCE* instance) {
|
||||
if (!instance) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_BGP, "route_bgp_destroy: instance is NULL");
|
||||
return;
|
||||
@@ -320,8 +301,7 @@ void route_bgp_destroy(struct UTUN_INSTANCE* instance)
|
||||
instance->bgp = NULL;
|
||||
}
|
||||
|
||||
void route_bgp_new_conn(struct ETCP_CONN* conn)
|
||||
{
|
||||
void route_bgp_new_conn(struct ETCP_CONN* conn) {
|
||||
if (!conn) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_BGP, "route_bgp_new_conn: conn is NULL");
|
||||
return;
|
||||
@@ -368,8 +348,7 @@ void route_bgp_new_conn(struct ETCP_CONN* conn)
|
||||
route_bgp_send_table_request(bgp, conn);
|
||||
}
|
||||
|
||||
void route_bgp_remove_conn(struct ETCP_CONN* conn)
|
||||
{
|
||||
void route_bgp_remove_conn(struct ETCP_CONN* conn) {
|
||||
if (!conn) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_BGP, "route_bgp_remove_conn: conn is NULL");
|
||||
return;
|
||||
@@ -455,8 +434,7 @@ void route_bgp_remove_conn(struct ETCP_CONN* conn)
|
||||
* NEW NODEINFO BASED IMPLEMENTATION
|
||||
* ================================================ */
|
||||
|
||||
struct NODEINFO_Q* route_bgp_get_node(struct ROUTE_BGP* bgp, uint64_t node_id)
|
||||
{
|
||||
struct NODEINFO_Q* route_bgp_get_node(struct ROUTE_BGP* bgp, uint64_t node_id) {
|
||||
if (!bgp || !bgp->nodes) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user