| Summary: | mount doesn't work with cifs | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Christof Kaser <c.kaser> |
| Component: | Other | Assignee: | unassigned |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | busybox-cvs |
| Priority: | P4 | ||
| Version: | 1.15.x | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
What command exactly do you run? (In reply to comment #1) > What command exactly do you run? > ~ # strace -e mount mount //k3/ki /mnt -o user=u01,pass=u mount("//k3/ki", "/mnt", "cifs", MS_MANDLOCK|MS_SILENT, "user=u01,pass=u") = -1 EINVAL (Invalid argument) mount: mounting //k3/ki on /mnt failed: Invalid argument ~ # ~ # cat /proc/version Linux version 2.6.32 ..... ~ # ~ # busybox BusyBox v1.15.2 ..... After enabling the code, which build the cifs mount options: ~ # strace -e mount mount //k3/ki /mnt -o user=u01,pass=u mount("\\\\10.8.0.3\\ki", "/mnt", "cifs", MS_MANDLOCK|MS_SILENT, "user=u01,pass=u,ip=10.8.0.3") = 0 I wonder what was breaking for those "other people". I definitely remember that for someone it was working without that code, and broke with it. Had to document it better... oh well. Maybe converting hostname to ip (\\10.8.0.3\ki thing) is not such a good idea, we lose information this way - textual host name is lost. And we already pass ip=N.N.N.N in options. Can you try what happens if we DONT mangle //k3/ki and only add ip=N.N.N.N to options? That works.
.
#if 0 /* reported to break things */
.
.
#else
len_and_sockaddr *lsa;
char *ip, *dotted;
char *s;
// Get server IP
s = strrchr(mp->mnt_fsname, '/');
if (s <= mp->mnt_fsname+1)
goto report_error;
*s = '\0';
lsa = host2sockaddr(mp->mnt_fsname+2, 0);
*s = '/';
if (!lsa)
goto report_error;
// Insert ip=... option into string flags.
dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
ip = xasprintf("ip=%s", dotted);
parse_mount_options(ip, &filteropts);
#endif
.
~ # strace -e mount mount //k3/ki /mnt -o user=u01,pass=u
mount("//k3/ki", "/mnt", "cifs", MS_MANDLOCK|MS_SILENT, "user=u01,pass=u,ip=10.8.0.3") = 0
~ #
~ # mount | grep k3
//k3/ki on /mnt type cifs (rw,mand,relatime,unc=\\k3\ki,username=u01,uid=0,noforceuid,gid=0,noforcegid,addr=10.8.0.3,posixpaths,serverino,acl,rsize=16384,wsize=57344)
Thanks! Fixed in git. Please test and confirm that current git works for you. It works with that change: // lsa = host2sockaddr(s, 0); lsa = host2sockaddr(mp->mnt_fsname + 2, 0); Sorry... fixed, please try git again. Now it works :) Fixed, will be in 1.16.x |
For the mount command I have enabled the "Support mounting CIFS/SMB file systems" and therefor I assumed that the command "mount //server/share /dir -o user=xy,pass=yz" would mount a CIFS-share, as it was possible in previous versions. But unfortunately this support has been disabled: util-linux/mount.c if (ENABLE_FEATURE_MOUNT_CIFS && (!mp->mnt_type || strcmp(mp->mnt_type, "cifs") == 0) && (mp->mnt_fsname[0] == '/' || mp->mnt_fsname[0] == '\\') && mp->mnt_fsname[0] == mp->mnt_fsname[1] ) { #if 0 /* reported to break things */ len_and_sockaddr *lsa; There was a problem with a 2.4 kernel, which led to the deactivating of that code: http://lists.busybox.net/pipermail/busybox/2009-April/068758.html This "#if 0" breaks things with kernel 2.6.32.