gcc: backport a libgcc fix for a dependency on libc write() on ARM
[openwrt.git] / toolchain / musl / patches / 920-getifaddrs_ptp_fix.patch
1 --- a/src/network/getifaddrs.c
2 +++ b/src/network/getifaddrs.c
3 @@ -161,6 +161,15 @@ static int netlink_msg_to_ifaddr(void *p
4                 ifs->ifa.ifa_flags = ifs0->ifa.ifa_flags;
5                 for (rta = NLMSG_RTA(h, sizeof(*ifa)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) {
6                         switch (rta->rta_type) {
7 +                       case IFA_LOCAL:
8 +                               /* If ifa_addr is set and we get IFA_LOCAL, assume we have
9 +                                * a point-to-point network. Move address to correct field.  */
10 +                               if (ifs->ifa.ifa_addr != NULL) {
11 +                                       ifs->ifu = ifs->addr;
12 +                                       ifs->ifa.ifa_broadaddr = &ifs->ifu.sa;
13 +                                       memset(&ifs->addr, 0, sizeof(ifs->addr));
14 +                               }
15 +                               /* fall through */
16                         case IFA_ADDRESS:
17                                 copy_addr(&ifs->ifa.ifa_addr, ifa->ifa_family, &ifs->addr, RTA_DATA(rta), RTA_DATALEN(rta), ifa->ifa_index);
18                                 break;