equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
381 throw new UnknownHostException ("could not enumerate local network interfaces"); |
381 throw new UnknownHostException ("could not enumerate local network interfaces"); |
382 } |
382 } |
383 while (en.hasMoreElements()) { |
383 while (en.hasMoreElements()) { |
384 NetworkInterface ifc = en.nextElement(); |
384 NetworkInterface ifc = en.nextElement(); |
385 if (ifc.getName().equals (ifname)) { |
385 if (ifc.getName().equals (ifname)) { |
386 Enumeration addresses = ifc.getInetAddresses(); |
386 Enumeration<InetAddress> addresses = ifc.getInetAddresses(); |
387 while (addresses.hasMoreElements()) { |
387 while (addresses.hasMoreElements()) { |
388 InetAddress addr = (InetAddress)addresses.nextElement(); |
388 InetAddress addr = addresses.nextElement(); |
389 if (!(addr instanceof Inet6Address)) { |
389 if (!(addr instanceof Inet6Address)) { |
390 continue; |
390 continue; |
391 } |
391 } |
392 Inet6Address ia6_addr = (Inet6Address)addr; |
392 Inet6Address ia6_addr = (Inet6Address)addr; |
393 /* check if site or link local prefixes match */ |
393 /* check if site or link local prefixes match */ |