1 // SoftEther UT-VPN SourceCode
\r
3 // Copyright (C) 2004-2010 SoftEther Corporation.
\r
4 // Copyright (C) 2004-2010 University of Tsukuba, Japan.
\r
5 // Copyright (C) 2003-2010 Daiyuu Nobori.
\r
6 // All Rights Reserved.
\r
8 // http://utvpn.tsukuba.ac.jp/
\r
10 // This program is free software; you can redistribute it and/or
\r
11 // modify it under the terms of the GNU General Public License
\r
12 // version 2 as published by the Free Software Foundation.
\r
14 // This program is distributed in the hope that it will be useful,
\r
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 // GNU General Public License for more details.
\r
19 // You should have received a copy of the GNU General Public License version 2
\r
20 // along with this program; if not, write to the Free Software
\r
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
23 // このファイルは GPL バージョン 2 ライセンスで公開されています。
\r
24 // 誰でもこのファイルの内容を複製、改変したり、改変したバージョンを再配布
\r
25 // することができます。ただし、原著作物を改変した場合は、原著作物の著作権表示
\r
26 // を除去することはできません。改変した著作物を配布する場合は、改変実施者の
\r
27 // 著作権表示を原著作物の著作権表示に付随して記載するようにしてください。
\r
29 // この SoftEther UT-VPN オープンソース・プロジェクトは、日本国の
\r
30 // ソフトイーサ株式会社 (SoftEther Corporation, http://www.softether.co.jp/ )
\r
31 // および筑波大学 (University of Tsukuba, http://www.tsukuba.ac.jp/ ) によって
\r
33 // 本プログラムの配布者は、本プログラムを、業としての利用以外のため、
\r
34 // および、試験または研究のために利用が行われることを想定して配布
\r
36 // SoftEther UT-VPN プロジェクトの Web サイトは http://utvpn.tsukuba.ac.jp/ に
\r
38 // 本ソフトウェアの不具合の修正、機能改良、セキュリティホールの修復などのコード
\r
39 // の改変を行った場合で、その成果物を SoftEther UT-VPN プロジェクトに提出して
\r
40 // いただける場合は、 http://utvpn.tsukuba.ac.jp/ までソースコードを送付して
\r
41 // ください。SoftEther UT-VPN プロジェクトの本体リリースまたはブランチリリース
\r
44 // GPL に基づいて原著作物が提供される本ソフトウェアの改良版を配布、販売する
\r
45 // 場合は、そのソースコードを GPL に基づいて誰にでも開示する義務が生じます。
\r
47 // 本ソフトウェアに関連する著作権、特許権、商標権はソフトイーサ株式会社
\r
48 // (SoftEther Corporation) およびその他の著作権保持者が保有しています。
\r
49 // ソフトイーサ株式会社等はこれらの権利を放棄していません。本ソフトウェアの
\r
50 // 二次著作物を配布、販売する場合は、これらの権利を侵害しないようにご注意
\r
53 // お願い: どのような通信ソフトウェアにも通常は必ず未発見の
\r
54 // セキュリティホールが潜んでいます。本ソースコードをご覧いただいた結果、
\r
55 // UT-VPN にセキュリティホールを発見された場合は、当該セキュリティホールの
\r
56 // 情報を不特定多数に開示される前に、必ず、ソフトイーサ株式会社
\r
57 // および脆弱性情報の届出を受け付ける公的機関まで通報いただき、
\r
58 // 公益保護にご協力いただきますようお願い申し上げます。
\r
60 // ソフトイーサ株式会社は、当該セキュリティホールについて迅速に対処を
\r
61 // 行い、UT-VPN および UT-VPN に関連するソフトウェアのユーザー・顧客
\r
64 // ソフトイーサへの届出先: http://www.softether.co.jp/jp/contact/
\r
65 // 日本国内の脆弱性情報届出受付公的機関:
\r
67 // http://www.ipa.go.jp/security/vuln/report/
\r
69 // 上記各事項について不明な点は、ソフトイーサ株式会社までご連絡ください。
\r
70 // 連絡先: http://www.softether.co.jp/jp/contact/
\r
72 // -----------------------------------------------
\r
75 // 新規リリース by SoftEther
\r
76 // -----------------------------------------------
\r
83 // -----------------------------------------------------------------
\r
85 // -----------------------------------------------------------------
\r
87 * Universal TUN/TAP device driver.
\r
88 * Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
\r
90 * This program is free software; you can redistribute it and/or modify
\r
91 * it under the terms of the GNU General Public License as published by
\r
92 * the Free Software Foundation; either version 2 of the License, or
\r
93 * (at your option) any later version.
\r
95 * This program is distributed in the hope that it will be useful,
\r
96 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
97 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
98 * GNU General Public License for more details.
\r
100 * $Id: if_tun.h,v 1.2 2001/10/31 15:27:57 arjanv Exp $
\r
106 /* Uncomment to enable debugging */
\r
107 /* #define TUN_DEBUG 1 */
\r
111 /* Read queue size */
\r
112 #define TUN_READQ_SIZE 10
\r
114 /* TUN device flags */
\r
115 #define TUN_TUN_DEV 0x0001
\r
116 #define TUN_TAP_DEV 0x0002
\r
117 #define TUN_TYPE_MASK 0x000f
\r
119 #define TUN_FASYNC 0x0010
\r
120 #define TUN_NOCHECKSUM 0x0020
\r
121 #define TUN_NO_PI 0x0040
\r
122 #define TUN_ONE_QUEUE 0x0080
\r
123 #define TUN_PERSIST 0x0100
\r
125 /* Ioctl defines */
\r
126 #define TUNSETNOCSUM _IOW('T', 200, int)
\r
127 #define TUNSETDEBUG _IOW('T', 201, int)
\r
128 #define TUNSETIFF _IOW('T', 202, int)
\r
129 #define TUNSETPERSIST _IOW('T', 203, int)
\r
130 #define TUNSETOWNER _IOW('T', 204, int)
\r
132 /* TUNSETIFF ifr flags */
\r
133 #define IFF_TUN 0x0001
\r
134 #define IFF_TAP 0x0002
\r
135 #define IFF_NO_PI 0x1000
\r
136 #define IFF_ONE_QUEUE 0x2000
\r
139 unsigned short flags;
\r
140 unsigned short proto;
\r
142 #define TUN_PKT_STRIP 0x0001
\r
144 #endif /* __IF_TUN_H */
\r
145 #else // UNIX_LINUX
\r
147 #ifdef UNIX_SOLARIS
\r
149 // -----------------------------------------------------------------
\r
150 // Solaris 用 tap ヘッダ
\r
151 // -----------------------------------------------------------------
\r
153 * Universal TUN/TAP device driver.
\r
155 * Multithreaded STREAMS tun pseudo device driver.
\r
157 * Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
\r
159 * This program is free software; you can redistribute it and/or modify
\r
160 * it under the terms of the GNU General Public License as published by
\r
161 * the Free Software Foundation; either version 2 of the License, or
\r
162 * (at your option) any later version.
\r
164 * This program is distributed in the hope that it will be useful,
\r
165 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
166 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
167 * GNU General Public License for more details.
\r
169 * $Id: if_tun.h,v 1.4 2000/05/01 12:23:27 maxk Exp $
\r
172 #ifndef _SYS_IF_TUN_H
\r
173 #define _SYS_IF_TUN_H
\r
176 /* Uncomment to enable debuging */
\r
177 /* #define TUN_DEBUG 1 */
\r
180 #define DBG cmn_err
\r
182 #define DBG( a... )
\r
185 /* PPA structure, one per TUN iface */
\r
187 unsigned int id; /* Iface number */
\r
188 queue_t *rq; /* Control Stream RQ */
\r
189 struct tunstr * p_str; /* Protocol Streams */
\r
191 #define TUNMAXPPA 20
\r
193 /* Stream structure, one per Stream */
\r
195 struct tunstr *s_next; /* next in streams list */
\r
196 struct tunstr *p_next; /* next in ppa list */
\r
197 queue_t *rq; /* pointer to rq */
\r
199 struct tunppa *ppa; /* assigned PPA */
\r
200 u_long flags; /* flags */
\r
201 u_long state; /* DL state */
\r
202 u_long sap; /* bound sap */
\r
203 u_long minor; /* minor device number */
\r
207 #define TUN_CONTROL 0x0001
\r
209 #define TUN_RAW 0x0100
\r
210 #define TUN_FAST 0x0200
\r
212 #define TUN_ALL_PHY 0x0010
\r
213 #define TUN_ALL_SAP 0x0020
\r
214 #define TUN_ALL_MUL 0x0040
\r
216 #define SNIFFER(a) ( (a & TUN_ALL_SAP) || (a & TUN_ALL_PHY) )
\r
221 #define TUN_ADDR_LEN (sizeof(struct tundladdr))
\r
223 #define TUN_QUEUE 0
\r
226 #endif /* _KERNEL */
\r
228 /* IOCTL defines */
\r
229 #define TUNNEWPPA (('T'<<16) | 0x0001)
\r
230 #define TUNSETPPA (('T'<<16) | 0x0002)
\r
232 #endif /* _SYS_IF_TUN_H */
\r
234 #else // UNIX_SOLARIS
\r
238 // -----------------------------------------------------------------
\r
239 // FreeBSD 用 tap ヘッダ
\r
240 // -----------------------------------------------------------------
\r
241 /* $NetBSD: if_tun.h,v 1.5 1994/06/29 06:36:27 cgd Exp $ */
\r
244 * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
\r
245 * Nottingham University 1987.
\r
247 * This source may be freely distributed, however I would be interested
\r
248 * in any changes that are made.
\r
250 * This driver takes packets off the IP i/f and hands them up to a
\r
251 * user process to have its wicked way with. This driver has it's
\r
252 * roots in a similar driver written by Phil Cockcroft (formerly) at
\r
253 * UCL. This driver is based much more on read/write/select mode of
\r
254 * operation though.
\r
256 * $FreeBSD: src/sys/net/if_tun.h,v 1.17 2000/01/23 01:47:12 brian Exp $
\r
259 #ifndef _NET_IF_TUN_H_
\r
260 #define _NET_IF_TUN_H_
\r
262 /* Refer to if_tunvar.h for the softc stuff */
\r
264 /* Maximum transmit packet size (default) */
\r
265 #define TUNMTU 1500
\r
267 /* Maximum receive packet size (hard limit) */
\r
268 #define TUNMRU 16384
\r
271 int baudrate; /* linespeed */
\r
272 short mtu; /* maximum transmission unit */
\r
273 u_char type; /* ethernet, tokenring, etc. */
\r
274 u_char dummy; /* place holder */
\r
277 /* ioctl's for get/set debug */
\r
278 #define TUNSDEBUG _IOW('t', 90, int)
\r
279 #define TUNGDEBUG _IOR('t', 89, int)
\r
280 #define TUNSIFINFO _IOW('t', 91, struct tuninfo)
\r
281 #define TUNGIFINFO _IOR('t', 92, struct tuninfo)
\r
282 #define TUNSLMODE _IOW('t', 93, int)
\r
283 #define TUNSIFMODE _IOW('t', 94, int)
\r
284 #define TUNSIFPID _IO('t', 95)
\r
285 #define TUNSIFHEAD _IOW('t', 96, int)
\r
286 #define TUNGIFHEAD _IOR('t', 97, int)
\r
288 #endif /* !_NET_IF_TUN_H_ */
\r
294 // -----------------------------------------------------------------
\r
296 // -----------------------------------------------------------------
\r
298 #else // UNIX_MACOS
\r
300 #endif // UNIX_MACOS
\r
304 #endif // UNIX_SOLARIS
\r
306 #endif // UNIX_LINUX
\r