[systemd-devel] unaligned write in dhcp_identifier_set_iaid

Michael Olbrich m.olbrich at pengutronix.de
Tue Feb 24 10:22:17 PST 2015


Hi,

there is an unaligned write in dhcp_identifier_set_iaid() and I'm not quite
sure what the correct fix is:

int dhcp_identifier_set_iaid(int ifindex, uint8_t *mac, size_t mac_len, uint32_t *_id) {
[...]
        *_id = (id & 0xffffffff) ^ (id >> 32);
[...]
}

And this is called with:
r = dhcp_identifier_set_iaid(client->index, client->mac_addr, client->mac_addr_len, &client->client_id.ns.iaid);

And iaid is not unaligned because of the packing in struct sd_dhcp_client.
I'm not sure why '_packed_' is used there. It this just to save some space,
or is there a reason for this?

Regards,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


More information about the systemd-devel mailing list