Merge pull request #3345 from sysown/v2.1.1-1614

Closes #1614: Added extra logging suggesting solution when 'bind()' fails due to 'EADDRNOTAVAIL'
pull/3356/head
René Cannaò 5 years ago committed by GitHub
commit 11ee38d12a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -51,6 +51,13 @@ int listen_on_port(char *ip, uint16_t port, int backlog, bool reuseport) {
if (bind(sd, next->ai_addr, next->ai_addrlen) == -1) {
//if (errno != EADDRINUSE) {
proxy_error("bind(): %s\n", strerror(errno));
// in case of 'EADDRNOTAVAIL' suggest a solution to user. See #1614.
if (errno == EADDRNOTAVAIL) {
proxy_info(
"Trying to 'bind()' failed due to 'EADDRNOTAVAIL'. If trying to bind to a "
"non-local IP address, make sure 'net.ipv4.ip_nonlocal_bind' is set to '1'\n"
);
}
close(sd);
freeaddrinfo(ai);
return -1;

Loading…
Cancel
Save