Add a new API to get the network ID range of IPSec tunnel interface
- Add a new API to get the network ID range of IPSec tunnel interface. - Use the new API in IpSecServiceTest to make sure the result is the same. Follow-up commit will change the logic in IpSecService#reserveNetId(), the modified test can ensure the correctness of the new change. Bug: 172183305 Test: atest FrameworksNetTests:IpSecServiceTest Change-Id: Ic605e48941fc9d6482cdcd01a8adcdc9b6d586a6
This commit is contained in:
@@ -5040,4 +5040,21 @@ public class ConnectivityManager {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
// The first network ID of IPSec tunnel interface.
|
||||
private static final int TUN_INTF_NETID_START = 0xFC00;
|
||||
// The network ID range of IPSec tunnel interface.
|
||||
private static final int TUN_INTF_NETID_RANGE = 0x0400;
|
||||
|
||||
/**
|
||||
* Get the network ID range reserved for IPSec tunnel interfaces.
|
||||
*
|
||||
* @return A Range which indicates the network ID range of IPSec tunnel interface.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = MODULE_LIBRARIES)
|
||||
@NonNull
|
||||
public static Range<Integer> getIpSecNetIdRange() {
|
||||
return new Range(TUN_INTF_NETID_START, TUN_INTF_NETID_START + TUN_INTF_NETID_RANGE - 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user