diff options
author | Jeff Layton <jlayton@redhat.com> | 2009-06-11 10:27:30 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2009-06-13 04:17:30 -0400 |
commit | 1e68b2b2756fc3488ecbade5ad5f13302b3aaafc (patch) | |
tree | 3ee4b36a1a00d449126050ce3bb1758ba88d7c2f /fs/cifs/dns_resolve.c | |
parent | 340481a36498bf3fe404bcecb2e2d6188e950bff (diff) |
cifs: add new routine for converting AF_INET and AF_INET6 addrs
...to consolidate some logic used in more than one place.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/dns_resolve.c')
-rw-r--r-- | fs/cifs/dns_resolve.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index df4a306f697e..91b5500755bf 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c | |||
@@ -37,24 +37,9 @@ | |||
37 | static int | 37 | static int |
38 | is_ip(const char *name) | 38 | is_ip(const char *name) |
39 | { | 39 | { |
40 | int rc; | 40 | struct sockaddr_storage ss; |
41 | struct sockaddr_in sin_server; | 41 | |
42 | struct sockaddr_in6 sin_server6; | 42 | return cifs_convert_address(name, &ss); |
43 | |||
44 | rc = cifs_inet_pton(AF_INET, name, | ||
45 | &sin_server.sin_addr.s_addr); | ||
46 | |||
47 | if (rc <= 0) { | ||
48 | /* not ipv4 address, try ipv6 */ | ||
49 | rc = cifs_inet_pton(AF_INET6, name, | ||
50 | &sin_server6.sin6_addr.in6_u); | ||
51 | if (rc > 0) | ||
52 | return 1; | ||
53 | } else { | ||
54 | return 1; | ||
55 | } | ||
56 | /* we failed translating address */ | ||
57 | return 0; | ||
58 | } | 43 | } |
59 | 44 | ||
60 | static int | 45 | static int |