Changeset b7155d7 in mainline


Ignore:
Timestamp:
2022-06-24T09:44:00Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb4ba92
Parents:
bbb7ffe
git-author:
Jiri Svoboda <jiri@…> (2022-07-23 19:43:22)
git-committer:
Jiri Svoboda <jiri@…> (2022-06-24 09:44:00)
Message:

DHCP should specify a parameter request list with the requested fields

Specifying that we need a DNS server makes DHCP work correctly in
VirtualBox. If not specified, VirtualBox provides an incorrect
DNS server address.

Location:
uspace/srv/net/dhcp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/dhcp/dhcp.c

    rbbb7ffe rb7155d7  
    161161        uint32_t xid;
    162162        errno_t rc;
     163        size_t i;
    163164
    164165        rc = rndgen_uint32(dlink->rndgen, &xid);
     
    176177        hdr->opt_magic = host2uint32_t_be(dhcp_opt_magic);
    177178
    178         opt[0] = opt_msg_type;
    179         opt[1] = 1;
    180         opt[2] = msg_dhcpdiscover;
    181 
    182         opt[3] = opt_end;
    183 
    184         return dhcp_send(&dlink->dt, msgbuf, sizeof(dhcp_hdr_t) + 4);
     179        i = 0;
     180
     181        opt[i++] = opt_msg_type;
     182        opt[i++] = 1;
     183        opt[i++] = msg_dhcpdiscover;
     184
     185        opt[i++] = opt_param_req_list;
     186        opt[i++] = 3;
     187        opt[i++] = 1; /* subnet mask */
     188        opt[i++] = 6; /* DNS server */
     189        opt[i++] = 3; /* router */
     190
     191        opt[i++] = opt_end;
     192
     193        return dhcp_send(&dlink->dt, msgbuf, sizeof(dhcp_hdr_t) + i);
    185194}
    186195
  • uspace/srv/net/dhcp/dhcp_std.h

    rbbb7ffe rb7155d7  
    110110        /** Server identifier */
    111111        opt_server_id = 54,
     112        /** Parameter request list */
     113        opt_param_req_list = 55,
    112114        /** End */
    113115        opt_end = 255
Note: See TracChangeset for help on using the changeset viewer.