1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-26 10:03:40 +03:00

test-lldp: initialize structs when we define them

This commit is contained in:
Lennart Poettering 2015-02-10 21:15:47 +01:00
parent b762fbd128
commit 804138a08c

View File

@ -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);