Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00723d8d authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by Automerger Merge Worker
Browse files

Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." am: 65be95c7 am:...

Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." am: 65be95c7 am: 97518a0b am: 8097b342

Change-Id: I78c0f8204c6fd900e946821ad9f29624a8406e45
parents 7fc5b207 8097b342
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -3153,7 +3153,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
            }
            }
        }
        }


        nai.clatd.setNat64Prefix(prefix);
        nai.clatd.setNat64PrefixFromDns(prefix);
        handleUpdateLinkProperties(nai, new LinkProperties(nai.linkProperties));
        handleUpdateLinkProperties(nai, new LinkProperties(nai.linkProperties));
    }
    }


@@ -5865,9 +5865,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
            @NonNull LinkProperties oldLp) {
            @NonNull LinkProperties oldLp) {
        int netId = networkAgent.network.netId;
        int netId = networkAgent.network.netId;


        // The NetworkAgentInfo does not know whether clatd is running on its network or not, or
        // The NetworkAgent does not know whether clatd is running on its network or not, or whether
        // whether there is a NAT64 prefix. Before we do anything else, make sure its LinkProperties
        // a NAT64 prefix was discovered by the DNS resolver. Before we do anything else, make sure
        // are accurate.
        // the LinkProperties for the network are accurate.
        networkAgent.clatd.fixupLinkProperties(oldLp, newLp);
        networkAgent.clatd.fixupLinkProperties(oldLp, newLp);


        updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities,
        updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities,
+10 −6
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ public class Nat464Xlat extends BaseNetworkObserver {
        RUNNING,      // start() called, and the stacked iface is known to be up.
        RUNNING,      // start() called, and the stacked iface is known to be up.
    }
    }


    private IpPrefix mNat64Prefix;
    private IpPrefix mNat64PrefixFromDns;
    private String mBaseIface;
    private String mBaseIface;
    private String mIface;
    private String mIface;
    private Inet6Address mIPv6Address;
    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
     * currently connected and where the NetworkAgent has not disabled 464xlat. It is the signal to
     * enable NAT64 prefix discovery.
     * 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.
     * @return true if the network requires clat, false otherwise.
     */
     */
    @VisibleForTesting
    @VisibleForTesting
@@ -180,7 +180,7 @@ public class Nat464Xlat extends BaseNetworkObserver {


        String addrStr = null;
        String addrStr = null;
        try {
        try {
            addrStr = mNetd.clatdStart(baseIface, mNat64Prefix.toString());
            addrStr = mNetd.clatdStart(baseIface, getNat64Prefix().toString());
        } catch (RemoteException | ServiceSpecificException e) {
        } catch (RemoteException | ServiceSpecificException e) {
            Slog.e(TAG, "Error starting clatd on " + baseIface + ": " + e);
            Slog.e(TAG, "Error starting clatd on " + baseIface + ": " + e);
        }
        }
@@ -318,8 +318,12 @@ public class Nat464Xlat extends BaseNetworkObserver {
        }
        }
    }
    }


    public void setNat64Prefix(IpPrefix nat64Prefix) {
    private IpPrefix getNat64Prefix() {
        mNat64Prefix = nat64Prefix;
        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.
     * has no idea that 464xlat is running on top of it.
     */
     */
    public void fixupLinkProperties(@NonNull LinkProperties oldLp, @NonNull LinkProperties lp) {
    public void fixupLinkProperties(@NonNull LinkProperties oldLp, @NonNull LinkProperties lp) {
        lp.setNat64Prefix(mNat64Prefix);
        lp.setNat64Prefix(getNat64Prefix());


        if (!isRunning()) {
        if (!isRunning()) {
            return;
            return;
+5 −5
Original line number Original line Diff line number Diff line
@@ -181,7 +181,7 @@ public class Nat464XlatTest {
        Nat464Xlat nat = makeNat464Xlat();
        Nat464Xlat nat = makeNat464Xlat();
        ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
        ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);


        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
        nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));


        // Start clat.
        // Start clat.
        nat.start();
        nat.start();
@@ -222,7 +222,7 @@ public class Nat464XlatTest {
        ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
        ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
        InOrder inOrder = inOrder(mNetd, mConnectivity);
        InOrder inOrder = inOrder(mNetd, mConnectivity);


        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
        nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));


        nat.start();
        nat.start();


@@ -309,7 +309,7 @@ public class Nat464XlatTest {
        Nat464Xlat nat = makeNat464Xlat();
        Nat464Xlat nat = makeNat464Xlat();
        ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
        ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);


        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
        nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));


        nat.start();
        nat.start();


@@ -348,7 +348,7 @@ public class Nat464XlatTest {
    public void testStopBeforeClatdStarts() throws Exception {
    public void testStopBeforeClatdStarts() throws Exception {
        Nat464Xlat nat = makeNat464Xlat();
        Nat464Xlat nat = makeNat464Xlat();


        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
        nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));


        nat.start();
        nat.start();


@@ -380,7 +380,7 @@ public class Nat464XlatTest {
    public void testStopAndClatdNeverStarts() throws Exception {
    public void testStopAndClatdNeverStarts() throws Exception {
        Nat464Xlat nat = makeNat464Xlat();
        Nat464Xlat nat = makeNat464Xlat();


        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
        nat.setNat64PrefixFromDns(new IpPrefix(NAT64_PREFIX));


        nat.start();
        nat.start();