Added implementation for VTI add/remove address

This change adds implementation details for add/remove addresses onto a
VTI.

Bug: 73675031
Test: New tests added, passing on Walleye
Merged-In: Idde9d943a5285d2c13c5c6b0f7b8a9faf718e6a5
Change-Id: Idde9d943a5285d2c13c5c6b0f7b8a9faf718e6a5
(cherry picked from commit ecc9f7cc08804e3fa15fea04ae94ea1bc74edbfe)
This commit is contained in:
Benedict Wong
2018-03-01 18:53:07 -08:00
committed by Nathan Harold
parent e3536f066d
commit 97c3c945d7
3 changed files with 57 additions and 24 deletions

View File

@@ -16,6 +16,7 @@
package android.net;
import android.net.LinkAddress;
import android.net.Network;
import android.net.IpSecConfig;
import android.net.IpSecUdpEncapResponse;
@@ -48,11 +49,11 @@ interface IIpSecService
void addAddressToTunnelInterface(
int tunnelResourceId,
String localAddr);
in LinkAddress localAddr);
void removeAddressFromTunnelInterface(
int tunnelResourceId,
String localAddr);
in LinkAddress localAddr);
void deleteTunnelInterface(int resourceId);

View File

@@ -656,10 +656,14 @@ public final class IpSecManager {
* tunneled traffic.
*
* @param address the local address for traffic inside the tunnel
* @throws IOException if the address could not be added
* @hide
*/
public void addAddress(LinkAddress address) throws IOException {
public void addAddress(LinkAddress address) {
try {
mService.addAddressToTunnelInterface(mResourceId, address);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
@@ -668,10 +672,14 @@ public final class IpSecManager {
* <p>Remove an address which was previously added to the IpSecTunnelInterface
*
* @param address to be removed
* @throws IOException if the address could not be removed
* @hide
*/
public void removeAddress(LinkAddress address) throws IOException {
public void removeAddress(LinkAddress address) {
try {
mService.removeAddressFromTunnelInterface(mResourceId, address);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
private IpSecTunnelInterface(@NonNull IIpSecService service,