+Sun Oct 6 13:20:04 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Don't swtich to become primary router if we are backup if
+ decryption error has occurred. Affected file silcd/server.c.
+
Thu Sep 26 13:51:02 CEST 2002 Pekka Riikonen <priikone@silcnet.org>
* If packet processing fails (like integrity check fails)
TODO/bugs In SILC Server
========================
+ o Still ghost clients in server signoff from server having secondary
+ interface.
+
+ o Normal server doesn't reconnect to backup router if connection was
+ lost.
+
o Add support for the <Requested Attributes> in WHOIS. Sending and
reception, with clients and servers should be added.
SIGNOFF of notify at all (using SIGNOFF takes the idea about
SERVER_SIGNOFF away entirely).
+ o See also ~/silcserver
+
o Add SilcAsyncOperation to utility library. Any function that takes
callback as an argument must/should return SilcAsyncOperation (see
~/silcasync).
/* If processing failed the connection is closed. */
if (!ret) {
+ /* On packet processing errors we may close our primary router
+ connection but won't become primary router if we are the backup
+ since this is local error condition. */
+ if (SILC_PRIMARY_ROUTE(server) == sock && server->backup_router)
+ server->backup_noswitch = TRUE;
+
if (sock->user_data)
silc_server_free_sock_user_data(server, sock, NULL);
silc_server_close_connection(server, sock);
SilcServer server = (SilcServer)context;
SilcSocketConnection sock = parser_context->sock;
SilcIDListData idata = (SilcIDListData)sock->user_data;
+ bool ret;
if (idata)
idata->psn_receive = parser_context->packet->sequence + 1;
the idata->receive_key might have become valid in the last packet
and we want to call this processor with valid cipher. */
if (idata)
- silc_packet_receive_process(sock, server->server_type == SILC_ROUTER ?
+ ret = silc_packet_receive_process(
+ sock, server->server_type == SILC_ROUTER ?
TRUE : FALSE, idata->receive_key,
idata->hmac_receive, idata->psn_receive,
silc_server_packet_parse, server);
else
- silc_packet_receive_process(sock, server->server_type == SILC_ROUTER ?
+ ret = silc_packet_receive_process(
+ sock, server->server_type == SILC_ROUTER ?
TRUE : FALSE, NULL, NULL, 0,
silc_server_packet_parse, server);
+
+ if (!ret) {
+ /* On packet processing errors we may close our primary router
+ connection but won't become primary router if we are the backup
+ since this is local error condition. */
+ if (SILC_PRIMARY_ROUTE(server) == sock && server->backup_router)
+ server->backup_noswitch = TRUE;
+
+ if (sock->user_data)
+ silc_server_free_sock_user_data(server, sock, NULL);
+ silc_server_close_connection(server, sock);
+ }
+
return FALSE;
}
sock->type != SILC_SOCKET_TYPE_ROUTER)
backup_router = NULL;
- if (server->server_shutdown)
+ if (server->server_shutdown || server->backup_noswitch)
backup_router = NULL;
/* If this was our primary router connection then we're lost to
server->server_name,
server->router->server_name));
}
+ server->backup_noswitch = FALSE;
/* Free the server entry */
silc_server_backup_del(server, user_data);
SILC_STR_UI_CHAR(&session),
SILC_STR_END);
if (ret < 0) {
- SILC_LOG_DEBUG(("Malformed packet received"));
+ SILC_LOG_ERROR(("Malformed resume router packet received"));
return;
}
return;
}
- SILC_LOG_DEBUG(("Bad resume router packet"));
+ SILC_LOG_ERROR(("Bad resume router packet RESUMED %d", type));
return;
}
proto_ctx->start = time(0);
SILC_LOG_DEBUG(("Starting backup resuming protocol as responder"));
+ SILC_LOG_INFO(("Starting backup resuming protocol"));
/* Run the backup resuming protocol */
silc_protocol_alloc(SILC_PROTOCOL_SERVER_BACKUP,
{
SilcServerConnection sconn;
+ SILC_LOG_INFO(("Attempting to reconnect to primary router"));
+
sconn = silc_calloc(1, sizeof(*sconn));
sconn->remote_host = strdup(ip);
sconn->remote_port = port;
SilcSocketConnection sock = proto_ctx->sock;
SILC_LOG_DEBUG(("Starting backup resuming protocol as initiator"));
+ SILC_LOG_INFO(("Starting backup resuming protocol"));
/* Run the backup resuming protocol */
silc_protocol_alloc(SILC_PROTOCOL_SERVER_BACKUP,
/* We should have received START or START_GLOBAL packet */
if (ctx->type != SILC_SERVER_BACKUP_START &&
ctx->type != SILC_SERVER_BACKUP_START_GLOBAL) {
- SILC_LOG_DEBUG(("Bad resume router packet"));
+ SILC_LOG_ERROR(("Bad resume router packet START %d", ctx->type));
break;
}
/* We should have received CONNECTED packet */
if (ctx->type != SILC_SERVER_BACKUP_CONNECTED) {
- SILC_LOG_DEBUG(("Bad resume router packet"));
+ SILC_LOG_ERROR(("Bad resume router packet CONNECTED %d", ctx->type));
break;
}
/* We should have been received ENDING packet */
if (ctx->type != SILC_SERVER_BACKUP_ENDING) {
- SILC_LOG_DEBUG(("Bad resume router packet"));
+ SILC_LOG_ERROR(("Bad resume router packet ENDING %d", ctx->type));
break;
}
router. */
if (ctx->type != SILC_SERVER_BACKUP_RESUMED &&
ctx->type != SILC_SERVER_BACKUP_RESUMED_GLOBAL) {
- SILC_LOG_DEBUG(("Bad resume router packet"));
+ SILC_LOG_ERROR(("Bad resume router packet RESUMED %d", ctx->type));
break;
}
case SILC_PROTOCOL_STATE_FAILURE:
/* Protocol has ended, call the final callback */
+ SILC_LOG_ERROR(("Error during backup resume: received Failure"));
if (protocol->final_callback)
silc_protocol_execute_final(protocol, server->schedule);
else
unsigned int backup_router : 1; /* Set if this is backup router */
unsigned int backup_primary : 1; /* Set if we've switched our primary
router to a backup router. */
+ unsigned int backup_noswitch: 1; /* Set if we've won't switch to
+ become primary (we are backup) */
unsigned int wait_backup : 1; /* Set if we are waiting for backup
router to connect to us. */
unsigned int server_shutdown: 1; /* Set when shutting down */
GNU General Public License for more details.
*/
-/*
- * $Id$
- * $Log$
- * Revision 1.1 2000/06/27 11:36:55 priikone
- * Initial revision
- *
- *
- */
#include "silcincludes.h"
#include "none.h"
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2002 - 2002 Pekka Riikonen
+ Copyright (C) 2000 - 2002 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by