aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util-linux/mount.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 305e41a3d..eb8b7ba7b 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1931,7 +1931,6 @@ static int singlemount(struct mntent *mp, int ignore_busy)
1931 int len; 1931 int len;
1932 char c; 1932 char c;
1933 char *hostname, *share; 1933 char *hostname, *share;
1934 char *dotted, *ip;
1935 len_and_sockaddr *lsa; 1934 len_and_sockaddr *lsa;
1936 1935
1937 // Parse mp->mnt_fsname of the form "//hostname/share[/dir1/dir2]" 1936 // Parse mp->mnt_fsname of the form "//hostname/share[/dir1/dir2]"
@@ -1971,19 +1970,26 @@ static int singlemount(struct mntent *mp, int ignore_busy)
1971 if (!lsa) 1970 if (!lsa)
1972 goto report_error; 1971 goto report_error;
1973 1972
1974 // Insert "ip=..." option into options 1973 // If there is no "ip=..." option yet
1975 dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); 1974 if (!is_prefixed_with(filteropts, ",ip="+1)
1976 if (ENABLE_FEATURE_CLEAN_UP) free(lsa); 1975 && !strstr(filteropts, ",ip=")
1977 ip = xasprintf("ip=%s", dotted); 1976 ) {
1978 if (ENABLE_FEATURE_CLEAN_UP) free(dotted); 1977 char *dotted, *ip;
1978 // Insert "ip=..." option into options
1979 dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
1980 if (ENABLE_FEATURE_CLEAN_UP) free(lsa);
1981 ip = xasprintf("ip=%s", dotted);
1982 if (ENABLE_FEATURE_CLEAN_UP) free(dotted);
1979// Note: IPv6 scoped addresses ("host%iface", see RFC 4007) should be 1983// Note: IPv6 scoped addresses ("host%iface", see RFC 4007) should be
1980// handled by libc in getnameinfo() (inside xmalloc_sockaddr2dotted_noport()). 1984// handled by libc in getnameinfo() (inside xmalloc_sockaddr2dotted_noport()).
1981// Currently, glibc does not support that (has no NI_NUMERICSCOPE), 1985// Currently, glibc does not support that (has no NI_NUMERICSCOPE),
1982// musl apparently does. This results in "ip=numericIPv6%iface_name" 1986// musl apparently does. This results in "ip=numericIPv6%iface_name"
1983// (instead of _numeric_ iface_id) with glibc. 1987// (instead of _numeric_ iface_id) with glibc.
1984// This probably should be fixed in glibc, not here. 1988// This probably should be fixed in glibc, not here.
1985 parse_mount_options(ip, &filteropts); 1989// The workaround is to manually specify correct "ip=ADDR%n" option.
1986 if (ENABLE_FEATURE_CLEAN_UP) free(ip); 1990 parse_mount_options(ip, &filteropts);
1991 if (ENABLE_FEATURE_CLEAN_UP) free(ip);
1992 }
1987 1993
1988 mp->mnt_type = (char*)"cifs"; 1994 mp->mnt_type = (char*)"cifs";
1989 rc = mount_it_now(mp, vfsflags, filteropts); 1995 rc = mount_it_now(mp, vfsflags, filteropts);