diff --git a/src/shrpx.cc b/src/shrpx.cc index 0f57e0cb..c4a96deb 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -131,7 +131,6 @@ void evlistener_errorcb(evconnlistener *listener, void *ptr) namespace { evconnlistener* create_evlistener(ListenHandler *handler, int family) { - // TODO Listen both IPv4 and IPv6 addrinfo hints; int fd = -1; int r; @@ -145,8 +144,10 @@ evconnlistener* create_evlistener(ListenHandler *handler, int family) hints.ai_flags |= AI_ADDRCONFIG; #endif // AI_ADDRCONFIG + auto node = strcmp("*", get_config()->host) == 0 ? NULL : get_config()->host; + addrinfo *res, *rp; - r = getaddrinfo(get_config()->host, service.c_str(), &hints, &res); + r = getaddrinfo(node, service.c_str(), &hints, &res); if(r != 0) { if(LOG_ENABLED(INFO)) { LOG(INFO) << "Unable to get IPv" << (family == AF_INET ? "4" : "6") @@ -346,7 +347,7 @@ void fill_default_config() mod_config()->daemon = false; mod_config()->server_name = "nghttpx nghttp2/" NGHTTP2_VERSION; - set_config_str(&mod_config()->host, "0.0.0.0"); + set_config_str(&mod_config()->host, "*"); mod_config()->port = 3000; mod_config()->private_key_file = 0; mod_config()->private_key_passwd = 0; @@ -499,7 +500,9 @@ Connections: << get_config()->downstream_host << "," << get_config()->downstream_port << R"(' -f, --frontend= - Set frontend host and port. + Set frontend host and port. If is '*', it + assumes all addresses including both IPv4 and + IPv6. Default: ')" << get_config()->host << "," << get_config()->port << R"(' --backlog= Set listen backlog size. If -1 is given,