[systemd-devel] unaligned write in dhcp_identifier_set_iaid

Tom Gundersen teg at jklm.no
Tue May 19 09:03:42 PDT 2015


On Tue, Feb 24, 2015 at 7:22 PM, Michael Olbrich
<m.olbrich at pengutronix.de> wrote:
> 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?

Thanks for the report. This seems to have fallen through the cracks.
Should be fixed in git, please verify.

Sorry for the delay.

Cheers,

Tom


More information about the systemd-devel mailing list