Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154370
b: refs/heads/master
c: 681bf72
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Jun 25, 2009
1 parent 176f207 commit 77472b7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 268875b9d1dd1bf0b523c59e736da9bc20c8ce1f
refs/heads/master: 681bf72e4893a187cf6b6b62c08fc193f81c8c2f
6 changes: 4 additions & 2 deletions trunk/fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,8 +1386,10 @@ cifs_find_tcp_session(struct sockaddr_storage *addr)
server->addr.sockAddr.sin_addr.s_addr))
continue;
else if (addr->ss_family == AF_INET6 &&
!ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr,
&addr6->sin6_addr))
(!ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr,
&addr6->sin6_addr) ||
server->addr.sockAddr6.sin6_scope_id !=
addr6->sin6_scope_id))
continue;

++server->srv_count;
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/cifs/dns_resolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* 0 - name is not IP
*/
static int
is_ip(const char *name)
is_ip(char *name)
{
struct sockaddr_storage ss;

Expand All @@ -57,7 +57,7 @@ dns_resolver_instantiate(struct key *key, const void *data,
ip[datalen] = '\0';

/* make sure this looks like an address */
if (!is_ip((const char *) ip)) {
if (!is_ip(ip)) {
kfree(ip);
return -EINVAL;
}
Expand Down
32 changes: 27 additions & 5 deletions trunk/fs/cifs/netmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,25 +158,47 @@ cifs_inet_pton(const int address_family, const char *cp, void *dst)
/*
* Try to convert a string to an IPv4 address and then attempt to convert
* it to an IPv6 address if that fails. Set the family field if either
* succeeds.
* succeeds. If it's an IPv6 address and it has a '%' sign in it, try to
* treat the part following it as a numeric sin6_scope_id.
*
* Returns 0 on failure.
*/
int
cifs_convert_address(char *src, void *dst)
{
int rc;
char *pct, *endp;
struct sockaddr_in *s4 = (struct sockaddr_in *) dst;
struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) dst;

/* IPv4 address */
if (cifs_inet_pton(AF_INET, src, &s4->sin_addr.s_addr)) {
s4->sin_family = AF_INET;
return 1;
} else if (cifs_inet_pton(AF_INET6, src, &s6->sin6_addr.s6_addr)) {
s6->sin6_family = AF_INET6;
return 1;
}

return 0;
/* temporarily terminate string */
pct = strchr(src, '%');
if (pct)
*pct = '\0';

rc = cifs_inet_pton(AF_INET6, src, &s6->sin6_addr.s6_addr);

/* repair temp termination (if any) and make pct point to scopeid */
if (pct)
*pct++ = '%';

if (!rc)
return rc;

s6->sin6_family = AF_INET6;
if (pct) {
s6->sin6_scope_id = (u32) simple_strtoul(pct, &endp, 0);
if (!*pct || *endp)
return 0;
}

return rc;
}

/*****************************************************************************
Expand Down

0 comments on commit 77472b7

Please sign in to comment.