From owner-svn-src-stable-9@FreeBSD.ORG Sun Jul 8 09:49:03 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1EDBA1065694; Sun, 8 Jul 2012 09:49:02 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F0618FC16; Sun, 8 Jul 2012 09:49:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q689n2Ys042219; Sun, 8 Jul 2012 09:49:02 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q689n2Zm042216; Sun, 8 Jul 2012 09:49:02 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207080949.q689n2Zm042216@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 8 Jul 2012 09:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238224 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2012 09:49:03 -0000 Author: bz Date: Sun Jul 8 09:49:01 2012 New Revision: 238224 URL: http://svn.freebsd.org/changeset/base/238224 Log: MFC r235916: Introduce in6_getscope() to allow more effective checksum computations without the need to copy the address to clear the scope. Approved by: re Modified: stable/9/sys/netinet6/scope6.c stable/9/sys/netinet6/scope6_var.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/scope6.c ============================================================================== --- stable/9/sys/netinet6/scope6.c Sun Jul 8 09:06:25 2012 (r238223) +++ stable/9/sys/netinet6/scope6.c Sun Jul 8 09:49:01 2012 (r238224) @@ -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); +} Modified: stable/9/sys/netinet6/scope6_var.h ============================================================================== --- stable/9/sys/netinet6/scope6_var.h Sun Jul 8 09:06:25 2012 (r238223) +++ stable/9/sys/netinet6/scope6_var.h Sun Jul 8 09:49:01 2012 (r238224) @@ -54,6 +54,7 @@ int sa6_embedscope __P((struct sockaddr_ 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_ */