aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2012-05-24 16:30:13 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2012-05-24 16:30:13 +0000
commit0edc703a02fa52423db245b448ed6c7bf8c1a860 (patch)
tree931acd617b74dd34db6841b9b7b8b291d18d8950 /sys/netinet6
parentf9b897ba2e49b634e41d20144e1689b2a7802d98 (diff)
downloadsrc-0edc703a02fa52423db245b448ed6c7bf8c1a860.tar.gz
src-0edc703a02fa52423db245b448ed6c7bf8c1a860.zip
MFp4 bz_ipv6_fast:
Introduce in6_getscope() to allow more effective checksum computations without the need to copy the address to clear the scope. Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Reviewed by: gnn (as part of the whole) MFC After: 3 days
Notes
Notes: svn path=/head/; revision=235916
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/scope6.c13
-rw-r--r--sys/netinet6/scope6_var.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c
index 8189d87c5bcd..7a1a04b25cea 100644
--- a/sys/netinet6/scope6.c
+++ b/sys/netinet6/scope6.c
@@ -494,3 +494,16 @@ in6_clearscope(struct in6_addr *in6)
return (modified);
}
+
+/*
+ * Return the scope identifier or zero.
+ */
+uint16_t
+in6_getscope(struct in6_addr *in6)
+{
+
+ if (IN6_IS_SCOPE_LINKLOCAL(in6) || IN6_IS_ADDR_MC_INTFACELOCAL(in6))
+ return (in6->s6_addr16[1]);
+
+ return (0);
+}
diff --git a/sys/netinet6/scope6_var.h b/sys/netinet6/scope6_var.h
index 8ec6f1051814..2248037f0856 100644
--- a/sys/netinet6/scope6_var.h
+++ b/sys/netinet6/scope6_var.h
@@ -54,6 +54,7 @@ int sa6_embedscope __P((struct sockaddr_in6 *, int));
int sa6_recoverscope __P((struct sockaddr_in6 *));
int in6_setscope __P((struct in6_addr *, struct ifnet *, u_int32_t *));
int in6_clearscope __P((struct in6_addr *));
+uint16_t in6_getscope(struct in6_addr *);
#endif /* _KERNEL */
#endif /* _NETINET6_SCOPE6_VAR_H_ */