mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-15 09:21:06 +02:00
Ip4Address: Update Self Assigned IP from 169.x.y.z to 169.254.x.y
Update the prefix for self assigned IPs, so we can support more IPs when using HostLocationProvider. Dynamic Configuration of IPv4 Link-Local Addresses https://tools.ietf.org/html/rfc3927 Change-Id: I29931ee45f01a4c9d89784884ef27adb376f5efa
This commit is contained in:
parent
67b756023b
commit
cf8ee3ca46
@ -335,7 +335,7 @@ public class IpAddress implements Comparable<IpAddress> {
|
|||||||
* @return true if this address is self-assigned
|
* @return true if this address is self-assigned
|
||||||
*/
|
*/
|
||||||
public boolean isSelfAssigned() {
|
public boolean isSelfAssigned() {
|
||||||
return isIp4() && octets[0] == (byte) 169;
|
return isIp4() && octets[0] == (byte) 169 && octets[1] == (byte) 254;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -763,7 +763,7 @@ public class IpAddressTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testIsSelfAssignedIpv4() {
|
public void testIsSelfAssignedIpv4() {
|
||||||
IpAddress normalIP = IpAddress.valueOf("10.0.0.1");
|
IpAddress normalIP = IpAddress.valueOf("10.0.0.1");
|
||||||
IpAddress selfAssignedIP = IpAddress.valueOf("169.1.2.3");
|
IpAddress selfAssignedIP = IpAddress.valueOf("169.254.2.3");
|
||||||
assertFalse(normalIP.isSelfAssigned());
|
assertFalse(normalIP.isSelfAssigned());
|
||||||
assertTrue(selfAssignedIP.isSelfAssigned());
|
assertTrue(selfAssignedIP.isSelfAssigned());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user