GNOME Bugzilla – Bug 604116
Nautilus not able to handle litteral IPv6 address like smb://::1/sharing/
Last modified: 2016-11-16 11:49:14 UTC
First reported on Ubuntu Launchpad: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/492948 but redirected to here upstream. Nautilus not able to handle litteral IPv6 address like smb://::1/sharing/ Nautilus 2.28.1 on Ubuntu Linux 9.10 Summary: Nautilus does not know how to handle smb://::1/sharing/ nor smb://[::1]/sharing/ ; this results in an error (see below). The tool smbclient is OK with this notation. Nautilus' does know how to handle names that resolve to IPv6 only, like smb://ip6-localhost/sharing/ So it looks like a parsing error (chopping off from :) and not understanding the meaning of [...] Suggested solution: let Nautilus understand that the info between [ and ] is a litteral IPv6 address, just like it's done with URLs / webbrowsers for example http://[2001:4860:a003::68]/ Long: Copy from Ubuntu bug report: Binary package hint: nautilus It seems Nautilus' SMB does not know how to handle litteral IPv6 address like smb://::1/sharing/ . This results in: Could not find "smb:///sharing". Please check the spelling and try again. The variant smb://[::1]/sharing/ results in: Could not display "smb://[::1]/sharing/". Expected behaviour: just a succesful connection to the share /sharing/ on the localhost via IPv6, by using ::1 or [::1]. This bug is relevant because SMB itself over IPv6 works great and is a solution for SMB access without IPv4 NAT problems, and/but a FQDN is not always available. NB: ::1 is just an example. Addresses like 2001:... don't work either. Important remarks: Nautilus' SMB does *correctly* handle: - litteral IPv4 address like 127.0.0.1 - name resolving to IPv4 address - name resolving to IPv6 address (yes!) - smb://ip6-localhost/sharing/ (yes!) - Bonjour/zereconf names like smb://quirinius.local./sharing/ smbclient does *correctly* handle litteral IPv6 addresses: sander@quirinius:~$ smbclient -N -L ::1 Anonymous login successful Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.4.0] Sharename Type Comment --------- ---- ------- print$ Disk Printer Drivers IPC$ IPC IPC Service (quirinius server (Samba, Ubuntu)) Brother-HL-2030-series Printer Brother HL-2030 series sharing Disk ::1 is an IPv6 address -- no workgroup available sander@quirinius:~$ ProblemType: Bug Architecture: i386 Date: Sat Dec 5 21:28:24 2009 DistroRelease: Ubuntu 9.10 ExecutablePath: /usr/bin/nautilus Package: nautilus 1:2.28.1-0ubuntu3 ProcEnviron: LANG=en_US.UTF-8 SHELL=/bin/bash ProcVersionSignature: Ubuntu 2.6.31-15.50-generic SourcePackage: nautilus Uname: Linux 2.6.31-15-generic i686 Things I tried that don't work: nautilus smb://::1/sharing nautilus 'smb://::1/sharing' nautilus smb://[::1]/sharing nautilus smb://\:\:\1/sharing This IPv6 name does work: nautilus smb://ip6-localhost/sharing/ And FWIW: bonjour / zeroconf works too: nautilus smb://quirinius.local./sharing/ #4 As the command $ nautilus smb://2001:666:2:1/sharing leads to error message Could not display "smb://2001/sharing/". it seems the parser (?) chops off everything starting from the : (maybe because the : could be the separator between name/FQDN and port?), I tried to escape the colon: $ nautilus smb://%3A%3A1/sharing Alas, this leads to the same error: Could not find "smb:///sharing". So, even the escaped colon (%3A) is seen as a colon and leads to a chop-off. :-( As $ nautilus smb://[::1]/sharing leads to Could not display "smb://[::1]/sharing/". I don't think there is a need to escape the [ and ]. IMHO: the best solution is that Nautilus' SMB should be triggered by [ ] to use the included stuff as a litteral IPv6 address
[::1] works with 3.20, so I'll consider this fixed.
Really? With Nautilus 3.20.3 ("Files") on Ubuntu 16.10 with smb://[::1]/sharing I get Unable to access location Failed to mount Windows share: Invalid argument See included screendump And yes, that share does exist: "smb://ip6-localhost/sharing/" does work and connect. So I would say still the same problem.
Created attachment 339671 [details] screendump of error message
Ok, so it works with ssh:// but not with smb:// or ftp:// I wonder if this is really a Nautilus issue or a gvfs one.
> I wonder if this is really a Nautilus issue or a gvfs one. Interesting. Let's try some things ... see below. Does this confirm your hypothesis it's a gvfs / gvfs-mount problem? **************************************************************** *** Part 1: ip6-localhost works: **************************************************************** sander@Stream-13:~$ gvfs-mount "smb://ip6-localhost/sharing" Password required for share sharing on ip6-localhost User [sander]: Domain [WORKGROUP]: Password: sander@Stream-13:~$ gvfs-mount -l Drive(0): MBG4GC Type: GProxyDrive (GProxyVolumeMonitorUDisks2) Drive(1): Unnamed Drive (/dev/mmcblk0boot1) Type: GProxyDrive (GProxyVolumeMonitorUDisks2) Mount(0): sharing on ip6-localhost -> smb://ip6-localhost/sharing/ Type: GDaemonMount sander@Stream-13:~$ sander@Stream-13:~$ gvfs-mount -u "smb://ip6-localhost/sharing" sander@Stream-13:~$ sander@Stream-13:~$ gvfs-mount -l Drive(0): MBG4GC Type: GProxyDrive (GProxyVolumeMonitorUDisks2) Drive(1): Unnamed Drive (/dev/mmcblk0boot1) Type: GProxyDrive (GProxyVolumeMonitorUDisks2) sander@Stream-13:~$ **************************************************************** *** Part 2: ::1 does not work with gvfs-mount: **************************************************************** sander@Stream-13:~$ gvfs-mount "smb://::1/sharing" Error mounting location: Location is already mounted sander@Stream-13:~$ sander@Stream-13:~$ gvfs-mount -l Drive(0): MBG4GC Type: GProxyDrive (GProxyVolumeMonitorUDisks2) Drive(1): Unnamed Drive (/dev/mmcblk0boot1) Type: GProxyDrive (GProxyVolumeMonitorUDisks2) sander@Stream-13:~$ **************************************************************** *** Part 3: [::1] does not work with gvfs-mount: **************************************************************** sander@Stream-13:~$ gvfs-mount "smb://[::1]/sharing" Error mounting location: Failed to mount Windows share: Invalid argument sander@Stream-13:~$ sander@Stream-13:~$ gvfs-mount -l Drive(0): MBG4GC Type: GProxyDrive (GProxyVolumeMonitorUDisks2) Drive(1): Unnamed Drive (/dev/mmcblk0boot1) Type: GProxyDrive (GProxyVolumeMonitorUDisks2) sander@Stream-13:~$
Mounting //::1/sharing does work with "sudo mount -t cifs ...". See proof below. Does this help? There is a difference between gvfs/gvfs-mount and "mount -t cifs"? In the parsing of the command line, or more deep-down? #### Nothing mounted: sander@Stream-13:~$ ll /home/sander/blabla/ total 8 drwxr-xr-x 2 sander sander 4096 nov 12 12:05 ./ drwxr-xr-x 27 sander sander 4096 nov 12 12:05 ../ sander@Stream-13:~$ #### Mount the SMB-share //::1/sharing sander@Stream-13:~$ sudo mount -t cifs -o username=guest,password= //::1/sharing /home/sander/blabla/ sander@Stream-13:~$ #### No error, looks good, so let's check: sander@Stream-13:~$ ll /home/sander/blabla/ total 4 drwxrwxrwx+ 2 sander sander 0 nov 12 12:36 ./ drwxr-xr-x 27 sander sander 4096 nov 12 12:05 ../ -rw-r--r--+ 1 sander sander 0 nov 11 23:37 hallo.txt -rw-r--r--+ 1 sander sander 0 nov 12 12:36 some-other-file.txt sander@Stream-13:~$ #### ... Yes, that worked!
FWIW: the output of the mount command: sander@Stream-13:~$ mount | grep sharing //::1/sharing on /home/sander/blabla type cifs (rw,relatime,vers=1.0,cache=strict,username=guest,domain=STREAM-13,uid=0,noforceuid,gid=0,noforcegid,addr=0000:0000:0000:0000:0000:0000:0000:0001,unix,posixpaths,serverino,mapposix,acl,rsize=1048576,wsize=65536,echo_interval=60,actimeo=1)
(In reply to sander.jonkers from comment #5) > Does this confirm your hypothesis it's a gvfs / gvfs-mount problem? [-✀-] > *** Part 1: ip6-localhost works: [-✀-] > *** Part 2: ::1 does not work with gvfs-mount: [-✀-] > *** Part 3: [::1] does not work with gvfs-mount: That seems to confirm it, yes. Reassigning. Thanks for the tests!
Yes, this is probably GVfs issue. There are different URI handlers for various protocols, it seems that SMB isn't handled correctly as per your report, but it should work for others... I will take a look at it.
Created attachment 339943 [details] [review] smb: Fix IPv6 uri handling IPv6 server includes brackets in GMountSpec, smbclient doesn't. Remove the brackets from the uri before usage in smbclient functions. The IPv6 uris can be consequently used in the following format (port isn't mandatory), e.g.: gvfs-mount smb://[::1]:139/
Created attachment 339944 [details] [review] smbbrowse: Fix IPv6 handling IPv6 server includes brackets in GMountSpec, smbclient doesn't. Commit 4012d70 fixed IPv6 handling for SMB backend. Share and use the modified create_smb_uri() function in order to fix the IPv6 handling.
Created attachment 339945 [details] [review] smb: Drop custom GString functionality Replace custom g_string_append_encoded() by g_string_append_uri_escaped(). The functions are identical except additional UTF-8 support, which can be simply disabled by allow_utf8 parameter. The custom function was used probably because the g_string_append_uri_escaped has been added later.
Are there any other backends which don't work with IPv6? Comment 4 says that FTP backend also doesn't work, but it works correctly to me. Please notice that the brackets are mandatory in the URI...
I can confirm gvfs-mount just works with ftp-urls and litteral IPv6-addresses like ftp://[2001:67c:2564:a120::20]/ Proof (on Ubuntu 16.10): # Find a ftp server with IPv6: sander@Stream-13:~$ host ftp.snt.utwente.nl ftp.snt.utwente.nl has address 130.89.149.20 ftp.snt.utwente.nl has IPv6 address 2001:67c:2564:a120::20 ftp.snt.utwente.nl mail is handled by 10 mx.snt.utwente.nl. # mount it via its litteral IPv6 address: sander@Stream-13:~$ gvfs-mount -a ftp://[2001:67c:2564:a120::20]/ # No error message, so let's check if there is content: sander@Stream-13:~$ ll /run/user/1000/gvfs/ total 0 dr-x------ 6 sander sander 0 nov 14 23:46 ./ drwx------ 10 sander sander 300 nov 14 23:46 ../ drwx------ 1 sander sander 0 jan 1 1970 ftp:host=2001%3A67c%3A2564%3Aa120%3A%3A20/ sander@Stream-13:~$ ll /run/user/1000/gvfs/ftp\:host\=2001%3A67c%3A2564%3Aa120%3A%3A20/ total 3 drwx------ 1 sander sander 0 jan 1 1970 ./ dr-x------ 6 sander sander 0 nov 14 23:46 ../ drwxrwxr-x 1 sander sander 0 jul 18 2011 pub/ -rwxr--r-- 1 sander sander 1294 feb 21 2011 welcome.txt* -rwxr--r-- 1 sander sander 1239 mei 31 2008 welcome.txt.ftp* sander@Stream-13:~$ # Yes, contents, so that works!
Thanks for the testing, so I hope it is problem only for smb...
Created attachment 340003 [details] [review] smbbrowse: Fix IPv6 handling IPv6 server includes brackets in GMountSpec, smbclient doesn't. Commit 4012d70 fixed IPv6 handling for SMB backend. Share and use the modified create_smb_uri() function in order to fix the IPv6 handling.
Created attachment 340004 [details] [review] smb: Drop custom GString functionality Replace custom g_string_append_encoded() by g_string_append_uri_escaped(). The functions are identical except additional UTF-8 support, which can be simply disabled by allow_utf8 parameter. The custom function was used probably because the g_string_append_uri_escaped has been added later.
Attachment 339943 [details] pushed as eadddde - smb: Fix IPv6 uri handling Attachment 340003 [details] pushed as a59d84f - smbbrowse: Fix IPv6 handling Attachment 340004 [details] pushed as 7eb9165 - smb: Drop custom GString functionality
I've pushed them also in gnome-3-22 branch...
"gvfsbackendsmbprivate.h" is missing from the source tree.
Dammit, thanks for the notice, I've pushed it as commit 536f8cd.