Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115407
b: refs/heads/master
c: 5e2e772
h: refs/heads/master
i:
  115405: 0293397
  115403: 50e41ba
  115399: 4d58e71
  115391: 118979d
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Oct 10, 2008
1 parent 9234d6b commit fe830de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 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: 456018d791ff4ef03d610f72486c637056bcd749
refs/heads/master: 5e2e7721f04c11e6dc4a74b33f05a0e1c0381e2e
34 changes: 23 additions & 11 deletions trunk/fs/nfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,17 +717,21 @@ static void nfs_parse_ipv4_address(char *string, size_t str_len,
}

#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
static void nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
const char *delim,
struct sockaddr_in6 *sin6)
static int nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
const char *delim,
struct sockaddr_in6 *sin6)
{
char *p;
size_t len;

if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
return ;
if ((string + str_len) == delim)
return 1;

if (*delim != IPV6_SCOPE_DELIMITER)
return;
return 0;

if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
return 0;

len = (string + str_len) - delim - 1;
p = kstrndup(delim + 1, len, GFP_KERNEL);
Expand All @@ -740,14 +744,20 @@ static void nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
scope_id = dev->ifindex;
dev_put(dev);
} else {
/* scope_id is set to zero on error */
strict_strtoul(p, 10, &scope_id);
if (strict_strtoul(p, 10, &scope_id) == 0) {
kfree(p);
return 0;
}
}

kfree(p);

sin6->sin6_scope_id = scope_id;
dfprintk(MOUNT, "NFS: IPv6 scope ID = %lu\n", scope_id);
return 1;
}

return 0;
}

static void nfs_parse_ipv6_address(char *string, size_t str_len,
Expand All @@ -763,9 +773,11 @@ static void nfs_parse_ipv6_address(char *string, size_t str_len,

sin6->sin6_family = AF_INET6;
*addr_len = sizeof(*sin6);
if (in6_pton(string, str_len, addr, IPV6_SCOPE_DELIMITER, &delim)) {
nfs_parse_ipv6_scope_id(string, str_len, delim, sin6);
return;
if (in6_pton(string, str_len, addr,
IPV6_SCOPE_DELIMITER, &delim) != 0) {
if (nfs_parse_ipv6_scope_id(string, str_len,
delim, sin6) != 0)
return;
}
}

Expand Down

0 comments on commit fe830de

Please sign in to comment.