summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-02-10 21:15:47 +0100
committerLennart Poettering <lennart@poettering.net>2015-02-10 21:15:47 +0100
commit804138a08c1fd6a4a3c19ead91eeb8ef312c36a0 (patch)
tree292dfd72ec492d3147066314b4bf86272207c273
parentb762fbd128480426d225596b18604a45042339c5 (diff)
test-lldp: initialize structs when we define them
-rw-r--r--src/libsystemd-network/test-lldp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd-network/test-lldp.c b/src/libsystemd-network/test-lldp.c
index 946f358e32..f81284e2a7 100644
--- a/src/libsystemd-network/test-lldp.c
+++ b/src/libsystemd-network/test-lldp.c
@@ -45,13 +45,13 @@ static struct ether_addr mac_addr = {
static int lldp_build_tlv_packet(tlv_packet **ret) {
_cleanup_tlv_packet_free_ tlv_packet *m = NULL;
const uint8_t lldp_dst[] = LLDP_MULTICAST_ADDR;
- struct ether_header ether;
+ struct ether_header ether = {
+ .ether_type = htons(ETHERTYPE_LLDP),
+ };
/* Append ethernet header */
- memset(&ether, 0, sizeof(ether));
memcpy(&ether.ether_dhost, lldp_dst, ETHER_ADDR_LEN);
memcpy(&ether.ether_shost, &mac_addr, ETHER_ADDR_LEN);
- ether.ether_type = htons(ETHERTYPE_LLDP);
assert_se(tlv_packet_new(&m) >= 0);