• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[MOD][Xposed][4.3+] hosts Enabler (v1.0) - re-enables use of hosts file

Search This thread

DavisNT

Inactive Recognized Developer
Aug 27, 2011
522
726
Riga
projects.dm.id.lv
This mod 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:
  • 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")

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

This mod requires Xposed framework to be set up and hosts Enabler enabled as Xposed module.
Disclaimer: I am not responsible for anything that may happen as a result of using this mod.


Xposed Module Repository page:
http://repo.xposed.info/module/lv.id.dm.hostsenabler

For changelog see next post, for download links see downloads section.

XDA:DevDB Information
hosts Enabler, Xposed for all devices (see above for details)

Contributors
DavisNT
Xposed Package Name: lv.id.dm.hostsenabler

Version Information
Status: Stable
Current Stable Version: 1.0
Stable Release Date: 2014-08-30

Created 2014-08-30
Last Updated 2014-08-31
 

defim

Senior Member
Feb 18, 2012
2,744
1,488
Actually I was aware of that module, but I wanted to restore full functionality of hosts file (name resolution, use with third party updater tools etc.) with main focus on name resolution.

Both seem technically more or less the same: Reading an file with blocked hosts and answer name resolution requests with its contents. Btw with some devices (like Nexus 7) there is the issue that the /etc/hosts file is sometime reverted at reboot, what was the cause for me to use Xposed
 

DavisNT

Inactive Recognized Developer
Aug 27, 2011
522
726
Riga
projects.dm.id.lv
Both seem technically more or less the same: Reading an file with blocked hosts and answer name resolution requests with its contents. Btw with some devices (like Nexus 7) there is the issue that the /etc/hosts file is sometime reverted at reboot, what was the cause for me to use Xposed
I won't say they are the same:
  • UnbelovedHosts: full featured ad blocking solution
  • hosts Enabler: enables use of /system/etc/hosts file (for manually added name resolution entries (home PC etc.) or, if you wish, with any 3rd party updater software)
 

bossgamethegreat

New member
Sep 2, 2012
2
0
So could I use this MOD to fix my google play store from have a no connection error caused by a change in the /ect host file?

Sent from my T0LTE using XDA Free mobile app
 

bossgamethegreat

New member
Sep 2, 2012
2
0
I suppose best solution is to undo the change in /system/etc/hosts file.

Yes, I understand and did that. What I'm trying to ask is if this would help make the change constant. It's getting really bothersome to half to keep making the change every time the Play Store feels like it doesn't want to work.

Sent from my T0LTE using XDA Free mobile app
 

DavisNT

Inactive Recognized Developer
Aug 27, 2011
522
726
Riga
projects.dm.id.lv
Yes, I understand and did that. What I'm trying to ask is if this would help make the change constant. It's getting really bothersome to half to keep making the change every time the Play Store feels like it doesn't want to work.
/system/etc/hosts by default should contain only localhost entry. If Google Play needs additional entries then, most likely, there is a problem with DNS servers of your network/provider. If there "appear" some entries which block Google Play then, most likely, you have installed an ad blocker (e.g. AdAway) and you are using some custom blocking lists (which include entry(-ies) that accidentally block Google Play).
BTW This is completely off-topic here. If you wish we can continue discussion in a new thread in form of your device (create the thread and send me PM with link to it).
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    This mod 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:
    • 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")

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

    This mod requires Xposed framework to be set up and hosts Enabler enabled as Xposed module.
    Disclaimer: I am not responsible for anything that may happen as a result of using this mod.


    Xposed Module Repository page:
    http://repo.xposed.info/module/lv.id.dm.hostsenabler

    For changelog see next post, for download links see downloads section.

    XDA:DevDB Information
    hosts Enabler, Xposed for all devices (see above for details)

    Contributors
    DavisNT
    Xposed Package Name: lv.id.dm.hostsenabler

    Version Information
    Status: Stable
    Current Stable Version: 1.0
    Stable Release Date: 2014-08-30

    Created 2014-08-30
    Last Updated 2014-08-31
    1
    Changelog:
    v 1.0
    * Initial release.