Changeset 3e6bca8 in mainline for uspace/srv/net/dhcp/dhcp.c


Ignore:
Timestamp:
2021-08-08T17:30:29Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a7f7b9c3
Parents:
b4edc96
Message:

Represent Ethernet address as a number instead of an array

Carefully document the design since this breaks the principle of least
surprise. Also add unit tests.

File:
1 edited

Legend:

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

    rb4edc96 r3e6bca8  
    162162        hdr->flags = flag_broadcast;
    163163
    164         memcpy(dlink->link_info.mac_addr.b, hdr->chaddr,
    165             sizeof(dlink->link_info.mac_addr.b));
     164        eth_addr_encode(&dlink->link_info.mac_addr, hdr->chaddr);
    166165        hdr->opt_magic = host2uint32_t_be(dhcp_opt_magic);
    167166
     
    187186        hdr->flags = flag_broadcast;
    188187        hdr->ciaddr = host2uint32_t_be(offer->oaddr.addr);
    189         memcpy(hdr->chaddr, dlink->link_info.mac_addr.b, 6);
     188        eth_addr_encode(&dlink->link_info.mac_addr, hdr->chaddr);
    190189        hdr->opt_magic = host2uint32_t_be(dhcp_opt_magic);
    191190
Note: See TracChangeset for help on using the changeset viewer.