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

Commit a5265e47 authored by Erik Kline's avatar Erik Kline Committed by Android (Google) Code Review
Browse files

Merge "Request vendor info option (43) to get metered hint" into nyc-dev

parents f262a7e3 1d511ab1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ public class DhcpClient extends StateMachine {
            MessageUtils.findMessageNames(sMessageClasses);

    // DHCP parameters that we request.
    private static final byte[] REQUESTED_PARAMS = new byte[] {
    /* package */ static final byte[] REQUESTED_PARAMS = new byte[] {
        DHCP_SUBNET_MASK,
        DHCP_ROUTER,
        DHCP_DNS_SERVER,
@@ -148,6 +148,7 @@ public class DhcpClient extends StateMachine {
        DHCP_LEASE_TIME,
        DHCP_RENEWAL_TIME,
        DHCP_REBINDING_TIME,
        DHCP_VENDOR_INFO,
    };

    // DHCP flag that means "yes, we support unicast."
+9 −13
Original line number Diff line number Diff line
@@ -631,18 +631,10 @@ public class DhcpPacketTest extends TestCase {
        byte[] hwaddr = {
                (byte) 0xda, (byte) 0x01, (byte) 0x19, (byte) 0x5b, (byte) 0xb1, (byte) 0x7a
        };
        byte[] params = new byte[] {
            DHCP_SUBNET_MASK,
            DHCP_ROUTER,
            DHCP_DNS_SERVER,
            DHCP_DOMAIN_NAME,
            DHCP_MTU,
            DHCP_LEASE_TIME,
        };

        ByteBuffer packet = DhcpPacket.buildDiscoverPacket(
                DhcpPacket.ENCAP_L2, transactionId, secs, hwaddr,
                false /* do unicast */, params);
                false /* do unicast */, DhcpClient.REQUESTED_PARAMS);

        byte[] headers = new byte[] {
            // Ethernet header.
@@ -650,14 +642,14 @@ public class DhcpPacketTest extends TestCase {
            (byte) 0xda, (byte) 0x01, (byte) 0x19, (byte) 0x5b, (byte) 0xb1, (byte) 0x7a,
            (byte) 0x08, (byte) 0x00,
            // IP header.
            (byte) 0x45, (byte) 0x10, (byte) 0x01, (byte) 0x52,
            (byte) 0x45, (byte) 0x10, (byte) 0x01, (byte) 0x56,
            (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x00,
            (byte) 0x40, (byte) 0x11, (byte) 0x39, (byte) 0x8c,
            (byte) 0x40, (byte) 0x11, (byte) 0x39, (byte) 0x88,
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
            // UDP header.
            (byte) 0x00, (byte) 0x44, (byte) 0x00, (byte) 0x43,
            (byte) 0x01, (byte) 0x3e, (byte) 0xd8, (byte) 0xa4,
            (byte) 0x01, (byte) 0x42, (byte) 0x6a, (byte) 0x4a,
            // BOOTP.
            (byte) 0x01, (byte) 0x01, (byte) 0x06, (byte) 0x00,
            (byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef,
@@ -688,13 +680,17 @@ public class DhcpPacketTest extends TestCase {
                    'a', 'n', 'd', 'r', 'o', 'i', 'd', '-',
                    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e',
            // Requested parameter list.
            (byte) 0x37, (byte) 0x06,
            (byte) 0x37, (byte) 0x0a,
                DHCP_SUBNET_MASK,
                DHCP_ROUTER,
                DHCP_DNS_SERVER,
                DHCP_DOMAIN_NAME,
                DHCP_MTU,
                DHCP_BROADCAST_ADDRESS,
                DHCP_LEASE_TIME,
                DHCP_RENEWAL_TIME,
                DHCP_REBINDING_TIME,
                DHCP_VENDOR_INFO,
            // End options.
            (byte) 0xff,
            // Our packets are always of even length. TODO: find out why and possibly fix it.