summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-12-20 13:05:13 +0100
committerThomas Haller <thaller@redhat.com>2018-12-21 19:29:35 +0100
commit24a62f90c764c4c84fc95c654b76842dcf48118e (patch)
tree801965b5dd9828f88e48fd7f8fa677ad3639fe05
parent7bd193ef30fb2a1d4c328bb61412e35a5bccfced (diff)
downloadNetworkManager-24a62f90c764c4c84fc95c654b76842dcf48118e.tar.gz
dhcp: fix sd_dhcp_client_set_client_id() for infiniband addresses
Infiniband addresses are 20 bytes (INFINIBAND_ALEN), but only the last 8 bytes are suitable for putting into the client-id. This bug had no effect for networkd, because sd_dhcp_client_set_client_id() has only one caller which always uses ARPHRD_ETHER type. I was unable to find good references for why this is correct ([1]). Fedora/RHEL has patches for ISC dhclient that also only use the last 8 bytes ([2], [3]). RFC 4390 (Dynamic Host Configuration Protocol (DHCP) over InfiniBand) [4] does not discuss the content of the client-id either. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1658057#c29 [2] https://bugzilla.redhat.com/show_bug.cgi?id=660681 [3] https://src.fedoraproject.org/rpms/dhcp/blob/3ccf3c8d815df4b8e11e1a04850975f099273d5d/f/dhcp-lpf-ib.patch [4] https://tools.ietf.org/html/rfc4390 https://github.com/systemd/systemd/commit/b9d80714583bf40e354ad0fc364ebfb35a0b3d76
-rw-r--r--src/systemd/src/libsystemd-network/sd-dhcp-client.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/systemd/src/libsystemd-network/sd-dhcp-client.c b/src/systemd/src/libsystemd-network/sd-dhcp-client.c
index a8c14072ef..0e40bedf8e 100644
--- a/src/systemd/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/systemd/src/libsystemd-network/sd-dhcp-client.c
@@ -310,7 +310,9 @@ int sd_dhcp_client_set_client_id(
break;
case ARPHRD_INFINIBAND:
- if (data_len != INFINIBAND_ALEN)
+ /* Infiniband addresses are 20 bytes (INFINIBAND_ALEN), however only
+ * the last 8 bytes are stable and suitable for putting into the client-id. */
+ if (data_len != 8)
return -EINVAL;
break;