This fixes backup router resuming protocol. Affected file
silcd/server_util.c.
+ * Decrease channel statistics count only if the channel
+ deletion worked. Affected files are silcd/server.c and
+ silcd/server_util.c.
+
+ * Added silc_server_update_servers_by_server to update origin
+ of all server entries. Used during backup router protocol.
+ Affected files silcd/server_util.[ch], silcd/server.c. and
+ silcd/backup_router.c.
+
Sun Oct 14 18:28:22 EDT 2001 Pekka Riikonen <priikone@silcnet.org>
* Assure that router cannot reroute the same channel message
o Server signoff notifys does not go to normal servers from routers.
- o On normal server the channel count can go negative (like -3 channels).
+ o Channel user mode changes are notified unnecessarely when switching
+ to backup router on router crash.
o Change the sever to connect to another server from low ports (706)
and not from high ports. Currently we cannot do incoming connection
checking by remote port because the port is not fixed.
+ o Announcements are incomplete: channel topics are not announced,
+ user modes (UMODE) are not announced.
+
o Add a timeout to handling incoming JOIN commands. It should be
enforced that JOIN command is executed only once in a second or two
seconds. Now it is possible to accept n incoming JOIN commands
returns only the channels the server knows about. The protocol spec
does not prohibit of sending the LIST to the router.
- o Announcements are incomplete: channel topics are not announced,
- user modes (UMODE) are not announced.
-
o Incomplete IPv6 support:
o silcd/serverid.c and its routines supports only IPv4.
router_sock = sock;
router = sock->user_data;
+ /* If the sender is backup router and ID is server (and we are not
+ backup router) then switch the entry to global list. */
if (server_entry->server_type == SILC_BACKUP_ROUTER &&
- id_type == SILC_ID_SERVER) {
+ id_type == SILC_ID_SERVER &&
+ server->id_entry->server_type != SILC_BACKUP_ROUTER) {
id_list = server->global_list;
router_sock = server->router ? server->router->connection : sock;
}
if (ptr->backup_router) {
server->server_type = SILC_BACKUP_ROUTER;
server->backup_router = TRUE;
+ server->id_entry->server_type = SILC_BACKUP_ROUTER;
break;
}
ptr = ptr->next;
by the primary router and went down with the router. */
silc_server_update_clients_by_server(server, user_data, backup_router,
TRUE, TRUE);
+ silc_server_update_servers_by_server(server, user_data, backup_router);
}
/* Free the server entry */
if (channel->rekey)
silc_schedule_task_del_by_context(server->schedule, channel->rekey);
if (silc_idlist_del_channel(server->local_list, channel))
- server->stat.my_channels--;
- silc_idlist_del_channel(server->global_list, channel);
+ server->stat.my_channels--;
+ else if (silc_idlist_del_channel(server->global_list, channel))
+ server->stat.my_channels--;
continue;
}
}
/* Remove the channel entry */
- if (!silc_idlist_del_channel(server->local_list, channel))
- silc_idlist_del_channel(server->global_list, channel);
- server->stat.my_channels--;
+ if (silc_idlist_del_channel(server->local_list, channel))
+ server->stat.my_channels--;
+ else if (silc_idlist_del_channel(server->global_list, channel))
+ server->stat.my_channels--;
continue;
}
silc_hash_table_count(channel->user_list) < 2) {
if (channel->rekey)
silc_schedule_task_del_by_context(server->schedule, channel->rekey);
- if (!silc_idlist_del_channel(server->local_list, channel))
- silc_idlist_del_channel(server->global_list, channel);
+ if (silc_idlist_del_channel(server->local_list, channel))
+ server->stat.my_channels--;
+ else if (silc_idlist_del_channel(server->global_list, channel))
+ server->stat.my_channels--;
silc_buffer_free(clidp);
- server->stat.my_channels--;
return FALSE;
}
}
/* Remove the channel entry */
- if (!silc_idlist_del_channel(server->local_list, channel))
- silc_idlist_del_channel(server->global_list, channel);
- server->stat.my_channels--;
+ if (silc_idlist_del_channel(server->local_list, channel))
+ server->stat.my_channels--;
+ else if (silc_idlist_del_channel(server->global_list, channel))
+ server->stat.my_channels--;
return FALSE;
}
router */
silc_server_update_clients_by_server(server, backup_router,
router, TRUE, FALSE);
+ silc_server_update_servers_by_server(server, backup_router, router);
silc_server_backup_replaced_del(server, backup_router);
silc_server_backup_add(server, backup_router,
ctx->sock->ip, ctx->sock->port,
if (channel->rekey)
silc_schedule_task_del_by_context(server->schedule, channel->rekey);
- if (!silc_idlist_del_channel(server->local_list, channel))
- silc_idlist_del_channel(server->global_list, channel);
- server->stat.my_channels--;
+ if (silc_idlist_del_channel(server->local_list, channel))
+ server->stat.my_channels--;
+ else if (silc_idlist_del_channel(server->global_list, channel))
+ server->stat.my_channels--;
continue;
}
}
/* Remove the channel entry */
- if (!silc_idlist_del_channel(server->local_list, channel))
- silc_idlist_del_channel(server->global_list, channel);
- server->stat.my_channels--;
+ if (silc_idlist_del_channel(server->local_list, channel))
+ server->stat.my_channels--;
+ else if (silc_idlist_del_channel(server->global_list, channel))
+ server->stat.my_channels--;
continue;
}
SILC_ID_SERVER)));
- local = TRUE;
- if (silc_idcache_get_all(server->local_list->clients, &list)) {
+ local = FALSE;
+ if (silc_idcache_get_all(server->global_list->clients, &list)) {
if (silc_idcache_list_first(list, &id_cache)) {
while (id_cache) {
client = (SilcClientEntry)id_cache->context;
+
if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED)) {
if (!silc_idcache_list_next(list, &id_cache))
continue;
}
- SILC_LOG_DEBUG(("Client (local) %s",
+ SILC_LOG_DEBUG(("Client (global) %s",
silc_id_render(client->id, SILC_ID_CLIENT)));
+ if (client->router)
+ SILC_LOG_DEBUG(("Client->router (global) %s",
+ silc_id_render(client->router->id, SILC_ID_SERVER)));
if (client->router == from) {
/* Skip clients that are *really* owned by the `from' */
silc_server_update_clients_by_real_server(server, from, client,
local, id_cache);
if (!client->router)
- client->router = from; /* on local list put old from */
+ client->router = to;
} else {
client->router = to;
}
silc_idcache_list_free(list);
}
- local = FALSE;
- if (silc_idcache_get_all(server->global_list->clients, &list)) {
+ local = TRUE;
+ if (silc_idcache_get_all(server->local_list->clients, &list)) {
if (silc_idcache_list_first(list, &id_cache)) {
while (id_cache) {
client = (SilcClientEntry)id_cache->context;
-
if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED)) {
if (!silc_idcache_list_next(list, &id_cache))
continue;
}
- SILC_LOG_DEBUG(("Client (global) %s",
+ SILC_LOG_DEBUG(("Client (local) %s",
silc_id_render(client->id, SILC_ID_CLIENT)));
+ if (client->router)
+ SILC_LOG_DEBUG(("Client->router (local) %s",
+ silc_id_render(client->router->id, SILC_ID_SERVER)));
if (client->router == from) {
/* Skip clients that are *really* owned by the `from' */
silc_server_update_clients_by_real_server(server, from, client,
local, id_cache);
if (!client->router)
- client->router = to;
+ client->router = from; /* on local list put old from */
} else {
client->router = to;
}
silc_server_remove_clients_by_server(server, from, TRUE);
}
+/* Updates servers that are from `from' to be originated from `to'. This
+ will also update the server's connection to `to's connection. */
+
+void silc_server_update_servers_by_server(SilcServer server,
+ SilcServerEntry from,
+ SilcServerEntry to)
+{
+ SilcIDCacheList list = NULL;
+ SilcIDCacheEntry id_cache = NULL;
+ SilcServerEntry server_entry = NULL;
+
+ SILC_LOG_DEBUG(("Start"));
+
+ if (silc_idcache_get_all(server->local_list->servers, &list)) {
+ if (silc_idcache_list_first(list, &id_cache)) {
+ while (id_cache) {
+ server_entry = (SilcServerEntry)id_cache->context;
+ if (server_entry->router == from) {
+ server_entry->router = to;
+ server_entry->connection = to->connection;
+ }
+ if (!silc_idcache_list_next(list, &id_cache))
+ break;
+ }
+ }
+ silc_idcache_list_free(list);
+ }
+
+ if (silc_idcache_get_all(server->global_list->servers, &list)) {
+ if (silc_idcache_list_first(list, &id_cache)) {
+ while (id_cache) {
+ server_entry = (SilcServerEntry)id_cache->context;
+ if (server_entry->router == from) {
+ server_entry->router = to;
+ server_entry->connection = to->connection;
+ }
+ if (!silc_idcache_list_next(list, &id_cache))
+ break;
+ }
+ }
+ silc_idcache_list_free(list);
+ }
+}
+
/* Checks whether given channel has global users. If it does this returns
TRUE and FALSE if there is only locally connected clients on the channel. */
bool resolve_real_server,
bool remove_from);
+/* Updates servers that are from `from' to be originated from `to'. This
+ will also update the server's connection to `to's connection. */
+void silc_server_update_servers_by_server(SilcServer server,
+ SilcServerEntry from,
+ SilcServerEntry to);
+
/* Checks whether given channel has global users. If it does this returns
TRUE and FALSE if there is only locally connected clients on the channel. */
bool silc_server_channel_has_global(SilcChannelEntry channel);
#
-# CELL 2 Server 212.146.42.150 on port 706
+# CELL 3 Server 212.146.42.150 on port 706
#
[Cipher]