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
Merged-In: I19e124adef6d9f4992d8293db3190bcf74c95848
Change-Id: I19e124adef6d9f4992d8293db3190bcf74c95848
(cherry picked from commit d39837f7e2)
This commit is contained in:
committed by
Nathan Harold
parent
cac8775b2a
commit
b25e678b4b
@@ -690,14 +690,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();
|
||||
}
|
||||
@@ -709,14 +710,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