1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-31 06:02:27 +02:00

Add debugging for alastair

This commit is contained in:
Jeff Mitchell 2012-06-22 16:46:44 -04:00
parent 966445a465
commit e2cc678daa

View File

@ -767,20 +767,26 @@ Servent::printCurrentTransfers()
bool
Servent::isIPWhitelisted( QHostAddress ip )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Performing checks against ip" << ip.toString();
typedef QPair< QHostAddress, int > range;
QList< range > subnetEntries;
QList< QNetworkInterface > networkInterfaces = QNetworkInterface::allInterfaces();
foreach( QNetworkInterface interface, networkInterfaces )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking interface" << interface.humanReadableName();
QList< QNetworkAddressEntry > addressEntries = interface.addressEntries();
foreach( QNetworkAddressEntry addressEntry, addressEntries )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking address entry with ip" << addressEntry.ip().toString() << "and prefix length" << addressEntry.prefixLength();
if ( ip.isInSubnet( addressEntry.ip(), addressEntry.prefixLength() ) )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "success";
return true;
}
}
}
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "failure";
return false;
}