Module Name: src Committed By: christos Date: Sat Oct 19 19:56:56 UTC 2013
Modified Files: src/lib/libc/net: Makefile.inc Added Files: src/lib/libc/net: inet6_getscopeid.3 Log Message: document the scopeid functions To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/lib/libc/net/Makefile.inc cvs rdiff -u -r0 -r1.1 src/lib/libc/net/inet6_getscopeid.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/net/Makefile.inc diff -u src/lib/libc/net/Makefile.inc:1.84 src/lib/libc/net/Makefile.inc:1.85 --- src/lib/libc/net/Makefile.inc:1.84 Fri Oct 18 20:08:34 2013 +++ src/lib/libc/net/Makefile.inc Sat Oct 19 15:56:56 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.84 2013/10/19 00:08:34 christos Exp $ +# $NetBSD: Makefile.inc,v 1.85 2013/10/19 19:56:56 christos Exp $ # @(#)Makefile.inc 8.2 (Berkeley) 9/5/93 # net sources @@ -120,12 +120,13 @@ MLINKS+=resolver.3 dn_comp.3 \ # IPv6 MAN+= gai_strerror.3 getaddrinfo.3 getnameinfo.3 if_indextoname.3 \ inet6_option_space.3 inet6_rthdr_space.3 \ - inet6_opt_init.3 inet6_rth_space.3 + inet6_opt_init.3 inet6_rth_space.3 inet6_getscopeid.3 MLINKS+=getaddrinfo.3 freeaddrinfo.3 \ getaddrinfo.3 allocaddrinfo.3 \ getifaddrs.3 freeifaddrs.3 \ if_indextoname.3 if_nametoindex.3 if_indextoname.3 if_nameindex.3 \ if_indextoname.3 if_freenameindex.3 \ + inet6_getscopeid.3 inet6_putscopeid.3 \ inet6_option_space.3 inet6_option_init.3 \ inet6_option_space.3 inet6_option_append.3 \ inet6_option_space.3 inet6_option_alloc.3 \ Added files: Index: src/lib/libc/net/inet6_getscopeid.3 diff -u /dev/null src/lib/libc/net/inet6_getscopeid.3:1.1 --- /dev/null Sat Oct 19 15:56:56 2013 +++ src/lib/libc/net/inet6_getscopeid.3 Sat Oct 19 15:56:56 2013 @@ -0,0 +1,83 @@ +.\" $NetBSD: inet6_getscopeid.3,v 1.1 2013/10/19 19:56:56 christos Exp $ +.\"- +.\" Copyright (c) 2003 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Christos Zoulas. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" +.Dd October 19, 2013 +.Dt INET6_GETSCOPEID 3 +.Os +.\" +.Sh NAME +.Nm inet6_getscopeid , +.Nm inet6_putscopeid +.Nd IPv6 scope id encoding and decoding functions +.\" +.Sh SYNOPSIS +.In netinet/in.h +.Ft void +.Fn inet6_getscopeid "struct sockaddr_in6 *sin6" "int flags" +.Ft void +.Fn inet6_putscopeid "struct sockaddr_in6 *sin6" "int flags" +.\" +.Sh DESCRIPTION +These functions implement a KAME-specific extension that encodes and +decodes the scope id inside in the 3rd and 4th byte of the address, +for link-local, site-local, and multicast-link-local addresses. +Typically those two bytes are +.Dv 0 +for these kinds of addresses. +The scope id is stored in network byte order. +.Pp +The +.Fn inet6_getscopeid +function retrieves the scope id from the 3rd and the 4th address bytes, +and sets the +.Ft sin6_scope_id +from them. +It then clears the two address bytes. +.Pp +The +.Fn inet6putscopeid +function stores the scope id found in +.Ft sin6_scope_id +into the 3rd and 4th byte of the address. +It then clears the +.Ft sin6_scope_id +.Pp +The +.Fa flags +argument controls for which addresses this action is performed. It +can be a combination of: +.Bl -tag -width "INET6_IS_ADDR_MC_LINKLOCAL" +.It Dv INET6_IS_ADDR_LINKLOCAL +.It Dv INET6_IS_ADDR_MC_LINKLOCAL +.It Dv INET6_IS_ADDR_SITELOCAL +.El +.Sh HISTORY +These functions first appeared in +.Nx 7 .