From 9d04444983069e81e6918cc52063d66d080f8739 Mon Sep 17 00:00:00 2001 From: lanthora Date: Wed, 11 Sep 2024 17:47:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0=20IP=20?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/peer/common.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/peer/common.cc b/src/peer/common.cc index 5114b00e..ecb6ad3a 100644 --- a/src/peer/common.cc +++ b/src/peer/common.cc @@ -99,7 +99,8 @@ uint32_t UdpHolder::IP() { if (!this->ip) { try { for (const auto &iface : Poco::Net::NetworkInterface::list()) { - if (iface.supportsIPv4() && !iface.isLoopback() && !iface.isPointToPoint()) { + if (iface.supportsIPv4() && !iface.isLoopback() && !iface.isPointToPoint() && + iface.type() != iface.NI_TYPE_OTHER) { auto firstAddress = iface.firstAddress(Poco::Net::IPAddress::IPv4); memcpy(&this->ip, firstAddress.addr(), sizeof(this->ip)); this->ip = ntohl(this->ip);