From: Guus Sliepen Date: Tue, 21 Feb 2012 12:31:21 +0000 (+0100) Subject: Fix a bug that caused tinc to ignore all but the last listening socket. X-Git-Tag: release-1.0.17~13 X-Git-Url: https://git.librecmc.org/?p=oweals%2Ftinc.git;a=commitdiff_plain;h=d9ad3d313d96d30ef45cd53367dff9a855a396d4 Fix a bug that caused tinc to ignore all but the last listening socket. --- diff --git a/src/net_setup.c b/src/net_setup.c index dfed7e5..299e372 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -580,6 +580,7 @@ static bool setup_myself(void) { /* Open sockets */ + listen_sockets = 0; cfg = lookup_config(config_tree, "BindToAddress"); do { @@ -601,9 +602,12 @@ static bool setup_myself(void) { return false; } - listen_sockets = 0; - for(aip = ai; aip; aip = aip->ai_next) { + if(listen_sockets >= MAXSOCKETS) { + logger(LOG_ERR, "Too many listening sockets"); + return false; + } + listen_socket[listen_sockets].tcp = setup_listen_socket((sockaddr_t *) aip->ai_addr);