Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns."
This commit is contained in:
@@ -3144,7 +3144,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
nai.clatd.setNat64Prefix(prefix);
|
||||
nai.clatd.setNat64PrefixFromDns(prefix);
|
||||
handleUpdateLinkProperties(nai, new LinkProperties(nai.linkProperties));
|
||||
}
|
||||
|
||||
@@ -5856,9 +5856,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
@NonNull LinkProperties oldLp) {
|
||||
int netId = networkAgent.network.netId;
|
||||
|
||||
// The NetworkAgentInfo does not know whether clatd is running on its network or not, or
|
||||
// whether there is a NAT64 prefix. Before we do anything else, make sure its LinkProperties
|
||||
// are accurate.
|
||||
// The NetworkAgent does not know whether clatd is running on its network or not, or whether
|
||||
// a NAT64 prefix was discovered by the DNS resolver. Before we do anything else, make sure
|
||||
// the LinkProperties for the network are accurate.
|
||||
networkAgent.clatd.fixupLinkProperties(oldLp, newLp);
|
||||
|
||||
updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities,
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Nat464Xlat extends BaseNetworkObserver {
|
||||
RUNNING, // start() called, and the stacked iface is known to be up.
|
||||
}
|
||||
|
||||
private IpPrefix mNat64Prefix;
|
||||
private IpPrefix mNat64PrefixFromDns;
|
||||
private String mBaseIface;
|
||||
private String mIface;
|
||||
private Inet6Address mIPv6Address;
|
||||
@@ -100,7 +100,7 @@ public class Nat464Xlat extends BaseNetworkObserver {
|
||||
* currently connected and where the NetworkAgent has not disabled 464xlat. It is the signal to
|
||||
* enable NAT64 prefix discovery.
|
||||
*
|
||||
* @param network the NetworkAgentInfo corresponding to the network.
|
||||
* @param nai the NetworkAgentInfo corresponding to the network.
|
||||
* @return true if the network requires clat, false otherwise.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
@@ -180,7 +180,7 @@ public class Nat464Xlat extends BaseNetworkObserver {
|
||||
|
||||
String addrStr = null;
|
||||
try {
|
||||
addrStr = mNetd.clatdStart(baseIface, mNat64Prefix.toString());
|
||||
addrStr = mNetd.clatdStart(baseIface, getNat64Prefix().toString());
|
||||
} catch (RemoteException | ServiceSpecificException e) {
|
||||
Slog.e(TAG, "Error starting clatd on " + baseIface + ": " + e);
|
||||
}
|
||||
@@ -318,8 +318,12 @@ public class Nat464Xlat extends BaseNetworkObserver {
|
||||
}
|
||||
}
|
||||
|
||||
public void setNat64Prefix(IpPrefix nat64Prefix) {
|
||||
mNat64Prefix = nat64Prefix;
|
||||
private IpPrefix getNat64Prefix() {
|
||||
return mNat64PrefixFromDns;
|
||||
}
|
||||
|
||||
public void setNat64PrefixFromDns(IpPrefix prefix) {
|
||||
mNat64PrefixFromDns = prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -328,7 +332,7 @@ public class Nat464Xlat extends BaseNetworkObserver {
|
||||
* has no idea that 464xlat is running on top of it.
|
||||
*/
|
||||
public void fixupLinkProperties(@NonNull LinkProperties oldLp, @NonNull LinkProperties lp) {
|
||||
lp.setNat64Prefix(mNat64Prefix);
|
||||
lp.setNat64Prefix(getNat64Prefix());
|
||||
|
||||
if (!isRunning()) {
|
||||
return;
|
||||
|
||||
@@ -181,7 +181,7 @@ public class Nat464XlatTest {
|
||||
Nat464Xlat nat = makeNat464Xlat();
|
||||
ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
|
||||
|
||||
nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
|
||||
nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));
|
||||
|
||||
// Start clat.
|
||||
nat.start();
|
||||
@@ -222,7 +222,7 @@ public class Nat464XlatTest {
|
||||
ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
|
||||
InOrder inOrder = inOrder(mNetd, mConnectivity);
|
||||
|
||||
nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
|
||||
nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));
|
||||
|
||||
nat.start();
|
||||
|
||||
@@ -309,7 +309,7 @@ public class Nat464XlatTest {
|
||||
Nat464Xlat nat = makeNat464Xlat();
|
||||
ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
|
||||
|
||||
nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
|
||||
nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));
|
||||
|
||||
nat.start();
|
||||
|
||||
@@ -348,7 +348,7 @@ public class Nat464XlatTest {
|
||||
public void testStopBeforeClatdStarts() throws Exception {
|
||||
Nat464Xlat nat = makeNat464Xlat();
|
||||
|
||||
nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
|
||||
nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));
|
||||
|
||||
nat.start();
|
||||
|
||||
@@ -380,7 +380,7 @@ public class Nat464XlatTest {
|
||||
public void testStopAndClatdNeverStarts() throws Exception {
|
||||
Nat464Xlat nat = makeNat464Xlat();
|
||||
|
||||
nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
|
||||
nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));
|
||||
|
||||
nat.start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user