mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Fixed TWK-226. Never advertise ourselves with an unroutable / internal-only IP address.
This commit is contained in:
@@ -195,8 +195,23 @@ Servent::createConnectionKey( const QString& name, const QString &nodeid, const
|
|||||||
void
|
void
|
||||||
Servent::setExternalAddress( QHostAddress ha, unsigned int port )
|
Servent::setExternalAddress( QHostAddress ha, unsigned int port )
|
||||||
{
|
{
|
||||||
|
QString ip = ha.toString();
|
||||||
|
if ( !qApp->arguments().contains( "--lanhack" ) )
|
||||||
|
{
|
||||||
|
if ( ip.startsWith( "10." ) || ip.startsWith( "172.16." ) || ip.startsWith( "192.168." ) )
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO << "Tried to set an invalid ip as external address!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_externalAddress = ha;
|
m_externalAddress = ha;
|
||||||
m_externalPort = port;
|
m_externalPort = port;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_externalAddress = ha;
|
||||||
|
m_externalPort = port;
|
||||||
|
}
|
||||||
|
|
||||||
if ( m_externalPort == 0 || m_externalAddress.toString().isEmpty() )
|
if ( m_externalPort == 0 || m_externalAddress.toString().isEmpty() )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user