hosts Enabler

hosts Enabler allows to use /system/etc/hosts file on configurations/ROMs (mostly symlinked hosts file on Android 4.4+) where it is ignored.
Hosts file usually gets ignored on some ROMs due to SELinux restrictions if it is a symlink to file on different partition.

Technically it works by attaching to all packages/apps and hooking DNS resolution API. On first name resolution API call hosts file is read and stored in memory (in HPPC OpenHashMap structure).

Additional features of hosts file introduced by hosts Enabler:

  • use of IP address 127.0.0.0 allows to fail name resolution of associated hosts
  • use of DNS names instead of IP addresses (these DNS names are passed directly to DNS resolver - they are not looked up in hosts file recursively)

Known limitations:

  • JNI libraries are not affected (some applications may still ignore hosts file)
  • hosts file is read in memory of each application when it makes first DNS query (time and memory used depends on size of hosts file; time is logged in logcat with tag "hostsEnabler")

Disclaimer: Author of hosts Enabler is not responsible for anything that may happen as a result of using this mod.

hosts Enabler uses HPPC: High Performance Primitive Collections for Java library which is distributed under Apache License 2.0.

XDA Thread:
http://forum.xda-developers.com/showthread.php?t=2863036

Author(s): 
Package: 
lv.id.dm.hostsenabler
Version name: 
1.0
Release type: 
Stable (low risk of bugs)
Number of downloads: 
30,954 in total · 11 in the last 24 hours
MD5 checksum: 
d4eb9c63f2cb238225f55a0ec77fa407
Uploaded on: 
Sunday, August 31, 2014 - 00:32
Changes: 
  • Initial release.