From: Thomas Haller Date: Tue, 11 Sep 2018 00:45:48 +0000 (+0200) Subject: dhcp: fix assertion starting DHCP client without MAC address (#10054) X-Git-Tag: v240~740 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a507737e5c440dae56102b6b8d0e68b68e624d00;p=thirdparty%2Fsystemd.git dhcp: fix assertion starting DHCP client without MAC address (#10054) An assertion in dhcp_network_bind_raw_socket() is triggered when starting an sd_dhcp_client without setting a MAC address first. - sd_dhcp_client_start() - client_start() - client_start_delayed() - dhcp_network_bind_raw_socket() In that case, the arp-type and MAC address is still unset. Note that dhcp_network_bind_raw_socket() already checks for a valid arp-type and MAC address below, so we should just gracefully return -EINVAL. Maybe sd_dhcp_client_start() should fail earlier when starting without MAC address. But the failure here will be correctly propagated and the start aborted. Fixes: 76253e73f9c9c24fec755e485516f3b55d0707b4 --- diff --git a/src/libsystemd-network/dhcp-network.c b/src/libsystemd-network/dhcp-network.c index 77638338f25..cf59f14958e 100644 --- a/src/libsystemd-network/dhcp-network.c +++ b/src/libsystemd-network/dhcp-network.c @@ -126,8 +126,6 @@ int dhcp_network_bind_raw_socket(int ifindex, union sockaddr_union *link, const uint8_t *bcast_addr = NULL; uint8_t dhcp_hlen = 0; - assert_return(mac_addr_len > 0, -EINVAL); - if (arp_type == ARPHRD_ETHER) { assert_return(mac_addr_len == ETH_ALEN, -EINVAL); memcpy(ð_mac, mac_addr, ETH_ALEN);