Fixed a bug in IpIsPrivate where 192.168.x.x was not recognized as a private ip.

This commit is contained in:
Andreas 2013-01-15 20:20:31 +01:00
parent 32b81f057d
commit e452ae3ea9
1 changed files with 2 additions and 1 deletions

View File

@ -142,6 +142,7 @@ void NetworkRemote::AcceptConnection() {
if (only_non_public_ip_ && !IpIsPrivate(client_socket->peerAddress())) {
qLog(Info) << "Got a connection from public ip" <<
client_socket->peerAddress().toString();
client_socket->close();
} else {
CreateRemoteClient(client_socket);
}
@ -153,7 +154,7 @@ bool NetworkRemote::IpIsPrivate(const QHostAddress& address) {
address.isInSubnet(QHostAddress::parseSubnet("127.0.0.1/8")) ||
// Link Local v6
address.isInSubnet(QHostAddress::parseSubnet("::1/128")) ||
address.isInSubnet(QHostAddress::parseSubnet("fe80::/10"));
address.isInSubnet(QHostAddress::parseSubnet("fe80::/10")) ||
// Private v4 range
address.isInSubnet(QHostAddress::parseSubnet("192.168.0.0/16")) ||
address.isInSubnet(QHostAddress::parseSubnet("172.16.0.0/12")) ||