Skip to contentSkip to conversation

Fix IPv6 address handling in addr.c

PATCH New Chuck Lever 1 participant 3 messages Jan 12, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix IPv6 address handling in addr.c

Two minor patches to net/sunrpc/addr.c to fix how sunrpc.ko handles certain types of IPv6 addresses. Please consider these for 2.6.34.

---

Chuck Lever (2):
SUNRPC: Don't display zero scope IDs
SUNRPC: Deprecate support for site-local addresses

 net/sunrpc/addr.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
chuck[dot]lever[at]oracle[dot]com

A message that is not in the archive (sent off-list or not yet received): 20100112223826.3167.13900.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

#2 lore raw

PATCH 1/2 SUNRPC: Deprecate support for site-local addresses

RFC 3879 "formally deprecates" site-local IPv6 addresses. We interpret that to mean that the scope ID is ignored for all but link-local addresses.

---

 net/sunrpc/addr.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
net/sunrpc/addr.c +2 -4
index 6dcdd25..0756c5d 100644
@@ -71,8 +71,7 @@ static size_t rpc_ntop6(const struct sockaddr *sap,
 	if (unlikely(len == 0))
 		return len;
 
-	if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) &&
-	    !(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_SITELOCAL))
+	if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
 		return len;
 
 	rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u",
@@ -165,8 +164,7 @@ static int rpc_parse_scope_id(const char *buf, const size_t buflen,
 	if (*delim != IPV6_SCOPE_DELIMITER)
 		return 0;
 
-	if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) &&
-	    !(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_SITELOCAL))
+	if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
 		return 0;
 
 	len = (buf + buflen) - delim - 1;
#3 lore raw

PATCH 2/2 SUNRPC: Don't display zero scope IDs

In reply to a message not in the archive

A zero scope ID means that it wasn't set, so we don't need to append it to presentation format addresses.

---

 net/sunrpc/addr.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/sunrpc/addr.c +2 -0
index 0756c5d..f845d9d 100644
@@ -73,6 +73,8 @@ static size_t rpc_ntop6(const struct sockaddr *sap,
 
 	if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
 		return len;
+	if (sin6->sin6_scope_id == 0)
+		return len;
 
 	rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u",
 			IPV6_SCOPE_DELIMITER, sin6->sin6_scope_id);