diff --git a/net/icmpv6/icmpv6_rnotify.c b/net/icmpv6/icmpv6_rnotify.c index 9adb145453..fca0317750 100644 --- a/net/icmpv6/icmpv6_rnotify.c +++ b/net/icmpv6/icmpv6_rnotify.c @@ -110,7 +110,7 @@ void icmpv6_setaddresses(FAR struct net_driver_s *dev, /* Copy prefix to the current IPv6 address, applying the mask */ - for (i = 0; i < 7; i++) + for (i = 0; i < 8; i++) { dev->d_ipv6addr[i] = (dev->d_ipv6addr[i] & ~dev->d_ipv6netmask[i]) | (prefix[i] & dev->d_ipv6netmask[i]); diff --git a/net/utils/net_ipv6_pref2mask.c b/net/utils/net_ipv6_pref2mask.c index 9eb4dd723c..4f016b57c8 100644 --- a/net/utils/net_ipv6_pref2mask.c +++ b/net/utils/net_ipv6_pref2mask.c @@ -91,7 +91,7 @@ void net_ipv6_pref2mask(uint8_t preflen, net_ipv6addr_t mask) * = 0xfc00 */ - mask[i] = 0xffff << (16 - (preflen - bit)); + mask[i] = HTONS(0xffff << (16 - (preflen - bit))); } } else