Home | History | Annotate | Line # | Download | only in net
if_sppp.h revision 1.30
      1 /*	$NetBSD: if_sppp.h,v 1.30 2020/12/02 14:20:20 wiz Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Martin Husemann <martin (at) NetBSD.org>.
      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 
     32 #ifndef _NET_IF_SPPP_H_
     33 #define _NET_IF_SPPP_H_
     34 
     35 /* ioctls used by the if_spppsubr.c driver */
     36 
     37 #include <sys/ioccom.h>
     38 
     39 
     40 #define	SPPP_AUTHPROTO_NONE	0
     41 #define SPPP_AUTHPROTO_PAP	1
     42 #define SPPP_AUTHPROTO_CHAP	2
     43 
     44 #define SPPP_AUTHFLAG_NOCALLOUT		1	/* do not require authentication on */
     45 						/* callouts */
     46 #define SPPP_AUTHFLAG_NORECHALLENGE	2	/* do not re-challenge CHAP */
     47 
     48 struct spppauthcfg {
     49 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
     50 	u_int	hisauth;		/* one of SPPP_AUTHPROTO_* above */
     51 	u_int	myauth;			/* one of SPPP_AUTHPROTO_* above */
     52 	u_int	myname_length;		/* includes terminating 0 */
     53 	u_int	mysecret_length;	/* includes terminating 0 */
     54 	u_int	hisname_length;		/* includes terminating 0 */
     55 	u_int	hissecret_length;	/* includes terminating 0 */
     56 	u_int	myauthflags;
     57 	u_int	hisauthflags;
     58 	char	*myname;
     59 	char	*mysecret;
     60 	char	*hisname;
     61 	char	*hissecret;
     62 };
     63 
     64 #define	SPPPGETAUTHCFG	_IOWR('i', 120, struct spppauthcfg)
     65 #define	SPPPSETAUTHCFG	_IOW('i', 121, struct spppauthcfg)
     66 
     67 struct sppplcpcfg {
     68 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
     69 	int	lcp_timeout;		/* LCP timeout, in ticks */
     70 };
     71 
     72 #define	SPPPGETLCPCFG	_IOWR('i', 122, struct sppplcpcfg)
     73 #define	SPPPSETLCPCFG	_IOW('i', 123, struct sppplcpcfg)
     74 
     75 /*
     76  * Don't change the order of this.  Ordering the phases this way allows
     77  * for a comparison of ``pp_phase >= PHASE_AUTHENTICATE'' in order to
     78  * know whether LCP is up.
     79  */
     80 #define	SPPP_PHASE_DEAD		0
     81 #define	SPPP_PHASE_ESTABLISH	1
     82 #define	SPPP_PHASE_TERMINATE	2
     83 #define	SPPP_PHASE_AUTHENTICATE	3
     84 #define	SPPP_PHASE_NETWORK	4
     85 
     86 struct spppstatus {
     87 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
     88 	int	phase;			/* one of SPPP_PHASE_* above */
     89 };
     90 
     91 #define	SPPPGETSTATUS	_IOWR('i', 124, struct spppstatus)
     92 
     93 struct spppstatusncp {
     94 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
     95 	int	phase;			/* one of SPPP_PHASE_* above */
     96 	int	ncpup;			/* != 0 if at least on NCP is up */
     97 };
     98 
     99 #define	SPPPGETSTATUSNCP	_IOWR('i', 134, struct spppstatusncp)
    100 
    101 struct spppidletimeout {
    102 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    103 	time_t	idle_seconds;		/* number of seconds idle before
    104 					 * disconnect, 0 to disable idle-timeout */
    105 };
    106 
    107 struct spppidletimeout50 {
    108 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    109 	uint32_t idle_seconds;		/* number of seconds idle before
    110 					 * disconnect, 0 to disable idle-timeout */
    111 };
    112 
    113 #define	SPPPGETIDLETO	_IOWR('i', 125, struct spppidletimeout)
    114 #define	SPPPSETIDLETO	_IOW('i', 126, struct spppidletimeout)
    115 #define	__SPPPGETIDLETO50	_IOWR('i', 125, struct spppidletimeout50)
    116 #define	__SPPPSETIDLETO50	_IOW('i', 126, struct spppidletimeout50)
    117 
    118 struct spppauthfailurestats {
    119 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    120 	int	auth_failures;		/* number of LCP failures since last successful TLU */
    121 	int	max_failures;		/* max. allowed authorization failures */
    122 };
    123 
    124 #define	SPPPGETAUTHFAILURES	_IOWR('i', 127, struct spppauthfailurestats)
    125 
    126 struct spppauthfailuresettings {
    127 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    128 	int	max_failures;		/* max. allowed authorization failures */
    129 };
    130 #define	SPPPSETAUTHFAILURE	_IOW('i', 128, struct spppauthfailuresettings)
    131 
    132 /* set the DNS options we would like to query during PPP negotiation */
    133 struct spppdnssettings {
    134 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    135 	int	query_dns;		/* bitmask (bits 0 and 1) for DNS options to query in IPCP */
    136 };
    137 #define	SPPPSETDNSOPTS		_IOW('i', 129, struct spppdnssettings)
    138 #define	SPPPGETDNSOPTS		_IOWR('i', 130, struct spppdnssettings)
    139 
    140 /* get the DNS addresses we received from the peer */
    141 struct spppdnsaddrs {
    142 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    143 	uint32_t dns[2];		/* IP addresses */
    144 };
    145 
    146 #define SPPPGETDNSADDRS		_IOWR('i', 131, struct spppdnsaddrs)
    147 
    148 /* set LCP keepalive/timeout options */
    149 struct spppkeepalivesettings {
    150 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    151 	u_int	maxalive;		/* number of LCP echo req. w/o reply */
    152 	time_t	max_noreceive;		/* (sec.) grace period before we start
    153 					   sending LCP echo requests. */
    154 };
    155 struct spppkeepalivesettings50 {
    156 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    157 	u_int	maxalive;		/* number of LCP echo req. w/o reply */
    158 	uint32_t max_noreceive;		/* (sec.) grace period before we start
    159 					   sending LCP echo requests. */
    160 };
    161 #define	SPPPSETKEEPALIVE	_IOW('i', 132, struct spppkeepalivesettings)
    162 #define	SPPPGETKEEPALIVE	_IOWR('i', 133, struct spppkeepalivesettings)
    163 #define	__SPPPSETKEEPALIVE50	_IOW('i', 132, struct spppkeepalivesettings50)
    164 #define	__SPPPGETKEEPALIVE50	_IOWR('i', 133, struct spppkeepalivesettings50)
    165 
    166 /* 134 already used! */
    167 
    168 /* states are named and numbered according to RFC 1661 */
    169 #define SPPP_STATE_INITIAL	0
    170 #define SPPP_STATE_STARTING	1
    171 #define SPPP_STATE_CLOSED	2
    172 #define SPPP_STATE_STOPPED	3
    173 #define SPPP_STATE_CLOSING	4
    174 #define SPPP_STATE_STOPPING	5
    175 #define SPPP_STATE_REQ_SENT	6
    176 #define SPPP_STATE_ACK_RCVD	7
    177 #define SPPP_STATE_ACK_SENT	8
    178 #define SPPP_STATE_OPENED	9
    179 
    180 #define SPPP_LCP_OPT_MRU		__BIT(1)
    181 #define SPPP_LCP_OPT_ASYNC_MAP		__BIT(2)
    182 #define SPPP_LCP_OPT_AUTH_PROTO		__BIT(3)
    183 #define SPPP_LCP_OPT_QUAL_PROTO		__BIT(4)
    184 #define SPPP_LCP_OPT_MAGIC		__BIT(5)
    185 #define SPPP_LCP_OPT_RESERVED		__BIT(6)
    186 #define SPPP_LCP_OPT_PROTO_COMP		__BIT(7)
    187 #define SPPP_LCP_OPT_ADDR_COMP		__BIT(8)
    188 #define SPPP_LCP_OPT_FCS_ALTS		__BIT(9)
    189 #define SPPP_LCP_OPT_SELF_DESC_PAD	__BIT(10)
    190 #define SPPP_LCP_OPT_CALL_BACK		__BIT(13)
    191 #define SPPP_LCP_OPT_COMPOUND_FRMS	__BIT(15)
    192 #define SPPP_LCP_OPT_MP_MRRU		__BIT(17)
    193 #define SPPP_LCP_OPT_MP_SSNHF		__BIT(18)
    194 #define SPPP_LCP_OPT_MP_EID		__BIT(19)
    195 
    196 /* #define SPPP_OPT_ADDRESSES	__BIT(0) */
    197 #define SPPP_IPCP_OPT_COMPRESSION	__BIT(1)
    198 #define SPPP_IPCP_OPT_ADDRESS		__BIT(2)
    199 #define SPPP_IPCP_OPT_PRIMDNS		__BIT(3)
    200 #define SPPP_IPCP_OPT_SECDNS		__BIT(4)
    201 
    202 #define SPPP_IPV6CP_OPT_IFID		__BIT(1)
    203 #define SPPP_IPV6CP_OPT_COMPRESSION	__BIT(2)
    204 
    205 struct sppplcpstatus {
    206 	char	ifname[IFNAMSIZ];
    207 	int	state;
    208 	int	timeout;
    209 	u_long	opts;
    210 	u_long	magic;
    211 	u_long	mru;
    212 };
    213 
    214 #define SPPPGETLCPSTATUS	_IOWR('i', 135, struct sppplcpstatus)
    215 
    216 struct spppipcpstatus {
    217 	char		ifname[IFNAMSIZ];
    218 	int		state;
    219 	u_long		opts;
    220 	u_int32_t	myaddr;
    221 };
    222 
    223 #define SPPPGETIPCPSTATUS	_IOWR('i', 136, struct spppipcpstatus)
    224 
    225 struct spppipv6cpstatus {
    226 	char		ifname[IFNAMSIZ];
    227 	int		state;
    228 	u_long		opts;
    229 	u_int8_t	my_ifid[8];
    230 	u_int8_t	his_ifid[8];
    231 };
    232 
    233 #define SPPPGETIPV6CPSTATUS	_IOWR('i', 137, struct spppipv6cpstatus)
    234 
    235 #endif /* !_NET_IF_SPPP_H_ */
    236 
    237