aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/netmisc.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-04-25 11:59:10 +0000
committerSteve French <sfrench@us.ibm.com>2007-04-25 11:59:10 +0000
commit5858ae44e289ac6c809af3fe81b9a6ed41914d41 (patch)
treeb62cf39ee27152cdfb891d2f723f0f00b3cbc346 /fs/cifs/netmisc.c
parent[CIFS] New CIFS POSIX mkdir performance improvement (part 2) (diff)
downloadlinux-dev-5858ae44e289ac6c809af3fe81b9a6ed41914d41.tar.xz
linux-dev-5858ae44e289ac6c809af3fe81b9a6ed41914d41.zip
[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/cifs/netmisc.c')
-rw-r--r--fs/cifs/netmisc.c24
1 files changed, 22 insertions, 2 deletions
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 @@
#include <linux/fs.h>
#include <asm/div64.h>
#include <asm/byteorder.h>
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+#include <linux/inet.h>
+#endif
#include "cifsfs.h"
#include "cifspdu.h"
#include "cifsglob.h"
@@ -129,11 +132,27 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
/* Convert string containing dotted ip address to binary form */
/* returns 0 if invalid address */
-/* BB add address family, change rc to status flag and return union or for ipv6 */
-/* will need parent to call something like inet_pton to convert ipv6 address BB */
int
cifs_inet_pton(int address_family, char *cp,void *dst)
{
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+ int ret = 0;
+
+ /* calculate length by finding first slash or NULL */
+ /* BB Should we convert '/' slash to '\' here since it seems already done
+ before this */
+ if( address_family == AF_INET ){
+ ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL);
+ } else if( address_family == AF_INET6 ){
+ ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
+ }
+#ifdef CONFIG_CIFS_DEBUG2
+ cFYI(1,("address conversion returned %d for %s", ret, cp));
+#endif
+ if (ret > 0)
+ ret = 1;
+ return ret;
+#else
int value;
int digit;
int i;
@@ -192,6 +211,7 @@ cifs_inet_pton(int address_family, char *cp,void *dst)
*((__be32 *)dst) = *((__be32 *) bytes) | htonl(value);
return 1; /* success */
+#endif /* EXPERIMENTAL */
}
/*****************************************************************************