From 1291a042984a3f90a6f122f27d40b10eab009994 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 17 Jan 2018 01:28:09 +0900 Subject: [PATCH 1/3] ipvlan: fix wrong assignment in ipvlan_init() --- src/network/netdev/ipvlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c index 418729c7ef4..856f5bd8058 100644 --- a/src/network/netdev/ipvlan.c +++ b/src/network/netdev/ipvlan.c @@ -79,7 +79,7 @@ static void ipvlan_init(NetDev *n) { assert(m); m->mode = _NETDEV_IPVLAN_MODE_INVALID; - m->mode = _NETDEV_IPVLAN_FLAGS_INVALID; + m->flags = _NETDEV_IPVLAN_FLAGS_INVALID; } const NetDevVTable ipvlan_vtable = { From b7d16a91d670c56bc5051cf8042882515d8de74d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 17 Jan 2018 01:29:13 +0900 Subject: [PATCH 2/3] networkd: fix wrong argument check --- src/network/networkd-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 526c4d46e4d..749b87f336d 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -1357,7 +1357,7 @@ int manager_dhcp6_prefix_remove_all(Manager *m, Link *link) { struct in6_addr *addr; assert_return(m, -EINVAL); - assert_return(l, -EINVAL); + assert_return(link, -EINVAL); HASHMAP_FOREACH_KEY(l, addr, m->dhcp6_prefixes, i) { if (l != link) From 976fade6c122130017d8f340f477db1aa06360bf Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 17 Jan 2018 01:53:00 +0900 Subject: [PATCH 3/3] dhcp6: fix warnings by clang with -Waddress-of-packed-member This fixes the following warnings: ``` [194/1521] Compiling C object 'src/libsystemd-network/systemd-network@sta/dhcp6-option.c.o'. ../../git/systemd/src/libsystemd-network/dhcp6-option.c:110:25: warning: taking address of packed member 'id' of class or structure 'ia_na' may result in an unaligned pointer value [-Waddress-of-packed-member] iaid = &ia->ia_na.id; ^~~~~~~~~~~~ ../../git/systemd/src/libsystemd-network/dhcp6-option.c:115:25: warning: taking address of packed member 'id' of class or structure 'ia_ta' may result in an unaligned pointer value [-Waddress-of-packed-member] iaid = &ia->ia_ta.id; ^~~~~~~~~~~~ 2 warnings generated. ``` --- src/libsystemd-network/dhcp6-option.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c index 7c6a6c4e080..df96ad739df 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/dhcp6-option.c @@ -96,9 +96,8 @@ int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code, int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) { uint16_t len; - be32_t *iaid; uint8_t *ia_hdr; - size_t ia_buflen, ia_addrlen = 0; + size_t iaid_offset, ia_buflen, ia_addrlen = 0; DHCP6Address *addr; int r; @@ -107,12 +106,12 @@ int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) { switch (ia->type) { case SD_DHCP6_OPTION_IA_NA: len = DHCP6_OPTION_IA_NA_LEN; - iaid = &ia->ia_na.id; + iaid_offset = offsetof(DHCP6IA, ia_na); break; case SD_DHCP6_OPTION_IA_TA: len = DHCP6_OPTION_IA_TA_LEN; - iaid = &ia->ia_ta.id; + iaid_offset = offsetof(DHCP6IA, ia_ta); break; default: @@ -128,7 +127,7 @@ int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) { *buf += sizeof(DHCP6Option); *buflen -= sizeof(DHCP6Option); - memcpy(*buf, iaid, len); + memcpy(*buf, (char*) ia + iaid_offset, len); *buf += len; *buflen -= len;