xref: /openbsd-src/share/man/man4/pipex.4 (revision 34e858ecfc3e6e5b0c8923b95a68bd9a46b927d0)
1*34e858ecSmvs.\"	$OpenBSD: pipex.4,v 1.15 2022/07/12 08:58:53 mvs Exp $
2c0f8380cSyasuoka.\"
3c0f8380cSyasuoka.\" Copyright (c) 2012 YASUOKA Masahiko <yasuoka@openbsd.org>
4c0f8380cSyasuoka.\" Copyright (c) 2010 SUENAGA Hiroki <hsuenaga@openbsd.org>
5c0f8380cSyasuoka.\"
6c0f8380cSyasuoka.\" Permission to use, copy, modify, and distribute this software for any
7c0f8380cSyasuoka.\" purpose with or without fee is hereby granted, provided that the above
8c0f8380cSyasuoka.\" copyright notice and this permission notice appear in all copies.
9c0f8380cSyasuoka.\"
10c0f8380cSyasuoka.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11c0f8380cSyasuoka.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12c0f8380cSyasuoka.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13c0f8380cSyasuoka.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14c0f8380cSyasuoka.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15c0f8380cSyasuoka.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16c0f8380cSyasuoka.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17c0f8380cSyasuoka.\"
18*34e858ecSmvs.Dd $Mdocdate: July 12 2022 $
19c0f8380cSyasuoka.Dt PIPEX 4
20c0f8380cSyasuoka.Os
21c0f8380cSyasuoka.Sh NAME
22c0f8380cSyasuoka.Nm pipex
232a72464eSderaadt.Nd PPP IP EXtension to handle IP/PPP frames in-kernel
24c0f8380cSyasuoka.Sh SYNOPSIS
25c0f8380cSyasuoka.Cd "option PIPEX"
26c0f8380cSyasuoka.Pp
2740774d9aSyasuoka.In sys/types.h
282f9345c2Sschwarze.In sys/socket.h
292f9345c2Sschwarze.In sys/ioctl.h
3040774d9aSyasuoka.In net/if.h
312f9345c2Sschwarze.In net/pipex.h
32c0f8380cSyasuoka.Sh DESCRIPTION
33c0f8380cSyasuoka.Nm
3482be78f9Sjmcis used with
35b538cba1Smpi.Xr pppac 4
36c0f8380cSyasuokaand
3741f57ac8Syasuoka.Xr pppx 4 ,
3882be78f9Sjmcand handles PPP frames and forwards IP packets in-kernel.
3982be78f9SjmcIt accelerates the performance of packet forwarding, because it reduces
4082be78f9Sjmccopying of packets between kernel and userland.
41c0f8380cSyasuoka.Nm
42c0f8380cSyasuokais disabled by default.
4382be78f9SjmcTo enable it, set
44c0f8380cSyasuoka.Va net.pipex.enable
4582be78f9Sjmcto
4682be78f9Sjmc.Sq 1
4782be78f9Sjmcusing
4882be78f9Sjmc.Xr sysctl 8 .
49c0f8380cSyasuoka.Pp
50c0f8380cSyasuoka.Nm
5182be78f9Sjmcadds some extensions to the
5282be78f9Sjmc.Xr ioctl 2
5382be78f9Sjmcrequests to
54b538cba1Smpi.Xr pppac 4
55c0f8380cSyasuokaor
5641f57ac8Syasuoka.Xr pppx 4
5782be78f9Sjmcdevices.
5882be78f9SjmcThe added requests are as follows:
59c0f8380cSyasuoka.Bl -tag -width Ds
60c0f8380cSyasuoka.It Dv PIPEXASESSION Fa "struct pipex_session_req *"
6182be78f9SjmcAdd a new PPP session to be handled by
62c0f8380cSyasuoka.Nm .
6382be78f9SjmcThe status of the session is passed as a
64c0f8380cSyasuoka.Vt pipex_session_req
65c0f8380cSyasuokastructure.
66c0f8380cSyasuokaThe
67c0f8380cSyasuoka.Vt pipex_session_req
6882be78f9Sjmcstructure has the following definition:
69c0f8380cSyasuoka.Bd -literal
70c0f8380cSyasuokastruct pipex_session_req {
71c0f8380cSyasuoka    int         pr_protocol;         /* tunnel protocol  */
72c0f8380cSyasuoka#define PIPEX_PROTO_L2TP   1         /* protocol L2TP */
73c0f8380cSyasuoka#define PIPEX_PROTO_PPTP   2         /* protocol PPTP */
74c0f8380cSyasuoka#define PIPEX_PROTO_PPPOE  3         /* protocol PPPoE */
75c0f8380cSyasuoka    uint16_t    pr_session_id;       /* session-id */
76c0f8380cSyasuoka    uint16_t    pr_peer_session_id;  /* peer's session-id */
77c0f8380cSyasuoka    uint32_t    pr_ppp_flags;        /* ppp configuration flags */
78c0f8380cSyasuoka#define PIPEX_PPP_ACFC_ACCEPTED  0x0001 /* ACFC accepted */
79c0f8380cSyasuoka#define PIPEX_PPP_PFC_ACCEPTED   0x0002 /* PFC accepted */
80c0f8380cSyasuoka#define PIPEX_PPP_ACFC_ENABLED   0x0004 /* ACFC enabled */
81c0f8380cSyasuoka#define PIPEX_PPP_PFC_ENABLED    0x0008 /* PFC enabled */
82c0f8380cSyasuoka#define PIPEX_PPP_MPPE_ACCEPTED  0x0010 /* MPPE accepted */
83c0f8380cSyasuoka#define PIPEX_PPP_MPPE_ENABLED   0x0020 /* MPPE enabled */
84c0f8380cSyasuoka#define PIPEX_PPP_MPPE_REQUIRED  0x0040 /* MPPE is required */
85c0f8380cSyasuoka#define PIPEX_PPP_HAS_ACF        0x0080 /* has ACF */
86c0f8380cSyasuoka#define PIPEX_PPP_ADJUST_TCPMSS  0x0100 /* do tcpmss adjustment */
87c0f8380cSyasuoka#define PIPEX_PPP_INGRESS_FILTER 0x0200 /* do ingress filter */
88c0f8380cSyasuoka    int8_t      pr_ccp_id;           /* ccp current packet id */
89c0f8380cSyasuoka    int         pr_ppp_id;           /* ppp id. */
90c0f8380cSyasuoka    uint16_t    pr_peer_mru;         /* peer's mru */
91c0f8380cSyasuoka    uint16_t    pr_timeout_sec;      /* idle timer */
92c0f8380cSyasuoka
93b538cba1Smpi    struct in_addr      pr_ip_srcaddr;    /* local IP address */
94c0f8380cSyasuoka    struct in_addr      pr_ip_address;    /* framed IP address */
95c0f8380cSyasuoka    struct in_addr      pr_ip_netmask;    /* framed IP netmask */
96c0f8380cSyasuoka    struct sockaddr_in6 pr_ip6_address;   /* framed IPv6 address */
97c0f8380cSyasuoka    int                 pr_ip6_prefixlen; /* framed IPv6 prefix
98c0f8380cSyasuoka                                             length */
99c0f8380cSyasuoka    union {
100c0f8380cSyasuoka        struct {
101c0f8380cSyasuoka            uint32_t snd_nxt;         /* send next */
102c0f8380cSyasuoka            uint32_t rcv_nxt;         /* receive next */
103c0f8380cSyasuoka            uint32_t snd_una;         /* unacked */
104c0f8380cSyasuoka            uint32_t rcv_acked;       /* recv acked */
105c0f8380cSyasuoka            int winsz;                /* window size */
106c0f8380cSyasuoka            int maxwinsz;             /* max window size */
107c0f8380cSyasuoka            int peer_maxwinsz;        /* peer's max window size */
108c0f8380cSyasuoka        } pptp;
109c0f8380cSyasuoka        struct {
110c0f8380cSyasuoka            /* select protocol options: 1 for enable */
111c0f8380cSyasuoka            uint32_t option_flags;
112c0f8380cSyasuoka    #define PIPEX_L2TP_USE_SEQUENCING  0x00000001
113c0f8380cSyasuoka                                      /* use sequence number
114c0f8380cSyasuoka					 on L2TP data messages */
115c0f8380cSyasuoka
116c0f8380cSyasuoka            uint16_t tunnel_id;       /* our tunnel-id */
117c0f8380cSyasuoka            uint16_t peer_tunnel_id;  /* peer's tunnel-id */
118c0f8380cSyasuoka            uint32_t ns_nxt;          /* send next */
119c0f8380cSyasuoka            uint32_t nr_nxt;          /* receive next */
120c0f8380cSyasuoka            uint32_t ns_una;          /* unacked */
121c0f8380cSyasuoka            uint32_t nr_acked;        /* recv acked */
122c0f8380cSyasuoka            uint32_t ipsecflowinfo;   /* IPsec flow id for NAT-T */
123c0f8380cSyasuoka        } l2tp;
124c0f8380cSyasuoka        struct {
125c0f8380cSyasuoka            char over_ifname[IF_NAMESIZE];
126c0f8380cSyasuoka                                      /* ethernet ifname */
127c0f8380cSyasuoka        } pppoe;
128c0f8380cSyasuoka    } pr_proto;
129c0f8380cSyasuoka    struct sockaddr_storage  pr_peer_address;
130c0f8380cSyasuoka                                      /* peer address of tunnel */
131c0f8380cSyasuoka    struct sockaddr_storage  pr_local_address;
132c0f8380cSyasuoka				      /* our address of tunnel */
133c0f8380cSyasuoka    struct pipex_mppe_req    pr_mppe_recv;
134c0f8380cSyasuoka				      /* mppe key for receive */
135c0f8380cSyasuoka    struct pipex_mppe_req    pr_mppe_send;
136c0f8380cSyasuoka				      /* mppe key for send */
137c0f8380cSyasuoka};
138c0f8380cSyasuoka.Ed
139c0f8380cSyasuoka.Pp
140c0f8380cSyasuokaThe
141c0f8380cSyasuoka.Vt pipex_mppe_req
142c0f8380cSyasuokastructure that was used by
143c0f8380cSyasuoka.Va pr_mppe_recv
144c0f8380cSyasuokaand
145c0f8380cSyasuoka.Va pr_mppe_send
14682be78f9Sjmchas the following definition:
147c0f8380cSyasuoka.Bd -literal
148c0f8380cSyasuokastruct pipex_mppe_req {
149c0f8380cSyasuoka    int16_t  stateless;            /* mppe key mode.
150c0f8380cSyasuoka                                      1 for stateless */
151c0f8380cSyasuoka    int16_t  keylenbits;           /* mppe key length(in bits)*/
152c0f8380cSyasuoka    u_char   master_key[PIPEX_MPPE_KEYLEN];
1539458645cSsobrado                                   /* mppe master key */
154c0f8380cSyasuoka};
155c0f8380cSyasuoka.Ed
156c0f8380cSyasuoka.It Dv PIPEXDSESSION Fa "struct pipex_session_close_req *"
157c0f8380cSyasuokaDelete the specified session from the kernel.
15882be78f9SjmcSpecify the session using a
159b538cba1Smpi.Vt pipex_session_close_req
16082be78f9Sjmcstructure, which has the following definition:
161c0f8380cSyasuoka.Bd -literal
162b538cba1Smpistruct pipex_session_close_req {
163c0f8380cSyasuoka    int                      psr_protocol;   /* tunnel protocol */
164c0f8380cSyasuoka    uint16_t                 psr_session_id; /* session-id */
165c0f8380cSyasuoka    struct pipex_statistics  psr_stat;       /* statistics */
166c0f8380cSyasuoka};
167c0f8380cSyasuoka.Ed
168c0f8380cSyasuoka.Pp
16982be78f9SjmcThe
170c0f8380cSyasuoka.Va psr_protocol
17182be78f9Sjmcand
172c0f8380cSyasuoka.Va psr_session_id
17382be78f9Sjmcfields used to specify the session are mandatory.
17482be78f9SjmcOn successful return, the
175c0f8380cSyasuoka.Va psr_stat
176c0f8380cSyasuokafield is filled by the kernel.
177c0f8380cSyasuokaSee
178c0f8380cSyasuoka.Dv PIPEXGSTAT
17982be78f9Sjmcsection for a description of the
180c0f8380cSyasuoka.Vt pipex_statistics
181c0f8380cSyasuokastructure.
182c0f8380cSyasuoka.It Dv PIPEXGSTAT    Fa "struct pipex_session_stat_req *"
18382be78f9SjmcGet statistics for the specified session.
18482be78f9SjmcSpecify the session using a
185c0f8380cSyasuoka.Vt pipex_session_stat_req
18682be78f9Sjmcstructure, which has the following definition:
187c0f8380cSyasuoka.Bd -literal
188c0f8380cSyasuokastruct pipex_session_stat_req {
189c0f8380cSyasuoka    int                      psr_protocol;   /* tunnel protocol */
190c0f8380cSyasuoka    uint16_t                 psr_session_id; /* session-id */
191c0f8380cSyasuoka    struct pipex_statistics  psr_stat;       /* statistics */
192c0f8380cSyasuoka};
193c0f8380cSyasuoka.Ed
194c0f8380cSyasuoka.Pp
19582be78f9SjmcThe
196c0f8380cSyasuoka.Va psr_protocol
19782be78f9Sjmcand
198c0f8380cSyasuoka.Va psr_session_id
1999458645cSsobradofields used to specify the session are mandatory.
20082be78f9SjmcOn successful return, the
201c0f8380cSyasuoka.Va psr_stat
202c0f8380cSyasuokafield is filled by the kernel.
203c0f8380cSyasuokaThe
204c0f8380cSyasuoka.Vt pipex_statistics
20582be78f9Sjmcstructure has the following definition:
206c0f8380cSyasuoka.Bd -literal
207c0f8380cSyasuokastruct pipex_statistics {
208c0f8380cSyasuoka    uint32_t ipackets;   /* packets received from tunnel */
209c0f8380cSyasuoka    uint32_t ierrors;    /* error packets received from tunnel */
210c0f8380cSyasuoka    uint64_t ibytes;     /* number of received bytes from tunnel */
211c0f8380cSyasuoka    uint32_t opackets;   /* packets sent to tunnel */
212c0f8380cSyasuoka    uint32_t oerrors;    /* error packets on sending to tunnel */
213c0f8380cSyasuoka    uint64_t obytes;     /* number of sent bytes to tunnel */
214c0f8380cSyasuoka
215c0f8380cSyasuoka    uint32_t idle_time;  /* idle time in seconds */
216c0f8380cSyasuoka};
217c0f8380cSyasuoka.Ed
218c0f8380cSyasuoka.It Dv PIPEXGCLOSED  Fa "struct pipex_session_list_req *"
21982be78f9SjmcGet a list of closed sessions.
220c0f8380cSyasuoka.Nm
22182be78f9Sjmcreserves closed sessions for 30 seconds
22282be78f9Sjmcfor userland programs to get statistical information.
22382be78f9SjmcOn successful return,
22482be78f9Sjmcthe
225c0f8380cSyasuoka.Vt pipex_session_list_req
226c0f8380cSyasuokastructure is filled by the kernel.
22782be78f9SjmcThe structure has the following definition.
228c0f8380cSyasuoka.Bd -literal
229c0f8380cSyasuokastruct pipex_session_list_req {
230c0f8380cSyasuoka    uint8_t  plr_flags;
231c0f8380cSyasuoka#define PIPEX_LISTREQ_MORE         0x01      /* has more session */
232c0f8380cSyasuoka    int      plr_ppp_id_count;               /* count of PPP id */
233c0f8380cSyasuoka    int      plr_ppp_id[PIPEX_MAX_LISTREQ];  /* PPP id */
234c0f8380cSyasuoka};
235c0f8380cSyasuoka.Ed
236c0f8380cSyasuoka.It Dv PIPEXSIFDESCR Fa "struct pipex_session_descr_req *"
237c0f8380cSyasuokaSet the
23841f57ac8Syasuoka.Xr pppx 4
239c0f8380cSyasuokainterface's description of the session.
240c0f8380cSyasuokaThis command doesn't work on
241b538cba1Smpi.Xr pppac 4
24282be78f9Sjmcdevices.
24382be78f9SjmcSpecify the session and its description using a
244c0f8380cSyasuoka.Vt pipex_session_descr_req
24582be78f9Sjmcstructure, which has the following definition:
246c0f8380cSyasuoka.Bd -literal
247c0f8380cSyasuokastruct pipex_session_descr_req {
248c0f8380cSyasuoka    int       pdr_protocol;           /* tunnel protocol */
249c0f8380cSyasuoka    uint16_t  pdr_session_id;         /* session-id */
250c0f8380cSyasuoka    char      pdr_descr[IFDESCRSIZE]; /* description */
251c0f8380cSyasuoka};
252c0f8380cSyasuoka.Ed
253c0f8380cSyasuoka.El
254c0f8380cSyasuoka.Sh SEE ALSO
25582be78f9Sjmc.Xr ioctl 2 ,
256b538cba1Smpi.Xr pppac 4 ,
257f91bf835Syasuoka.Xr pppx 4 ,
25882be78f9Sjmc.Xr npppd 8 ,
259c0f8380cSyasuoka.Xr sysctl 8
260c0f8380cSyasuoka.Sh AUTHORS
261c0f8380cSyasuokaThe
262c0f8380cSyasuoka.Nm
263edc19843Sschwarzewas written by
264edc19843Sschwarze.An Internet Initiative Japan Inc .
265c1a524bcSmvs.Sh BUGS
266c1a524bcSmvs.Xr pppx 4
267c1a524bcSmvsdoes not allow sessions with
268c1a524bcSmvs.Ic pr_timeout_sec
269c1a524bcSmvsset to any value other than 0.
270