Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

[Request] Add DNS name to IP popup #1415

Closed
an0n981 opened this issue Feb 21, 2014 · 13 comments
Closed

[Request] Add DNS name to IP popup #1415

an0n981 opened this issue Feb 21, 2014 · 13 comments

Comments

@an0n981
Copy link
Contributor

an0n981 commented Feb 21, 2014

No description provided.

@an0n981
Copy link
Contributor Author

an0n981 commented Feb 21, 2014

Edit: for some apps I receive the dns name

@M66B
Copy link
Owner

M66B commented Feb 22, 2014

Unfortunately this is not possibly. The connect hook is at the lowest level of Android. Doing a DNS lookup here would slow down your device, could result in instability and will result in recursion, since a DNS lookup also needs a connect.

@jpeg729
Copy link
Contributor

jpeg729 commented Feb 22, 2014

Try replacing address.toString() by address.getHostName() on the following line
https://github.com/M66B/XPrivacy/blob/master/src/biz/bokhorst/xprivacy/XIoBridge.java#L72

It I don't think it does a lookup, it will return a hostname if it has one, and the ip address otherwise.
I've tried it, it works fairly well. I'm guessing that when an app tries to open a connection to abc.com, that is what goes into the InetAddress object that is used.

@M66B
Copy link
Owner

M66B commented Feb 22, 2014

I will check the source code to be sure.

@an0n981
Copy link
Contributor Author

an0n981 commented Feb 22, 2014

The part I don't understand is that the popups for some apps show the hostname and some don't.

@M66B
Copy link
Owner

M66B commented Feb 22, 2014

I think we are good to go here:

    public String getHostName() {
        if (hostName == null) {
            try {
                hostName = getHostByAddrImpl(this).hostName;
            } catch (UnknownHostException ex) {
                hostName = getHostAddress();
            }
        }
        return hostName;
    }
    private static InetAddress getHostByAddrImpl(InetAddress address) throws UnknownHostException {
        BlockGuard.getThreadPolicy().onNetwork();
        try {
            String hostname = Libcore.os.getnameinfo(address, NI_NAMEREQD);
            return makeInetAddress(address.ipaddress.clone(), hostname);
        } catch (GaiException gaiException) {
            throw gaiException.rethrowAsUnknownHostException();
        }
    }

Meaning that resolving the hostname is handled by Linux and won't result in recursion.

M66B pushed a commit that referenced this issue Feb 22, 2014
@M66B
Copy link
Owner

M66B commented Feb 22, 2014

This might delay making internet connection, however.
I don't think that is a problem, because that is an expensive operation anyway.

@M66B
Copy link
Owner

M66B commented Feb 22, 2014

You can try with this version: http://d-h.st/YuI

@an0n981
Copy link
Contributor Author

an0n981 commented Feb 22, 2014

I know this may be being a bit picky, but would a combination of DNS and IP be possible? The upside of of having only DNS is that the whitelist will not be as long, but on the other hand with a combination we could restrict multinational services to servers in Europe for example

Also with this version Tapatalk cannot to XDA although it is not blacklisted. Faircode forum works ;)

@M66B
Copy link
Owner

M66B commented Feb 22, 2014

Tapatalk works for me without problems.
I don't see the point in showing the IP if there is a host name available, you are connecting to the same service.

@banderos101
Copy link

@an0n981
that would be a nice function to have

@an0n981
Copy link
Contributor Author

an0n981 commented Feb 22, 2014

@M66B sorry I somehow missed your reply, after a reboot XDA was working fine again. Given the fact that backbones in cretain countries are more prone to being monitored, I thought it would be a great security feature to be able to decide with which serves of the same service we connect to. For example I would feel a little more safe connecting to goggle services (bad example, they give me the creeps) if that server were in Europe as compared to the USA

@an0n981
Copy link
Contributor Author

an0n981 commented Feb 22, 2014

Another argument: this could help against DNS hijacking

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants