]> git.ipfire.org Git - thirdparty/systemd.git/commit
dhcp: support endianness independent dhcp_identifier_set_iaid() 10614/head
authorThomas Haller <thaller@redhat.com>
Thu, 1 Nov 2018 13:43:11 +0000 (14:43 +0100)
committerThomas Haller <thaller@redhat.com>
Mon, 12 Nov 2018 18:08:35 +0000 (19:08 +0100)
commit6d13616b9e97743b45794deb892b28b4d6ab1835
treefdd2ee10c0c096b80dfef769e1dd416976af1bda
parent43fc095532899121030750204f47ab8566514d90
dhcp: support endianness independent dhcp_identifier_set_iaid()

The previous code did htole64() followed by unaligned_write_be32() (the
XOR and shift in between is endianness agnostic). That means, on every
architeture there is always exactly one byte swap and the iaid is
dependent on endianness.

Since dhcp_identifier_set_iaid() is part of the DUID generation
algorithm, this cannot be fixed without changing the client-id.
In particular, as the client-id already depends on the machine-id (and
is thus inherrently host-specific), it is better to stick to the current
behavior.

However, add a parameter to switch between old and new behaviour.
Since the new behavior is unused, the only real purpose of this
change is to self-document the oddity of the function.

Fixes: 933f9caeeb2b3c1b951d330e04beb04226e5a890
src/libsystemd-network/dhcp-identifier.c
src/libsystemd-network/dhcp-identifier.h
src/libsystemd-network/sd-dhcp-client.c
src/libsystemd-network/sd-dhcp6-client.c
src/libsystemd-network/test-dhcp-client.c