Update IpSecManager to use InetAddress and prefixLen
LinkAddress constructors are currently @hide; this change updates IpSecManager to use InetAddress and prefixLen, and then construct a LinkAddress internally. LinkAddress is used over the binder interface to IpSecService to ensure validity. Bug: 77528639 Test: CTS, Java unit tests ran on walleye Change-Id: I19e124adef6d9f4992d8293db3190bcf74c95848
This commit is contained in:
committed by
Nathan Harold
parent
65ef843176
commit
d39837f7e2
@@ -684,14 +684,15 @@ public final class IpSecManager {
|
||||
* tunneled traffic.
|
||||
*
|
||||
* @param address the local address for traffic inside the tunnel
|
||||
* @param prefixLen length of the InetAddress prefix
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.MANAGE_IPSEC_TUNNELS)
|
||||
public void addAddress(@NonNull LinkAddress address) throws IOException {
|
||||
public void addAddress(@NonNull InetAddress address, int prefixLen) throws IOException {
|
||||
try {
|
||||
mService.addAddressToTunnelInterface(
|
||||
mResourceId, address, mOpPackageName);
|
||||
mResourceId, new LinkAddress(address, prefixLen), mOpPackageName);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -703,14 +704,15 @@ public final class IpSecManager {
|
||||
* <p>Remove an address which was previously added to the IpSecTunnelInterface
|
||||
*
|
||||
* @param address to be removed
|
||||
* @param prefixLen length of the InetAddress prefix
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.MANAGE_IPSEC_TUNNELS)
|
||||
public void removeAddress(@NonNull LinkAddress address) throws IOException {
|
||||
public void removeAddress(@NonNull InetAddress address, int prefixLen) throws IOException {
|
||||
try {
|
||||
mService.removeAddressFromTunnelInterface(
|
||||
mResourceId, address, mOpPackageName);
|
||||
mResourceId, new LinkAddress(address, prefixLen), mOpPackageName);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user