mount: for cifs, dont insert "ip=ADDR" option if user gave it explicitly
This makes it possible to use scoped IPv6 addresses: mount -t cifs -o ip=<ADDR>%<iface_id> //<ADDR>/test test Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
dea3bdbefe
commit
b09ab448b8
@ -1931,7 +1931,6 @@ static int singlemount(struct mntent *mp, int ignore_busy)
|
|||||||
int len;
|
int len;
|
||||||
char c;
|
char c;
|
||||||
char *hostname, *share;
|
char *hostname, *share;
|
||||||
char *dotted, *ip;
|
|
||||||
len_and_sockaddr *lsa;
|
len_and_sockaddr *lsa;
|
||||||
|
|
||||||
// Parse mp->mnt_fsname of the form "//hostname/share[/dir1/dir2]"
|
// Parse mp->mnt_fsname of the form "//hostname/share[/dir1/dir2]"
|
||||||
@ -1971,6 +1970,11 @@ static int singlemount(struct mntent *mp, int ignore_busy)
|
|||||||
if (!lsa)
|
if (!lsa)
|
||||||
goto report_error;
|
goto report_error;
|
||||||
|
|
||||||
|
// If there is no "ip=..." option yet
|
||||||
|
if (!is_prefixed_with(filteropts, ",ip="+1)
|
||||||
|
&& !strstr(filteropts, ",ip=")
|
||||||
|
) {
|
||||||
|
char *dotted, *ip;
|
||||||
// Insert "ip=..." option into options
|
// Insert "ip=..." option into options
|
||||||
dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
|
dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
|
||||||
if (ENABLE_FEATURE_CLEAN_UP) free(lsa);
|
if (ENABLE_FEATURE_CLEAN_UP) free(lsa);
|
||||||
@ -1982,8 +1986,10 @@ static int singlemount(struct mntent *mp, int ignore_busy)
|
|||||||
// musl apparently does. This results in "ip=numericIPv6%iface_name"
|
// musl apparently does. This results in "ip=numericIPv6%iface_name"
|
||||||
// (instead of _numeric_ iface_id) with glibc.
|
// (instead of _numeric_ iface_id) with glibc.
|
||||||
// This probably should be fixed in glibc, not here.
|
// This probably should be fixed in glibc, not here.
|
||||||
|
// The workaround is to manually specify correct "ip=ADDR%n" option.
|
||||||
parse_mount_options(ip, &filteropts);
|
parse_mount_options(ip, &filteropts);
|
||||||
if (ENABLE_FEATURE_CLEAN_UP) free(ip);
|
if (ENABLE_FEATURE_CLEAN_UP) free(ip);
|
||||||
|
}
|
||||||
|
|
||||||
mp->mnt_type = (char*)"cifs";
|
mp->mnt_type = (char*)"cifs";
|
||||||
rc = mount_it_now(mp, vfsflags, filteropts);
|
rc = mount_it_now(mp, vfsflags, filteropts);
|
||||||
|
Loading…
Reference in New Issue
Block a user