1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-02-25 07:32:46 +00:00

Fixed allowing numeric addresses

This commit is contained in:
M66B 2016-02-12 21:13:09 +01:00
parent 9b224314eb
commit 2ba3f8e0d8
2 changed files with 6 additions and 2 deletions

View file

@ -612,7 +612,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
String query = "SELECT a.uid, a.version, a.protocol, a.daddr, d.resource, a.dport, a.block";
query += " FROM access AS a";
query += " JOIN dns AS d";
query += " LEFT JOIN dns AS d";
query += " ON d.qname = a.daddr";
query += " WHERE a.block >= 0";

View file

@ -1013,8 +1013,12 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
map.put(key, new HashMap());
try {
map.get(key).put(InetAddress.getByName(dresource), block);
Log.i(TAG, "Set filter uid=" + uid + " " + daddr + " " + dresource + "/" + dport + "=" + block);
if (dresource == null) {
if (Util.isNumericAddress(daddr))
map.get(key).put(InetAddress.getByName(daddr), block);
} else
map.get(key).put(InetAddress.getByName(dresource), block);
} catch (UnknownHostException ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}