From f4f204b8505a9a7381a6c01a1c240d3cbbfc0024 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Tue, 14 Feb 2017 14:20:39 +0100 Subject: [PATCH] Implement a better way to initialize all fields in ip address than using memset() (better fix than my last commit) --- src/core/netif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/netif.c b/src/core/netif.c index a0d0598a..d74151e6 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -1049,8 +1049,9 @@ netif_ip6_addr_set_parts(struct netif *netif, s8_t addr_idx, u32_t i0, u32_t i1, LWIP_ASSERT("netif != NULL", netif != NULL); LWIP_ASSERT("invalid index", addr_idx < LWIP_IPV6_NUM_ADDRESSES); - memset(&old_addr, 0, sizeof(old_addr)); - ip_addr_copy(old_addr, *netif_ip_addr6(netif, addr_idx)); + ip6_addr_copy(*ip_2_ip6(&old_addr), *netif_ip6_addr(netif, addr_idx)); + IP_SET_TYPE_VAL(old_addr, IPADDR_TYPE_V6); + /* address is actually being changed? */ if ((ip_2_ip6(&old_addr)->addr[0] != i0) || (ip_2_ip6(&old_addr)->addr[1] != i1) || (ip_2_ip6(&old_addr)->addr[2] != i2) || (ip_2_ip6(&old_addr)->addr[3] != i3)) {