Home | History | Annotate | Line # | Download | only in netinet6
      1 /*	$NetBSD: in6_var.h,v 1.6 2020/06/12 11:04:45 roy Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2008 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Christos Zoulas.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 #ifndef _COMPAT_NETINET6_IN6_VAR_H_
     32 #define _COMPAT_NETINET6_IN6_VAR_H_
     33 
     34 #include <sys/ioccom.h>
     35 
     36 struct in6_addrlifetime50 {
     37 	int32_t ia6t_expire;
     38 	int32_t ia6t_preferred;
     39 	u_int32_t ia6t_vltime;
     40 	u_int32_t ia6t_pltime;
     41 };
     42 
     43 struct in6_aliasreq50 {
     44 	char	ifra_name[IFNAMSIZ];
     45 	struct	sockaddr_in6 ifra_addr;
     46 	struct	sockaddr_in6 ifra_dstaddr;
     47 	struct	sockaddr_in6 ifra_prefixmask;
     48 	int	ifra_flags;
     49 	struct in6_addrlifetime50 ifra_lifetime;
     50 };
     51 
     52 struct prf_ra {
     53 	u_int32_t onlink : 1;
     54 	u_int32_t autonomous : 1;
     55 	u_int32_t router : 1;
     56 	u_int32_t reserved : 5;
     57 };
     58 
     59 #define OSIOCAIFADDR_IN6	_IOW('i', 26, struct in6_aliasreq50)
     60 #define OSIOCSIFPHYADDR_IN6	_IOW('i', 70, struct in6_aliasreq50)
     61 #define OSIOCGDRLST_IN6		_IOWR('i', 74, struct in6_drlist)
     62 #define OSIOCGPRLST_IN6		_IOWR('i', 75, struct in6_oprlist)
     63 #define OSIOCGIFINFO_IN6	_IOWR('i', 76, struct in6_ondireq)
     64 #define OSIOCSNDFLUSH_IN6	_IOWR('i', 77, struct in6_ifreq)
     65 #define OSIOCSPFXFLUSH_IN6	_IOWR('i', 79, struct in6_ifreq)
     66 #define OSIOCSRTRFLUSH_IN6	_IOWR('i', 80, struct in6_ifreq)
     67 #define OSIOCGIFALIFETIME_IN6	_IOWR('i', 81, struct in6_ifreq)
     68 #define OSIOCSDEFIFACE_IN6	_IOWR('i', 85, struct in6_ndifreq90)
     69 #define OSIOCGDEFIFACE_IN6	_IOWR('i', 86, struct in6_ndifreq90)
     70 #define OSIOCSIFINFO_FLAGS_90	_IOWR('i', 87, struct in6_ndireq90)
     71 #define OSIOCGIFINFO_IN6_90	_IOWR('i', 108, struct in6_ndireq90)
     72 #define OSIOCSIFINFO_IN6_90	_IOWR('i', 109, struct in6_ndireq90)
     73 
     74 static __inline void in6_addrlifetime_to_in6_addrlifetime50(
     75     struct in6_addrlifetime *al)
     76 {
     77 	struct in6_addrlifetime cp;
     78 	struct in6_addrlifetime50 *oal =
     79 	    (struct in6_addrlifetime50 *)(void *)al;
     80 	(void)memcpy(&cp, al, sizeof(cp));
     81 	oal->ia6t_expire = (int32_t)cp.ia6t_expire;
     82 	oal->ia6t_preferred = (int32_t)cp.ia6t_preferred;
     83 	oal->ia6t_vltime = cp.ia6t_vltime;
     84 	oal->ia6t_pltime = cp.ia6t_pltime;
     85 }
     86 
     87 static __inline void in6_aliasreq50_to_in6_aliasreq(
     88     struct in6_aliasreq *ar)
     89 {
     90 	struct in6_aliasreq50 *oar =
     91 	    (struct in6_aliasreq50 *)(void *)ar;
     92 	struct in6_aliasreq50 cp;
     93 	memcpy(&cp, oar, sizeof(cp));
     94 	ar->ifra_lifetime.ia6t_expire = cp.ifra_lifetime.ia6t_expire;
     95 	ar->ifra_lifetime.ia6t_preferred = cp.ifra_lifetime.ia6t_preferred;
     96 	ar->ifra_lifetime.ia6t_vltime = cp.ifra_lifetime.ia6t_vltime;
     97 	ar->ifra_lifetime.ia6t_pltime = cp.ifra_lifetime.ia6t_pltime;
     98 }
     99 
    100 #endif /* _COMPAT_NETINET6_IN6_VAR_H_ */
    101