From 33cf831bcbb37d145051ee687fc5a0ce4df1ec80 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Thu, 11 Oct 2001 09:29:31 +0000 Subject: [PATCH] updates. --- CHANGES | 11 +++++++++++ apps/silcd/packet_receive.c | 17 ++++++++++++++++- apps/silcd/packet_send.c | 6 ++++++ apps/silcd/server.c | 15 +++++++++++++++ doc/draft-riikonen-silc-pp-04.nroff | 27 +++++++++++++++++++++++++++ doc/draft-riikonen-silc-spec-04.nroff | 5 ++++- 6 files changed, 79 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 5eb2d331..67902536 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,14 @@ +Thu Oct 11 12:14:19 EDT 2001 Pekka Riikonen + + * Check for existing server ID in silc_server_new_server + and in silc_server_connect_to_router_final and remove the + old entry if it exists. Affected file silcd/packet_receive.c, + silcd/server.c. + + * Send the channel message always to only one router, either + in upstream or downstream. Affected file is + silcd/packet_send.c. + Tue Oct 9 17:45:43 EDT 2001 Pekka Riikonen * Wrote the definition of the backup resuming protocol to the diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index a7f07df9..47d7cf0a 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -1618,7 +1618,7 @@ SilcServerEntry silc_server_new_server(SilcServer server, SilcPacketContext *packet) { SilcBuffer buffer = packet->buffer; - SilcServerEntry new_server; + SilcServerEntry new_server, server_entry; SilcServerID *server_id; SilcIDListData idata; unsigned char *server_name, *id_string; @@ -1670,10 +1670,25 @@ SilcServerEntry silc_server_new_server(SilcServer server, } silc_free(id_string); + /* Check that we do not have this ID already */ + server_entry = silc_idlist_find_server_by_id(server->local_list, + server_id, TRUE, NULL); + if (server_entry) { + silc_idcache_del_by_context(server->local_list->servers, server_entry); + } else { + server_entry = silc_idlist_find_server_by_id(server->global_list, + server_id, TRUE, NULL); + if (server_entry) + silc_idcache_del_by_context(server->global_list->servers, server_entry); + } + /* Update server entry */ idata->status |= SILC_IDLIST_STATUS_REGISTERED; new_server->server_name = server_name; new_server->id = server_id; + + SILC_LOG_DEBUG(("New server id(%s)", + silc_id_render(server_id, SILC_ID_SERVER))); /* Add again the entry to the ID cache. */ silc_idcache_add(server->local_list->servers, server_name, server_id, diff --git a/apps/silcd/packet_send.c b/apps/silcd/packet_send.c index c42daec9..535ebc0e 100644 --- a/apps/silcd/packet_send.c +++ b/apps/silcd/packet_send.c @@ -639,6 +639,7 @@ void silc_server_packet_relay_to_channel(SilcServer server, uint32 routed_count = 0; SilcIDListData idata; SilcHashTableList htl; + bool gone = FALSE; SILC_LOG_DEBUG(("Relaying packet to channel")); @@ -753,7 +754,12 @@ void silc_server_packet_relay_to_channel(SilcServer server, channel keys are cell specific and we have different channel key than the remote router has. */ if (sock->type == SILC_SOCKET_TYPE_ROUTER) { + + if (gone) + continue; + SILC_LOG_DEBUG(("Remote is router, encrypt with session key")); + gone = TRUE; /* If private key mode is not set then decrypt the packet and re-encrypt it */ diff --git a/apps/silcd/server.c b/apps/silcd/server.c index 4b58bda6..101235e4 100644 --- a/apps/silcd/server.c +++ b/apps/silcd/server.c @@ -872,6 +872,21 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router_final) SILC_LOG_INFO(("Connected to router %s", sock->hostname)); + /* Check that we do not have this ID already */ + id_entry = silc_idlist_find_server_by_id(server->local_list, + ctx->dest_id, TRUE, NULL); + if (id_entry) { + silc_idcache_del_by_context(server->local_list->servers, id_entry); + } else { + id_entry = silc_idlist_find_server_by_id(server->global_list, + ctx->dest_id, TRUE, NULL); + if (id_entry) + silc_idcache_del_by_context(server->global_list->servers, id_entry); + } + + SILC_LOG_DEBUG(("New server id(%s)", + silc_id_render(ctx->dest_id, SILC_ID_SERVER))); + /* Add the connected router to local server list */ id_entry = silc_idlist_add_server(server->local_list, strdup(sock->hostname), SILC_ROUTER, ctx->dest_id, NULL, sock); diff --git a/doc/draft-riikonen-silc-pp-04.nroff b/doc/draft-riikonen-silc-pp-04.nroff index 40c8fe34..858dd119 100644 --- a/doc/draft-riikonen-silc-pp-04.nroff +++ b/doc/draft-riikonen-silc-pp-04.nroff @@ -2628,6 +2628,19 @@ to create route cache based on these informations. If faster route for destination does not exist in router's route cache the packet MUST be routed to the primary route (default route). +However, there are some issues when routing channel messages to group +of users. Routers are responsible of routing the channel message to +other routers, local servers and local clients as well. Routers MUST +send the channel message to only one router in the network, preferrably +to the shortest route to reach the channel users. The message can be +routed into either upstream or downstream. After the message is sent +to a router in the network it MUST NOT be sent to any other router in +either same route or other route. The message MUST NOT be routed to +the router it came from. + +When routing for example private messages they should be routed to the +shortest route always to reach the destination client as fast as possible. + For server which receives a packet to be routed to its locally connected client the server MUST check whether the particular packet type is allowed to be routed to the client. Not all packets may be sent by @@ -2638,6 +2651,20 @@ that may be sent to indirectly connected entities. It is clear that server cannot send, for example, disconnect packet to client that is not directly connected to the server. +Routers form a ring in the SILC network. However, routers may have other +direct connections to other routers in the network too. This can cause +interesting routing problems in the network. Since the network is ring, +the packets usually should be routed into counter clock-wise direction, +or if it cannot be used then always clock-wise (primary route) direction. +Problems may arise when a faster direct route exists and router is routing +a channel messages. Currently channel messages must be routed either +in upstream or downstream, they cannot be routed to other direct routes. +The SILC protocol should have a shortest path discovery protocol, and some +existing routing protocol, that can handle a ring network with other direct +routes inside the ring (hybrid ring-mesh network), MAY be defined to be +used with the SILC protocol. Additional specifications MAY be written +on the subject. + .ti 0 2.12 Packet Broadcasting diff --git a/doc/draft-riikonen-silc-spec-04.nroff b/doc/draft-riikonen-silc-spec-04.nroff index 22d93d60..3a97b1db 100644 --- a/doc/draft-riikonen-silc-spec-04.nroff +++ b/doc/draft-riikonen-silc-spec-04.nroff @@ -376,7 +376,7 @@ be connected in a specific way. Every router has their primary route which is a connection to another router in the network. Unless there is only two routers in the network must not routers use each other as their primary routes. The router -connections in the network must form a circular. +connections in the network must form a ring. @@ -2012,6 +2012,9 @@ as Destination ID in the SILC Packet Header. The server MUST then distribute the message to all clients on the channel by sending the channel message destined explicitly to a client on the channel. +See the [SILC2] for description of channel messege routing for router +servers. + See [SILC2] for description of channel message encryption and decryption process. -- 2.24.0