aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-04-25 07:59:10 -0400
committerSteve French <sfrench@us.ibm.com>2007-04-25 07:59:10 -0400
commit5858ae44e289ac6c809af3fe81b9a6ed41914d41 (patch)
treeb62cf39ee27152cdfb891d2f723f0f00b3cbc346 /fs
parentcbac3cba66ab51492da53e7bf4f38da872408065 (diff)
[CIFS] Add IPv6 support
IPv6 support was started a few years ago in the cifs client, but lacked a kernel helper function for parsing the ascii form of the ipv6 address. Now that that is added (and now IPv6 is the default that some OS use now) it was fairly easy to finish the cifs ipv6 support. This requires that CIFS_EXPERIMENTAL be enabled and (at least until the mount.cifs module is modified to use a new ipv6 friendly call instead of gethostbyname) and the ipv6 address be passed on the mount as "ip=" mount option. Thanks Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/CHANGES8
-rw-r--r--fs/cifs/connect.c15
-rw-r--r--fs/cifs/netmisc.c24
3 files changed, 40 insertions, 7 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 713fec669135..301631cac7f8 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,4 +1,10 @@
1Verison 1.48 1Version 1.49
2------------
3IPv6 support. Enable ipv6 addresses to be passed on mount (put the ipv6
4address after the "ip=" mount option, at least until mount.cifs is fixed to
5handle DNS host to ipv6 name translation).
6
7Version 1.48
2------------ 8------------
3Fix mtime bouncing around from local idea of last write times to remote time. 9Fix mtime bouncing around from local idea of last write times to remote time.
4Fix hang (in i_size_read) when simultaneous size update of same remote file 10Fix hang (in i_size_read) when simultaneous size update of same remote file
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 9e41f8ea5fbb..c139fbd24be9 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1790,11 +1790,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1790 existingCifsSes = cifs_find_tcp_session(&sin_server.sin_addr, 1790 existingCifsSes = cifs_find_tcp_session(&sin_server.sin_addr,
1791 NULL /* no ipv6 addr */, 1791 NULL /* no ipv6 addr */,
1792 volume_info.username, &srvTcp); 1792 volume_info.username, &srvTcp);
1793 else if(address_type == AF_INET6) 1793 else if(address_type == AF_INET6) {
1794 cFYI(1,("looking for ipv6 address"));
1794 existingCifsSes = cifs_find_tcp_session(NULL /* no ipv4 addr */, 1795 existingCifsSes = cifs_find_tcp_session(NULL /* no ipv4 addr */,
1795 &sin_server6.sin6_addr, 1796 &sin_server6.sin6_addr,
1796 volume_info.username, &srvTcp); 1797 volume_info.username, &srvTcp);
1797 else { 1798 } else {
1798 kfree(volume_info.UNC); 1799 kfree(volume_info.UNC);
1799 kfree(volume_info.password); 1800 kfree(volume_info.password);
1800 kfree(volume_info.prepath); 1801 kfree(volume_info.prepath);
@@ -1810,12 +1811,18 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1810 sin_server.sin_port = htons(volume_info.port); 1811 sin_server.sin_port = htons(volume_info.port);
1811 else 1812 else
1812 sin_server.sin_port = 0; 1813 sin_server.sin_port = 0;
1813 rc = ipv4_connect(&sin_server,&csocket, 1814 if (address_type == AF_INET6) {
1815 cFYI(1,("attempting ipv6 connect"));
1816 /* BB should we allow ipv6 on port 139? */
1817 /* other OS never observed in Wild doing 139 with v6 */
1818 rc = ipv6_connect(&sin_server6,&csocket);
1819 } else
1820 rc = ipv4_connect(&sin_server,&csocket,
1814 volume_info.source_rfc1001_name, 1821 volume_info.source_rfc1001_name,
1815 volume_info.target_rfc1001_name); 1822 volume_info.target_rfc1001_name);
1816 if (rc < 0) { 1823 if (rc < 0) {
1817 cERROR(1, 1824 cERROR(1,
1818 ("Error connecting to IPv4 socket. Aborting operation")); 1825 ("Error connecting to IPv4 socket. Aborting operation"));
1819 if(csocket != NULL) 1826 if(csocket != NULL)
1820 sock_release(csocket); 1827 sock_release(csocket);
1821 kfree(volume_info.UNC); 1828 kfree(volume_info.UNC);
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 992e80edc720..53e304d59544 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -30,6 +30,9 @@
30#include <linux/fs.h> 30#include <linux/fs.h>
31#include <asm/div64.h> 31#include <asm/div64.h>
32#include <asm/byteorder.h> 32#include <asm/byteorder.h>
33#ifdef CONFIG_CIFS_EXPERIMENTAL
34#include <linux/inet.h>
35#endif
33#include "cifsfs.h" 36#include "cifsfs.h"
34#include "cifspdu.h" 37#include "cifspdu.h"
35#include "cifsglob.h" 38#include "cifsglob.h"
@@ -129,11 +132,27 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
129/* Convert string containing dotted ip address to binary form */ 132/* Convert string containing dotted ip address to binary form */
130/* returns 0 if invalid address */ 133/* returns 0 if invalid address */
131 134
132/* BB add address family, change rc to status flag and return union or for ipv6 */
133/* will need parent to call something like inet_pton to convert ipv6 address BB */
134int 135int
135cifs_inet_pton(int address_family, char *cp,void *dst) 136cifs_inet_pton(int address_family, char *cp,void *dst)
136{ 137{
138#ifdef CONFIG_CIFS_EXPERIMENTAL
139 int ret = 0;
140
141 /* calculate length by finding first slash or NULL */
142 /* BB Should we convert '/' slash to '\' here since it seems already done
143 before this */
144 if( address_family == AF_INET ){
145 ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL);
146 } else if( address_family == AF_INET6 ){
147 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
148 }
149#ifdef CONFIG_CIFS_DEBUG2
150 cFYI(1,("address conversion returned %d for %s", ret, cp));
151#endif
152 if (ret > 0)
153 ret = 1;
154 return ret;
155#else
137 int value; 156 int value;
138 int digit; 157 int digit;
139 int i; 158 int i;
@@ -192,6 +211,7 @@ cifs_inet_pton(int address_family, char *cp,void *dst)
192 211
193 *((__be32 *)dst) = *((__be32 *) bytes) | htonl(value); 212 *((__be32 *)dst) = *((__be32 *) bytes) | htonl(value);
194 return 1; /* success */ 213 return 1; /* success */
214#endif /* EXPERIMENTAL */
195} 215}
196 216
197/***************************************************************************** 217/*****************************************************************************