diff --git a/src/ip_utils.cpp b/src/ip_utils.cpp index 3bcf38cfb159bd70678e852f6b35e92d559b3be0..ad031230b54259b1b16f697d9d94c24b26a404a3 100644 --- a/src/ip_utils.cpp +++ b/src/ip_utils.cpp @@ -87,10 +87,6 @@ ip_utils::getHostName() p = inet_ntop(AF_INET, &localAddr.sin_addr, tempstr, sizeof(tempstr)); if (p) ret.address = p; - else - return {}; - } else { - return {}; } #elif (defined(BSD) && BSD >= 199306) || defined(__FreeBSD_kernel__) struct ifaddrs* ifap; @@ -124,7 +120,6 @@ ip_utils::getHostName() } } freeifaddrs(ifap); - return ret; #else struct ifconf ifConf; struct ifreq ifReq; @@ -170,18 +165,17 @@ ip_utils::getHostName() } ret.interface = pifReq->ifr_name; p = inet_ntop(pifReq->ifr_addr.sa_family, - (sockaddr_in*)&pifReq->ifr_addr, + &((sockaddr_in*)&pifReq->ifr_addr)->sin_addr, tempstr, sizeof(tempstr)); if (p) ret.address = p; - } j++; // Increment j if we found an address which is not loopback and is up. } close(localSock); #endif - return {}; + return ret; } std::string diff --git a/src/upnp/protocol/pupnp/pupnp.cpp b/src/upnp/protocol/pupnp/pupnp.cpp index 403a7046142e69bc23e87b7d852f1792bf612d6e..e5e1a42b7a6484d0f15d363bd1cf5a8f8989d294 100644 --- a/src/upnp/protocol/pupnp/pupnp.cpp +++ b/src/upnp/protocol/pupnp/pupnp.cpp @@ -111,13 +111,8 @@ void PUPnP::initUpnpLib() { assert(not initialized_); - auto hostinfo = ip_utils::getHostName(); - - if (logger_) logger_->debug("PUPnP: Initializing libupnp {} {}", hostinfo.address, hostinfo.interface); - int upnp_err = UpnpInit2(hostinfo.interface.empty() ? nullptr : hostinfo.interface.c_str(), 0); - if (upnp_err != UPNP_E_SUCCESS) { if (logger_) logger_->error("PUPnP: Can't initialize libupnp: {}", UpnpGetErrorMessage(upnp_err)); UpnpFinish(); @@ -632,7 +627,7 @@ PUPnP::processRequestMappingFailure(const Mapping& map) ioContext->post([w = weak(), map] { if (auto upnpThis = w.lock()) { - if (upnpThis->logger_) upnpThis->logger_->warn("PUPnP: Closed mapping {}", map.toString()); + if (upnpThis->logger_) upnpThis->logger_->debug("PUPnP: Closed mapping {}", map.toString()); // JAMI_DBG("PUPnP: Failed to request mapping %s", map.toString().c_str()); if (upnpThis->observer_) upnpThis->observer_->onMappingRequestFailed(map); @@ -754,7 +749,7 @@ PUPnP::processDiscoverySearchResult(const std::string& cpDeviceId, auto igdId = cpDeviceId + " url: " + igdLocationUrl; if (not discoveredIgdList_.emplace(igdId).second) { - if (logger_) logger_->warn("PUPnP: IGD [{}] already in the list", igdId); + //if (logger_) logger_->debug("PUPnP: IGD [{}] already in the list", igdId); return; }