TODO/bugs In SILC Server
========================
+ o After backup resuming protocol some of the server's SilcIDListData
+ on primary that came back online are NULL. Seems actually that the
+ udpate_client_by_server does not work since the client->router, and
+ the client->router->connection->user_data are not same, and they
+ should be.
+
o Server signoff notifys does not go to normal servers from routers.
o Channel user mode changes are notified unnecessarely when switching
bool channel_message,
bool force_send)
{
- int block_len = 0;
+ int block_len;
packet->truelen = data_len + SILC_PACKET_HEADER_LEN +
packet->src_id_len + packet->dst_id_len;
- if (cipher) {
- block_len = silc_cipher_get_block_len(cipher);
-
- if (channel_message)
- packet->padlen = SILC_PACKET_PADLEN((SILC_PACKET_HEADER_LEN +
- packet->src_id_len +
- packet->dst_id_len), block_len);
- else
- packet->padlen = SILC_PACKET_PADLEN(packet->truelen, block_len);
- }
+ block_len = cipher ? silc_cipher_get_block_len(cipher) : 0;
+ if (channel_message)
+ packet->padlen = SILC_PACKET_PADLEN((SILC_PACKET_HEADER_LEN +
+ packet->src_id_len +
+ packet->dst_id_len), block_len);
+ else
+ packet->padlen = SILC_PACKET_PADLEN(packet->truelen, block_len);
/* Prepare outgoing data buffer for packet sending */
silc_packet_send_prepare(sock,
if (sender && sock == sender)
continue;
- /* Send the packet */
+ /* Send the packet */
silc_server_packet_send_to_channel_real(server, sock, &packetdata,
idata->send_key,
idata->hmac_send,
uint32 data_len;
bool force_send = FALSE;
va_list ap;
- int block_len;
SILC_LOG_DEBUG(("Start"));
/* Get data used in packet header encryption, keys and stuff. */
sock = (SilcSocketConnection)c->router->connection;
idata = (SilcIDListData)c->router;
- block_len = idata->send_key ?
- silc_cipher_get_block_len(idata->send_key) : 0;
+
+ {
+ SILC_LOG_DEBUG(("*****************"));
+ SILC_LOG_DEBUG(("client->router->id %s",
+ silc_id_render(c->router->id, SILC_ID_SERVER)));
+ SILC_LOG_DEBUG(("client->router->connection->user_data->id %s",
+ silc_id_render(((SilcServerEntry)sock->user_data)->id, SILC_ID_SERVER)));
+ }
packetdata.dst_id = silc_id_id2str(c->router->id, SILC_ID_SERVER);
packetdata.dst_id_len = silc_id_get_len(c->router->id, SILC_ID_SERVER);
packetdata.dst_id_type = SILC_ID_SERVER;
- packetdata.truelen = data_len + SILC_PACKET_HEADER_LEN +
- packetdata.src_id_len + packetdata.dst_id_len;
- packetdata.padlen = SILC_PACKET_PADLEN(packetdata.truelen, block_len);
/* Send the packet */
silc_server_packet_send_to_channel_real(server, sock, &packetdata,
/* Get data used in packet header encryption, keys and stuff. */
sock = (SilcSocketConnection)c->connection;
idata = (SilcIDListData)c;
- block_len = idata->send_key ?
- silc_cipher_get_block_len(idata->send_key) : 0;
packetdata.dst_id = silc_id_id2str(c->id, SILC_ID_CLIENT);
packetdata.dst_id_len = silc_id_get_len(c->id, SILC_ID_CLIENT);
packetdata.dst_id_type = SILC_ID_CLIENT;
- packetdata.truelen = data_len + SILC_PACKET_HEADER_LEN +
- packetdata.src_id_len + packetdata.dst_id_len;
- packetdata.padlen = SILC_PACKET_PADLEN(packetdata.truelen, block_len);
/* Send the packet */
silc_server_packet_send_to_channel_real(server, sock, &packetdata,
/* Update the client entries of the backup router to the new
router */
+ silc_server_update_servers_by_server(server, backup_router, 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,
SILC_LOG_DEBUG(("Found (local) %s",
silc_id_render(server_entry->id, SILC_ID_SERVER)));
- /* If the client is not marked as local then move it to local list
- since the server is local. */
- if (server_entry->server_type != SILC_BACKUP_ROUTER && !local) {
- SILC_LOG_DEBUG(("Moving client to local list"));
- silc_idcache_add(server->local_list->clients, client_cache->name,
- client_cache->id, client_cache->context,
- client_cache->expire);
- silc_idcache_del_by_context(server->global_list->clients, client);
+#if 0
+ if (!server_entry->data.send_key && server_entry->router) {
+ SILC_LOG_DEBUG(("Server not locally connected, use its router"));
+ /* If the client is not marked as local then move it to local list
+ since the server is local. */
+ if (!local) {
+ SILC_LOG_DEBUG(("Moving client to local list"));
+ silc_idcache_add(server->local_list->clients, client_cache->name,
+ client_cache->id, client_cache->context,
+ client_cache->expire);
+ silc_idcache_del_by_context(server->global_list->clients, client);
+ }
+ server_entry = server_entry->router;
+ } else {
+#endif
+ /* If the client is not marked as local then move it to local list
+ since the server is local. */
+ if (server_entry->server_type != SILC_BACKUP_ROUTER && !local) {
+ SILC_LOG_DEBUG(("Moving client to local list"));
+ silc_idcache_add(server->local_list->clients, client_cache->name,
+ client_cache->id, client_cache->context,
+ client_cache->expire);
+ silc_idcache_del_by_context(server->global_list->clients, client);
+ }
+#if 0
}
+#endif
silc_idcache_list_free(list);
return server_entry;
SILC_LOG_DEBUG(("Found (global) %s",
silc_id_render(server_entry->id, SILC_ID_SERVER)));
- /* If the client is marked as local then move it to global list
- since the server is global. */
- if (server_entry->server_type != SILC_BACKUP_ROUTER && local) {
- SILC_LOG_DEBUG(("Moving client to global list"));
- silc_idcache_add(server->global_list->clients, client_cache->name,
- client_cache->id, client_cache->context,
- client_cache->expire);
- silc_idcache_del_by_context(server->local_list->clients, client);
+#if 0
+ if (!server_entry->data.send_key && server_entry->router) {
+ SILC_LOG_DEBUG(("Server not locally connected, use its router"));
+ /* If the client is marked as local then move it to global list
+ since the server is global. */
+ if (local) {
+ SILC_LOG_DEBUG(("Moving client to global list"));
+ silc_idcache_add(server->global_list->clients, client_cache->name,
+ client_cache->id, client_cache->context,
+ client_cache->expire);
+ silc_idcache_del_by_context(server->local_list->clients, client);
+ }
+ server_entry = server_entry->router;
+ } else {
+#endif
+ /* If the client is marked as local then move it to global list
+ since the server is global. */
+ if (server_entry->server_type != SILC_BACKUP_ROUTER && local) {
+ SILC_LOG_DEBUG(("Moving client to global list"));
+ silc_idcache_add(server->global_list->clients, client_cache->name,
+ client_cache->id, client_cache->context,
+ client_cache->expire);
+ silc_idcache_del_by_context(server->local_list->clients, client);
+ }
+#if 0
}
+#endif
silc_idcache_list_free(list);
return server_entry;
# Irssi SILC Client distribution
client_SUBDIRS=lib irssi doc includes
-client_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq silcclient
+client_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq silcclient silcsftp
client_SUBDIRS_doc=$(COMMONDIRS)
client_DISTLABEL=SILC_DIST_CLIENT
client_EXTRA_DIST=#
# SILC Server distribution
server_SUBDIRS=lib silcd doc includes
-server_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq dotconf
+server_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq dotconf silcsftp
server_SUBDIRS_doc=$(COMMONDIRS)
server_DISTLABEL=SILC_DIST_SERVER
server_EXTRA_DIST=#
/* Compare the HMAC's (buffer->tail has the packet's HMAC) */
if (memcmp(mac, buffer->tail, mac_len)) {
SILC_LOG_ERROR(("MAC failed"));
- assert(FALSE);
return FALSE;
}
memset(rng->pool, 0, sizeof(rng->pool));
memset(rng->key, 0, sizeof(rng->key));
silc_hash_free(rng->sha1);
- silc_free(new->devrandom);
+ silc_free(rng->devrandom);
silc_free(rng);
}
}
int fd, len, i;
/* Get noise from /dev/[u]random if available */
- fd = open(rnd->devrandom, O_RDONLY);
+ fd = open(rng->devrandom, O_RDONLY);
if (fd < 0)
return;