Do not call listen() on UDP listeners.

This commit is contained in:
Sam Hocevar 2017-09-05 17:26:30 +02:00
parent 33e8b8d7f9
commit a613195ad9
2 changed files with 12 additions and 10 deletions

View File

@ -337,13 +337,15 @@ void addServer(char *bindAddress, int bindPort, int bindProto,
closesocket(fd);
PARSE_ERROR;
}
if (listen(fd, RINETD_LISTEN_BACKLOG) == SOCKET_ERROR) {
/* Warn -- don't exit. */
syslog(LOG_ERR, "couldn't listen to "
"address %s port %d (%m)\n",
bindAddress, bindPort);
closesocket(fd);
PARSE_ERROR;
if (bindProto == protoTcp) {
if (listen(fd, RINETD_LISTEN_BACKLOG) == SOCKET_ERROR) {
/* Warn -- don't exit. */
syslog(LOG_ERR, "couldn't listen to "
"address %s port %d (%m)\n",
bindAddress, bindPort);
closesocket(fd);
PARSE_ERROR;
}
}
#if _WIN32
u_long ioctltmp;

View File

@ -16,10 +16,10 @@
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport
127.0.0.1 4000 127.0.0.1 3000
#127.0.0.1 4000 127.0.0.1 3000
#127.0.0.1 4000/udp 127.0.0.1 22
#127.0.0.1 4000 127.0.0.1 3000/udp
#127.0.0.1 3000/udp 127.0.0.1 22
127.0.0.1 4000 127.0.0.1 3000/udp
127.0.0.1 3000/udp 127.0.0.1 22
# logging information
logfile /var/log/rinetd.log