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

Commit b7b42cec authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6721158 from a3a733c5 to sc-release

Change-Id: I4f814df4ad9d8e106a81f4e44fa6d11e121ac846
parents 4b7d81ab a3a733c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
    <!-- Permissions must be defined here, and not in the base manifest, as the network stack
         running in the system server process does not need any permission, and having privileged
         permissions added would cause crashes on startup unless they are also added to the
         privileged permissions whitelist for that package. -->
         privileged permissions allowlist for that package. -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+1 −1
Original line number Diff line number Diff line
@@ -778,7 +778,7 @@ public class ApfFilter {
            mPacket = ByteBuffer.wrap(Arrays.copyOf(packet, length));
            mLastSeen = currentTimeSeconds();

            // Sanity check packet in case a packet arrives before we attach RA filter
            // Check packet in case a packet arrives before we attach RA filter
            // to our packet socket. b/29586253
            if (getUint16(mPacket, ETH_ETHERTYPE_OFFSET) != ETH_P_IPV6 ||
                    getUint8(mPacket, IPV6_NEXT_HEADER_OFFSET) != IPPROTO_ICMPV6 ||
+7 −1
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ public class DhcpServer extends StateMachine {
    private static final int CMD_UPDATE_PARAMS = 3;
    @VisibleForTesting
    protected static final int CMD_RECEIVE_PACKET = 4;
    private static final int CMD_TERMINATE_AFTER_STOP = 5;

    @NonNull
    private final Context mContext;
@@ -362,10 +363,12 @@ public class DhcpServer extends StateMachine {
     * Stop listening for packets.
     *
     * <p>As the server is stopped asynchronously, some packets may still be processed shortly after
     * calling this method.
     * calling this method. The server will also be cleaned up and can't be started again, even if
     * it was already stopped.
     */
    void stop(@Nullable INetworkStackStatusCallback cb) {
        sendMessage(CMD_STOP_DHCP_SERVER, cb);
        sendMessage(CMD_TERMINATE_AFTER_STOP);
    }

    private void maybeNotifyStatus(@Nullable INetworkStackStatusCallback cb, int statusCode) {
@@ -407,6 +410,9 @@ public class DhcpServer extends StateMachine {
                    mEventCallbacks = obj.second;
                    transitionTo(mRunningState);
                    return HANDLED;
                case CMD_TERMINATE_AFTER_STOP:
                    quit();
                    return HANDLED;
                default:
                    return NOT_HANDLED;
            }
+11 −7
Original line number Diff line number Diff line
@@ -1012,7 +1012,7 @@ public class IpClientIntegrationTest {
        assertNotNull(params.macAddr);
        assertTrue(params.hasMacAddress);

        // Sanity check.
        //  Check interface "lo".
        params = InterfaceParams.getByName("lo");
        assertNotNull(params);
        assertEquals("lo", params.name);
@@ -1239,12 +1239,16 @@ public class IpClientIntegrationTest {
                        == (byte) ICMPV6_ROUTER_SOLICITATION;
    }

    private void waitForRouterSolicitation() throws ParseException {
        byte[] packet;
        while ((packet = mPacketReader.popPacket(PACKET_TIMEOUT_MS)) != null) {
            if (isRouterSolicitation(packet)) return;
        }
        fail("No router solicitation received on interface within timeout");
    /**
     * Wait for any router solicitation to have arrived since the packet reader was received.
     *
     * This method does not affect packets obtained via mPacketReader.popPacket. After any router
     * solicitation has been received, calls to this method will just return immediately.
     */
    private void waitForRouterSolicitation() {
        assertNotNull("No router solicitation received on interface within timeout",
                mPacketReader.getReceivedPackets().poll(
                        PACKET_TIMEOUT_MS, 0 /* pos */, this::isRouterSolicitation));
    }

    private void sendRouterAdvertisement(boolean waitForRs, short lifetime) throws Exception {
+8 −0
Original line number Diff line number Diff line
@@ -72,6 +72,14 @@ public class TapPacketReader extends PacketReader {
        return mReadHead.getValue().poll(timeoutMs, filter::test);
    }

    /**
     * Get the {@link ArrayTrackRecord} that records all packets received by the reader since its
     * creation.
     */
    public ArrayTrackRecord<byte[]> getReceivedPackets() {
        return mReceivedPackets;
    }

    public void sendResponse(final ByteBuffer packet) throws IOException {
        try (FileOutputStream out = new FileOutputStream(mTapFd)) {
            byte[] packetBytes = new byte[packet.limit()];
Loading