+Fri Jun 18 19:26:58 CEST 2004 Pekka Riikonen <priikone@silcnet.org>
+
+ * Check for valid route when receiving packet from router and
+ when routing it to local server in the cell. A patch from
+ Matt Miller. Affected files silcd/router.c and server.c.
+
Sat May 1 13:55:54 CEST 2004 Patrik Weiskircher <pat@icore.at>
* Couldn't detach and reattach twice, because of the previous
#endif
router = silc_server_route_check(dest, port);
- if (!router)
- return (SilcSocketConnection)server->id_entry->router->connection;
-
- return (SilcSocketConnection)router->connection;
+ if (router)
+ return (SilcSocketConnection)router->connection;
}
- return (SilcSocketConnection)server->id_entry->router->connection;
+ return (server->id_entry->router)
+ ? (SilcSocketConnection)server->id_entry->router->connection
+ : NULL;
}
packet->dst_id_type == SILC_ID_SERVER &&
sock->type != SILC_SOCKET_TYPE_CLIENT &&
memcmp(packet->dst_id, server->id_string, server->id_string_len)) {
+ SilcSocketConnection conn;
/* Route the packet to fastest route for the destination ID */
void *id = silc_id_str2id(packet->dst_id, packet->dst_id_len,
packet->dst_id_type);
if (!id)
goto out;
- silc_server_packet_route(server,
- silc_server_route_get(server, id,
- packet->dst_id_type),
- packet);
+
+ conn = silc_server_route_get(server, id, packet->dst_id_type);
+ if (!conn) {
+ SILC_LOG_WARNING(("Packet to unknown server ID %s, dropped (no route)",
+ silc_id_render(id, SILC_ID_SERVER)));
+ goto out;
+ }
+
+ silc_server_packet_route(server, conn, packet);
silc_free(id);
goto out;
}
dst_sock = silc_server_route_get(server, id, SILC_ID_CLIENT);
silc_free(id);
- if (idata)
+ if (idata && dst_sock)
*idata = (SilcIDListData)dst_sock->user_data;
return dst_sock;
}