adjustments for ipv6
This commit is contained in:
parent
bfad6a3193
commit
00a7b17f94
|
@ -659,11 +659,17 @@ public class Sigar implements SigarProxy {
|
|||
}
|
||||
|
||||
if (conn.getLocalPort() == port) {
|
||||
if (conn.getLocalAddress().equals(NetFlags.ANY_ADDR)) {
|
||||
String address =
|
||||
conn.getLocalAddress();
|
||||
|
||||
if (address.equals(NetFlags.ANY_ADDR)) {
|
||||
return NetFlags.LOOPBACK_ADDRESS;
|
||||
}
|
||||
else if (address.equals(NetFlags.ANY_ADDR_V6)) {
|
||||
return NetFlags.LOOPBACK_ADDRESS_V6;
|
||||
}
|
||||
else {
|
||||
return conn.getLocalAddress();
|
||||
return address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,12 +110,12 @@ public class Netstat extends SigarCommandBase {
|
|||
String port = formatPort(proto, portnum);
|
||||
String address;
|
||||
|
||||
if (isNumeric) {
|
||||
address = ip;
|
||||
}
|
||||
else if (ip.equals(NetFlags.ANY_ADDR)) {
|
||||
if (NetFlags.isAnyAddress(ip)) {
|
||||
address = "*";
|
||||
}
|
||||
else if (isNumeric) {
|
||||
address = ip;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
address = InetAddress.getByName(ip).getHostName();
|
||||
|
|
Loading…
Reference in New Issue