summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-10 19:04:43 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-10 19:04:43 +0200
commit3dc055541c570e93c817e42f451f7d3519629cbc (patch)
tree0f0eee0a0a5250b0b091aada462a77a5b83b8173
parent53bac4e0e32b017e7a5c1fd1181c740a1583e3fd (diff)
Revert "sd-dhcp-client: fix strict aliasing issue"
This reverts commit 6ec8e7c763b7dfa82e25e31f6938122748d1608f. This doesn't fix any issues, just makes the code harder to read.
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index a477cccecb..4224e0197c 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -1469,7 +1469,7 @@ static int client_receive_message_udp(sd_event_source *s, int fd,
_cleanup_free_ DHCPMessage *message = NULL;
int buflen = 0, len, r;
const struct ether_addr zero_mac = { { 0, 0, 0, 0, 0, 0 } };
- bool expect_chaddr;
+ const struct ether_addr *expected_chaddr = NULL;
uint8_t expected_hlen = 0;
assert(s);
@@ -1514,11 +1514,11 @@ static int client_receive_message_udp(sd_event_source *s, int fd,
if (client->arp_type == ARPHRD_ETHER) {
expected_hlen = ETH_ALEN;
- expect_chaddr = true;
+ expected_chaddr = (const struct ether_addr *) &client->mac_addr;
} else {
/* Non-ethernet links expect zero chaddr */
expected_hlen = 0;
- expect_chaddr = false;
+ expected_chaddr = &zero_mac;
}
if (message->hlen != expected_hlen) {
@@ -1526,10 +1526,7 @@ static int client_receive_message_udp(sd_event_source *s, int fd,
return 0;
}
- if (memcmp(&message->chaddr[0], expect_chaddr ?
- (void *)&client->mac_addr :
- (void *)&zero_mac,
- ETH_ALEN)) {
+ if (memcmp(&message->chaddr[0], expected_chaddr, ETH_ALEN)) {
log_dhcp_client(client, "received chaddr does not match "
"expected: ignoring");
return 0;