RFR 8168840: InetAddress.getByName() throws java.net.UnknownHostException no such interface when used with virtual interfaces on Solaris

Langer, Christoph christoph.langer at sap.com
Tue Dec 13 08:08:02 UTC 2016


Hi Vyom,

thanks for looking at this. Overall your fix and test look good to me. 

The coding to do the parent search and if required a child search in Java_java_net_NetworkInterface_getByName0 could be done a bit more straightforward, e.g. like this:

    // search the list of interfaces by name
    // for virtual interfaces we need to find the parent first
    colonp = strchr(name_utf, ':');
    if (colonp == NULL) {
        searchName = name_utf;
    } else {
        jio_snprintf(pname, IFNAMESIZE, "%.*s", colonp - name_utf);
        searchName = pname;
    }
    curr = ifs;
    while (curr != NULL) {
        if (strcmp(searchName, curr->name) == 0) {
            break;
        }
        curr = curr->next;
    }

    // search the child list
    if (curr != NULL && colonp != NULL) {
        curr = curr->childs;
        while (curr != NULL) {
            if (strcmp(name_utf, curr->name) == 0) {
                break;
            }
            curr = curr->next;
        }
    }

Best regards
Christoph

> -----Original Message-----
> From: net-dev [mailto:net-dev-bounces at openjdk.java.net] On Behalf Of Vyom
> Tewari
> Sent: Dienstag, 13. Dezember 2016 04:47
> To: net-dev <net-dev at openjdk.java.net>
> Subject: RFR 8168840: InetAddress.getByName() throws
> java.net.UnknownHostException no such interface when used with virtual
> interfaces on Solaris
> 
> Hi,
> 
> Please review the code changes for below issue.
> 
> BugId    : https://bugs.openjdk.java.net/browse/JDK-8168840
> 
> webrev :
> http://cr.openjdk.java.net/~vtewari/8168840/webrev0.0/index.html
> <http://cr.openjdk.java.net/%7Evtewari/8168840/webrev0.0/index.html>
> 
> Thanks,
> 
> Vyom



More information about the net-dev mailing list