Fix type confusion in createRandomUnicastAddress
In createRandomUnicastAddress, it compare the mac with the DEFAULT_MAC_ADDRESS. However, the DEFAULT_MAC_ADDRESS is defined as a string, so the MacAddress equals check always return false. This patch corrects the wrong String definition to MacAddress. Bug: 182165856 Test: NetworkStaticLibTests Change-Id: Ia0905bfa7a4dd723f42903f77f9d925349ce193e
This commit is contained in:
@@ -41,7 +41,8 @@ public final class MacAddressUtils {
|
||||
private static final long NIC_MASK = longAddrFromByteAddr(
|
||||
MacAddress.fromString("0:0:0:ff:ff:ff").toByteArray());
|
||||
// Matches WifiInfo.DEFAULT_MAC_ADDRESS
|
||||
private static final String DEFAULT_MAC_ADDRESS = "02:00:00:00:00:00";
|
||||
private static final MacAddress DEFAULT_MAC_ADDRESS =
|
||||
MacAddress.fromString("02:00:00:00:00:00");
|
||||
private static final int ETHER_ADDR_LEN = 6;
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,8 @@ import org.junit.runner.RunWith;
|
||||
public final class MacAddressUtilsTest {
|
||||
|
||||
// Matches WifiInfo.DEFAULT_MAC_ADDRESS
|
||||
private static final String DEFAULT_MAC_ADDRESS = "02:00:00:00:00:00";
|
||||
private static final MacAddress DEFAULT_MAC_ADDRESS =
|
||||
MacAddress.fromString("02:00:00:00:00:00");
|
||||
|
||||
@Test
|
||||
public void testIsMulticastAddress() {
|
||||
|
||||
Reference in New Issue
Block a user