Changeset View
Changeset View
Standalone View
Standalone View
crypto/openssh/sshd.c
Show First 20 Lines • Show All 1,050 Lines • ▼ Show 20 Lines | |||||
* Listen for TCP connections | * Listen for TCP connections | ||||
*/ | */ | ||||
static void | static void | ||||
listen_on_addrs(struct listenaddr *la) | listen_on_addrs(struct listenaddr *la) | ||||
{ | { | ||||
int ret, listen_sock; | int ret, listen_sock; | ||||
struct addrinfo *ai; | struct addrinfo *ai; | ||||
char ntop[NI_MAXHOST], strport[NI_MAXSERV]; | char ntop[NI_MAXHOST], strport[NI_MAXSERV]; | ||||
int socksize; | |||||
socklen_t len; | |||||
for (ai = la->addrs; ai; ai = ai->ai_next) { | for (ai = la->addrs; ai; ai = ai->ai_next) { | ||||
if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) | if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) | ||||
continue; | continue; | ||||
if (num_listen_socks >= MAX_LISTEN_SOCKS) | if (num_listen_socks >= MAX_LISTEN_SOCKS) | ||||
fatal("Too many listen sockets. " | fatal("Too many listen sockets. " | ||||
"Enlarge MAX_LISTEN_SOCKS"); | "Enlarge MAX_LISTEN_SOCKS"); | ||||
if ((ret = getnameinfo(ai->ai_addr, ai->ai_addrlen, | if ((ret = getnameinfo(ai->ai_addr, ai->ai_addrlen, | ||||
Show All 28 Lines | if (la->rdomain != NULL && | ||||
continue; | continue; | ||||
} | } | ||||
/* Only communicate in IPv6 over AF_INET6 sockets. */ | /* Only communicate in IPv6 over AF_INET6 sockets. */ | ||||
if (ai->ai_family == AF_INET6) | if (ai->ai_family == AF_INET6) | ||||
sock_set_v6only(listen_sock); | sock_set_v6only(listen_sock); | ||||
debug("Bind to port %s on %s.", strport, ntop); | debug("Bind to port %s on %s.", strport, ntop); | ||||
len = sizeof(socksize); | |||||
getsockopt(listen_sock, SOL_SOCKET, SO_RCVBUF, &socksize, &len); | |||||
debug("Server TCP RWIN socket size: %d", socksize); | |||||
/* Bind the socket to the desired port. */ | /* Bind the socket to the desired port. */ | ||||
if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) { | if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) { | ||||
error("Bind to port %s on %s failed: %.200s.", | error("Bind to port %s on %s failed: %.200s.", | ||||
strport, ntop, strerror(errno)); | strport, ntop, strerror(errno)); | ||||
close(listen_sock); | close(listen_sock); | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,315 Lines • Show Last 20 Lines |