diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-26 19:53:04 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-26 19:53:04 +0200 |
commit | 3c18e3051dfdb5591afc18562e9d9da987a5945e (patch) | |
tree | f3d6a693bb0f8cb4dea6e1a3a8632698279d63d6 | |
parent | 525209ac9465f37a9ba292f1ff138dd80768e869 (diff) | |
download | busybox-w32-3c18e3051dfdb5591afc18562e9d9da987a5945e.tar.gz busybox-w32-3c18e3051dfdb5591afc18562e9d9da987a5945e.tar.bz2 busybox-w32-3c18e3051dfdb5591afc18562e9d9da987a5945e.zip |
libbb: make xmalloc_sockaddr2dotted use NI_NUMERICSCOPE
Gives "mount -t cifs //fe80::6a05:caff:fe3e:dbf5%eth0/test test"
a chance to work: mount must pass "ip=numeric_IPv6%numeric_iface_id"
in the omunt option string. Currently, it does not.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/xconnect.c | 7 | ||||
-rw-r--r-- | util-linux/mount.c | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/libbb/xconnect.c b/libbb/xconnect.c index 6e78e6363..3a0dc2653 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c | |||
@@ -496,12 +496,15 @@ char* FAST_FUNC xmalloc_sockaddr2hostonly_noport(const struct sockaddr *sa) | |||
496 | { | 496 | { |
497 | return sockaddr2str(sa, NI_NAMEREQD | IGNORE_PORT); | 497 | return sockaddr2str(sa, NI_NAMEREQD | IGNORE_PORT); |
498 | } | 498 | } |
499 | #ifndef NI_NUMERICSCOPE | ||
500 | # define NI_NUMERICSCOPE 0 | ||
501 | #endif | ||
499 | char* FAST_FUNC xmalloc_sockaddr2dotted(const struct sockaddr *sa) | 502 | char* FAST_FUNC xmalloc_sockaddr2dotted(const struct sockaddr *sa) |
500 | { | 503 | { |
501 | return sockaddr2str(sa, NI_NUMERICHOST); | 504 | return sockaddr2str(sa, NI_NUMERICHOST | NI_NUMERICSCOPE); |
502 | } | 505 | } |
503 | 506 | ||
504 | char* FAST_FUNC xmalloc_sockaddr2dotted_noport(const struct sockaddr *sa) | 507 | char* FAST_FUNC xmalloc_sockaddr2dotted_noport(const struct sockaddr *sa) |
505 | { | 508 | { |
506 | return sockaddr2str(sa, NI_NUMERICHOST | IGNORE_PORT); | 509 | return sockaddr2str(sa, NI_NUMERICHOST | NI_NUMERICSCOPE | IGNORE_PORT); |
507 | } | 510 | } |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 13590ceb4..c3e91e2a6 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -1975,6 +1975,12 @@ static int singlemount(struct mntent *mp, int ignore_busy) | |||
1975 | dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); | 1975 | dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); |
1976 | if (ENABLE_FEATURE_CLEAN_UP) free(lsa); | 1976 | if (ENABLE_FEATURE_CLEAN_UP) free(lsa); |
1977 | ip = xasprintf("ip=%s", dotted); | 1977 | ip = xasprintf("ip=%s", dotted); |
1978 | // Note: IPv6 scoped addresses ("name%iface", see RFC 4007) should be | ||
1979 | // handled by libc in getnameinfo() (inside xmalloc_sockaddr2dotted_noport()). | ||
1980 | // Currently, glibc does not support that (has no NI_NUMERICSCOPE), | ||
1981 | // musl apparently does. This results in "ip=numericIPv6%iface_name" | ||
1982 | // (instead of _numeric_ iface_id) with glibc. | ||
1983 | // This probalby should be fixed in glibc, not here. | ||
1978 | if (ENABLE_FEATURE_CLEAN_UP) free(dotted); | 1984 | if (ENABLE_FEATURE_CLEAN_UP) free(dotted); |
1979 | parse_mount_options(ip, &filteropts); | 1985 | parse_mount_options(ip, &filteropts); |
1980 | if (ENABLE_FEATURE_CLEAN_UP) free(ip); | 1986 | if (ENABLE_FEATURE_CLEAN_UP) free(ip); |