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

Commit 6a35f3c3 authored by Joel Scherpelz's avatar Joel Scherpelz
Browse files

Revert "Set accept_ra_rt_info_max_plen to 64 before enabling IPv6 interfaces"

On second thought, let's set accept_ra_rt_info_m**_plen in 
Netd (InterfaceController::initializeAll())

This reverts commit 25870a2c.

Change-Id: I22b000623bb852e375385d4aae789d007e84ba3d
parent 25870a2c
Loading
Loading
Loading
Loading
+6 −30
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.net.ip;

import static android.net.util.NetworkConstants.RFC7421_PREFIX_LENGTH;

import com.android.internal.util.MessageUtils;
import com.android.internal.util.WakeupMessage;

@@ -44,7 +42,6 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
import android.os.SystemClock;
import android.system.OsConstants;
import android.text.TextUtils;
import android.util.LocalLog;
import android.util.Log;
@@ -1031,36 +1028,15 @@ public class IpManager extends StateMachine {
        return true;
    }

    private void enableInterfaceIPv6PrivacyExtensions() {
    private boolean startIPv6() {
        // Set privacy extensions.
        final String PREFER_TEMPADDRS = "2";
        NetdService.run((INetd netd) -> {
                netd.setProcSysNet(
                        INetd.IPV6, INetd.CONF, mInterfaceName, "use_tempaddr", PREFER_TEMPADDRS);
            });
    }

    private void setInterfaceIPv6RaRtInfoMaxPlen(int plen) {
        // Setting RIO max plen is best effort. Catch and ignore most exceptions.
        try {
            NetdService.run((INetd netd) -> {
                netd.setProcSysNet(
                            INetd.IPV6, INetd.CONF, mInterfaceName, "accept_ra_rt_info_max_plen",
                            Integer.toString(plen));
                        INetd.IPV6, INetd.CONF, mInterfaceName, "use_tempaddr",
                        PREFER_TEMPADDRS);
            });
        } catch (ServiceSpecificException e) {
            // Old kernel versions without support for RIOs do not export accept_ra_rt_info_max_plen
            // in the /proc filesystem. If the kernel supports RIOs we should never see any other
            // type of error.
            if (e.errorCode != OsConstants.ENOENT) {
                logError("unexpected error setting accept_ra_rt_info_max_plen %s", e);
            }
        }
    }

    private boolean startIPv6() {
        try {
            enableInterfaceIPv6PrivacyExtensions();
            setInterfaceIPv6RaRtInfoMaxPlen(RFC7421_PREFIX_LENGTH);
            mNwService.enableIpv6(mInterfaceName);
        } catch (IllegalStateException|RemoteException|ServiceSpecificException e) {
            logError("Unable to change interface settings: %s", e);