|
|
@ -178,22 +178,26 @@ class FilterParserThread : public QThread { |
|
|
|
} |
|
|
|
} |
|
|
|
// Now Add to the filter
|
|
|
|
// Now Add to the filter
|
|
|
|
QStringList IP; |
|
|
|
QStringList IP; |
|
|
|
if(IPv4) { |
|
|
|
try { |
|
|
|
//IPv4 addresses
|
|
|
|
if(IPv4) { |
|
|
|
IP = strStartIP.split('.'); |
|
|
|
//IPv4 addresses
|
|
|
|
address_v4 start((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt()); |
|
|
|
IP = strStartIP.split('.'); |
|
|
|
IP = strEndIP.split('.'); |
|
|
|
address_v4 start((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt()); |
|
|
|
address_v4 last((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt()); |
|
|
|
IP = strEndIP.split('.'); |
|
|
|
// Apply to bittorrent session
|
|
|
|
address_v4 last((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt()); |
|
|
|
filter.add_rule(start, last, ip_filter::blocked); |
|
|
|
// Apply to bittorrent session
|
|
|
|
} else { |
|
|
|
filter.add_rule(start, last, ip_filter::blocked); |
|
|
|
// IPv6, ex : 1fff:0000:0a88:85a3:0000:0000:ac1f:8001
|
|
|
|
} else { |
|
|
|
IP = strStartIP.split(':'); |
|
|
|
// IPv6, ex : 1fff:0000:0a88:85a3:0000:0000:ac1f:8001
|
|
|
|
address_v6 start = address_v6::from_string(strStartIP.remove(':', 0).toUtf8().data()); |
|
|
|
IP = strStartIP.split(':'); |
|
|
|
IP = strEndIP.split(':'); |
|
|
|
address_v6 start = address_v6::from_string(strStartIP.remove(':', 0).toUtf8().data()); |
|
|
|
address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toUtf8().data()); |
|
|
|
IP = strEndIP.split(':'); |
|
|
|
// Apply to bittorrent session
|
|
|
|
address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toUtf8().data()); |
|
|
|
filter.add_rule(start, last, ip_filter::blocked); |
|
|
|
// Apply to bittorrent session
|
|
|
|
|
|
|
|
filter.add_rule(start, last, ip_filter::blocked); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}catch(exception){ |
|
|
|
|
|
|
|
qDebug("Bad line in filter file, avoided crash..."); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
file.close(); |
|
|
|
file.close(); |
|
|
|