Changeset b7155d7 in mainline for uspace/srv/net/dhcp/dhcp.c


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.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.