diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-11-16 18:15:00 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-11-16 18:15:00 +0000 |
commit | 2bbee707e4bd625525606a4796de3dff97aedde4 (patch) | |
tree | e3bc14c0b247d0426b8e97eb5911990981d2f390 /toolchain | |
parent | b7b275b665ce350c6e4dec0bc94bc833dc4b997d (diff) | |
download | master-187ad058-2bbee707e4bd625525606a4796de3dff97aedde4.tar.gz master-187ad058-2bbee707e4bd625525606a4796de3dff97aedde4.tar.bz2 master-187ad058-2bbee707e4bd625525606a4796de3dff97aedde4.zip |
musl: fix handling of point-to-point interfaces in getifaddrs()
Current musl reports the peer (remote) address of a point-to-point
interface and does not store the local address at all.
Apply the same special treatment of IFA_LOCAL to musl's getifaddrs() which
is also used in glibc and uclibc.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47488 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'toolchain')
-rw-r--r-- | toolchain/musl/patches/920-getifaddrs_ptp_fix.patch | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/toolchain/musl/patches/920-getifaddrs_ptp_fix.patch b/toolchain/musl/patches/920-getifaddrs_ptp_fix.patch new file mode 100644 index 0000000000..3e65232563 --- /dev/null +++ b/toolchain/musl/patches/920-getifaddrs_ptp_fix.patch @@ -0,0 +1,18 @@ +--- a/src/network/getifaddrs.c ++++ b/src/network/getifaddrs.c +@@ -161,6 +161,15 @@ static int netlink_msg_to_ifaddr(void *p + ifs->ifa.ifa_flags = ifs0->ifa.ifa_flags; + for (rta = NLMSG_RTA(h, sizeof(*ifa)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) { + switch (rta->rta_type) { ++ case IFA_LOCAL: ++ /* If ifa_addr is set and we get IFA_LOCAL, assume we have ++ * a point-to-point network. Move address to correct field. */ ++ if (ifs->ifa.ifa_addr != NULL) { ++ ifs->ifu = ifs->addr; ++ ifs->ifa.ifa_broadaddr = &ifs->ifu.sa; ++ memset(&ifs->addr, 0, sizeof(ifs->addr)); ++ } ++ /* fall through */ + case IFA_ADDRESS: + copy_addr(&ifs->ifa.ifa_addr, ifa->ifa_family, &ifs->addr, RTA_DATA(rta), RTA_DATALEN(rta), ifa->ifa_index); + break; |