Home | History | Annotate | Line # | Download | only in net
if_sppp.h revision 1.31.2.2
      1  1.31.2.2   thorpej /*	$NetBSD: if_sppp.h,v 1.31.2.2 2021/06/17 04:46:35 thorpej Exp $	*/
      2       1.4  explorer 
      3      1.17    martin /*-
      4      1.17    martin  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5      1.17    martin  * All rights reserved.
      6      1.17    martin  *
      7      1.17    martin  * This code is derived from software contributed to The NetBSD Foundation
      8      1.22    keihan  * by Martin Husemann <martin (at) NetBSD.org>.
      9       1.1  explorer  *
     10      1.12    martin  * Redistribution and use in source and binary forms, with or without
     11      1.12    martin  * modification, are permitted provided that the following conditions
     12      1.12    martin  * are met:
     13      1.12    martin  * 1. Redistributions of source code must retain the above copyright
     14      1.12    martin  *    notice, this list of conditions and the following disclaimer.
     15      1.12    martin  * 2. Redistributions in binary form must reproduce the above copyright
     16      1.12    martin  *    notice, this list of conditions and the following disclaimer in the
     17      1.12    martin  *    documentation and/or other materials provided with the distribution.
     18      1.12    martin  *
     19      1.17    martin  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20      1.17    martin  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21      1.17    martin  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22      1.17    martin  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23      1.17    martin  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24      1.17    martin  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25      1.17    martin  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26      1.17    martin  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27      1.17    martin  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28      1.17    martin  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29      1.17    martin  * POSSIBILITY OF SUCH DAMAGE.
     30       1.1  explorer  */
     31       1.1  explorer 
     32      1.24      elad #ifndef _NET_IF_SPPP_H_
     33      1.24      elad #define _NET_IF_SPPP_H_
     34      1.24      elad 
     35      1.12    martin /* ioctls used by the if_spppsubr.c driver */
     36       1.3  explorer 
     37      1.28  dholland #include <sys/ioccom.h>
     38      1.28  dholland 
     39      1.28  dholland 
     40      1.12    martin #define	SPPP_AUTHPROTO_NONE	0
     41      1.12    martin #define SPPP_AUTHPROTO_PAP	1
     42      1.12    martin #define SPPP_AUTHPROTO_CHAP	2
     43  1.31.2.1   thorpej #define SPPP_AUTHPROTO_NOCHG	3
     44      1.12    martin 
     45      1.12    martin #define SPPP_AUTHFLAG_NOCALLOUT		1	/* do not require authentication on */
     46      1.12    martin 						/* callouts */
     47      1.12    martin #define SPPP_AUTHFLAG_NORECHALLENGE	2	/* do not re-challenge CHAP */
     48      1.31  yamaguch #define SPPP_AUTHFLAG_PASSIVEAUTHPROTO	4	/* use authproto proposed by peer */
     49      1.12    martin 
     50      1.12    martin struct spppauthcfg {
     51      1.12    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
     52      1.15    martin 	u_int	hisauth;		/* one of SPPP_AUTHPROTO_* above */
     53      1.15    martin 	u_int	myauth;			/* one of SPPP_AUTHPROTO_* above */
     54      1.15    martin 	u_int	myname_length;		/* includes terminating 0 */
     55      1.15    martin 	u_int	mysecret_length;	/* includes terminating 0 */
     56      1.15    martin 	u_int	hisname_length;		/* includes terminating 0 */
     57      1.15    martin 	u_int	hissecret_length;	/* includes terminating 0 */
     58      1.15    martin 	u_int	myauthflags;
     59      1.15    martin 	u_int	hisauthflags;
     60      1.12    martin 	char	*myname;
     61      1.12    martin 	char	*mysecret;
     62      1.12    martin 	char	*hisname;
     63      1.12    martin 	char	*hissecret;
     64      1.12    martin };
     65      1.12    martin 
     66      1.12    martin #define	SPPPGETAUTHCFG	_IOWR('i', 120, struct spppauthcfg)
     67      1.12    martin #define	SPPPSETAUTHCFG	_IOW('i', 121, struct spppauthcfg)
     68      1.12    martin 
     69      1.12    martin struct sppplcpcfg {
     70      1.12    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
     71      1.12    martin 	int	lcp_timeout;		/* LCP timeout, in ticks */
     72       1.1  explorer };
     73       1.1  explorer 
     74      1.12    martin #define	SPPPGETLCPCFG	_IOWR('i', 122, struct sppplcpcfg)
     75      1.12    martin #define	SPPPSETLCPCFG	_IOW('i', 123, struct sppplcpcfg)
     76       1.3  explorer 
     77       1.3  explorer /*
     78       1.3  explorer  * Don't change the order of this.  Ordering the phases this way allows
     79      1.30       wiz  * for a comparison of ``pp_phase >= PHASE_AUTHENTICATE'' in order to
     80       1.3  explorer  * know whether LCP is up.
     81       1.3  explorer  */
     82      1.12    martin #define	SPPP_PHASE_DEAD		0
     83      1.12    martin #define	SPPP_PHASE_ESTABLISH	1
     84      1.12    martin #define	SPPP_PHASE_TERMINATE	2
     85      1.12    martin #define	SPPP_PHASE_AUTHENTICATE	3
     86      1.12    martin #define	SPPP_PHASE_NETWORK	4
     87      1.12    martin 
     88      1.12    martin struct spppstatus {
     89      1.12    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
     90      1.12    martin 	int	phase;			/* one of SPPP_PHASE_* above */
     91       1.1  explorer };
     92       1.1  explorer 
     93      1.12    martin #define	SPPPGETSTATUS	_IOWR('i', 124, struct spppstatus)
     94      1.13    martin 
     95      1.23    martin struct spppstatusncp {
     96      1.23    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
     97      1.23    martin 	int	phase;			/* one of SPPP_PHASE_* above */
     98      1.23    martin 	int	ncpup;			/* != 0 if at least on NCP is up */
     99      1.23    martin };
    100      1.23    martin 
    101      1.23    martin #define	SPPPGETSTATUSNCP	_IOWR('i', 134, struct spppstatusncp)
    102      1.23    martin 
    103      1.13    martin struct spppidletimeout {
    104      1.13    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    105      1.13    martin 	time_t	idle_seconds;		/* number of seconds idle before
    106      1.13    martin 					 * disconnect, 0 to disable idle-timeout */
    107      1.13    martin };
    108      1.13    martin 
    109      1.27  jmcneill struct spppidletimeout50 {
    110      1.27  jmcneill 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    111      1.27  jmcneill 	uint32_t idle_seconds;		/* number of seconds idle before
    112      1.27  jmcneill 					 * disconnect, 0 to disable idle-timeout */
    113      1.27  jmcneill };
    114      1.27  jmcneill 
    115      1.21    martin #define	SPPPGETIDLETO	_IOWR('i', 125, struct spppidletimeout)
    116      1.21    martin #define	SPPPSETIDLETO	_IOW('i', 126, struct spppidletimeout)
    117      1.27  jmcneill #define	__SPPPGETIDLETO50	_IOWR('i', 125, struct spppidletimeout50)
    118      1.27  jmcneill #define	__SPPPSETIDLETO50	_IOW('i', 126, struct spppidletimeout50)
    119      1.14    martin 
    120      1.14    martin struct spppauthfailurestats {
    121      1.14    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    122      1.18       wiz 	int	auth_failures;		/* number of LCP failures since last successful TLU */
    123      1.14    martin 	int	max_failures;		/* max. allowed authorization failures */
    124      1.14    martin };
    125      1.14    martin 
    126      1.14    martin #define	SPPPGETAUTHFAILURES	_IOWR('i', 127, struct spppauthfailurestats)
    127      1.14    martin 
    128      1.14    martin struct spppauthfailuresettings {
    129      1.14    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    130      1.14    martin 	int	max_failures;		/* max. allowed authorization failures */
    131      1.14    martin };
    132      1.14    martin #define	SPPPSETAUTHFAILURE	_IOW('i', 128, struct spppauthfailuresettings)
    133      1.16    martin 
    134      1.16    martin /* set the DNS options we would like to query during PPP negotiation */
    135      1.16    martin struct spppdnssettings {
    136      1.16    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    137      1.16    martin 	int	query_dns;		/* bitmask (bits 0 and 1) for DNS options to query in IPCP */
    138      1.16    martin };
    139      1.16    martin #define	SPPPSETDNSOPTS		_IOW('i', 129, struct spppdnssettings)
    140      1.16    martin #define	SPPPGETDNSOPTS		_IOWR('i', 130, struct spppdnssettings)
    141      1.16    martin 
    142      1.16    martin /* get the DNS addresses we received from the peer */
    143      1.16    martin struct spppdnsaddrs {
    144      1.16    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    145      1.25      matt 	uint32_t dns[2];		/* IP addresses */
    146      1.16    martin };
    147      1.16    martin 
    148      1.16    martin #define SPPPGETDNSADDRS		_IOWR('i', 131, struct spppdnsaddrs)
    149      1.19    martin 
    150      1.19    martin /* set LCP keepalive/timeout options */
    151      1.19    martin struct spppkeepalivesettings {
    152      1.19    martin 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    153      1.19    martin 	u_int	maxalive;		/* number of LCP echo req. w/o reply */
    154      1.19    martin 	time_t	max_noreceive;		/* (sec.) grace period before we start
    155      1.19    martin 					   sending LCP echo requests. */
    156  1.31.2.2   thorpej 	u_int	alive_interval;		/* number of keepalive between echo req. */
    157      1.19    martin };
    158      1.27  jmcneill struct spppkeepalivesettings50 {
    159      1.27  jmcneill 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
    160      1.27  jmcneill 	u_int	maxalive;		/* number of LCP echo req. w/o reply */
    161      1.27  jmcneill 	uint32_t max_noreceive;		/* (sec.) grace period before we start
    162      1.27  jmcneill 					   sending LCP echo requests. */
    163      1.27  jmcneill };
    164      1.20    martin #define	SPPPSETKEEPALIVE	_IOW('i', 132, struct spppkeepalivesettings)
    165      1.20    martin #define	SPPPGETKEEPALIVE	_IOWR('i', 133, struct spppkeepalivesettings)
    166      1.27  jmcneill #define	__SPPPSETKEEPALIVE50	_IOW('i', 132, struct spppkeepalivesettings50)
    167      1.27  jmcneill #define	__SPPPGETKEEPALIVE50	_IOWR('i', 133, struct spppkeepalivesettings50)
    168      1.19    martin 
    169      1.23    martin /* 134 already used! */
    170      1.24      elad 
    171      1.29  yamaguch /* states are named and numbered according to RFC 1661 */
    172      1.29  yamaguch #define SPPP_STATE_INITIAL	0
    173      1.29  yamaguch #define SPPP_STATE_STARTING	1
    174      1.29  yamaguch #define SPPP_STATE_CLOSED	2
    175      1.29  yamaguch #define SPPP_STATE_STOPPED	3
    176      1.29  yamaguch #define SPPP_STATE_CLOSING	4
    177      1.29  yamaguch #define SPPP_STATE_STOPPING	5
    178      1.29  yamaguch #define SPPP_STATE_REQ_SENT	6
    179      1.29  yamaguch #define SPPP_STATE_ACK_RCVD	7
    180      1.29  yamaguch #define SPPP_STATE_ACK_SENT	8
    181      1.29  yamaguch #define SPPP_STATE_OPENED	9
    182      1.29  yamaguch 
    183      1.29  yamaguch #define SPPP_LCP_OPT_MRU		__BIT(1)
    184      1.29  yamaguch #define SPPP_LCP_OPT_ASYNC_MAP		__BIT(2)
    185      1.29  yamaguch #define SPPP_LCP_OPT_AUTH_PROTO		__BIT(3)
    186      1.29  yamaguch #define SPPP_LCP_OPT_QUAL_PROTO		__BIT(4)
    187      1.29  yamaguch #define SPPP_LCP_OPT_MAGIC		__BIT(5)
    188      1.29  yamaguch #define SPPP_LCP_OPT_RESERVED		__BIT(6)
    189      1.29  yamaguch #define SPPP_LCP_OPT_PROTO_COMP		__BIT(7)
    190      1.29  yamaguch #define SPPP_LCP_OPT_ADDR_COMP		__BIT(8)
    191      1.29  yamaguch #define SPPP_LCP_OPT_FCS_ALTS		__BIT(9)
    192      1.29  yamaguch #define SPPP_LCP_OPT_SELF_DESC_PAD	__BIT(10)
    193      1.29  yamaguch #define SPPP_LCP_OPT_CALL_BACK		__BIT(13)
    194      1.29  yamaguch #define SPPP_LCP_OPT_COMPOUND_FRMS	__BIT(15)
    195      1.29  yamaguch #define SPPP_LCP_OPT_MP_MRRU		__BIT(17)
    196      1.29  yamaguch #define SPPP_LCP_OPT_MP_SSNHF		__BIT(18)
    197      1.29  yamaguch #define SPPP_LCP_OPT_MP_EID		__BIT(19)
    198      1.29  yamaguch 
    199      1.29  yamaguch /* #define SPPP_OPT_ADDRESSES	__BIT(0) */
    200      1.29  yamaguch #define SPPP_IPCP_OPT_COMPRESSION	__BIT(1)
    201      1.29  yamaguch #define SPPP_IPCP_OPT_ADDRESS		__BIT(2)
    202      1.29  yamaguch #define SPPP_IPCP_OPT_PRIMDNS		__BIT(3)
    203      1.29  yamaguch #define SPPP_IPCP_OPT_SECDNS		__BIT(4)
    204      1.29  yamaguch 
    205      1.29  yamaguch #define SPPP_IPV6CP_OPT_IFID		__BIT(1)
    206      1.29  yamaguch #define SPPP_IPV6CP_OPT_COMPRESSION	__BIT(2)
    207      1.29  yamaguch 
    208      1.29  yamaguch struct sppplcpstatus {
    209      1.29  yamaguch 	char	ifname[IFNAMSIZ];
    210      1.29  yamaguch 	int	state;
    211      1.29  yamaguch 	int	timeout;
    212      1.29  yamaguch 	u_long	opts;
    213      1.29  yamaguch 	u_long	magic;
    214      1.29  yamaguch 	u_long	mru;
    215      1.29  yamaguch };
    216      1.29  yamaguch 
    217      1.29  yamaguch #define SPPPGETLCPSTATUS	_IOWR('i', 135, struct sppplcpstatus)
    218      1.29  yamaguch 
    219      1.29  yamaguch struct spppipcpstatus {
    220      1.29  yamaguch 	char		ifname[IFNAMSIZ];
    221      1.29  yamaguch 	int		state;
    222      1.29  yamaguch 	u_long		opts;
    223      1.29  yamaguch 	u_int32_t	myaddr;
    224      1.29  yamaguch };
    225      1.29  yamaguch 
    226      1.29  yamaguch #define SPPPGETIPCPSTATUS	_IOWR('i', 136, struct spppipcpstatus)
    227      1.29  yamaguch 
    228      1.29  yamaguch struct spppipv6cpstatus {
    229      1.29  yamaguch 	char		ifname[IFNAMSIZ];
    230      1.29  yamaguch 	int		state;
    231      1.29  yamaguch 	u_long		opts;
    232      1.29  yamaguch 	u_int8_t	my_ifid[8];
    233      1.29  yamaguch 	u_int8_t	his_ifid[8];
    234      1.29  yamaguch };
    235      1.29  yamaguch 
    236      1.29  yamaguch #define SPPPGETIPV6CPSTATUS	_IOWR('i', 137, struct spppipv6cpstatus)
    237      1.29  yamaguch 
    238  1.31.2.1   thorpej #define SPPP_NCP_IPCP		__BIT(0)
    239  1.31.2.1   thorpej #define SPPP_NCP_IPV6CP		__BIT(1)
    240  1.31.2.1   thorpej struct spppncpcfg {
    241  1.31.2.1   thorpej 	char		ifname[IFNAMSIZ];
    242  1.31.2.1   thorpej 	u_int		ncp_flags;
    243  1.31.2.1   thorpej };
    244  1.31.2.1   thorpej 
    245  1.31.2.1   thorpej #define SPPPGETNCPCFG		_IOWR('i', 138, struct spppncpcfg)
    246  1.31.2.1   thorpej #define SPPPSETNCPCFG		_IOW('i', 139, struct spppncpcfg)
    247  1.31.2.1   thorpej 
    248      1.24      elad #endif /* !_NET_IF_SPPP_H_ */
    249      1.24      elad 
    250