Skip to content

Commit 12f3e2e

Browse files
Merge pull request stealthcopter#25 from stealthcopter/feature/develop
Feature/develop
2 parents b40b8f7 + cf6420a commit 12f3e2e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ public static SubnetDevices fromIPAddress(@NonNull final String ipAddress) {
7171
subnetDevice.addresses.addAll(ARPInfo.getAllIPAddressesInARPCache());
7272

7373
// Add all missing addresses in subnet
74+
String segment = ipAddress.substring(0, ipAddress.lastIndexOf(".") + 1);
7475
for (int j = 0; j < 255; j++) {
75-
if (!subnetDevice.addresses.contains(ipAddress + j)) {
76-
subnetDevice.addresses.add(ipAddress + j);
76+
if (!subnetDevice.addresses.contains(segment + j)) {
77+
subnetDevice.addresses.add(segment + j);
7778
}
7879
}
7980

@@ -178,4 +179,4 @@ public void run() {
178179
}
179180
}
180181

181-
}
182+
}

0 commit comments

Comments
 (0)