diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2015-08-26 21:16:01 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2015-08-26 21:16:01 +0200 |
| commit | 066e5cdaa0d28a0efa7931a1d324013a0a7db8c6 (patch) | |
| tree | 6c1713791a223a4dae14be760ce89b7e2cb5fff1 /src/base/QXmppStun.cpp | |
| parent | b6a6b481588f4589d037400476a60978d11b792f (diff) | |
| download | qxmpp-066e5cdaa0d28a0efa7931a1d324013a0a7db8c6.tar.gz | |
exclude loopback addresses
Diffstat (limited to 'src/base/QXmppStun.cpp')
| -rw-r--r-- | src/base/QXmppStun.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/base/QXmppStun.cpp b/src/base/QXmppStun.cpp index d41231ac..b8313881 100644 --- a/src/base/QXmppStun.cpp +++ b/src/base/QXmppStun.cpp @@ -118,6 +118,11 @@ static bool isIPv6LinkLocalAddress(const QHostAddress &addr) return (((ipv6addr[0] << 8) + ipv6addr[1]) & 0xffc0) == 0xfe80; } +static bool isLoopbackAddress(const QHostAddress &addr) +{ + return (addr.toIPv4Address() & 0xff000000) == 0x7f000000; +} + static bool decodeAddress(QDataStream &stream, quint16 a_length, QHostAddress &address, quint16 &port, const QByteArray &xorId = QByteArray()) { if (a_length < 4) @@ -2427,6 +2432,11 @@ QList<QHostAddress> QXmppIceComponent::discoverAddresses() entry.netmask().isNull()) continue; + // FIXME: for some reason we can have loopback addresses + // even if the interface does not have the loopback flag + if (isLoopbackAddress(ip)) + continue; + // FIXME: for now skip IPv6 link-local addresses, seems to upset // clients such as empathy if (isIPv6LinkLocalAddress(ip)) { |
