mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-25 02:49:52 +03:00
Change line endings to LF
This commit is contained in:
parent
f52730c724
commit
9997785812
280
AUTHORS.TXT
280
AUTHORS.TXT
@ -1,140 +1,140 @@
|
||||
SoftEther VPN is developed by SoftEther VPN Project at University of Tsukuba.
|
||||
https://www.softether.org/
|
||||
|
||||
AUTHORS OF SOFTETHER VPN
|
||||
------------------------
|
||||
|
||||
CORE DEVELOPERS:
|
||||
|
||||
- Daiyuu Nobori, Ph.D.
|
||||
Computer Science, Graduate School of University of Tsukuba
|
||||
SoftEther Corporation
|
||||
E-mail: daiyuu-nobori [at] softether.org
|
||||
|
||||
- Tetsuo Sugiyama, Ph.D.
|
||||
SoftEther Corporation
|
||||
|
||||
- Junpei Kuwana, Ph.D.
|
||||
Risk Engineering, Graduate School of University of Tsukuba
|
||||
SoftEther Corporation
|
||||
|
||||
- Takao Ito, Ph.D.
|
||||
Computer Science, Graduate School of University of Tsukuba
|
||||
SoftEther Corporation
|
||||
|
||||
- Mei Sharie Ann Yamaguchi, Ph.D.
|
||||
Life and Environmental Sciences, Graduate School of University of Tsukuba
|
||||
|
||||
- Christopher Smith
|
||||
College of Information Science, University of Tsukuba
|
||||
|
||||
|
||||
WEB-SITE DESIGNER:
|
||||
|
||||
- Genya Hatakeyama
|
||||
College of Information Science, University of Tsukuba
|
||||
|
||||
|
||||
DEVELOPMENT BOARD MEMBERS:
|
||||
|
||||
- Moataz Elmasry
|
||||
https://github.com/moatazelmasry2
|
||||
|
||||
- Zulyandri Zardi
|
||||
https://github.com/zulzardi
|
||||
|
||||
- Alex Maslakov
|
||||
https://github.com/GildedHonour
|
||||
|
||||
- Davide Beatrici
|
||||
https://github.com/davidebeatrici
|
||||
|
||||
- Ilya Shipitsin
|
||||
https://github.com/chipitsine
|
||||
|
||||
|
||||
SPECIAL CONTRIBUTORS:
|
||||
|
||||
- Guido Vranken
|
||||
https://github.com/guidovranken
|
||||
|
||||
|
||||
CONTRIBUTORS:
|
||||
|
||||
- ajeecai <ajee.cai@gmail.com>
|
||||
- Alexandre De Oliveira <yodresh@gmail.com>
|
||||
- Alexey Kryuchkov <alexey.kruchkov@gmail.com>
|
||||
- Allen Cui <allen_st_clair@msn.com>
|
||||
- Andy Walsh <andy.walsh44+github@gmail.com>
|
||||
- Bernhard Rosenkränzer <bero@lindev.ch>
|
||||
- Bill Welliver <bill@welliver.org>
|
||||
- Charles Surett <surettcharles@gmail.com>
|
||||
- cm0x4d <cm0x4d@codemonkey.ch>
|
||||
- DDGo <Wiki13@hotmail.nl>
|
||||
- Denis Lesnov <den.lesnov@gmail.com>
|
||||
- Den Lesnov <https://github.com/Leden>
|
||||
- Dexter Ang <thepoch@gmail.com>
|
||||
- Dmitry Glushenok <dglushenok@yandex.ru>
|
||||
- Dmitry Orlov <dorlov@undev.ru>
|
||||
- ELIN <elin@mikomoe.jp>
|
||||
- Guanzhong Chen <quantum2048@gmail.com>
|
||||
- Hideki Saito <hideki@hidekisaito.com>
|
||||
- holoreimu <michael3707@gmail.com>
|
||||
- Holoreimu <michael3707@gmail.com>
|
||||
- hoppler <https://github.com/hoppler>
|
||||
- Igor Pikovets <igor@ahrefs.com>
|
||||
- James Brink <brink.james@gmail.com>
|
||||
- Jeff Tang <https://github.com/mrjefftang>
|
||||
- Jioh L. Jung <ziozzang@gmail.com>
|
||||
- Johan de Vries <devries@wivion.nl>
|
||||
- Josh Soref <https://github.com/jsoref>
|
||||
- Joshua Perry <josh@6bit.com>
|
||||
- Koichiro Iwao <meta@FreeBSD.org>
|
||||
- Luiz Eduardo Gava <luiz.gava@procempa.com.br>
|
||||
- macvk <tutumbul@gmail.com>
|
||||
- Maks Naumov <maksqwe1@ukr.net>
|
||||
- Matt Lewandowsky <lewellyn@foxmail.com>
|
||||
- Max Miroshnikov <mogikanin.tir@gmail.com>
|
||||
- Melvyn <yaurthek@gmail.com>
|
||||
- Michael B <https://github.com/DownWithUp>
|
||||
- Michael Clausen <cm0x4d@codemonkey.ch>
|
||||
- Michael Clausen <michael.clausen@hevs.ch>
|
||||
- Mike Selivanov <mikes777@gmail.com>
|
||||
- Mikhail Pridushchenko <mikhail.pridushchenko@dsr-company.com>
|
||||
- mogikanin <mogikanin.tir@gmail.com>
|
||||
- Mykhaylo Yehorov <yehorov@gmail.com>
|
||||
- nattoheaven <nattoheaven@gmail.com>
|
||||
- Nguyễn Hồng Quân <ng.hong.quan@gmail.com>
|
||||
- Noah O'Donoghue <https://github.com/NoahO>
|
||||
- NOKUBI Takatsugu <knok@daionet.gr.jp>
|
||||
- NoNameA 774 <nonamea774@gmail.com>
|
||||
- Norbert Preining <norbert@preining.info>
|
||||
- NV <nvsofts@gmail.com>
|
||||
- Olimjon <olim98@bk.ru>
|
||||
- parly <https://github.com/parly>
|
||||
- PeTeeR <tom2pet@gmail.com>
|
||||
- Quantum <quantum2048@gmail.com>
|
||||
- Quintin <quintin@last.za.net>
|
||||
- Raymond Tau <raymondtau@gmail.com>
|
||||
- rel22 <rel22@inbox.ru>
|
||||
- Renaud Allard <renaud@allard.it>
|
||||
- root <root@vpn.sjbcom.com>
|
||||
- Sacha J Bernstein <sacha@sjbcom.com>
|
||||
- Sahal Ansari <github@sahal.info>
|
||||
- Shadus Black <blackholefoxdev@gmail.com>
|
||||
- thepyper <thepyper@gmail.com>
|
||||
- Tim Schneider <schneider0tim@gmail.com>
|
||||
- tonychung00 <tonychung00@gmail.com>
|
||||
- Victor Salgado <vms@pinhaotec.com.br>
|
||||
- William Welliver <william@welliver.org>
|
||||
- YF <yfdyh000@gmail.com>
|
||||
|
||||
|
||||
JOIN THE SOFTETHER VPN DEVELOPMENT
|
||||
----------------------------------
|
||||
|
||||
Want to become a contributor? Please send us a patch.
|
||||
|
||||
See also: SoftEther VPN Patch Acceptance Policy
|
||||
https://www.softether.org/5-download/src/9.patch
|
||||
|
||||
SoftEther VPN is developed by SoftEther VPN Project at University of Tsukuba.
|
||||
https://www.softether.org/
|
||||
|
||||
AUTHORS OF SOFTETHER VPN
|
||||
------------------------
|
||||
|
||||
CORE DEVELOPERS:
|
||||
|
||||
- Daiyuu Nobori, Ph.D.
|
||||
Computer Science, Graduate School of University of Tsukuba
|
||||
SoftEther Corporation
|
||||
E-mail: daiyuu-nobori [at] softether.org
|
||||
|
||||
- Tetsuo Sugiyama, Ph.D.
|
||||
SoftEther Corporation
|
||||
|
||||
- Junpei Kuwana, Ph.D.
|
||||
Risk Engineering, Graduate School of University of Tsukuba
|
||||
SoftEther Corporation
|
||||
|
||||
- Takao Ito, Ph.D.
|
||||
Computer Science, Graduate School of University of Tsukuba
|
||||
SoftEther Corporation
|
||||
|
||||
- Mei Sharie Ann Yamaguchi, Ph.D.
|
||||
Life and Environmental Sciences, Graduate School of University of Tsukuba
|
||||
|
||||
- Christopher Smith
|
||||
College of Information Science, University of Tsukuba
|
||||
|
||||
|
||||
WEB-SITE DESIGNER:
|
||||
|
||||
- Genya Hatakeyama
|
||||
College of Information Science, University of Tsukuba
|
||||
|
||||
|
||||
DEVELOPMENT BOARD MEMBERS:
|
||||
|
||||
- Moataz Elmasry
|
||||
https://github.com/moatazelmasry2
|
||||
|
||||
- Zulyandri Zardi
|
||||
https://github.com/zulzardi
|
||||
|
||||
- Alex Maslakov
|
||||
https://github.com/GildedHonour
|
||||
|
||||
- Davide Beatrici
|
||||
https://github.com/davidebeatrici
|
||||
|
||||
- Ilya Shipitsin
|
||||
https://github.com/chipitsine
|
||||
|
||||
|
||||
SPECIAL CONTRIBUTORS:
|
||||
|
||||
- Guido Vranken
|
||||
https://github.com/guidovranken
|
||||
|
||||
|
||||
CONTRIBUTORS:
|
||||
|
||||
- ajeecai <ajee.cai@gmail.com>
|
||||
- Alexandre De Oliveira <yodresh@gmail.com>
|
||||
- Alexey Kryuchkov <alexey.kruchkov@gmail.com>
|
||||
- Allen Cui <allen_st_clair@msn.com>
|
||||
- Andy Walsh <andy.walsh44+github@gmail.com>
|
||||
- Bernhard Rosenkränzer <bero@lindev.ch>
|
||||
- Bill Welliver <bill@welliver.org>
|
||||
- Charles Surett <surettcharles@gmail.com>
|
||||
- cm0x4d <cm0x4d@codemonkey.ch>
|
||||
- DDGo <Wiki13@hotmail.nl>
|
||||
- Denis Lesnov <den.lesnov@gmail.com>
|
||||
- Den Lesnov <https://github.com/Leden>
|
||||
- Dexter Ang <thepoch@gmail.com>
|
||||
- Dmitry Glushenok <dglushenok@yandex.ru>
|
||||
- Dmitry Orlov <dorlov@undev.ru>
|
||||
- ELIN <elin@mikomoe.jp>
|
||||
- Guanzhong Chen <quantum2048@gmail.com>
|
||||
- Hideki Saito <hideki@hidekisaito.com>
|
||||
- holoreimu <michael3707@gmail.com>
|
||||
- Holoreimu <michael3707@gmail.com>
|
||||
- hoppler <https://github.com/hoppler>
|
||||
- Igor Pikovets <igor@ahrefs.com>
|
||||
- James Brink <brink.james@gmail.com>
|
||||
- Jeff Tang <https://github.com/mrjefftang>
|
||||
- Jioh L. Jung <ziozzang@gmail.com>
|
||||
- Johan de Vries <devries@wivion.nl>
|
||||
- Josh Soref <https://github.com/jsoref>
|
||||
- Joshua Perry <josh@6bit.com>
|
||||
- Koichiro Iwao <meta@FreeBSD.org>
|
||||
- Luiz Eduardo Gava <luiz.gava@procempa.com.br>
|
||||
- macvk <tutumbul@gmail.com>
|
||||
- Maks Naumov <maksqwe1@ukr.net>
|
||||
- Matt Lewandowsky <lewellyn@foxmail.com>
|
||||
- Max Miroshnikov <mogikanin.tir@gmail.com>
|
||||
- Melvyn <yaurthek@gmail.com>
|
||||
- Michael B <https://github.com/DownWithUp>
|
||||
- Michael Clausen <cm0x4d@codemonkey.ch>
|
||||
- Michael Clausen <michael.clausen@hevs.ch>
|
||||
- Mike Selivanov <mikes777@gmail.com>
|
||||
- Mikhail Pridushchenko <mikhail.pridushchenko@dsr-company.com>
|
||||
- mogikanin <mogikanin.tir@gmail.com>
|
||||
- Mykhaylo Yehorov <yehorov@gmail.com>
|
||||
- nattoheaven <nattoheaven@gmail.com>
|
||||
- Nguyễn Hồng Quân <ng.hong.quan@gmail.com>
|
||||
- Noah O'Donoghue <https://github.com/NoahO>
|
||||
- NOKUBI Takatsugu <knok@daionet.gr.jp>
|
||||
- NoNameA 774 <nonamea774@gmail.com>
|
||||
- Norbert Preining <norbert@preining.info>
|
||||
- NV <nvsofts@gmail.com>
|
||||
- Olimjon <olim98@bk.ru>
|
||||
- parly <https://github.com/parly>
|
||||
- PeTeeR <tom2pet@gmail.com>
|
||||
- Quantum <quantum2048@gmail.com>
|
||||
- Quintin <quintin@last.za.net>
|
||||
- Raymond Tau <raymondtau@gmail.com>
|
||||
- rel22 <rel22@inbox.ru>
|
||||
- Renaud Allard <renaud@allard.it>
|
||||
- root <root@vpn.sjbcom.com>
|
||||
- Sacha J Bernstein <sacha@sjbcom.com>
|
||||
- Sahal Ansari <github@sahal.info>
|
||||
- Shadus Black <blackholefoxdev@gmail.com>
|
||||
- thepyper <thepyper@gmail.com>
|
||||
- Tim Schneider <schneider0tim@gmail.com>
|
||||
- tonychung00 <tonychung00@gmail.com>
|
||||
- Victor Salgado <vms@pinhaotec.com.br>
|
||||
- William Welliver <william@welliver.org>
|
||||
- YF <yfdyh000@gmail.com>
|
||||
|
||||
|
||||
JOIN THE SOFTETHER VPN DEVELOPMENT
|
||||
----------------------------------
|
||||
|
||||
Want to become a contributor? Please send us a patch.
|
||||
|
||||
See also: SoftEther VPN Patch Acceptance Policy
|
||||
https://www.softether.org/5-download/src/9.patch
|
||||
|
||||
|
484
LICENSE
484
LICENSE
@ -1,242 +1,242 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
Copyright (c) all contributors on SoftEther VPN project in GitHub.
|
||||
Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
|
||||
DISCLAIMER
|
||||
==========
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN, UNDER
|
||||
JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY, MERGE, PUBLISH,
|
||||
DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS SOFTWARE, THAT ANY
|
||||
JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS SOFTWARE OR ITS CONTENTS,
|
||||
AGAINST US (SOFTETHER PROJECT, SOFTETHER CORPORATION, DAIYUU NOBORI OR OTHER
|
||||
SUPPLIERS), OR ANY JURIDICAL DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND
|
||||
OF USING, COPYING, MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING,
|
||||
AND/OR SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
|
||||
CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO EXCLUSIVE
|
||||
JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO, JAPAN. YOU MUST WAIVE
|
||||
ALL DEFENSES OF LACK OF PERSONAL JURISDICTION AND FORUM NON CONVENIENS.
|
||||
PROCESS MAY BE SERVED ON EITHER PARTY IN THE MANNER AUTHORIZED BY APPLICABLE
|
||||
LAW OR COURT RULE.
|
||||
|
||||
USE ONLY IN JAPAN. DO NOT USE THIS SOFTWARE IN ANOTHER COUNTRY UNLESS YOU HAVE
|
||||
A CONFIRMATION THAT THIS SOFTWARE DOES NOT VIOLATE ANY CRIMINAL LAWS OR CIVIL
|
||||
RIGHTS IN THAT PARTICULAR COUNTRY. USING THIS SOFTWARE IN OTHER COUNTRIES IS
|
||||
COMPLETELY AT YOUR OWN RISK. THE SOFTETHER VPN PROJECT HAS DEVELOPED AND
|
||||
DISTRIBUTED THIS SOFTWARE TO COMPLY ONLY WITH THE JAPANESE LAWS AND EXISTING
|
||||
CIVIL RIGHTS INCLUDING PATENTS WHICH ARE SUBJECTS APPLY IN JAPAN. OTHER
|
||||
COUNTRIES' LAWS OR CIVIL RIGHTS ARE NONE OF OUR CONCERNS NOR RESPONSIBILITIES.
|
||||
WE HAVE NEVER INVESTIGATED ANY CRIMINAL REGULATIONS, CIVIL LAWS OR
|
||||
INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENTS IN ANY OF OTHER 200+ COUNTRIES
|
||||
AND TERRITORIES. BY NATURE, THERE ARE 200+ REGIONS IN THE WORLD, WITH
|
||||
DIFFERENT LAWS. IT IS IMPOSSIBLE TO VERIFY EVERY COUNTRIES' LAWS, REGULATIONS
|
||||
AND CIVIL RIGHTS TO MAKE THE SOFTWARE COMPLY WITH ALL COUNTRIES' LAWS BY THE
|
||||
PROJECT. EVEN IF YOU WILL BE SUED BY A PRIVATE ENTITY OR BE DAMAGED BY A
|
||||
PUBLIC SERVANT IN YOUR COUNTRY, THE DEVELOPERS OF THIS SOFTWARE WILL NEVER BE
|
||||
LIABLE TO RECOVER OR COMPENSATE SUCH DAMAGES, CRIMINAL OR CIVIL
|
||||
RESPONSIBILITIES. NOTE THAT THIS LINE IS NOT LICENSE RESTRICTION BUT JUST A
|
||||
STATEMENT FOR WARNING AND DISCLAIMER.
|
||||
|
||||
READ AND UNDERSTAND THE 'src/WARNING.TXT' FILE BEFORE USING THIS SOFTWARE.
|
||||
SOME SOFTWARE PROGRAMS FROM THIRD PARTIES ARE INCLUDED ON THIS SOFTWARE WITH
|
||||
LICENSE CONDITIONS WHICH ARE DESCRIBED ON THE 'src/THIRD_PARTY.TXT' FILE.
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
Copyright (c) all contributors on SoftEther VPN project in GitHub.
|
||||
Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
|
||||
DISCLAIMER
|
||||
==========
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN, UNDER
|
||||
JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY, MERGE, PUBLISH,
|
||||
DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS SOFTWARE, THAT ANY
|
||||
JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS SOFTWARE OR ITS CONTENTS,
|
||||
AGAINST US (SOFTETHER PROJECT, SOFTETHER CORPORATION, DAIYUU NOBORI OR OTHER
|
||||
SUPPLIERS), OR ANY JURIDICAL DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND
|
||||
OF USING, COPYING, MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING,
|
||||
AND/OR SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
|
||||
CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO EXCLUSIVE
|
||||
JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO, JAPAN. YOU MUST WAIVE
|
||||
ALL DEFENSES OF LACK OF PERSONAL JURISDICTION AND FORUM NON CONVENIENS.
|
||||
PROCESS MAY BE SERVED ON EITHER PARTY IN THE MANNER AUTHORIZED BY APPLICABLE
|
||||
LAW OR COURT RULE.
|
||||
|
||||
USE ONLY IN JAPAN. DO NOT USE THIS SOFTWARE IN ANOTHER COUNTRY UNLESS YOU HAVE
|
||||
A CONFIRMATION THAT THIS SOFTWARE DOES NOT VIOLATE ANY CRIMINAL LAWS OR CIVIL
|
||||
RIGHTS IN THAT PARTICULAR COUNTRY. USING THIS SOFTWARE IN OTHER COUNTRIES IS
|
||||
COMPLETELY AT YOUR OWN RISK. THE SOFTETHER VPN PROJECT HAS DEVELOPED AND
|
||||
DISTRIBUTED THIS SOFTWARE TO COMPLY ONLY WITH THE JAPANESE LAWS AND EXISTING
|
||||
CIVIL RIGHTS INCLUDING PATENTS WHICH ARE SUBJECTS APPLY IN JAPAN. OTHER
|
||||
COUNTRIES' LAWS OR CIVIL RIGHTS ARE NONE OF OUR CONCERNS NOR RESPONSIBILITIES.
|
||||
WE HAVE NEVER INVESTIGATED ANY CRIMINAL REGULATIONS, CIVIL LAWS OR
|
||||
INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENTS IN ANY OF OTHER 200+ COUNTRIES
|
||||
AND TERRITORIES. BY NATURE, THERE ARE 200+ REGIONS IN THE WORLD, WITH
|
||||
DIFFERENT LAWS. IT IS IMPOSSIBLE TO VERIFY EVERY COUNTRIES' LAWS, REGULATIONS
|
||||
AND CIVIL RIGHTS TO MAKE THE SOFTWARE COMPLY WITH ALL COUNTRIES' LAWS BY THE
|
||||
PROJECT. EVEN IF YOU WILL BE SUED BY A PRIVATE ENTITY OR BE DAMAGED BY A
|
||||
PUBLIC SERVANT IN YOUR COUNTRY, THE DEVELOPERS OF THIS SOFTWARE WILL NEVER BE
|
||||
LIABLE TO RECOVER OR COMPENSATE SUCH DAMAGES, CRIMINAL OR CIVIL
|
||||
RESPONSIBILITIES. NOTE THAT THIS LINE IS NOT LICENSE RESTRICTION BUT JUST A
|
||||
STATEMENT FOR WARNING AND DISCLAIMER.
|
||||
|
||||
READ AND UNDERSTAND THE 'src/WARNING.TXT' FILE BEFORE USING THIS SOFTWARE.
|
||||
SOME SOFTWARE PROGRAMS FROM THIRD PARTIES ARE INCLUDED ON THIS SOFTWARE WITH
|
||||
LICENSE CONDITIONS WHICH ARE DESCRIBED ON THE 'src/THIRD_PARTY.TXT' FILE.
|
||||
|
||||
|
546
README.md
546
README.md
@ -1,273 +1,273 @@
|
||||
# SoftEther VPN
|
||||
|
||||
||Badges|
|
||||
|---|---|
|
||||
|AppVeyor|[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/softethervpn/softethervpn?branch=master&svg=true)](https://ci.appveyor.com/project/softethervpn/softethervpn) |
|
||||
|Travis CI|[![Travis CI build status](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN.svg?branch=master)](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN) |
|
||||
|GitLab CI|[![GitLab CI build status](https://gitlab.com/SoftEther/SoftEtherVPN/badges/master/pipeline.svg)](https://gitlab.com/SoftEther/SoftEtherVPN/pipelines)|
|
||||
|Coverity Scan|[![Coverity Scan build status](https://scan.coverity.com/projects/16304/badge.svg)](https://scan.coverity.com/projects/softethervpn-softethervpn)|
|
||||
|Azure Pipelines|[![Azure Pipelines build status for Nightly](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_apis/build/status/6?api-version=6.0-preview.1)](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_build?definitionId=6)|
|
||||
|Cirrus CI|[![Cirrus CI build status](https://api.cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN.svg)](https://cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN)|
|
||||
|
||||
- [SoftEther VPN](#softether-vpn)
|
||||
- [BOARD MEMBERS OF THIS REPOSITORY](#board-members-of-this-repository)
|
||||
- [SOFTETHER VPN ADVANTAGES](#softether-vpn-advantages)
|
||||
- [Installation](#installation)
|
||||
* [For Ubuntu](#for-ubuntu)
|
||||
* [For FreeBSD](#for-freebsd)
|
||||
* [From binary installers:](#from-binary-installers)
|
||||
* [Build from Source code](#build-from-source-code)
|
||||
- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite)
|
||||
* [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console)
|
||||
* [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite)
|
||||
- [TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION](#to-circumvent-your-governments-firewall-restriction)
|
||||
- [SOURCE CODE CONTRIBUTION](#source-code-contribution)
|
||||
- [DEAR SECURITY EXPERTS](#dear-security-experts)
|
||||
|
||||
SoftEther VPN (Developer Edition Master Repository)
|
||||
- An Open-Source Cross-platform Multi-protocol VPN Program
|
||||
https://www.softether.org/
|
||||
|
||||
|
||||
This repository has experimental codes. Pull requests are welcome.
|
||||
|
||||
Stable Edition is available on
|
||||
https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
|
||||
which the non-developer user can stable use.
|
||||
|
||||
Source code packages (.zip and .tar.gz) and binary files of Stable Edition are also available:
|
||||
https://www.softether-download.com/
|
||||
|
||||
Copyright (c) all contributors on SoftEther VPN project in GitHub.
|
||||
Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.
|
||||
|
||||
---
|
||||
|
||||
The development of SoftEther VPN was supported by the MITOH Project,
|
||||
a research and development project by Japanese Government,
|
||||
subsidized by Ministry of Economy, Trade and Industry of Japan,
|
||||
administrated by Information Promotion Agency.
|
||||
https://www.ipa.go.jp/english/humandev/
|
||||
|
||||
---
|
||||
|
||||
![https://icons8.com](resources/icons8.png "Icons8")
|
||||
|
||||
[Icons8](https://icons8.com) kindly supported the project by gifting a license which allows to edit and redistribute their icons.
|
||||
|
||||
Please note that you are not allowed to redistribute those icons outside of this repository.
|
||||
|
||||
The developers of SoftEther VPN love Icons8's work and kindly ask the users to support them as much as possible.
|
||||
|
||||
---
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
|
||||
world's most powerful and easy-to-use multi-protocol VPN software.
|
||||
|
||||
SoftEther VPN runs on Windows, Linux, Mac, FreeBSD and Solaris.
|
||||
|
||||
SoftEther VPN supports most of widely-used VPN protocols
|
||||
including SSL-VPN, OpenVPN, IPsec, L2TP, MS-SSTP, L2TPv3 and EtherIP
|
||||
by the single SoftEther VPN Server program.
|
||||
|
||||
More details on https://www.softether.org/.
|
||||
|
||||
|
||||
# BOARD MEMBERS OF THIS REPOSITORY
|
||||
|
||||
|
||||
Daiyuu Nobori (Since Jan 2, 2014)
|
||||
https://github.com/dnobori
|
||||
|
||||
Moataz Elmasry (Since Nov 6, 2017)
|
||||
https://github.com/moatazelmasry2
|
||||
|
||||
Zulyandri Zardi (Since Nov 6, 2017)
|
||||
https://github.com/zulzardi
|
||||
|
||||
Alex Maslakov (Since Nov 6, 2017)
|
||||
https://github.com/GildedHonour
|
||||
|
||||
Davide Beatrici (Since Jul 21, 2018)
|
||||
https://github.com/davidebeatrici
|
||||
|
||||
Ilya Shipitsin (Since Jul 21, 2018)
|
||||
https://github.com/chipitsine
|
||||
|
||||
|
||||
# SOFTETHER VPN ADVANTAGES
|
||||
|
||||
|
||||
- Supporting all popular VPN protocols by the single VPN server:
|
||||
SSL-VPN (HTTPS)
|
||||
OpenVPN
|
||||
IPsec
|
||||
L2TP
|
||||
MS-SSTP
|
||||
L2TPv3
|
||||
EtherIP
|
||||
- Free and open-source software.
|
||||
- Easy to establish both remote-access and site-to-site VPN.
|
||||
- SSL-VPN Tunneling on HTTPS to pass through NATs and firewalls.
|
||||
- Revolutionary VPN over ICMP and VPN over DNS features.
|
||||
- Resistance to highly-restricted firewall.
|
||||
- Ethernet-bridging (L2) and IP-routing (L3) over VPN.
|
||||
- Embedded dynamic-DNS and NAT-traversal so that no static nor
|
||||
fixed IP address is required.
|
||||
- AES 256-bit and RSA 4096-bit encryptions.
|
||||
- Sufficient security features such as logging and firewall inner
|
||||
VPN tunnel.
|
||||
- User authentication with RADIUS and NT domain controllers.
|
||||
- User authentication with X.509 client certificate.
|
||||
- Packet logging.
|
||||
- 1Gbps-class high-speed throughput performance with low memory and
|
||||
CPU usage.
|
||||
- Windows, Linux, Mac, Android, iPhone, iPad and Windows Phone are
|
||||
supported.
|
||||
- The OpenVPN clone function supports legacy OpenVPN clients.
|
||||
- IPv4 / IPv6 dual-stack.
|
||||
- The VPN server runs on Windows, Linux, FreeBSD, Solaris and Mac OS X.
|
||||
- Configure All settings on GUI.
|
||||
- Multi-languages (English, Japanese and Simplified-Chinese).
|
||||
- No memory leaks. High quality stable codes, intended for long-term runs.
|
||||
We always verify that there are no memory or resource leaks before
|
||||
releasing the build.
|
||||
- More details at https://www.softether.org/.
|
||||
|
||||
|
||||
# Installation
|
||||
|
||||
## For Ubuntu
|
||||
|
||||
Launchpad PPA maintained by [Dmitry Verkhoturov](https://github.com/paskal):
|
||||
|
||||
[Daily builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn) (latest released tag)
|
||||
|
||||
[Nightly builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn-nightly)
|
||||
|
||||
## For FreeBSD
|
||||
|
||||
SoftEther VPN in FreeBSD Ports Collection is maintained by
|
||||
[Koichiro Iwao](https://people.FreeBSD.org/~meta/) ([@metalefty](https://github.com/metalefty)).
|
||||
|
||||
Binary package can be installed by pkg:
|
||||
```
|
||||
pkg install softether5
|
||||
```
|
||||
|
||||
Alternatively, it can be built & installed by ports:
|
||||
```
|
||||
make install -C /usr/ports/security/softether5
|
||||
```
|
||||
|
||||
To run SoftEther VPN Server:
|
||||
```
|
||||
service softether_server start
|
||||
```
|
||||
|
||||
To configure SoftEther VPN Server startup on boot:
|
||||
```
|
||||
sysrc softether_server_enable=yes
|
||||
```
|
||||
|
||||
Also SoftEther VPN [Stable Edition](https://www.freshports.org/security/softether-devel/) and
|
||||
[RTM version](https://www.freshports.org/security/softether/) are available on FreeBSD.
|
||||
|
||||
## From binary installers:
|
||||
|
||||
Those can be found under https://www.softether-download.com/
|
||||
There you can also find SoftEtherVPN source code in zip and tar formats.
|
||||
|
||||
## Build from Source code
|
||||
|
||||
see [BUILD_UNIX](src/BUILD_UNIX.md) or [BUILD_WINDOWS](src/BUILD_WINDOWS.md)
|
||||
|
||||
There are two flavours of SoftEtherVPN source code:
|
||||
|
||||
1. Unstable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN
|
||||
2. Stable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
|
||||
|
||||
|
||||
# About HTML5-based Modern Admin Console and JSON-RPC API Suite
|
||||
|
||||
## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console
|
||||
We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server.
|
||||
|
||||
Access to the following URL from your favorite web browser.
|
||||
|
||||
```
|
||||
https://<vpn_server_hostname>:<port>/admin/
|
||||
```
|
||||
|
||||
For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by:
|
||||
|
||||
```
|
||||
https://192.168.0.1:5555/admin/
|
||||
```
|
||||
|
||||
Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server.
|
||||
|
||||
|
||||
## Built-in SoftEther Server VPN JSON-RPC API Suite
|
||||
The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions).
|
||||
|
||||
You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/)
|
||||
|
||||
- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API.
|
||||
You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.)
|
||||
- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server.
|
||||
- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment.
|
||||
- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available.
|
||||
|
||||
|
||||
# TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION
|
||||
|
||||
Because SoftEther VPN is overly strong tool to build a VPN tunnel,
|
||||
some censorship governments want to block your access to the source code
|
||||
of SoftEther VPN, by abusing their censorship firewalls.
|
||||
|
||||
To circumvent your censor's unjust restriction,
|
||||
SoftEther VPN Project distributes the up-to-date source-code
|
||||
on all the following open-source repositories:
|
||||
|
||||
- GitHub
|
||||
https://github.com/SoftEtherVPN/SoftEtherVPN/
|
||||
|
||||
```
|
||||
$ git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git
|
||||
```
|
||||
|
||||
- GitLab (mirrored from GitHub)
|
||||
https://gitlab.com/SoftEther/SoftEtherVPN/
|
||||
|
||||
```
|
||||
$ git clone https://gitlab.com/SoftEther/SoftEtherVPN.git
|
||||
```
|
||||
|
||||
We hope that you can reach one of the above URLs at least!
|
||||
|
||||
|
||||
# SOURCE CODE CONTRIBUTION
|
||||
|
||||
Your contribution to SoftEther VPN Project is much appreciated.
|
||||
Please send patches to us through GitHub.
|
||||
|
||||
|
||||
# DEAR SECURITY EXPERTS
|
||||
|
||||
If you find a bug or a security vulnerability please kindly inform us
|
||||
about the problem immediately so that we can fix the security problem
|
||||
to protect a lot of users around the world as soon as possible.
|
||||
|
||||
Our e-mail address for security reports is:
|
||||
**softether-vpn-security at softether.org**
|
||||
|
||||
Please note that the above e-mail address is not a technical support
|
||||
inquiry address. If you need technical assistance, please visit
|
||||
https://www.softether.org/ and ask your question on the users forum.
|
||||
# SoftEther VPN
|
||||
|
||||
||Badges|
|
||||
|---|---|
|
||||
|AppVeyor|[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/softethervpn/softethervpn?branch=master&svg=true)](https://ci.appveyor.com/project/softethervpn/softethervpn) |
|
||||
|Travis CI|[![Travis CI build status](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN.svg?branch=master)](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN) |
|
||||
|GitLab CI|[![GitLab CI build status](https://gitlab.com/SoftEther/SoftEtherVPN/badges/master/pipeline.svg)](https://gitlab.com/SoftEther/SoftEtherVPN/pipelines)|
|
||||
|Coverity Scan|[![Coverity Scan build status](https://scan.coverity.com/projects/16304/badge.svg)](https://scan.coverity.com/projects/softethervpn-softethervpn)|
|
||||
|Azure Pipelines|[![Azure Pipelines build status for Nightly](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_apis/build/status/6?api-version=6.0-preview.1)](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_build?definitionId=6)|
|
||||
|Cirrus CI|[![Cirrus CI build status](https://api.cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN.svg)](https://cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN)|
|
||||
|
||||
- [SoftEther VPN](#softether-vpn)
|
||||
- [BOARD MEMBERS OF THIS REPOSITORY](#board-members-of-this-repository)
|
||||
- [SOFTETHER VPN ADVANTAGES](#softether-vpn-advantages)
|
||||
- [Installation](#installation)
|
||||
* [For Ubuntu](#for-ubuntu)
|
||||
* [For FreeBSD](#for-freebsd)
|
||||
* [From binary installers:](#from-binary-installers)
|
||||
* [Build from Source code](#build-from-source-code)
|
||||
- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite)
|
||||
* [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console)
|
||||
* [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite)
|
||||
- [TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION](#to-circumvent-your-governments-firewall-restriction)
|
||||
- [SOURCE CODE CONTRIBUTION](#source-code-contribution)
|
||||
- [DEAR SECURITY EXPERTS](#dear-security-experts)
|
||||
|
||||
SoftEther VPN (Developer Edition Master Repository)
|
||||
- An Open-Source Cross-platform Multi-protocol VPN Program
|
||||
https://www.softether.org/
|
||||
|
||||
|
||||
This repository has experimental codes. Pull requests are welcome.
|
||||
|
||||
Stable Edition is available on
|
||||
https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
|
||||
which the non-developer user can stable use.
|
||||
|
||||
Source code packages (.zip and .tar.gz) and binary files of Stable Edition are also available:
|
||||
https://www.softether-download.com/
|
||||
|
||||
Copyright (c) all contributors on SoftEther VPN project in GitHub.
|
||||
Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.
|
||||
|
||||
---
|
||||
|
||||
The development of SoftEther VPN was supported by the MITOH Project,
|
||||
a research and development project by Japanese Government,
|
||||
subsidized by Ministry of Economy, Trade and Industry of Japan,
|
||||
administrated by Information Promotion Agency.
|
||||
https://www.ipa.go.jp/english/humandev/
|
||||
|
||||
---
|
||||
|
||||
![https://icons8.com](resources/icons8.png "Icons8")
|
||||
|
||||
[Icons8](https://icons8.com) kindly supported the project by gifting a license which allows to edit and redistribute their icons.
|
||||
|
||||
Please note that you are not allowed to redistribute those icons outside of this repository.
|
||||
|
||||
The developers of SoftEther VPN love Icons8's work and kindly ask the users to support them as much as possible.
|
||||
|
||||
---
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
|
||||
world's most powerful and easy-to-use multi-protocol VPN software.
|
||||
|
||||
SoftEther VPN runs on Windows, Linux, Mac, FreeBSD and Solaris.
|
||||
|
||||
SoftEther VPN supports most of widely-used VPN protocols
|
||||
including SSL-VPN, OpenVPN, IPsec, L2TP, MS-SSTP, L2TPv3 and EtherIP
|
||||
by the single SoftEther VPN Server program.
|
||||
|
||||
More details on https://www.softether.org/.
|
||||
|
||||
|
||||
# BOARD MEMBERS OF THIS REPOSITORY
|
||||
|
||||
|
||||
Daiyuu Nobori (Since Jan 2, 2014)
|
||||
https://github.com/dnobori
|
||||
|
||||
Moataz Elmasry (Since Nov 6, 2017)
|
||||
https://github.com/moatazelmasry2
|
||||
|
||||
Zulyandri Zardi (Since Nov 6, 2017)
|
||||
https://github.com/zulzardi
|
||||
|
||||
Alex Maslakov (Since Nov 6, 2017)
|
||||
https://github.com/GildedHonour
|
||||
|
||||
Davide Beatrici (Since Jul 21, 2018)
|
||||
https://github.com/davidebeatrici
|
||||
|
||||
Ilya Shipitsin (Since Jul 21, 2018)
|
||||
https://github.com/chipitsine
|
||||
|
||||
|
||||
# SOFTETHER VPN ADVANTAGES
|
||||
|
||||
|
||||
- Supporting all popular VPN protocols by the single VPN server:
|
||||
SSL-VPN (HTTPS)
|
||||
OpenVPN
|
||||
IPsec
|
||||
L2TP
|
||||
MS-SSTP
|
||||
L2TPv3
|
||||
EtherIP
|
||||
- Free and open-source software.
|
||||
- Easy to establish both remote-access and site-to-site VPN.
|
||||
- SSL-VPN Tunneling on HTTPS to pass through NATs and firewalls.
|
||||
- Revolutionary VPN over ICMP and VPN over DNS features.
|
||||
- Resistance to highly-restricted firewall.
|
||||
- Ethernet-bridging (L2) and IP-routing (L3) over VPN.
|
||||
- Embedded dynamic-DNS and NAT-traversal so that no static nor
|
||||
fixed IP address is required.
|
||||
- AES 256-bit and RSA 4096-bit encryptions.
|
||||
- Sufficient security features such as logging and firewall inner
|
||||
VPN tunnel.
|
||||
- User authentication with RADIUS and NT domain controllers.
|
||||
- User authentication with X.509 client certificate.
|
||||
- Packet logging.
|
||||
- 1Gbps-class high-speed throughput performance with low memory and
|
||||
CPU usage.
|
||||
- Windows, Linux, Mac, Android, iPhone, iPad and Windows Phone are
|
||||
supported.
|
||||
- The OpenVPN clone function supports legacy OpenVPN clients.
|
||||
- IPv4 / IPv6 dual-stack.
|
||||
- The VPN server runs on Windows, Linux, FreeBSD, Solaris and Mac OS X.
|
||||
- Configure All settings on GUI.
|
||||
- Multi-languages (English, Japanese and Simplified-Chinese).
|
||||
- No memory leaks. High quality stable codes, intended for long-term runs.
|
||||
We always verify that there are no memory or resource leaks before
|
||||
releasing the build.
|
||||
- More details at https://www.softether.org/.
|
||||
|
||||
|
||||
# Installation
|
||||
|
||||
## For Ubuntu
|
||||
|
||||
Launchpad PPA maintained by [Dmitry Verkhoturov](https://github.com/paskal):
|
||||
|
||||
[Daily builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn) (latest released tag)
|
||||
|
||||
[Nightly builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn-nightly)
|
||||
|
||||
## For FreeBSD
|
||||
|
||||
SoftEther VPN in FreeBSD Ports Collection is maintained by
|
||||
[Koichiro Iwao](https://people.FreeBSD.org/~meta/) ([@metalefty](https://github.com/metalefty)).
|
||||
|
||||
Binary package can be installed by pkg:
|
||||
```
|
||||
pkg install softether5
|
||||
```
|
||||
|
||||
Alternatively, it can be built & installed by ports:
|
||||
```
|
||||
make install -C /usr/ports/security/softether5
|
||||
```
|
||||
|
||||
To run SoftEther VPN Server:
|
||||
```
|
||||
service softether_server start
|
||||
```
|
||||
|
||||
To configure SoftEther VPN Server startup on boot:
|
||||
```
|
||||
sysrc softether_server_enable=yes
|
||||
```
|
||||
|
||||
Also SoftEther VPN [Stable Edition](https://www.freshports.org/security/softether-devel/) and
|
||||
[RTM version](https://www.freshports.org/security/softether/) are available on FreeBSD.
|
||||
|
||||
## From binary installers:
|
||||
|
||||
Those can be found under https://www.softether-download.com/
|
||||
There you can also find SoftEtherVPN source code in zip and tar formats.
|
||||
|
||||
## Build from Source code
|
||||
|
||||
see [BUILD_UNIX](src/BUILD_UNIX.md) or [BUILD_WINDOWS](src/BUILD_WINDOWS.md)
|
||||
|
||||
There are two flavours of SoftEtherVPN source code:
|
||||
|
||||
1. Unstable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN
|
||||
2. Stable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
|
||||
|
||||
|
||||
# About HTML5-based Modern Admin Console and JSON-RPC API Suite
|
||||
|
||||
## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console
|
||||
We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server.
|
||||
|
||||
Access to the following URL from your favorite web browser.
|
||||
|
||||
```
|
||||
https://<vpn_server_hostname>:<port>/admin/
|
||||
```
|
||||
|
||||
For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by:
|
||||
|
||||
```
|
||||
https://192.168.0.1:5555/admin/
|
||||
```
|
||||
|
||||
Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server.
|
||||
|
||||
|
||||
## Built-in SoftEther Server VPN JSON-RPC API Suite
|
||||
The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions).
|
||||
|
||||
You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/)
|
||||
|
||||
- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API.
|
||||
You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.)
|
||||
- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server.
|
||||
- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment.
|
||||
- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available.
|
||||
|
||||
|
||||
# TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION
|
||||
|
||||
Because SoftEther VPN is overly strong tool to build a VPN tunnel,
|
||||
some censorship governments want to block your access to the source code
|
||||
of SoftEther VPN, by abusing their censorship firewalls.
|
||||
|
||||
To circumvent your censor's unjust restriction,
|
||||
SoftEther VPN Project distributes the up-to-date source-code
|
||||
on all the following open-source repositories:
|
||||
|
||||
- GitHub
|
||||
https://github.com/SoftEtherVPN/SoftEtherVPN/
|
||||
|
||||
```
|
||||
$ git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git
|
||||
```
|
||||
|
||||
- GitLab (mirrored from GitHub)
|
||||
https://gitlab.com/SoftEther/SoftEtherVPN/
|
||||
|
||||
```
|
||||
$ git clone https://gitlab.com/SoftEther/SoftEtherVPN.git
|
||||
```
|
||||
|
||||
We hope that you can reach one of the above URLs at least!
|
||||
|
||||
|
||||
# SOURCE CODE CONTRIBUTION
|
||||
|
||||
Your contribution to SoftEther VPN Project is much appreciated.
|
||||
Please send patches to us through GitHub.
|
||||
|
||||
|
||||
# DEAR SECURITY EXPERTS
|
||||
|
||||
If you find a bug or a security vulnerability please kindly inform us
|
||||
about the problem immediately so that we can fix the security problem
|
||||
to protect a lot of users around the world as soon as possible.
|
||||
|
||||
Our e-mail address for security reports is:
|
||||
**softether-vpn-security at softether.org**
|
||||
|
||||
Please note that the above e-mail address is not a technical support
|
||||
inquiry address. If you need technical assistance, please visit
|
||||
https://www.softether.org/ and ask your question on the users forum.
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
public class Program
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Security.Cryptography;
|
||||
|
@ -1,4 +1,4 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2026
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# SoftEther VPN Server JSON-RPC API Suite Document
|
||||
# SoftEther VPN Server JSON-RPC API Suite Document
|
||||
This reference describes all JSON-RPC functions available on SoftEther VPN Server.
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// JsonRpc.cs - JSON-RPC Client Utility Functions
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// VPNServerRpc.cs - SoftEther VPN Server's JSON-RPC Stubs
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// VPNServerRpcTypes.cs - Data Type Definition for SoftEther VPN Server JSON-RPC Stubs
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// Program.cs - The Main() entry point
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// VpnServerRpcTest.cs - Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2041
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||
// Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||
// Runs on both web browsers and Node.js
|
||||
//
|
||||
// sample.ts
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for TypeScript
|
||||
// SoftEther VPN Server JSON-RPC Stub code for TypeScript
|
||||
//
|
||||
// vpnrpc.ts
|
||||
// Automatically generated at 2019-07-10 14:36:11 by vpnserver-jsonrpc-codegen
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||
// Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||
// Runs on both web browsers and Node.js
|
||||
//
|
||||
// sample.ts
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for TypeScript
|
||||
// SoftEther VPN Server JSON-RPC Stub code for TypeScript
|
||||
//
|
||||
// vpnrpc.ts
|
||||
// Automatically generated at 2019-07-10 14:36:11 by vpnserver-jsonrpc-codegen
|
||||
|
@ -1,4 +1,4 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using System;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// Program.cs - The Main() entry point
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# SoftEther VPN Server JSON-RPC API Suite Document
|
||||
# SoftEther VPN Server JSON-RPC API Suite Document
|
||||
This reference describes all JSON-RPC functions available on SoftEther VPN Server.
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for TypeScript
|
||||
// SoftEther VPN Server JSON-RPC Stub code for TypeScript
|
||||
//
|
||||
// vpnrpc.ts
|
||||
// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||
// Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||
// Runs on both web browsers and Node.js
|
||||
//
|
||||
// sample.ts
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// JsonRpc.cs - JSON-RPC Client Utility Functions
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// VPNServerRpc.cs - SoftEther VPN Server's JSON-RPC Stubs
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// VPNServerRpcTypes.cs - Data Type Definition for SoftEther VPN Server JSON-RPC Stubs
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// VpnServerRpcTest.cs - Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2041
|
||||
|
@ -1,236 +1,236 @@
|
||||
This document describes how to build SoftEtherVPN for UNIX based Operating systems
|
||||
|
||||
- [Requirements](#requirements)
|
||||
* [Install requirements on Centos/RedHat](#install-requirements-on-centosredhat)
|
||||
* [Install Requirements on Debian/Ubuntu](#install-requirements-on-debianubuntu)
|
||||
* [Install Requirements on macOS](#install-requirements-on-macos)
|
||||
- [Build from source code and install](#build-from-source-code-and-install)
|
||||
- [Additional Build Options](#additional-build-options)
|
||||
- [How to Run SoftEther](#how-to-run-softether)
|
||||
* [Start/Stop SoftEther VPN Server](#startstop-softether-vpn-server)
|
||||
* [Start/Stop SoftEther VPN Bridge](#startstop-softether-vpn-bridge)
|
||||
* [Start/Stop SoftEther VPN Client](#startstop-softether-vpn-client)
|
||||
- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite)
|
||||
* [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console)
|
||||
* [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite)
|
||||
- [Using SoftEther without installation.](#using-softether-without-installation)
|
||||
|
||||
# Requirements
|
||||
|
||||
You need to install the following software to build SoftEther VPN for UNIX.
|
||||
|
||||
- [CMake](https://cmake.org)
|
||||
- C compiler (GCC, Clang, etc)
|
||||
- C Library (BSD libc, GNU libc, musl libc, etc)
|
||||
- POSIX threads library (pthread)
|
||||
- OpenSSL or LibreSSL (crypto, ssl)
|
||||
- make (GNU make, BSD make, etc)
|
||||
- libiconv
|
||||
- readline
|
||||
- ncurses
|
||||
|
||||
## Install requirements on Centos/RedHat
|
||||
|
||||
```bash
|
||||
sudo yum -y groupinstall "Development Tools"
|
||||
sudo yum -y install cmake ncurses-devel openssl-devel readline-devel zlib-devel
|
||||
```
|
||||
|
||||
## Install requirements on Debian/Ubuntu
|
||||
```bash
|
||||
sudo apt -y install cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev
|
||||
```
|
||||
|
||||
## Install requirements on macOS
|
||||
```bash
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
||||
brew install cmake openssl readline
|
||||
```
|
||||
|
||||
# Build from source code and install
|
||||
|
||||
To build the programs from the source code, run the following commands:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git
|
||||
cd SoftEtherVPN
|
||||
git submodule init && git submodule update
|
||||
./configure
|
||||
make -C build
|
||||
make -C build install
|
||||
```
|
||||
|
||||
This will compile and install SoftEther VPN Server, Bridge and Client binaries under your executable path.
|
||||
|
||||
If any error occurs, please check the above requirements.
|
||||
|
||||
# Build on musl-based linux
|
||||
|
||||
To build the programs from the source code when using musl as libc, run the following commands:
|
||||
|
||||
```bash
|
||||
export USE_MUSL=YES
|
||||
git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git
|
||||
cd SoftEtherVPN
|
||||
git submodule init && git submodule update
|
||||
./configure
|
||||
make -C build
|
||||
make -C build install
|
||||
```
|
||||
|
||||
Building without USE_MUSL environment variable set compiles, but produced executables exhibit bad run-time behaviour.
|
||||
|
||||
# Additional Build Options
|
||||
|
||||
There are some additional build options useful if you're a distro package maintainer and creating a package of SoftEther VPN. It is recommended that you only specify these options when you understand what happens.
|
||||
|
||||
## Specify log, config, PID directories
|
||||
|
||||
By default, SoftEther VPN writes out all files such as logs, config files, PID files under the same directory as `vpnserver`, `vpnbridge`, `vpnclient` executables. This behaviour is suitable when [using SoftEther without installation](#using-softether-without-installation) however not appropriate using with installation.
|
||||
Usually PID files are to put in `/var/run` or `/run`. Logs are `/var/log`. Other variable state information files including config files are `/var/lib` or `/var/db`.
|
||||
|
||||
These directories can be changed at compile-time by specifying via CMake variables.
|
||||
* `SE_PIDDIR` - PID directory
|
||||
* `SE_LOGDIR` - root log directory
|
||||
* `SE_DBDIR` - config files and variable state directory
|
||||
|
||||
To specify directories, perform `./configure` like below.
|
||||
|
||||
```bash
|
||||
CMAKE_FLAGS="-DSE_PIDDIR=/run/softether -DSE_LOGDIR=/var/log/softether -DSE_DBDIR=/var/lib/softether" ./configure
|
||||
```
|
||||
|
||||
Please note that these directories are not created automatically after installation. Make sure to create these directories before starting SoftEther VPN Server, Bridge or Client.
|
||||
|
||||
## Build without [cpu_features](https://github.com/google/cpu_features)
|
||||
|
||||
SoftEther VPN uses cpu_features library to retrieve CPU features such as available processor instructions. However, cpu_features is not available on some architectures. Whether to build with cpu_features is auto detected but autodetection is not so smart.
|
||||
|
||||
If you want to build without cpu_features explicitly, perform `./configure` like below.
|
||||
|
||||
```bash
|
||||
CMAKE_FLAGS="-DSKIP_CPU_FEATURES" ./configure
|
||||
```
|
||||
|
||||
# How to Run SoftEther
|
||||
|
||||
## Start/Stop SoftEther VPN Server
|
||||
|
||||
To start the SoftEther VPN Server background service, run the following:
|
||||
|
||||
```bash
|
||||
vpnserver start
|
||||
```
|
||||
|
||||
To stop the service, run the following:
|
||||
|
||||
```bash
|
||||
vpnserver stop
|
||||
```
|
||||
|
||||
To configure the running SoftEther VPN Server service,
|
||||
you can use SoftEther VPN Command Line Management Utility as following:
|
||||
|
||||
```bash
|
||||
vpncmd
|
||||
```
|
||||
|
||||
Or you can also use VPN Server Manager GUI Tool on other Windows PC to
|
||||
connect to the VPN Server remotely. You can download the GUI Tool
|
||||
from https://www.softether-download.com/.
|
||||
|
||||
|
||||
## Start/Stop SoftEther VPN Bridge
|
||||
|
||||
To start the SoftEther VPN Bridge background service, run the following:
|
||||
|
||||
```bash
|
||||
vpnbridge start
|
||||
```
|
||||
|
||||
To stop the service, run the following:
|
||||
|
||||
```bash
|
||||
vpnbridge stop
|
||||
```
|
||||
|
||||
To configure the running SoftEther VPN Bridge service,
|
||||
you can use SoftEther VPN Command Line Management Utility as following:
|
||||
|
||||
```bash
|
||||
vpncmd
|
||||
```
|
||||
|
||||
Or you can also use VPN Server Manager GUI Tool on other Windows PC to
|
||||
connect to the VPN Bridge remotely. You can download the GUI Tool
|
||||
from https://www.softether-download.com/.
|
||||
|
||||
|
||||
## Start/Stop SoftEther VPN Client
|
||||
|
||||
To start the SoftEther VPN Client background service, run the following:
|
||||
|
||||
```bash
|
||||
vpnclient start
|
||||
```
|
||||
|
||||
To stop the service, run the following:
|
||||
|
||||
```bash
|
||||
vpnclient stop
|
||||
```
|
||||
|
||||
To configure the running SoftEther VPN Client service,
|
||||
you can use SoftEther VPN Command Line Management Utility as following:
|
||||
|
||||
```bash
|
||||
vpncmd
|
||||
```
|
||||
|
||||
Or you can also use VPN Client Manager GUI Tool on other Windows PC to
|
||||
connect to the VPN Client remotely. You can download the GUI Tool
|
||||
from https://www.softether-download.com/.
|
||||
|
||||
|
||||
# About HTML5-based Modern Admin Console and JSON-RPC API Suite
|
||||
|
||||
## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console
|
||||
We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server.
|
||||
|
||||
Access to the following URL from your favorite web browser.
|
||||
|
||||
```
|
||||
https://<vpn_server_hostname>:<port>/admin/
|
||||
```
|
||||
|
||||
For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by:
|
||||
|
||||
```
|
||||
https://192.168.0.1:5555/admin/
|
||||
```
|
||||
|
||||
Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server.
|
||||
|
||||
|
||||
## Built-in SoftEther Server VPN JSON-RPC API Suite
|
||||
The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions).
|
||||
|
||||
You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/)
|
||||
|
||||
- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API.
|
||||
You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.)
|
||||
- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server.
|
||||
- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment.
|
||||
- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available.
|
||||
|
||||
|
||||
# Using SoftEther without installation
|
||||
|
||||
You can use any SoftEtherVPN component (server, client, bridge) without installing it, if you wish so.
|
||||
|
||||
In this case please do not run the `make install` command after compiling the source code, and head directly to the **bin/** directory. There you will find the generated binaries for SoftEtherVPN and those could be used without installing SoftEtherVPN.
|
||||
|
||||
************************************
|
||||
Thank You Using SoftEther VPN !
|
||||
By SoftEther VPN Open-Source Project
|
||||
https://www.softether.org/
|
||||
This document describes how to build SoftEtherVPN for UNIX based Operating systems
|
||||
|
||||
- [Requirements](#requirements)
|
||||
* [Install requirements on Centos/RedHat](#install-requirements-on-centosredhat)
|
||||
* [Install Requirements on Debian/Ubuntu](#install-requirements-on-debianubuntu)
|
||||
* [Install Requirements on macOS](#install-requirements-on-macos)
|
||||
- [Build from source code and install](#build-from-source-code-and-install)
|
||||
- [Additional Build Options](#additional-build-options)
|
||||
- [How to Run SoftEther](#how-to-run-softether)
|
||||
* [Start/Stop SoftEther VPN Server](#startstop-softether-vpn-server)
|
||||
* [Start/Stop SoftEther VPN Bridge](#startstop-softether-vpn-bridge)
|
||||
* [Start/Stop SoftEther VPN Client](#startstop-softether-vpn-client)
|
||||
- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite)
|
||||
* [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console)
|
||||
* [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite)
|
||||
- [Using SoftEther without installation.](#using-softether-without-installation)
|
||||
|
||||
# Requirements
|
||||
|
||||
You need to install the following software to build SoftEther VPN for UNIX.
|
||||
|
||||
- [CMake](https://cmake.org)
|
||||
- C compiler (GCC, Clang, etc)
|
||||
- C Library (BSD libc, GNU libc, musl libc, etc)
|
||||
- POSIX threads library (pthread)
|
||||
- OpenSSL or LibreSSL (crypto, ssl)
|
||||
- make (GNU make, BSD make, etc)
|
||||
- libiconv
|
||||
- readline
|
||||
- ncurses
|
||||
|
||||
## Install requirements on Centos/RedHat
|
||||
|
||||
```bash
|
||||
sudo yum -y groupinstall "Development Tools"
|
||||
sudo yum -y install cmake ncurses-devel openssl-devel readline-devel zlib-devel
|
||||
```
|
||||
|
||||
## Install requirements on Debian/Ubuntu
|
||||
```bash
|
||||
sudo apt -y install cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev
|
||||
```
|
||||
|
||||
## Install requirements on macOS
|
||||
```bash
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
||||
brew install cmake openssl readline
|
||||
```
|
||||
|
||||
# Build from source code and install
|
||||
|
||||
To build the programs from the source code, run the following commands:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git
|
||||
cd SoftEtherVPN
|
||||
git submodule init && git submodule update
|
||||
./configure
|
||||
make -C build
|
||||
make -C build install
|
||||
```
|
||||
|
||||
This will compile and install SoftEther VPN Server, Bridge and Client binaries under your executable path.
|
||||
|
||||
If any error occurs, please check the above requirements.
|
||||
|
||||
# Build on musl-based linux
|
||||
|
||||
To build the programs from the source code when using musl as libc, run the following commands:
|
||||
|
||||
```bash
|
||||
export USE_MUSL=YES
|
||||
git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git
|
||||
cd SoftEtherVPN
|
||||
git submodule init && git submodule update
|
||||
./configure
|
||||
make -C build
|
||||
make -C build install
|
||||
```
|
||||
|
||||
Building without USE_MUSL environment variable set compiles, but produced executables exhibit bad run-time behaviour.
|
||||
|
||||
# Additional Build Options
|
||||
|
||||
There are some additional build options useful if you're a distro package maintainer and creating a package of SoftEther VPN. It is recommended that you only specify these options when you understand what happens.
|
||||
|
||||
## Specify log, config, PID directories
|
||||
|
||||
By default, SoftEther VPN writes out all files such as logs, config files, PID files under the same directory as `vpnserver`, `vpnbridge`, `vpnclient` executables. This behaviour is suitable when [using SoftEther without installation](#using-softether-without-installation) however not appropriate using with installation.
|
||||
Usually PID files are to put in `/var/run` or `/run`. Logs are `/var/log`. Other variable state information files including config files are `/var/lib` or `/var/db`.
|
||||
|
||||
These directories can be changed at compile-time by specifying via CMake variables.
|
||||
* `SE_PIDDIR` - PID directory
|
||||
* `SE_LOGDIR` - root log directory
|
||||
* `SE_DBDIR` - config files and variable state directory
|
||||
|
||||
To specify directories, perform `./configure` like below.
|
||||
|
||||
```bash
|
||||
CMAKE_FLAGS="-DSE_PIDDIR=/run/softether -DSE_LOGDIR=/var/log/softether -DSE_DBDIR=/var/lib/softether" ./configure
|
||||
```
|
||||
|
||||
Please note that these directories are not created automatically after installation. Make sure to create these directories before starting SoftEther VPN Server, Bridge or Client.
|
||||
|
||||
## Build without [cpu_features](https://github.com/google/cpu_features)
|
||||
|
||||
SoftEther VPN uses cpu_features library to retrieve CPU features such as available processor instructions. However, cpu_features is not available on some architectures. Whether to build with cpu_features is auto detected but autodetection is not so smart.
|
||||
|
||||
If you want to build without cpu_features explicitly, perform `./configure` like below.
|
||||
|
||||
```bash
|
||||
CMAKE_FLAGS="-DSKIP_CPU_FEATURES" ./configure
|
||||
```
|
||||
|
||||
# How to Run SoftEther
|
||||
|
||||
## Start/Stop SoftEther VPN Server
|
||||
|
||||
To start the SoftEther VPN Server background service, run the following:
|
||||
|
||||
```bash
|
||||
vpnserver start
|
||||
```
|
||||
|
||||
To stop the service, run the following:
|
||||
|
||||
```bash
|
||||
vpnserver stop
|
||||
```
|
||||
|
||||
To configure the running SoftEther VPN Server service,
|
||||
you can use SoftEther VPN Command Line Management Utility as following:
|
||||
|
||||
```bash
|
||||
vpncmd
|
||||
```
|
||||
|
||||
Or you can also use VPN Server Manager GUI Tool on other Windows PC to
|
||||
connect to the VPN Server remotely. You can download the GUI Tool
|
||||
from https://www.softether-download.com/.
|
||||
|
||||
|
||||
## Start/Stop SoftEther VPN Bridge
|
||||
|
||||
To start the SoftEther VPN Bridge background service, run the following:
|
||||
|
||||
```bash
|
||||
vpnbridge start
|
||||
```
|
||||
|
||||
To stop the service, run the following:
|
||||
|
||||
```bash
|
||||
vpnbridge stop
|
||||
```
|
||||
|
||||
To configure the running SoftEther VPN Bridge service,
|
||||
you can use SoftEther VPN Command Line Management Utility as following:
|
||||
|
||||
```bash
|
||||
vpncmd
|
||||
```
|
||||
|
||||
Or you can also use VPN Server Manager GUI Tool on other Windows PC to
|
||||
connect to the VPN Bridge remotely. You can download the GUI Tool
|
||||
from https://www.softether-download.com/.
|
||||
|
||||
|
||||
## Start/Stop SoftEther VPN Client
|
||||
|
||||
To start the SoftEther VPN Client background service, run the following:
|
||||
|
||||
```bash
|
||||
vpnclient start
|
||||
```
|
||||
|
||||
To stop the service, run the following:
|
||||
|
||||
```bash
|
||||
vpnclient stop
|
||||
```
|
||||
|
||||
To configure the running SoftEther VPN Client service,
|
||||
you can use SoftEther VPN Command Line Management Utility as following:
|
||||
|
||||
```bash
|
||||
vpncmd
|
||||
```
|
||||
|
||||
Or you can also use VPN Client Manager GUI Tool on other Windows PC to
|
||||
connect to the VPN Client remotely. You can download the GUI Tool
|
||||
from https://www.softether-download.com/.
|
||||
|
||||
|
||||
# About HTML5-based Modern Admin Console and JSON-RPC API Suite
|
||||
|
||||
## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console
|
||||
We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server.
|
||||
|
||||
Access to the following URL from your favorite web browser.
|
||||
|
||||
```
|
||||
https://<vpn_server_hostname>:<port>/admin/
|
||||
```
|
||||
|
||||
For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by:
|
||||
|
||||
```
|
||||
https://192.168.0.1:5555/admin/
|
||||
```
|
||||
|
||||
Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server.
|
||||
|
||||
|
||||
## Built-in SoftEther Server VPN JSON-RPC API Suite
|
||||
The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions).
|
||||
|
||||
You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/)
|
||||
|
||||
- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API.
|
||||
You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.)
|
||||
- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server.
|
||||
- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment.
|
||||
- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available.
|
||||
|
||||
|
||||
# Using SoftEther without installation
|
||||
|
||||
You can use any SoftEtherVPN component (server, client, bridge) without installing it, if you wish so.
|
||||
|
||||
In this case please do not run the `make install` command after compiling the source code, and head directly to the **bin/** directory. There you will find the generated binaries for SoftEtherVPN and those could be used without installing SoftEtherVPN.
|
||||
|
||||
************************************
|
||||
Thank You Using SoftEther VPN !
|
||||
By SoftEther VPN Open-Source Project
|
||||
https://www.softether.org/
|
||||
|
@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="amd64" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="amd64" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
|
@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="amd64" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="amd64" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
|
@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
|
@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
|
@ -1,18 +1,18 @@
|
||||
; VPN Client Web Installer Inf File
|
||||
;
|
||||
; Copyright (c) SoftEther Project at University of Tsukuba, Japan.
|
||||
; All Rights Reserved.
|
||||
|
||||
[version]
|
||||
signature="$CHICAGO$"
|
||||
AdvancedINF=2.0
|
||||
|
||||
[Add.Code]
|
||||
vpnweb.ocx=vpnweb.ocx
|
||||
|
||||
[vpnweb.ocx]
|
||||
file-win32-x86=thiscab
|
||||
clsid={64F1A16B-C3EE-484C-B551-35338A9BB6D2}
|
||||
FileVersion=$CAB_VERSION$
|
||||
RegisterServer=yes
|
||||
|
||||
; VPN Client Web Installer Inf File
|
||||
;
|
||||
; Copyright (c) SoftEther Project at University of Tsukuba, Japan.
|
||||
; All Rights Reserved.
|
||||
|
||||
[version]
|
||||
signature="$CHICAGO$"
|
||||
AdvancedINF=2.0
|
||||
|
||||
[Add.Code]
|
||||
vpnweb.ocx=vpnweb.ocx
|
||||
|
||||
[vpnweb.ocx]
|
||||
file-win32-x86=thiscab
|
||||
clsid={64F1A16B-C3EE-484C-B551-35338A9BB6D2}
|
||||
FileVersion=$CAB_VERSION$
|
||||
RegisterServer=yes
|
||||
|
||||
|
@ -1,74 +1,74 @@
|
||||
|
||||
MICROSOFT CABINET SOFTWARE DEVELOPMENT KIT
|
||||
|
||||
END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE
|
||||
|
||||
IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software product identified above, which includes computer software and associated media and printed materials, and may include "online" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA; promptly return the unused SOFTWARE PRODUCT to the place from which you obtained it for a full refund; or if you received the SOFTWARE PRODUCT as part of a subscription or other service from Microsoft, you may cancel the subscription and receive a pro rata portion of the subscription price.
|
||||
|
||||
SOFTWARE PRODUCT LICENSE
|
||||
|
||||
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold.
|
||||
|
||||
1. GRANT OF LICENSE. This EULA grants you the following limited, non-exclusive rights:
|
||||
|
||||
Software Product. You may install and use the SOFTWARE PRODUCT on a single computer solely for the purpose of developing applications which create, extract or manipulate files that are compatible with Microsoft CAB file format ("Application"). You may not use the SOFTWARE PRODUCT to create files which are not compatible with the Microsoft CAB file format.
|
||||
|
||||
Microsoft Developer Network Subscriber. If you acquired the SOFTWARE PRODUCT through a subscription to the Microsoft Developer Network, and you are either an individual developer or an individual designated within a single entity, you are granted the following additional rights with respect to the SOFTWARE PRODUCT: (a) you may make and use copies of the SOFTWARE PRODUCT on up to ten (10) separate computers, provided that you are the only individual using the SOFTWARE PRODUCT on each such computer, and (b) if you are a single entity, you may designate one individual within your organization to have the right to use the SOFTWARE PRODUCT in the manner described herein.
|
||||
|
||||
Sample Code. You may modify the sample source code located in the SOFTWARE PRODUCT's "SAMPLES" directory ("Sample Code") to design, develop, and test your Application. You may also reproduce and distribute the Sample Code in object code form along with any modifications you make to the Sample Code, provided that the modifications do not create files which are not compatible with Microsoft CAB file format and that you comply with the Distribution Requirements described below. For purposes of this section, "modifications" shall mean changes to the functionality of the Sample Code.
|
||||
|
||||
Redistributable Code. Portions of the SOFTWARE PRODUCT in the "BIN" and "LIB" directories are designated as "Redistributable Code." You may reproduce and distribute the Redistributable Code provided you comply with the Distribution Requirements described below.
|
||||
|
||||
Distribution Requirements. You may copy and redistribute the Sample Code and/or Redistributable Code (collectively "REDISTRIBUTABLE COMPONENTS") as described above, provided that (a) you distribute the REDISTRIBUTABLE COMPONENTS only in conjunction with, and as a part of, your Application; (b) your Application adds significant and primary functionality to the REDISTRIBUTABLE COMPONENTS; (c) the Application does not allow the use of the REDISTRIBUTABLE COMPONENTS for files which are not compatible with the Microsoft CAB files; (d) the executable code in the BIN directory may be redistributed unmodified in conjunction with your Application provided that your Application adds significant and primary functionality to the REDISTRIBUTABLE COMPONENTS; (e) the library code in the LIB directory may only be redistributed when linked into your Application; (f) you do not use Microsoft's name, logo, or trademarks to market your Application; (g) you include a valid copyright notice on your Application; and (h) you agree to indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of your Application. Contact Microsoft for the applicable royalties due and other licensing terms for all other uses and/or distribution of the REDISTRIBUTABLE COMPONENTS.
|
||||
|
||||
Microsoft reserves all rights not expressly granted to you.
|
||||
|
||||
2. COPYRIGHT. All rights, title, and copyrights in and to the SOFTWARE PRODUCT (including, but not limited to, any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT) and any copies of the SOFTWARE PRODUCT are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material, except that you may either (a) make one copy of the SOFTWARE PRODUCT solely for backup or archival purposes, or (b) install the SOFTWARE PRODUCT on a single computer, provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the SOFTWARE PRODUCT.
|
||||
|
||||
3. PRERELEASE CODE. The SOFTWARE PRODUCT may contain PRERELEASE CODE that is not at the level of performance and compatibility of the final, generally available, product offering. These portions of the SOFTWARE PRODUCT may not operate correctly and may be substantially modified prior to first commercial shipment. Microsoft is not obligated to make this or any later version of the SOFTWARE PRODUCT commercially available. Microsoft grants you the right to distribute test versions of your Application created using the PRERELEASE CODE provided you comply with the Distribution Requirements described in Section 1 and the following additional provisions: (a) you must mark the test version of your Application "BETA" and (b) you are solely responsible for updating your customers with versions of your Application that operate satisfactorily with the final commercial release of the PRERELEASE CODE.
|
||||
|
||||
4. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
|
||||
|
||||
Limitations on Reverse-Engineering, Decompilation, and Disassembly. You may not reverse- engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
|
||||
|
||||
Rental. You may not rent or lease the SOFTWARE PRODUCT.
|
||||
|
||||
Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, this EULA, and, if applicable, the Certificate of Authenticity), and the recipient agrees to the terms of this EULA. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions of the SOFTWARE PRODUCT.
|
||||
|
||||
Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts.
|
||||
|
||||
5. EXPORT RESTRICTIONS. You agree that neither you nor your customers intend to or will, directly or indirectly, export or transmit (a) the SOFTWARE PRODUCT or related documentation and technical data, or (b) your Application as described in Section 1 of this EULA (or any part thereof), or process, or service that is the direct product of the SOFTWARE PRODUCT to any country to which such export or transmission is restricted by any applicable U.S. regulation or statute, without the prior written consent, if required, of the Bureau of Export Administration of the U.S. Department of Commerce, or such other governmental entity as may have jurisdiction over such export or transmission.
|
||||
|
||||
6. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399.
|
||||
|
||||
MISCELLANEOUS
|
||||
|
||||
If you acquired this product in the United States, this EULA is governed by the laws of the State of Washington.
|
||||
|
||||
If you acquired this product in Canada, this EULA is governed by the laws of the Province of Ontario, Canada. Each of the parties hereto irrevocably attorns to the jurisdiction of the courts of the Province of Ontario and further agrees to commence any litigation that may arise hereunder in the courts located in the Judicial District of York, Province of Ontario.
|
||||
|
||||
If this product was acquired outside the United States, local law may apply.
|
||||
|
||||
Should you have any questions concerning this EULA, or if you desire to contact Microsoft for any reason, please contact the Microsoft subsidiary serving your country, or write: Microsoft Customer Sales and Service/One Microsoft Way/Redmond, WA 98052-6399.
|
||||
|
||||
NO WARRANTIES. To the maximum extent permitted by applicable law, Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation are provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.
|
||||
|
||||
LIMITATION OF LIABILITY. Microsoft's entire liability and your exclusive remedy under this EULA shall not exceed five dollars (US$5.00).
|
||||
|
||||
NO LIABILITY FOR CONSEQUENTIAL DAMAGES. To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profit, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of, or inability to use, this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.
|
||||
|
||||
|
||||
Si vous avez acquis votre produit Microsoft au CANADA, la garantie limitée suivante vous concerne:
|
||||
|
||||
GARANTIE LIMITÉE
|
||||
|
||||
EXCLUSION DE GARANTIES. Microsoft renonce entièrement à toute garantie pour le LOGICIEL. Le LOGICIEL et toute autre documentation s'y rapportant sont fournis « comme tels » sans aucune garantie quelle qu'elle soit, expresse ou implicite, y compris, mais ne se limitant pas aux garanties implicites de la qualité marchande ou un usage particulier. Le risque total découlant de l'utilisation ou de la performance du LOGICIEL est entre vos mains.
|
||||
|
||||
RESPONSABILITÉ LIMITÉE. La seule obligation de Microsoft et votre recours exclusif concernant ce contrat n'excèderont pas cinq dollars (US$5.00).
|
||||
|
||||
ABSENCE DE RESPONSABILITÉ POUR LES DOMMAGES INDIRECTS. Microsoft ou ses
|
||||
fournisseurs ne pourront être tenus responsables en aucune circonstance de tout dommage quel qu'il soit (y compris mais non de façon limitative les dommages directs ou indirects causés par la perte de bénéfices commerciaux, l'interruption des affaires, la perte d'information commerciale ou toute autre perte pécuniaire) résultant de l'utilisation ou de l'impossibilité d'utilisation de ce produit, et ce, même si la société Microsoft a été avisée de l'éventualité de tels dommages. Certains états/juridictions ne permettent pas l'exclusion ou la limitation de responsabilité relative aux dommages indirects ou consécutifs, et la limitation ci-dessus peut ne pas s'appliquer à votre égard.
|
||||
La présente Convention est régie par les lois de la province d'Ontario, Canada. Chacune des parties à la Convention reconnaît irrévocablement la compétence des tribunaux de la province d'Ontario et consent à instituer tout litige qui pourrait découler de la Convention auprès des tribunaux situés dans le district judiciaire de York, province d'Ontario.
|
||||
Au cas où vous auriez des questions concernant cette licence ou que vous désiriez vous mettre en rapport avec Microsoft pour quelque raison que ce soit, veuillez contacter la succursale Microsoft desservant votre pays, dont l'adresse est fournie dans ce produit, ou écrire à: Microsoft Customer Sales and Service, One Microsoft Way, Redmond, Washington 98052-6399.
|
||||
|
||||
|
||||
MICROSOFT CABINET SOFTWARE DEVELOPMENT KIT
|
||||
|
||||
END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE
|
||||
|
||||
IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software product identified above, which includes computer software and associated media and printed materials, and may include "online" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA; promptly return the unused SOFTWARE PRODUCT to the place from which you obtained it for a full refund; or if you received the SOFTWARE PRODUCT as part of a subscription or other service from Microsoft, you may cancel the subscription and receive a pro rata portion of the subscription price.
|
||||
|
||||
SOFTWARE PRODUCT LICENSE
|
||||
|
||||
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold.
|
||||
|
||||
1. GRANT OF LICENSE. This EULA grants you the following limited, non-exclusive rights:
|
||||
|
||||
Software Product. You may install and use the SOFTWARE PRODUCT on a single computer solely for the purpose of developing applications which create, extract or manipulate files that are compatible with Microsoft CAB file format ("Application"). You may not use the SOFTWARE PRODUCT to create files which are not compatible with the Microsoft CAB file format.
|
||||
|
||||
Microsoft Developer Network Subscriber. If you acquired the SOFTWARE PRODUCT through a subscription to the Microsoft Developer Network, and you are either an individual developer or an individual designated within a single entity, you are granted the following additional rights with respect to the SOFTWARE PRODUCT: (a) you may make and use copies of the SOFTWARE PRODUCT on up to ten (10) separate computers, provided that you are the only individual using the SOFTWARE PRODUCT on each such computer, and (b) if you are a single entity, you may designate one individual within your organization to have the right to use the SOFTWARE PRODUCT in the manner described herein.
|
||||
|
||||
Sample Code. You may modify the sample source code located in the SOFTWARE PRODUCT's "SAMPLES" directory ("Sample Code") to design, develop, and test your Application. You may also reproduce and distribute the Sample Code in object code form along with any modifications you make to the Sample Code, provided that the modifications do not create files which are not compatible with Microsoft CAB file format and that you comply with the Distribution Requirements described below. For purposes of this section, "modifications" shall mean changes to the functionality of the Sample Code.
|
||||
|
||||
Redistributable Code. Portions of the SOFTWARE PRODUCT in the "BIN" and "LIB" directories are designated as "Redistributable Code." You may reproduce and distribute the Redistributable Code provided you comply with the Distribution Requirements described below.
|
||||
|
||||
Distribution Requirements. You may copy and redistribute the Sample Code and/or Redistributable Code (collectively "REDISTRIBUTABLE COMPONENTS") as described above, provided that (a) you distribute the REDISTRIBUTABLE COMPONENTS only in conjunction with, and as a part of, your Application; (b) your Application adds significant and primary functionality to the REDISTRIBUTABLE COMPONENTS; (c) the Application does not allow the use of the REDISTRIBUTABLE COMPONENTS for files which are not compatible with the Microsoft CAB files; (d) the executable code in the BIN directory may be redistributed unmodified in conjunction with your Application provided that your Application adds significant and primary functionality to the REDISTRIBUTABLE COMPONENTS; (e) the library code in the LIB directory may only be redistributed when linked into your Application; (f) you do not use Microsoft's name, logo, or trademarks to market your Application; (g) you include a valid copyright notice on your Application; and (h) you agree to indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of your Application. Contact Microsoft for the applicable royalties due and other licensing terms for all other uses and/or distribution of the REDISTRIBUTABLE COMPONENTS.
|
||||
|
||||
Microsoft reserves all rights not expressly granted to you.
|
||||
|
||||
2. COPYRIGHT. All rights, title, and copyrights in and to the SOFTWARE PRODUCT (including, but not limited to, any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT) and any copies of the SOFTWARE PRODUCT are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material, except that you may either (a) make one copy of the SOFTWARE PRODUCT solely for backup or archival purposes, or (b) install the SOFTWARE PRODUCT on a single computer, provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the SOFTWARE PRODUCT.
|
||||
|
||||
3. PRERELEASE CODE. The SOFTWARE PRODUCT may contain PRERELEASE CODE that is not at the level of performance and compatibility of the final, generally available, product offering. These portions of the SOFTWARE PRODUCT may not operate correctly and may be substantially modified prior to first commercial shipment. Microsoft is not obligated to make this or any later version of the SOFTWARE PRODUCT commercially available. Microsoft grants you the right to distribute test versions of your Application created using the PRERELEASE CODE provided you comply with the Distribution Requirements described in Section 1 and the following additional provisions: (a) you must mark the test version of your Application "BETA" and (b) you are solely responsible for updating your customers with versions of your Application that operate satisfactorily with the final commercial release of the PRERELEASE CODE.
|
||||
|
||||
4. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
|
||||
|
||||
Limitations on Reverse-Engineering, Decompilation, and Disassembly. You may not reverse- engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
|
||||
|
||||
Rental. You may not rent or lease the SOFTWARE PRODUCT.
|
||||
|
||||
Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, this EULA, and, if applicable, the Certificate of Authenticity), and the recipient agrees to the terms of this EULA. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions of the SOFTWARE PRODUCT.
|
||||
|
||||
Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts.
|
||||
|
||||
5. EXPORT RESTRICTIONS. You agree that neither you nor your customers intend to or will, directly or indirectly, export or transmit (a) the SOFTWARE PRODUCT or related documentation and technical data, or (b) your Application as described in Section 1 of this EULA (or any part thereof), or process, or service that is the direct product of the SOFTWARE PRODUCT to any country to which such export or transmission is restricted by any applicable U.S. regulation or statute, without the prior written consent, if required, of the Bureau of Export Administration of the U.S. Department of Commerce, or such other governmental entity as may have jurisdiction over such export or transmission.
|
||||
|
||||
6. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399.
|
||||
|
||||
MISCELLANEOUS
|
||||
|
||||
If you acquired this product in the United States, this EULA is governed by the laws of the State of Washington.
|
||||
|
||||
If you acquired this product in Canada, this EULA is governed by the laws of the Province of Ontario, Canada. Each of the parties hereto irrevocably attorns to the jurisdiction of the courts of the Province of Ontario and further agrees to commence any litigation that may arise hereunder in the courts located in the Judicial District of York, Province of Ontario.
|
||||
|
||||
If this product was acquired outside the United States, local law may apply.
|
||||
|
||||
Should you have any questions concerning this EULA, or if you desire to contact Microsoft for any reason, please contact the Microsoft subsidiary serving your country, or write: Microsoft Customer Sales and Service/One Microsoft Way/Redmond, WA 98052-6399.
|
||||
|
||||
NO WARRANTIES. To the maximum extent permitted by applicable law, Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation are provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.
|
||||
|
||||
LIMITATION OF LIABILITY. Microsoft's entire liability and your exclusive remedy under this EULA shall not exceed five dollars (US$5.00).
|
||||
|
||||
NO LIABILITY FOR CONSEQUENTIAL DAMAGES. To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profit, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of, or inability to use, this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.
|
||||
|
||||
|
||||
Si vous avez acquis votre produit Microsoft au CANADA, la garantie limitée suivante vous concerne:
|
||||
|
||||
GARANTIE LIMITÉE
|
||||
|
||||
EXCLUSION DE GARANTIES. Microsoft renonce entièrement à toute garantie pour le LOGICIEL. Le LOGICIEL et toute autre documentation s'y rapportant sont fournis « comme tels » sans aucune garantie quelle qu'elle soit, expresse ou implicite, y compris, mais ne se limitant pas aux garanties implicites de la qualité marchande ou un usage particulier. Le risque total découlant de l'utilisation ou de la performance du LOGICIEL est entre vos mains.
|
||||
|
||||
RESPONSABILITÉ LIMITÉE. La seule obligation de Microsoft et votre recours exclusif concernant ce contrat n'excèderont pas cinq dollars (US$5.00).
|
||||
|
||||
ABSENCE DE RESPONSABILITÉ POUR LES DOMMAGES INDIRECTS. Microsoft ou ses
|
||||
fournisseurs ne pourront être tenus responsables en aucune circonstance de tout dommage quel qu'il soit (y compris mais non de façon limitative les dommages directs ou indirects causés par la perte de bénéfices commerciaux, l'interruption des affaires, la perte d'information commerciale ou toute autre perte pécuniaire) résultant de l'utilisation ou de l'impossibilité d'utilisation de ce produit, et ce, même si la société Microsoft a été avisée de l'éventualité de tels dommages. Certains états/juridictions ne permettent pas l'exclusion ou la limitation de responsabilité relative aux dommages indirects ou consécutifs, et la limitation ci-dessus peut ne pas s'appliquer à votre égard.
|
||||
La présente Convention est régie par les lois de la province d'Ontario, Canada. Chacune des parties à la Convention reconnaît irrévocablement la compétence des tribunaux de la province d'Ontario et consent à instituer tout litige qui pourrait découler de la Convention auprès des tribunaux situés dans le district judiciaire de York, province d'Ontario.
|
||||
Au cas où vous auriez des questions concernant cette licence ou que vous désiriez vous mettre en rapport avec Microsoft pour quelque raison que ce soit, veuillez contacter la succursale Microsoft desservant votre pays, dont l'adresse est fournie dans ce produit, ou écrire à: Microsoft Customer Sales and Service, One Microsoft Way, Redmond, Washington 98052-6399.
|
||||
|
||||
3/27/97 10:39 AM 970860004
|
@ -1,30 +1,30 @@
|
||||
#pragma code_page(932)
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,${PROJECT_VERSION_PATCH}
|
||||
PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,${PROJECT_VERSION_PATCH}
|
||||
FILEFLAGSMASK 0x17L
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "041104b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "SoftEther VPN Project at University of Tsukuba, Japan."
|
||||
VALUE "FileDescription", "${PROJECT_NAME} ${COMPONENT_NAME} (Developer Edition)"
|
||||
VALUE "FileVersion", "${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, 0, ${PROJECT_VERSION_PATCH}"
|
||||
VALUE "InternalName", "${COMPONENT_INTERNAL_NAME}"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2012-${DATE_YEAR} all contributors on SoftEther VPN project in GitHub. Copyright (C) 2004-${DATE_YEAR} Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. All Rights Reserved."
|
||||
VALUE "LegalTrademarks", "SoftEther(R) is a registered trademark of SoftEther Corporation in Japan, United States and People's Republic of China. SoftEther Corporation is a company founded at University of Tsukuba, Japan."
|
||||
VALUE "OriginalFilename", "${COMPONENT_FILE_NAME}"
|
||||
VALUE "ProductName", "${PROJECT_NAME} ${COMPONENT_NAME}"
|
||||
VALUE "ProductVersion", "${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, 0, ${PROJECT_VERSION_PATCH}"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x411, 1200
|
||||
END
|
||||
END
|
||||
#pragma code_page(932)
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,${PROJECT_VERSION_PATCH}
|
||||
PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,${PROJECT_VERSION_PATCH}
|
||||
FILEFLAGSMASK 0x17L
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "041104b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "SoftEther VPN Project at University of Tsukuba, Japan."
|
||||
VALUE "FileDescription", "${PROJECT_NAME} ${COMPONENT_NAME} (Developer Edition)"
|
||||
VALUE "FileVersion", "${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, 0, ${PROJECT_VERSION_PATCH}"
|
||||
VALUE "InternalName", "${COMPONENT_INTERNAL_NAME}"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2012-${DATE_YEAR} all contributors on SoftEther VPN project in GitHub. Copyright (C) 2004-${DATE_YEAR} Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. All Rights Reserved."
|
||||
VALUE "LegalTrademarks", "SoftEther(R) is a registered trademark of SoftEther Corporation in Japan, United States and People's Republic of China. SoftEther Corporation is a company founded at University of Tsukuba, Japan."
|
||||
VALUE "OriginalFilename", "${COMPONENT_FILE_NAME}"
|
||||
VALUE "ProductName", "${PROJECT_NAME} ${COMPONENT_NAME}"
|
||||
VALUE "ProductVersion", "${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, 0, ${PROJECT_VERSION_PATCH}"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x411, 1200
|
||||
END
|
||||
END
|
||||
|
@ -1,30 +1,30 @@
|
||||
#pragma code_page(932)
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION $VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$
|
||||
PRODUCTVERSION $VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$
|
||||
FILEFLAGSMASK 0x17L
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "041104b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "University of Tsukuba"
|
||||
VALUE "FileDescription", "VPN Gate Plug-in DLL for SoftEther VPN"
|
||||
VALUE "FileVersion", "$VER_MAJOR$, $VER_MINOR$, 0, $VER_BUILD$"
|
||||
VALUE "InternalName", "$INTERNALNAME$"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2012-$YEAR$ VPN Gate Project at University of Tsukuba. All Rights Reserved."
|
||||
VALUE "LegalTrademarks", ""
|
||||
VALUE "OriginalFilename", "$FILENAME$"
|
||||
VALUE "ProductName", "VPN Gate Software"
|
||||
VALUE "ProductVersion", "$VER_MAJOR$, $VER_MINOR$, 0, $VER_BUILD$"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x411, 1200
|
||||
END
|
||||
END
|
||||
#pragma code_page(932)
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION $VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$
|
||||
PRODUCTVERSION $VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$
|
||||
FILEFLAGSMASK 0x17L
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "041104b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "University of Tsukuba"
|
||||
VALUE "FileDescription", "VPN Gate Plug-in DLL for SoftEther VPN"
|
||||
VALUE "FileVersion", "$VER_MAJOR$, $VER_MINOR$, 0, $VER_BUILD$"
|
||||
VALUE "InternalName", "$INTERNALNAME$"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2012-$YEAR$ VPN Gate Project at University of Tsukuba. All Rights Reserved."
|
||||
VALUE "LegalTrademarks", ""
|
||||
VALUE "OriginalFilename", "$FILENAME$"
|
||||
VALUE "ProductName", "VPN Gate Software"
|
||||
VALUE "ProductVersion", "$VER_MAJOR$, $VER_MINOR$, 0, $VER_BUILD$"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x411, 1200
|
||||
END
|
||||
END
|
||||
|
2714
src/Cedar/Account.c
2714
src/Cedar/Account.c
File diff suppressed because it is too large
Load Diff
@ -1,211 +1,211 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Account.h
|
||||
// Header of Account.c
|
||||
|
||||
#ifndef ACCOUNT_H
|
||||
#define ACCOUNT_H
|
||||
|
||||
#define USER_MAC_STR_PREFIX L"MAC:"
|
||||
#define USER_IPV4_STR_PREFIX L"IPv4:"
|
||||
|
||||
// Policy item
|
||||
struct POLICY_ITEM
|
||||
{
|
||||
UINT Index;
|
||||
bool TypeInt;
|
||||
bool AllowZero;
|
||||
UINT MinValue;
|
||||
UINT MaxValue;
|
||||
UINT DefaultValue;
|
||||
char *FormatStr;
|
||||
};
|
||||
|
||||
// Policy
|
||||
struct POLICY
|
||||
{
|
||||
// For Ver 2.0
|
||||
bool Access; // Grant access
|
||||
bool DHCPFilter; // Filter DHCP packets (IPv4)
|
||||
bool DHCPNoServer; // Prohibit the behavior of the DHCP server (IPv4)
|
||||
bool DHCPForce; // Force DHCP-assigned IP address (IPv4)
|
||||
bool NoBridge; // Prohibit the bridge behavior
|
||||
bool NoRouting; // Prohibit the router behavior (IPv4)
|
||||
bool CheckMac; // Prohibit the duplicate MAC address
|
||||
bool CheckIP; // Prohibit a duplicate IP address (IPv4)
|
||||
bool ArpDhcpOnly; // Prohibit the broadcast other than ARP, DHCP, ICMPv6
|
||||
bool PrivacyFilter; // Privacy filter mode
|
||||
bool NoServer; // Prohibit to operate as a TCP/IP server (IPv4)
|
||||
bool NoBroadcastLimiter; // Not to limit the number of broadcast
|
||||
bool MonitorPort; // Allow monitoring mode
|
||||
UINT MaxConnection; // Maximum number of TCP connections
|
||||
UINT TimeOut; // Communication time-out period
|
||||
UINT MaxMac; // Maximum number of MAC address
|
||||
UINT MaxIP; // Maximum number of IP address (IPv4)
|
||||
UINT MaxUpload; // Upload bandwidth
|
||||
UINT MaxDownload; // Download bandwidth
|
||||
bool FixPassword; // User can not change password
|
||||
UINT MultiLogins; // Multiple logins limit
|
||||
bool NoQoS; // Prohibit the use of VoIP / QoS features
|
||||
|
||||
// For Ver 3.0
|
||||
bool RSandRAFilter; // Filter the Router Solicitation / Advertising packet (IPv6)
|
||||
bool RAFilter; // Filter the router advertisement packet (IPv6)
|
||||
bool DHCPv6Filter; // Filter DHCP packets (IPv6)
|
||||
bool DHCPv6NoServer; // Prohibit the behavior of the DHCP server (IPv6)
|
||||
bool NoRoutingV6; // Prohibit the router behavior (IPv6)
|
||||
bool CheckIPv6; // Prohibit the duplicate IP address (IPv6)
|
||||
bool NoServerV6; // Prohibit to operate as a TCP/IP server (IPv6)
|
||||
UINT MaxIPv6; // Maximum number of IP address (IPv6)
|
||||
bool NoSavePassword; // Prohibit to save the password in the VPN Client
|
||||
UINT AutoDisconnect; // Disconnect the VPN Client automatically at a certain period of time
|
||||
bool FilterIPv4; // Filter all IPv4 packets
|
||||
bool FilterIPv6; // Filter all IPv6 packets
|
||||
bool FilterNonIP; // Filter all non-IP packets
|
||||
bool NoIPv6DefaultRouterInRA; // Delete the default router specification from the IPv6 router advertisement
|
||||
bool NoIPv6DefaultRouterInRAWhenIPv6; // Delete the default router specification from the IPv6 router advertisement (Enable IPv6 connection)
|
||||
UINT VLanId; // Specify the VLAN ID
|
||||
|
||||
bool Ver3; // Whether version 3.0
|
||||
};
|
||||
|
||||
// Group
|
||||
struct USERGROUP
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
char *Name; // Group name
|
||||
wchar_t *RealName; // Display name
|
||||
wchar_t *Note; // Note
|
||||
POLICY *Policy; // Policy
|
||||
TRAFFIC *Traffic; // Traffic data
|
||||
};
|
||||
|
||||
// User
|
||||
struct USER
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
char *Name; // User name
|
||||
wchar_t *RealName; // Real name
|
||||
wchar_t *Note; // Note
|
||||
char *GroupName; // Group name
|
||||
USERGROUP *Group; // Group
|
||||
UINT AuthType; // Authentication type
|
||||
void *AuthData; // Authentication data
|
||||
UINT64 CreatedTime; // Creation date and time
|
||||
UINT64 UpdatedTime; // Updating date
|
||||
UINT64 ExpireTime; // Expiration date
|
||||
UINT64 LastLoginTime; // Last login time
|
||||
UINT NumLogin; // Total number of logins
|
||||
POLICY *Policy; // Policy
|
||||
TRAFFIC *Traffic; // Traffic data
|
||||
};
|
||||
|
||||
// Password authentication data
|
||||
struct AUTHPASSWORD
|
||||
{
|
||||
UCHAR HashedKey[SHA1_SIZE]; // Hashed passwords
|
||||
UCHAR NtLmSecureHash[MD5_SIZE]; // Encrypted password for the NTLM
|
||||
};
|
||||
|
||||
// User certificate authentication data
|
||||
struct AUTHUSERCERT
|
||||
{
|
||||
X *UserX; // X509 certificate for the user
|
||||
};
|
||||
|
||||
// Root certification authority authentication data
|
||||
struct AUTHROOTCERT
|
||||
{
|
||||
X_SERIAL *Serial; // Serial number
|
||||
wchar_t *CommonName; // CommonName
|
||||
};
|
||||
|
||||
// Radius authentication data
|
||||
struct AUTHRADIUS
|
||||
{
|
||||
wchar_t *RadiusUsername; // User name in the Radius
|
||||
};
|
||||
|
||||
// Windows NT authentication data
|
||||
struct AUTHNT
|
||||
{
|
||||
wchar_t *NtUsername; // User name on NT
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Macro
|
||||
#define POLICY_CURRENT_VERSION 3
|
||||
#define NUM_POLICY_ITEM ((sizeof(POLICY) / sizeof(UINT)) - 1)
|
||||
#define NUM_POLICY_ITEM_FOR_VER2 22
|
||||
#define NUM_POLICY_ITEM_FOR_VER3 38
|
||||
|
||||
#define IS_POLICY_FOR_VER2(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER2))
|
||||
#define IS_POLICY_FOR_VER3(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER3))
|
||||
|
||||
#define IS_POLICY_FOR_CURRENT_VER(index, ver) ((ver) >= 3 ? IS_POLICY_FOR_VER3(index) : IS_POLICY_FOR_VER2(index))
|
||||
|
||||
#define POLICY_BOOL(p, i) (((bool *)(p))[(i)])
|
||||
#define POLICY_INT(p, i) (((UINT *)(p))[(i)])
|
||||
|
||||
extern POLICY_ITEM policy_item[];
|
||||
|
||||
|
||||
|
||||
|
||||
// Function prototype
|
||||
int CompareUserName(void *p1, void *p2);
|
||||
int CompareGroupName(void *p1, void *p2);
|
||||
void AcLock(HUB *h);
|
||||
void AcUnlock(HUB *h);
|
||||
USERGROUP *NewGroup(char *name, wchar_t *realname, wchar_t *note);
|
||||
void ReleaseGroup(USERGROUP *g);
|
||||
void CleanupGroup(USERGROUP *g);
|
||||
USER *NewUser(char *name, wchar_t *realname, wchar_t *note, UINT authtype, void *authdata);
|
||||
void ReleaseUser(USER *u);
|
||||
void CleanupUser(USER *u);
|
||||
void FreeAuthData(UINT authtype, void *authdata);
|
||||
bool AcAddUser(HUB *h, USER *u);
|
||||
bool AcAddGroup(HUB *h, USERGROUP *g);
|
||||
USER *AcGetUser(HUB *h, char *name);
|
||||
USERGROUP *AcGetGroup(HUB *h, char *name);
|
||||
bool AcIsUser(HUB *h, char *name);
|
||||
bool AcIsGroup(HUB *h, char *name);
|
||||
bool AcDeleteUser(HUB *h, char *name);
|
||||
bool AcDeleteGroup(HUB *h, char *name);
|
||||
void JoinUserToGroup(USER *u, USERGROUP *g);
|
||||
void SetUserTraffic(USER *u, TRAFFIC *t);
|
||||
void SetGroupTraffic(USERGROUP *g, TRAFFIC *t);
|
||||
void SetUserAuthData(USER *u, UINT authtype, void *authdata);
|
||||
void *NewPasswordAuthData(char *username, char *password);
|
||||
void *NewPasswordAuthDataRaw(UCHAR *hashed_password, UCHAR *ntlm_secure_hash);
|
||||
void *NewUserCertAuthData(X *x);
|
||||
void *NewRootCertAuthData(X_SERIAL *serial, wchar_t *common_name);
|
||||
void *NewRadiusAuthData(wchar_t *username);
|
||||
void *NewNTAuthData(wchar_t *username);
|
||||
void HashPassword(void *dst, char *username, char *password);
|
||||
POLICY *GetDefaultPolicy();
|
||||
POLICY *ClonePolicy(POLICY *policy);
|
||||
void SetUserPolicy(USER *u, POLICY *policy);
|
||||
void OverwritePolicy(POLICY **target, POLICY *p);
|
||||
void SetGroupPolicy(USERGROUP *g, POLICY *policy);
|
||||
POLICY *GetGroupPolicy(USERGROUP *g);
|
||||
wchar_t *GetPolicyTitle(UINT id);
|
||||
wchar_t *GetPolicyDescription(UINT id);
|
||||
bool IsUserName(char *name);
|
||||
void *CopyAuthData(void *authdata, UINT authtype);
|
||||
UINT PolicyNum();
|
||||
bool PolicyIsSupportedForCascade(UINT i);
|
||||
UINT PolicyStrToId(char *name);
|
||||
char *PolicyIdToStr(UINT i);
|
||||
POLICY_ITEM *GetPolicyItem(UINT id);
|
||||
void GetPolicyValueRangeStr(wchar_t *str, UINT size, UINT id);
|
||||
void FormatPolicyValue(wchar_t *str, UINT size, UINT id, UINT value);
|
||||
bool GetUserMacAddressFromUserNote(UCHAR *mac, wchar_t *note);
|
||||
UINT GetUserIPv4AddressFromUserNote32(wchar_t *note);
|
||||
|
||||
#endif // ACCOUNT_H
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Account.h
|
||||
// Header of Account.c
|
||||
|
||||
#ifndef ACCOUNT_H
|
||||
#define ACCOUNT_H
|
||||
|
||||
#define USER_MAC_STR_PREFIX L"MAC:"
|
||||
#define USER_IPV4_STR_PREFIX L"IPv4:"
|
||||
|
||||
// Policy item
|
||||
struct POLICY_ITEM
|
||||
{
|
||||
UINT Index;
|
||||
bool TypeInt;
|
||||
bool AllowZero;
|
||||
UINT MinValue;
|
||||
UINT MaxValue;
|
||||
UINT DefaultValue;
|
||||
char *FormatStr;
|
||||
};
|
||||
|
||||
// Policy
|
||||
struct POLICY
|
||||
{
|
||||
// For Ver 2.0
|
||||
bool Access; // Grant access
|
||||
bool DHCPFilter; // Filter DHCP packets (IPv4)
|
||||
bool DHCPNoServer; // Prohibit the behavior of the DHCP server (IPv4)
|
||||
bool DHCPForce; // Force DHCP-assigned IP address (IPv4)
|
||||
bool NoBridge; // Prohibit the bridge behavior
|
||||
bool NoRouting; // Prohibit the router behavior (IPv4)
|
||||
bool CheckMac; // Prohibit the duplicate MAC address
|
||||
bool CheckIP; // Prohibit a duplicate IP address (IPv4)
|
||||
bool ArpDhcpOnly; // Prohibit the broadcast other than ARP, DHCP, ICMPv6
|
||||
bool PrivacyFilter; // Privacy filter mode
|
||||
bool NoServer; // Prohibit to operate as a TCP/IP server (IPv4)
|
||||
bool NoBroadcastLimiter; // Not to limit the number of broadcast
|
||||
bool MonitorPort; // Allow monitoring mode
|
||||
UINT MaxConnection; // Maximum number of TCP connections
|
||||
UINT TimeOut; // Communication time-out period
|
||||
UINT MaxMac; // Maximum number of MAC address
|
||||
UINT MaxIP; // Maximum number of IP address (IPv4)
|
||||
UINT MaxUpload; // Upload bandwidth
|
||||
UINT MaxDownload; // Download bandwidth
|
||||
bool FixPassword; // User can not change password
|
||||
UINT MultiLogins; // Multiple logins limit
|
||||
bool NoQoS; // Prohibit the use of VoIP / QoS features
|
||||
|
||||
// For Ver 3.0
|
||||
bool RSandRAFilter; // Filter the Router Solicitation / Advertising packet (IPv6)
|
||||
bool RAFilter; // Filter the router advertisement packet (IPv6)
|
||||
bool DHCPv6Filter; // Filter DHCP packets (IPv6)
|
||||
bool DHCPv6NoServer; // Prohibit the behavior of the DHCP server (IPv6)
|
||||
bool NoRoutingV6; // Prohibit the router behavior (IPv6)
|
||||
bool CheckIPv6; // Prohibit the duplicate IP address (IPv6)
|
||||
bool NoServerV6; // Prohibit to operate as a TCP/IP server (IPv6)
|
||||
UINT MaxIPv6; // Maximum number of IP address (IPv6)
|
||||
bool NoSavePassword; // Prohibit to save the password in the VPN Client
|
||||
UINT AutoDisconnect; // Disconnect the VPN Client automatically at a certain period of time
|
||||
bool FilterIPv4; // Filter all IPv4 packets
|
||||
bool FilterIPv6; // Filter all IPv6 packets
|
||||
bool FilterNonIP; // Filter all non-IP packets
|
||||
bool NoIPv6DefaultRouterInRA; // Delete the default router specification from the IPv6 router advertisement
|
||||
bool NoIPv6DefaultRouterInRAWhenIPv6; // Delete the default router specification from the IPv6 router advertisement (Enable IPv6 connection)
|
||||
UINT VLanId; // Specify the VLAN ID
|
||||
|
||||
bool Ver3; // Whether version 3.0
|
||||
};
|
||||
|
||||
// Group
|
||||
struct USERGROUP
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
char *Name; // Group name
|
||||
wchar_t *RealName; // Display name
|
||||
wchar_t *Note; // Note
|
||||
POLICY *Policy; // Policy
|
||||
TRAFFIC *Traffic; // Traffic data
|
||||
};
|
||||
|
||||
// User
|
||||
struct USER
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
char *Name; // User name
|
||||
wchar_t *RealName; // Real name
|
||||
wchar_t *Note; // Note
|
||||
char *GroupName; // Group name
|
||||
USERGROUP *Group; // Group
|
||||
UINT AuthType; // Authentication type
|
||||
void *AuthData; // Authentication data
|
||||
UINT64 CreatedTime; // Creation date and time
|
||||
UINT64 UpdatedTime; // Updating date
|
||||
UINT64 ExpireTime; // Expiration date
|
||||
UINT64 LastLoginTime; // Last login time
|
||||
UINT NumLogin; // Total number of logins
|
||||
POLICY *Policy; // Policy
|
||||
TRAFFIC *Traffic; // Traffic data
|
||||
};
|
||||
|
||||
// Password authentication data
|
||||
struct AUTHPASSWORD
|
||||
{
|
||||
UCHAR HashedKey[SHA1_SIZE]; // Hashed passwords
|
||||
UCHAR NtLmSecureHash[MD5_SIZE]; // Encrypted password for the NTLM
|
||||
};
|
||||
|
||||
// User certificate authentication data
|
||||
struct AUTHUSERCERT
|
||||
{
|
||||
X *UserX; // X509 certificate for the user
|
||||
};
|
||||
|
||||
// Root certification authority authentication data
|
||||
struct AUTHROOTCERT
|
||||
{
|
||||
X_SERIAL *Serial; // Serial number
|
||||
wchar_t *CommonName; // CommonName
|
||||
};
|
||||
|
||||
// Radius authentication data
|
||||
struct AUTHRADIUS
|
||||
{
|
||||
wchar_t *RadiusUsername; // User name in the Radius
|
||||
};
|
||||
|
||||
// Windows NT authentication data
|
||||
struct AUTHNT
|
||||
{
|
||||
wchar_t *NtUsername; // User name on NT
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Macro
|
||||
#define POLICY_CURRENT_VERSION 3
|
||||
#define NUM_POLICY_ITEM ((sizeof(POLICY) / sizeof(UINT)) - 1)
|
||||
#define NUM_POLICY_ITEM_FOR_VER2 22
|
||||
#define NUM_POLICY_ITEM_FOR_VER3 38
|
||||
|
||||
#define IS_POLICY_FOR_VER2(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER2))
|
||||
#define IS_POLICY_FOR_VER3(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER3))
|
||||
|
||||
#define IS_POLICY_FOR_CURRENT_VER(index, ver) ((ver) >= 3 ? IS_POLICY_FOR_VER3(index) : IS_POLICY_FOR_VER2(index))
|
||||
|
||||
#define POLICY_BOOL(p, i) (((bool *)(p))[(i)])
|
||||
#define POLICY_INT(p, i) (((UINT *)(p))[(i)])
|
||||
|
||||
extern POLICY_ITEM policy_item[];
|
||||
|
||||
|
||||
|
||||
|
||||
// Function prototype
|
||||
int CompareUserName(void *p1, void *p2);
|
||||
int CompareGroupName(void *p1, void *p2);
|
||||
void AcLock(HUB *h);
|
||||
void AcUnlock(HUB *h);
|
||||
USERGROUP *NewGroup(char *name, wchar_t *realname, wchar_t *note);
|
||||
void ReleaseGroup(USERGROUP *g);
|
||||
void CleanupGroup(USERGROUP *g);
|
||||
USER *NewUser(char *name, wchar_t *realname, wchar_t *note, UINT authtype, void *authdata);
|
||||
void ReleaseUser(USER *u);
|
||||
void CleanupUser(USER *u);
|
||||
void FreeAuthData(UINT authtype, void *authdata);
|
||||
bool AcAddUser(HUB *h, USER *u);
|
||||
bool AcAddGroup(HUB *h, USERGROUP *g);
|
||||
USER *AcGetUser(HUB *h, char *name);
|
||||
USERGROUP *AcGetGroup(HUB *h, char *name);
|
||||
bool AcIsUser(HUB *h, char *name);
|
||||
bool AcIsGroup(HUB *h, char *name);
|
||||
bool AcDeleteUser(HUB *h, char *name);
|
||||
bool AcDeleteGroup(HUB *h, char *name);
|
||||
void JoinUserToGroup(USER *u, USERGROUP *g);
|
||||
void SetUserTraffic(USER *u, TRAFFIC *t);
|
||||
void SetGroupTraffic(USERGROUP *g, TRAFFIC *t);
|
||||
void SetUserAuthData(USER *u, UINT authtype, void *authdata);
|
||||
void *NewPasswordAuthData(char *username, char *password);
|
||||
void *NewPasswordAuthDataRaw(UCHAR *hashed_password, UCHAR *ntlm_secure_hash);
|
||||
void *NewUserCertAuthData(X *x);
|
||||
void *NewRootCertAuthData(X_SERIAL *serial, wchar_t *common_name);
|
||||
void *NewRadiusAuthData(wchar_t *username);
|
||||
void *NewNTAuthData(wchar_t *username);
|
||||
void HashPassword(void *dst, char *username, char *password);
|
||||
POLICY *GetDefaultPolicy();
|
||||
POLICY *ClonePolicy(POLICY *policy);
|
||||
void SetUserPolicy(USER *u, POLICY *policy);
|
||||
void OverwritePolicy(POLICY **target, POLICY *p);
|
||||
void SetGroupPolicy(USERGROUP *g, POLICY *policy);
|
||||
POLICY *GetGroupPolicy(USERGROUP *g);
|
||||
wchar_t *GetPolicyTitle(UINT id);
|
||||
wchar_t *GetPolicyDescription(UINT id);
|
||||
bool IsUserName(char *name);
|
||||
void *CopyAuthData(void *authdata, UINT authtype);
|
||||
UINT PolicyNum();
|
||||
bool PolicyIsSupportedForCascade(UINT i);
|
||||
UINT PolicyStrToId(char *name);
|
||||
char *PolicyIdToStr(UINT i);
|
||||
POLICY_ITEM *GetPolicyItem(UINT id);
|
||||
void GetPolicyValueRangeStr(wchar_t *str, UINT size, UINT id);
|
||||
void FormatPolicyValue(wchar_t *str, UINT size, UINT id, UINT value);
|
||||
bool GetUserMacAddressFromUserNote(UCHAR *mac, wchar_t *note);
|
||||
UINT GetUserIPv4AddressFromUserNote32(wchar_t *note);
|
||||
|
||||
#endif // ACCOUNT_H
|
||||
|
31010
src/Cedar/Admin.c
31010
src/Cedar/Admin.c
File diff suppressed because it is too large
Load Diff
2984
src/Cedar/Admin.h
2984
src/Cedar/Admin.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,68 +1,68 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// AzureClient.h
|
||||
// Header of AzureClient.c
|
||||
|
||||
#ifndef AZURE_CLIENT_H
|
||||
#define AZURE_CLIENT_H
|
||||
|
||||
// Constants
|
||||
#define AZURE_SERVER_PORT 443
|
||||
#define AZURE_PROTOCOL_CONTROL_SIGNATURE "ACTL"
|
||||
#define AZURE_PROTOCOL_DATA_SIANGTURE "AZURE_CONNECT_SIGNATURE!"
|
||||
#define AZURE_PROTOCOL_CONTROL_TIMEOUT_DEFAULT (5 * 1000) // Default timeout
|
||||
#define AZURE_CONNECT_INITIAL_RETRY_INTERVAL (1 * 1000) // Initial re-connection interval (15 * 1000)
|
||||
#define AZURE_CONNECT_MAX_RETRY_INTERVAL (60 * 60 * 1000) // Maximum re-connection interval
|
||||
|
||||
#define AZURE_DOMAIN_SUFFIX ".vpnazure.net"
|
||||
|
||||
#define AZURE_SERVER_MAX_KEEPALIVE (5 * 60 * 1000)
|
||||
#define AZURE_SERVER_MAX_TIMEOUT (10 * 60 * 1000)
|
||||
|
||||
#define AZURE_VIA_PROXY_TIMEOUT 5000
|
||||
|
||||
|
||||
// Communications parameter
|
||||
struct AZURE_PARAM
|
||||
{
|
||||
UINT ControlKeepAlive;
|
||||
UINT ControlTimeout;
|
||||
UINT DataTimeout;
|
||||
UINT SslTimeout;
|
||||
};
|
||||
|
||||
// VPN Azure Client
|
||||
struct AZURE_CLIENT
|
||||
{
|
||||
CEDAR *Cedar;
|
||||
SERVER *Server;
|
||||
LOCK *Lock;
|
||||
DDNS_CLIENT_STATUS DDnsStatus;
|
||||
volatile bool IsEnabled;
|
||||
EVENT *Event;
|
||||
volatile bool Halt;
|
||||
THREAD *MainThread;
|
||||
volatile UINT IpStatusRevision;
|
||||
DDNS_CLIENT_STATUS DDnsStatusCopy;
|
||||
SOCK *CurrentSock;
|
||||
char ConnectingAzureIp[MAX_SIZE];
|
||||
AZURE_PARAM AzureParam;
|
||||
volatile UINT DDnsTriggerInt;
|
||||
volatile bool IsConnected;
|
||||
};
|
||||
|
||||
|
||||
// Function prototype
|
||||
AZURE_CLIENT *NewAzureClient(CEDAR *cedar, SERVER *server);
|
||||
void FreeAzureClient(AZURE_CLIENT *ac);
|
||||
void AcApplyCurrentConfig(AZURE_CLIENT *ac, DDNS_CLIENT_STATUS *ddns_status);
|
||||
void AcMainThread(THREAD *thread, void *param);
|
||||
void AcSetEnable(AZURE_CLIENT *ac, bool enabled);
|
||||
void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param);
|
||||
|
||||
|
||||
#endif // AZURE_CLIENT_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// AzureClient.h
|
||||
// Header of AzureClient.c
|
||||
|
||||
#ifndef AZURE_CLIENT_H
|
||||
#define AZURE_CLIENT_H
|
||||
|
||||
// Constants
|
||||
#define AZURE_SERVER_PORT 443
|
||||
#define AZURE_PROTOCOL_CONTROL_SIGNATURE "ACTL"
|
||||
#define AZURE_PROTOCOL_DATA_SIANGTURE "AZURE_CONNECT_SIGNATURE!"
|
||||
#define AZURE_PROTOCOL_CONTROL_TIMEOUT_DEFAULT (5 * 1000) // Default timeout
|
||||
#define AZURE_CONNECT_INITIAL_RETRY_INTERVAL (1 * 1000) // Initial re-connection interval (15 * 1000)
|
||||
#define AZURE_CONNECT_MAX_RETRY_INTERVAL (60 * 60 * 1000) // Maximum re-connection interval
|
||||
|
||||
#define AZURE_DOMAIN_SUFFIX ".vpnazure.net"
|
||||
|
||||
#define AZURE_SERVER_MAX_KEEPALIVE (5 * 60 * 1000)
|
||||
#define AZURE_SERVER_MAX_TIMEOUT (10 * 60 * 1000)
|
||||
|
||||
#define AZURE_VIA_PROXY_TIMEOUT 5000
|
||||
|
||||
|
||||
// Communications parameter
|
||||
struct AZURE_PARAM
|
||||
{
|
||||
UINT ControlKeepAlive;
|
||||
UINT ControlTimeout;
|
||||
UINT DataTimeout;
|
||||
UINT SslTimeout;
|
||||
};
|
||||
|
||||
// VPN Azure Client
|
||||
struct AZURE_CLIENT
|
||||
{
|
||||
CEDAR *Cedar;
|
||||
SERVER *Server;
|
||||
LOCK *Lock;
|
||||
DDNS_CLIENT_STATUS DDnsStatus;
|
||||
volatile bool IsEnabled;
|
||||
EVENT *Event;
|
||||
volatile bool Halt;
|
||||
THREAD *MainThread;
|
||||
volatile UINT IpStatusRevision;
|
||||
DDNS_CLIENT_STATUS DDnsStatusCopy;
|
||||
SOCK *CurrentSock;
|
||||
char ConnectingAzureIp[MAX_SIZE];
|
||||
AZURE_PARAM AzureParam;
|
||||
volatile UINT DDnsTriggerInt;
|
||||
volatile bool IsConnected;
|
||||
};
|
||||
|
||||
|
||||
// Function prototype
|
||||
AZURE_CLIENT *NewAzureClient(CEDAR *cedar, SERVER *server);
|
||||
void FreeAzureClient(AZURE_CLIENT *ac);
|
||||
void AcApplyCurrentConfig(AZURE_CLIENT *ac, DDNS_CLIENT_STATUS *ddns_status);
|
||||
void AcMainThread(THREAD *thread, void *param);
|
||||
void AcSetEnable(AZURE_CLIENT *ac, bool enabled);
|
||||
void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param);
|
||||
|
||||
|
||||
#endif // AZURE_CLIENT_H
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// AzureServer.c
|
||||
// VPN Azure Server
|
||||
|
||||
#include "CedarPch.h"
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// AzureServer.c
|
||||
// VPN Azure Server
|
||||
|
||||
#include "CedarPch.h"
|
||||
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// AzureServer.h
|
||||
// Header of AzureServer.c
|
||||
|
||||
#ifndef AZURE_SERVER_H
|
||||
#define AZURE_SERVER_H
|
||||
|
||||
|
||||
#endif // AZURE_SERVER_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// AzureServer.h
|
||||
// Header of AzureServer.c
|
||||
|
||||
#ifndef AZURE_SERVER_H
|
||||
#define AZURE_SERVER_H
|
||||
|
||||
|
||||
#endif // AZURE_SERVER_H
|
||||
|
||||
|
||||
|
@ -1,466 +1,466 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Bridge.c
|
||||
// Ethernet Bridge Program (Local Bridge)
|
||||
|
||||
#include <GlobalConst.h>
|
||||
|
||||
#define BRIDGE_C
|
||||
|
||||
#ifdef WIN32
|
||||
#define OS_WIN32
|
||||
#endif
|
||||
|
||||
#ifdef OS_WIN32
|
||||
|
||||
// Win32
|
||||
#include "BridgeWin32.c"
|
||||
|
||||
#else
|
||||
|
||||
// Unix
|
||||
#include "BridgeUnix.c"
|
||||
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Hash the list of current Ethernet devices
|
||||
UINT GetEthDeviceHash()
|
||||
{
|
||||
#ifdef OS_UNIX
|
||||
// UNIX
|
||||
UINT num = 0;
|
||||
UINT i;
|
||||
char tmp[4096];
|
||||
UCHAR hash[SHA1_SIZE];
|
||||
TOKEN_LIST *t = GetEthList();
|
||||
|
||||
tmp[0] = 0;
|
||||
|
||||
if (t != NULL)
|
||||
{
|
||||
num = t->NumTokens;
|
||||
for (i = 0; i < t->NumTokens; i++)
|
||||
{
|
||||
StrCat(tmp, sizeof(tmp), t->Token[i]);
|
||||
}
|
||||
FreeToken(t);
|
||||
}
|
||||
|
||||
Sha0(hash, tmp, StrLen(tmp));
|
||||
|
||||
Copy(&num, hash, sizeof(UINT));
|
||||
|
||||
return num;
|
||||
#else // OS_UNIX
|
||||
// Win32
|
||||
UINT ret = 0;
|
||||
MS_ADAPTER_LIST *a = MsCreateAdapterListEx(true);
|
||||
UINT num;
|
||||
UINT i;
|
||||
char tmp[4096];
|
||||
UCHAR hash[SHA1_SIZE];
|
||||
|
||||
tmp[0] = 0;
|
||||
if (a != NULL)
|
||||
{
|
||||
for (i = 0;i < a->Num;i++)
|
||||
{
|
||||
StrCat(tmp, sizeof(tmp), a->Adapters[i]->Title);
|
||||
}
|
||||
}
|
||||
MsFreeAdapterList(a);
|
||||
|
||||
Sha0(hash, tmp, StrLen(tmp));
|
||||
|
||||
Copy(&num, hash, sizeof(UINT));
|
||||
|
||||
return num;
|
||||
#endif // OS_UNIX
|
||||
}
|
||||
|
||||
// Get whether WinPcap is needed
|
||||
bool IsNeedWinPcap()
|
||||
{
|
||||
if (IsBridgeSupported() == false)
|
||||
{
|
||||
// Not in Windows
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows
|
||||
if (IsEthSupported())
|
||||
{
|
||||
// Already success to access the Ethernet device
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Failed to access the Ethernet device
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get whether the local-bridging is supported by current OS
|
||||
bool IsBridgeSupported()
|
||||
{
|
||||
UINT type = GetOsInfo()->OsType;
|
||||
|
||||
if (OS_IS_WINDOWS(type))
|
||||
{
|
||||
if (IsEthSupported())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
#ifdef OS_WIN32
|
||||
ret = MsIsAdmin();
|
||||
#endif // OS_WIN32
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return IsEthSupported();
|
||||
}
|
||||
}
|
||||
|
||||
// Delete a local-bridge
|
||||
bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename)
|
||||
{
|
||||
bool ret = false;
|
||||
// Validate arguments
|
||||
if (c == NULL || hubname == NULL || devicename == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LockList(c->HubList);
|
||||
{
|
||||
LockList(c->LocalBridgeList);
|
||||
{
|
||||
UINT i;
|
||||
|
||||
for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++)
|
||||
{
|
||||
LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i);
|
||||
|
||||
if (StrCmpi(br->HubName, hubname) == 0)
|
||||
{
|
||||
if (StrCmpi(br->DeviceName, devicename) == 0)
|
||||
{
|
||||
if (br->Bridge != NULL)
|
||||
{
|
||||
BrFreeBridge(br->Bridge);
|
||||
br->Bridge = NULL;
|
||||
}
|
||||
|
||||
Delete(c->LocalBridgeList, br);
|
||||
Free(br);
|
||||
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UnlockList(c->LocalBridgeList);
|
||||
}
|
||||
UnlockList(c->HubList);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Add a local-bridge
|
||||
void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast)
|
||||
{
|
||||
UINT i;
|
||||
HUB *h = NULL;
|
||||
LOCALBRIDGE *br = NULL;
|
||||
// Validate arguments
|
||||
if (c == NULL || hubname == NULL || devicename == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (OS_IS_UNIX(GetOsInfo()->OsType) == false)
|
||||
{
|
||||
tapmode = false;
|
||||
}
|
||||
|
||||
LockList(c->HubList);
|
||||
{
|
||||
LockList(c->LocalBridgeList);
|
||||
{
|
||||
bool exists = false;
|
||||
|
||||
// Ensure that the same configuration local-bridge doesn't exist already
|
||||
for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++)
|
||||
{
|
||||
LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i);
|
||||
if (StrCmpi(br->DeviceName, devicename) == 0)
|
||||
{
|
||||
if (StrCmpi(br->HubName, hubname) == 0)
|
||||
{
|
||||
if (br->TapMode == tapmode)
|
||||
{
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exists == false)
|
||||
{
|
||||
// Add configuration
|
||||
br = ZeroMalloc(sizeof(LOCALBRIDGE));
|
||||
StrCpy(br->HubName, sizeof(br->HubName), hubname);
|
||||
StrCpy(br->DeviceName, sizeof(br->DeviceName), devicename);
|
||||
br->Bridge = NULL;
|
||||
br->Local = local;
|
||||
br->TapMode = tapmode;
|
||||
br->LimitBroadcast = limit_broadcast;
|
||||
br->Monitor = monitor;
|
||||
if (br->TapMode)
|
||||
{
|
||||
if (tapaddr != NULL && IsZero(tapaddr, 6) == false)
|
||||
{
|
||||
Copy(br->TapMacAddress, tapaddr, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
GenMacAddress(br->TapMacAddress);
|
||||
}
|
||||
}
|
||||
|
||||
Add(c->LocalBridgeList, br);
|
||||
|
||||
// Find the hub
|
||||
for (i = 0;i < LIST_NUM(c->HubList);i++)
|
||||
{
|
||||
HUB *hub = LIST_DATA(c->HubList, i);
|
||||
if (StrCmpi(hub->Name, br->HubName) == 0)
|
||||
{
|
||||
h = hub;
|
||||
AddRef(h->ref);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UnlockList(c->LocalBridgeList);
|
||||
}
|
||||
UnlockList(c->HubList);
|
||||
|
||||
// Start the local-bridge immediately
|
||||
if (h != NULL && br != NULL && h->Type != HUB_TYPE_FARM_DYNAMIC)
|
||||
{
|
||||
Lock(h->lock_online);
|
||||
{
|
||||
if (h->Offline == false)
|
||||
{
|
||||
LockList(c->LocalBridgeList);
|
||||
{
|
||||
if (IsInList(c->LocalBridgeList, br))
|
||||
{
|
||||
if (br->Bridge == NULL)
|
||||
{
|
||||
br->Bridge = BrNewBridge(h, br->DeviceName, NULL, br->Local, br->Monitor, br->TapMode, br->TapMacAddress, br->LimitBroadcast, br);
|
||||
}
|
||||
}
|
||||
}
|
||||
UnlockList(c->LocalBridgeList);
|
||||
}
|
||||
}
|
||||
Unlock(h->lock_online);
|
||||
}
|
||||
|
||||
ReleaseHub(h);
|
||||
}
|
||||
|
||||
// Initialize the local-bridge list
|
||||
void InitLocalBridgeList(CEDAR *c)
|
||||
{
|
||||
// Validate arguments
|
||||
if (c == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
c->LocalBridgeList = NewList(NULL);
|
||||
}
|
||||
|
||||
// Free the local-bridge list
|
||||
void FreeLocalBridgeList(CEDAR *c)
|
||||
{
|
||||
UINT i;
|
||||
// Validate arguments
|
||||
if (c == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++)
|
||||
{
|
||||
LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i);
|
||||
Free(br);
|
||||
}
|
||||
|
||||
ReleaseList(c->LocalBridgeList);
|
||||
c->LocalBridgeList = NULL;
|
||||
}
|
||||
|
||||
// Bridging thread
|
||||
void BrBridgeThread(THREAD *thread, void *param)
|
||||
{
|
||||
BRIDGE *b;
|
||||
CONNECTION *c;
|
||||
SESSION *s;
|
||||
HUB *h;
|
||||
char name[MAX_SIZE];
|
||||
// Validate arguments
|
||||
if (thread == NULL || param == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
b = (BRIDGE *)param;
|
||||
|
||||
// Create a connection object
|
||||
c = NewServerConnection(b->Cedar, NULL, thread);
|
||||
c->Protocol = CONNECTION_HUB_BRIDGE;
|
||||
|
||||
// Create a session object
|
||||
s = NewServerSession(b->Cedar, c, b->Hub, BRIDGE_USER_NAME, b->Policy);
|
||||
HLog(b->Hub, "LH_START_BRIDGE", b->Name, s->Name);
|
||||
StrCpy(name, sizeof(name), b->Name);
|
||||
h = b->Hub;
|
||||
AddRef(h->ref);
|
||||
s->BridgeMode = true;
|
||||
s->Bridge = b;
|
||||
c->Session = s;
|
||||
ReleaseConnection(c);
|
||||
|
||||
// Dummy user name for local-bridge
|
||||
s->Username = CopyStr(BRIDGE_USER_NAME_PRINT);
|
||||
|
||||
b->Session = s;
|
||||
AddRef(s->ref);
|
||||
|
||||
// Notify completion
|
||||
NoticeThreadInit(thread);
|
||||
|
||||
// Main procedure of the session
|
||||
Debug("Bridge %s Start.\n", b->Name);
|
||||
SessionMain(s);
|
||||
Debug("Bridge %s Stop.\n", b->Name);
|
||||
|
||||
HLog(h, "LH_STOP_BRIDGE", name);
|
||||
|
||||
ReleaseHub(h);
|
||||
|
||||
ReleaseSession(s);
|
||||
}
|
||||
|
||||
// Free the local-bridge object
|
||||
void BrFreeBridge(BRIDGE *b)
|
||||
{
|
||||
// Validate arguments
|
||||
if (b == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (b->ParentLocalBridge != NULL)
|
||||
{
|
||||
b->ParentLocalBridge = NULL;
|
||||
}
|
||||
|
||||
// Stop session thread
|
||||
StopSession(b->Session);
|
||||
ReleaseSession(b->Session);
|
||||
|
||||
Free(b);
|
||||
}
|
||||
|
||||
// Create new local-bridge
|
||||
BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast, LOCALBRIDGE *parent_local_bridge)
|
||||
{
|
||||
BRIDGE *b;
|
||||
POLICY *policy;
|
||||
THREAD *t;
|
||||
// Validate arguments
|
||||
if (h == NULL || name == NULL || parent_local_bridge == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
policy = ClonePolicy(GetDefaultPolicy());
|
||||
}
|
||||
else
|
||||
{
|
||||
policy = ClonePolicy(p);
|
||||
}
|
||||
|
||||
b = ZeroMalloc(sizeof(BRIDGE));
|
||||
b->Cedar = h->Cedar;
|
||||
b->Hub = h;
|
||||
StrCpy(b->Name, sizeof(b->Name), name);
|
||||
b->Policy = policy;
|
||||
b->Local = local;
|
||||
b->Monitor = monitor;
|
||||
b->TapMode = tapmode;
|
||||
b->LimitBroadcast = limit_broadcast;
|
||||
b->ParentLocalBridge = parent_local_bridge;
|
||||
|
||||
if (b->TapMode)
|
||||
{
|
||||
if (tapaddr != NULL && IsZero(tapaddr, 6) == false)
|
||||
{
|
||||
Copy(b->TapMacAddress, tapaddr, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
GenMacAddress(b->TapMacAddress);
|
||||
}
|
||||
}
|
||||
|
||||
if (monitor)
|
||||
{
|
||||
// Enabling monitoring mode
|
||||
policy->MonitorPort = true;
|
||||
}
|
||||
|
||||
if (b->LimitBroadcast == false)
|
||||
{
|
||||
// Disable broadcast limiter
|
||||
policy->NoBroadcastLimiter = true;
|
||||
}
|
||||
|
||||
// Start thread
|
||||
t = NewThread(BrBridgeThread, b);
|
||||
WaitThreadInit(t);
|
||||
ReleaseThread(t);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
// Raw IP bridge is supported only on Linux
|
||||
bool IsRawIpBridgeSupported()
|
||||
{
|
||||
#ifdef UNIX_LINUX
|
||||
return true;
|
||||
#else // UNIX_LINUX
|
||||
return false;
|
||||
#endif // UNIX_LINUX
|
||||
}
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Bridge.c
|
||||
// Ethernet Bridge Program (Local Bridge)
|
||||
|
||||
#include <GlobalConst.h>
|
||||
|
||||
#define BRIDGE_C
|
||||
|
||||
#ifdef WIN32
|
||||
#define OS_WIN32
|
||||
#endif
|
||||
|
||||
#ifdef OS_WIN32
|
||||
|
||||
// Win32
|
||||
#include "BridgeWin32.c"
|
||||
|
||||
#else
|
||||
|
||||
// Unix
|
||||
#include "BridgeUnix.c"
|
||||
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Hash the list of current Ethernet devices
|
||||
UINT GetEthDeviceHash()
|
||||
{
|
||||
#ifdef OS_UNIX
|
||||
// UNIX
|
||||
UINT num = 0;
|
||||
UINT i;
|
||||
char tmp[4096];
|
||||
UCHAR hash[SHA1_SIZE];
|
||||
TOKEN_LIST *t = GetEthList();
|
||||
|
||||
tmp[0] = 0;
|
||||
|
||||
if (t != NULL)
|
||||
{
|
||||
num = t->NumTokens;
|
||||
for (i = 0; i < t->NumTokens; i++)
|
||||
{
|
||||
StrCat(tmp, sizeof(tmp), t->Token[i]);
|
||||
}
|
||||
FreeToken(t);
|
||||
}
|
||||
|
||||
Sha0(hash, tmp, StrLen(tmp));
|
||||
|
||||
Copy(&num, hash, sizeof(UINT));
|
||||
|
||||
return num;
|
||||
#else // OS_UNIX
|
||||
// Win32
|
||||
UINT ret = 0;
|
||||
MS_ADAPTER_LIST *a = MsCreateAdapterListEx(true);
|
||||
UINT num;
|
||||
UINT i;
|
||||
char tmp[4096];
|
||||
UCHAR hash[SHA1_SIZE];
|
||||
|
||||
tmp[0] = 0;
|
||||
if (a != NULL)
|
||||
{
|
||||
for (i = 0;i < a->Num;i++)
|
||||
{
|
||||
StrCat(tmp, sizeof(tmp), a->Adapters[i]->Title);
|
||||
}
|
||||
}
|
||||
MsFreeAdapterList(a);
|
||||
|
||||
Sha0(hash, tmp, StrLen(tmp));
|
||||
|
||||
Copy(&num, hash, sizeof(UINT));
|
||||
|
||||
return num;
|
||||
#endif // OS_UNIX
|
||||
}
|
||||
|
||||
// Get whether WinPcap is needed
|
||||
bool IsNeedWinPcap()
|
||||
{
|
||||
if (IsBridgeSupported() == false)
|
||||
{
|
||||
// Not in Windows
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows
|
||||
if (IsEthSupported())
|
||||
{
|
||||
// Already success to access the Ethernet device
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Failed to access the Ethernet device
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get whether the local-bridging is supported by current OS
|
||||
bool IsBridgeSupported()
|
||||
{
|
||||
UINT type = GetOsInfo()->OsType;
|
||||
|
||||
if (OS_IS_WINDOWS(type))
|
||||
{
|
||||
if (IsEthSupported())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
#ifdef OS_WIN32
|
||||
ret = MsIsAdmin();
|
||||
#endif // OS_WIN32
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return IsEthSupported();
|
||||
}
|
||||
}
|
||||
|
||||
// Delete a local-bridge
|
||||
bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename)
|
||||
{
|
||||
bool ret = false;
|
||||
// Validate arguments
|
||||
if (c == NULL || hubname == NULL || devicename == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LockList(c->HubList);
|
||||
{
|
||||
LockList(c->LocalBridgeList);
|
||||
{
|
||||
UINT i;
|
||||
|
||||
for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++)
|
||||
{
|
||||
LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i);
|
||||
|
||||
if (StrCmpi(br->HubName, hubname) == 0)
|
||||
{
|
||||
if (StrCmpi(br->DeviceName, devicename) == 0)
|
||||
{
|
||||
if (br->Bridge != NULL)
|
||||
{
|
||||
BrFreeBridge(br->Bridge);
|
||||
br->Bridge = NULL;
|
||||
}
|
||||
|
||||
Delete(c->LocalBridgeList, br);
|
||||
Free(br);
|
||||
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UnlockList(c->LocalBridgeList);
|
||||
}
|
||||
UnlockList(c->HubList);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Add a local-bridge
|
||||
void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast)
|
||||
{
|
||||
UINT i;
|
||||
HUB *h = NULL;
|
||||
LOCALBRIDGE *br = NULL;
|
||||
// Validate arguments
|
||||
if (c == NULL || hubname == NULL || devicename == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (OS_IS_UNIX(GetOsInfo()->OsType) == false)
|
||||
{
|
||||
tapmode = false;
|
||||
}
|
||||
|
||||
LockList(c->HubList);
|
||||
{
|
||||
LockList(c->LocalBridgeList);
|
||||
{
|
||||
bool exists = false;
|
||||
|
||||
// Ensure that the same configuration local-bridge doesn't exist already
|
||||
for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++)
|
||||
{
|
||||
LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i);
|
||||
if (StrCmpi(br->DeviceName, devicename) == 0)
|
||||
{
|
||||
if (StrCmpi(br->HubName, hubname) == 0)
|
||||
{
|
||||
if (br->TapMode == tapmode)
|
||||
{
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exists == false)
|
||||
{
|
||||
// Add configuration
|
||||
br = ZeroMalloc(sizeof(LOCALBRIDGE));
|
||||
StrCpy(br->HubName, sizeof(br->HubName), hubname);
|
||||
StrCpy(br->DeviceName, sizeof(br->DeviceName), devicename);
|
||||
br->Bridge = NULL;
|
||||
br->Local = local;
|
||||
br->TapMode = tapmode;
|
||||
br->LimitBroadcast = limit_broadcast;
|
||||
br->Monitor = monitor;
|
||||
if (br->TapMode)
|
||||
{
|
||||
if (tapaddr != NULL && IsZero(tapaddr, 6) == false)
|
||||
{
|
||||
Copy(br->TapMacAddress, tapaddr, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
GenMacAddress(br->TapMacAddress);
|
||||
}
|
||||
}
|
||||
|
||||
Add(c->LocalBridgeList, br);
|
||||
|
||||
// Find the hub
|
||||
for (i = 0;i < LIST_NUM(c->HubList);i++)
|
||||
{
|
||||
HUB *hub = LIST_DATA(c->HubList, i);
|
||||
if (StrCmpi(hub->Name, br->HubName) == 0)
|
||||
{
|
||||
h = hub;
|
||||
AddRef(h->ref);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UnlockList(c->LocalBridgeList);
|
||||
}
|
||||
UnlockList(c->HubList);
|
||||
|
||||
// Start the local-bridge immediately
|
||||
if (h != NULL && br != NULL && h->Type != HUB_TYPE_FARM_DYNAMIC)
|
||||
{
|
||||
Lock(h->lock_online);
|
||||
{
|
||||
if (h->Offline == false)
|
||||
{
|
||||
LockList(c->LocalBridgeList);
|
||||
{
|
||||
if (IsInList(c->LocalBridgeList, br))
|
||||
{
|
||||
if (br->Bridge == NULL)
|
||||
{
|
||||
br->Bridge = BrNewBridge(h, br->DeviceName, NULL, br->Local, br->Monitor, br->TapMode, br->TapMacAddress, br->LimitBroadcast, br);
|
||||
}
|
||||
}
|
||||
}
|
||||
UnlockList(c->LocalBridgeList);
|
||||
}
|
||||
}
|
||||
Unlock(h->lock_online);
|
||||
}
|
||||
|
||||
ReleaseHub(h);
|
||||
}
|
||||
|
||||
// Initialize the local-bridge list
|
||||
void InitLocalBridgeList(CEDAR *c)
|
||||
{
|
||||
// Validate arguments
|
||||
if (c == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
c->LocalBridgeList = NewList(NULL);
|
||||
}
|
||||
|
||||
// Free the local-bridge list
|
||||
void FreeLocalBridgeList(CEDAR *c)
|
||||
{
|
||||
UINT i;
|
||||
// Validate arguments
|
||||
if (c == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++)
|
||||
{
|
||||
LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i);
|
||||
Free(br);
|
||||
}
|
||||
|
||||
ReleaseList(c->LocalBridgeList);
|
||||
c->LocalBridgeList = NULL;
|
||||
}
|
||||
|
||||
// Bridging thread
|
||||
void BrBridgeThread(THREAD *thread, void *param)
|
||||
{
|
||||
BRIDGE *b;
|
||||
CONNECTION *c;
|
||||
SESSION *s;
|
||||
HUB *h;
|
||||
char name[MAX_SIZE];
|
||||
// Validate arguments
|
||||
if (thread == NULL || param == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
b = (BRIDGE *)param;
|
||||
|
||||
// Create a connection object
|
||||
c = NewServerConnection(b->Cedar, NULL, thread);
|
||||
c->Protocol = CONNECTION_HUB_BRIDGE;
|
||||
|
||||
// Create a session object
|
||||
s = NewServerSession(b->Cedar, c, b->Hub, BRIDGE_USER_NAME, b->Policy);
|
||||
HLog(b->Hub, "LH_START_BRIDGE", b->Name, s->Name);
|
||||
StrCpy(name, sizeof(name), b->Name);
|
||||
h = b->Hub;
|
||||
AddRef(h->ref);
|
||||
s->BridgeMode = true;
|
||||
s->Bridge = b;
|
||||
c->Session = s;
|
||||
ReleaseConnection(c);
|
||||
|
||||
// Dummy user name for local-bridge
|
||||
s->Username = CopyStr(BRIDGE_USER_NAME_PRINT);
|
||||
|
||||
b->Session = s;
|
||||
AddRef(s->ref);
|
||||
|
||||
// Notify completion
|
||||
NoticeThreadInit(thread);
|
||||
|
||||
// Main procedure of the session
|
||||
Debug("Bridge %s Start.\n", b->Name);
|
||||
SessionMain(s);
|
||||
Debug("Bridge %s Stop.\n", b->Name);
|
||||
|
||||
HLog(h, "LH_STOP_BRIDGE", name);
|
||||
|
||||
ReleaseHub(h);
|
||||
|
||||
ReleaseSession(s);
|
||||
}
|
||||
|
||||
// Free the local-bridge object
|
||||
void BrFreeBridge(BRIDGE *b)
|
||||
{
|
||||
// Validate arguments
|
||||
if (b == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (b->ParentLocalBridge != NULL)
|
||||
{
|
||||
b->ParentLocalBridge = NULL;
|
||||
}
|
||||
|
||||
// Stop session thread
|
||||
StopSession(b->Session);
|
||||
ReleaseSession(b->Session);
|
||||
|
||||
Free(b);
|
||||
}
|
||||
|
||||
// Create new local-bridge
|
||||
BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast, LOCALBRIDGE *parent_local_bridge)
|
||||
{
|
||||
BRIDGE *b;
|
||||
POLICY *policy;
|
||||
THREAD *t;
|
||||
// Validate arguments
|
||||
if (h == NULL || name == NULL || parent_local_bridge == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
policy = ClonePolicy(GetDefaultPolicy());
|
||||
}
|
||||
else
|
||||
{
|
||||
policy = ClonePolicy(p);
|
||||
}
|
||||
|
||||
b = ZeroMalloc(sizeof(BRIDGE));
|
||||
b->Cedar = h->Cedar;
|
||||
b->Hub = h;
|
||||
StrCpy(b->Name, sizeof(b->Name), name);
|
||||
b->Policy = policy;
|
||||
b->Local = local;
|
||||
b->Monitor = monitor;
|
||||
b->TapMode = tapmode;
|
||||
b->LimitBroadcast = limit_broadcast;
|
||||
b->ParentLocalBridge = parent_local_bridge;
|
||||
|
||||
if (b->TapMode)
|
||||
{
|
||||
if (tapaddr != NULL && IsZero(tapaddr, 6) == false)
|
||||
{
|
||||
Copy(b->TapMacAddress, tapaddr, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
GenMacAddress(b->TapMacAddress);
|
||||
}
|
||||
}
|
||||
|
||||
if (monitor)
|
||||
{
|
||||
// Enabling monitoring mode
|
||||
policy->MonitorPort = true;
|
||||
}
|
||||
|
||||
if (b->LimitBroadcast == false)
|
||||
{
|
||||
// Disable broadcast limiter
|
||||
policy->NoBroadcastLimiter = true;
|
||||
}
|
||||
|
||||
// Start thread
|
||||
t = NewThread(BrBridgeThread, b);
|
||||
WaitThreadInit(t);
|
||||
ReleaseThread(t);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
// Raw IP bridge is supported only on Linux
|
||||
bool IsRawIpBridgeSupported()
|
||||
{
|
||||
#ifdef UNIX_LINUX
|
||||
return true;
|
||||
#else // UNIX_LINUX
|
||||
return false;
|
||||
#endif // UNIX_LINUX
|
||||
}
|
||||
|
||||
|
@ -1,76 +1,76 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Bridge.h
|
||||
// Header of Bridge.c
|
||||
|
||||
#ifndef BRIDGE_H
|
||||
#define BRIDGE_H
|
||||
|
||||
#ifdef OS_WIN32
|
||||
|
||||
// For Win32
|
||||
#include <Cedar/BridgeWin32.h>
|
||||
|
||||
#else
|
||||
|
||||
// For Unix
|
||||
#include <Cedar/BridgeUnix.h>
|
||||
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Constants
|
||||
#define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router"
|
||||
|
||||
// Bridge
|
||||
struct BRIDGE
|
||||
{
|
||||
bool Active; // Status
|
||||
CEDAR *Cedar; // Cedar
|
||||
HUB *Hub; // HUB
|
||||
SESSION *Session; // Session
|
||||
POLICY *Policy; // Policy
|
||||
ETH *Eth; // Ethernet
|
||||
char Name[MAX_SIZE]; // Device name
|
||||
UINT64 LastBridgeTry; // Time to try to bridge at last
|
||||
bool Local; // Local mode
|
||||
bool Monitor; // Monitor mode
|
||||
bool TapMode; // Tap mode
|
||||
bool LimitBroadcast; // Broadcasts limiting mode
|
||||
UCHAR TapMacAddress[6]; // MAC address of the tap
|
||||
UINT LastNumDevice; // Number of device (Number of last checked)
|
||||
UINT64 LastNumDeviceCheck; // Time at which to check the number of devices at last
|
||||
UINT64 LastChangeMtuError; // Time that recorded the error to change the MTU at last
|
||||
LOCALBRIDGE *ParentLocalBridge; // Parent Local Bridge
|
||||
};
|
||||
|
||||
// Local bridge
|
||||
struct LOCALBRIDGE
|
||||
{
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
bool Local; // Local mode
|
||||
bool Monitor; // Monitor mode
|
||||
bool TapMode; // Tap mode
|
||||
bool LimitBroadcast; // Broadcast packets limiting mode
|
||||
UCHAR TapMacAddress[6]; // MAC address of the tap
|
||||
BRIDGE *Bridge; // Bridge
|
||||
};
|
||||
|
||||
BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast, LOCALBRIDGE *parent_local_bridge);
|
||||
void BrBridgeThread(THREAD *thread, void *param);
|
||||
void BrFreeBridge(BRIDGE *b);
|
||||
void InitLocalBridgeList(CEDAR *c);
|
||||
void FreeLocalBridgeList(CEDAR *c);
|
||||
void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast);
|
||||
bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename);
|
||||
bool IsBridgeSupported();
|
||||
bool IsNeedWinPcap();
|
||||
UINT GetEthDeviceHash();
|
||||
bool IsRawIpBridgeSupported();
|
||||
|
||||
#endif // BRIDGE_H
|
||||
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Bridge.h
|
||||
// Header of Bridge.c
|
||||
|
||||
#ifndef BRIDGE_H
|
||||
#define BRIDGE_H
|
||||
|
||||
#ifdef OS_WIN32
|
||||
|
||||
// For Win32
|
||||
#include <Cedar/BridgeWin32.h>
|
||||
|
||||
#else
|
||||
|
||||
// For Unix
|
||||
#include <Cedar/BridgeUnix.h>
|
||||
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Constants
|
||||
#define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router"
|
||||
|
||||
// Bridge
|
||||
struct BRIDGE
|
||||
{
|
||||
bool Active; // Status
|
||||
CEDAR *Cedar; // Cedar
|
||||
HUB *Hub; // HUB
|
||||
SESSION *Session; // Session
|
||||
POLICY *Policy; // Policy
|
||||
ETH *Eth; // Ethernet
|
||||
char Name[MAX_SIZE]; // Device name
|
||||
UINT64 LastBridgeTry; // Time to try to bridge at last
|
||||
bool Local; // Local mode
|
||||
bool Monitor; // Monitor mode
|
||||
bool TapMode; // Tap mode
|
||||
bool LimitBroadcast; // Broadcasts limiting mode
|
||||
UCHAR TapMacAddress[6]; // MAC address of the tap
|
||||
UINT LastNumDevice; // Number of device (Number of last checked)
|
||||
UINT64 LastNumDeviceCheck; // Time at which to check the number of devices at last
|
||||
UINT64 LastChangeMtuError; // Time that recorded the error to change the MTU at last
|
||||
LOCALBRIDGE *ParentLocalBridge; // Parent Local Bridge
|
||||
};
|
||||
|
||||
// Local bridge
|
||||
struct LOCALBRIDGE
|
||||
{
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
bool Local; // Local mode
|
||||
bool Monitor; // Monitor mode
|
||||
bool TapMode; // Tap mode
|
||||
bool LimitBroadcast; // Broadcast packets limiting mode
|
||||
UCHAR TapMacAddress[6]; // MAC address of the tap
|
||||
BRIDGE *Bridge; // Bridge
|
||||
};
|
||||
|
||||
BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast, LOCALBRIDGE *parent_local_bridge);
|
||||
void BrBridgeThread(THREAD *thread, void *param);
|
||||
void BrFreeBridge(BRIDGE *b);
|
||||
void InitLocalBridgeList(CEDAR *c);
|
||||
void FreeLocalBridgeList(CEDAR *c);
|
||||
void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast);
|
||||
bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename);
|
||||
bool IsBridgeSupported();
|
||||
bool IsNeedWinPcap();
|
||||
UINT GetEthDeviceHash();
|
||||
bool IsRawIpBridgeSupported();
|
||||
|
||||
#endif // BRIDGE_H
|
||||
|
||||
|
||||
|
||||
|
@ -1,133 +1,133 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// BridgeUnix.h
|
||||
// Header of BridgeUnix.c
|
||||
|
||||
#ifndef BRIDGEUNIX_H
|
||||
#define BRIDGEUNIX_H
|
||||
|
||||
// Macro
|
||||
#ifndef SOL_PACKET
|
||||
#define SOL_PACKET 263
|
||||
#endif
|
||||
#ifndef ifr_newname
|
||||
#define ifr_newname ifr_ifru.ifru_slave
|
||||
#endif
|
||||
|
||||
// Constants
|
||||
#define UNIX_ETH_TMP_BUFFER_SIZE (2000)
|
||||
#define SOLARIS_MAXDLBUF (32768)
|
||||
#define BRIDGE_MAX_QUEUE_SIZE (4096*1500)
|
||||
|
||||
// ETH structure
|
||||
struct ETH
|
||||
{
|
||||
char *Name; // Adapter name
|
||||
char *Title; // Adapter title
|
||||
CANCEL *Cancel; // Cancel object
|
||||
int IfIndex; // Index
|
||||
int Socket; // Socket
|
||||
UINT InitialMtu; // Initial MTU value
|
||||
UINT CurrentMtu; // Current MTU value
|
||||
int SocketBsdIf; // BSD interface operation socket
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
|
||||
#ifdef BRIDGE_PCAP
|
||||
void *Pcap; // Pcap descriptor
|
||||
QUEUE *Queue; // Queue of the relay thread
|
||||
UINT QueueSize; // Number of bytes in Queue
|
||||
THREAD *CaptureThread; // Pcap relay thread
|
||||
#endif // BRIDGE_PCAP
|
||||
|
||||
#ifdef BRIDGE_BPF
|
||||
UINT BufSize; // Buffer size to read the BPF (error for other)
|
||||
#ifdef BRIDGE_BPF_THREAD
|
||||
QUEUE *Queue; // Queue of the relay thread
|
||||
UINT QueueSize; // Number of bytes in Queue
|
||||
THREAD *CaptureThread; // BPF relay thread
|
||||
#else // BRIDGE_BPF_THREAD
|
||||
UCHAR *Buffer; // Buffer to read the BPF
|
||||
UCHAR *Next;
|
||||
int Rest;
|
||||
#endif // BRIDGE_BPF_THREAD
|
||||
#endif // BRIDGE_BPF
|
||||
|
||||
VLAN *Tap; // tap
|
||||
bool Linux_IsAuxDataSupported; // Is PACKET_AUXDATA supported
|
||||
|
||||
bool IsRawIpMode; // RAW IP mode
|
||||
SOCK *RawTcp, *RawUdp, *RawIcmp; // RAW sockets
|
||||
bool RawIp_HasError;
|
||||
UCHAR RawIpMyMacAddr[6];
|
||||
UCHAR RawIpYourMacAddr[6];
|
||||
IP MyIP;
|
||||
IP YourIP;
|
||||
QUEUE *RawIpSendQueue;
|
||||
IP MyPhysicalIP;
|
||||
IP MyPhysicalIPForce;
|
||||
UCHAR *RawIP_TmpBuffer;
|
||||
UINT RawIP_TmpBufferSize;
|
||||
};
|
||||
|
||||
#if defined( BRIDGE_BPF ) || defined( BRIDGE_PCAP )
|
||||
struct CAPTUREBLOCK{
|
||||
UINT Size;
|
||||
UCHAR *Buf;
|
||||
};
|
||||
#endif // BRIDGE_BPF
|
||||
|
||||
|
||||
// Function prototype
|
||||
void InitEth();
|
||||
void FreeEth();
|
||||
bool IsEthSupported();
|
||||
bool IsEthSupportedLinux();
|
||||
bool IsEthSupportedSolaris();
|
||||
bool IsEthSupportedPcap();
|
||||
TOKEN_LIST *GetEthList();
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip);
|
||||
TOKEN_LIST *GetEthListLinux(bool enum_normal, bool enum_rawip);
|
||||
TOKEN_LIST *GetEthListSolaris();
|
||||
TOKEN_LIST *GetEthListPcap();
|
||||
ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
ETH *OpenEthLinux(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
ETH *OpenEthSolaris(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
ETH *OpenEthPcap(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
bool ParseUnixEthDeviceName(char *dst_devname, UINT dst_devname_size, char *src_name);
|
||||
void CloseEth(ETH *e);
|
||||
CANCEL *EthGetCancel(ETH *e);
|
||||
UINT EthGetPacket(ETH *e, void **data);
|
||||
UINT EthGetPacketLinux(ETH *e, void **data);
|
||||
UINT EthGetPacketSolaris(ETH *e, void **data);
|
||||
UINT EthGetPacketPcap(ETH *e, void **data);
|
||||
UINT EthGetPacketBpf(ETH *e, void **data);
|
||||
void EthPutPacket(ETH *e, void *data, UINT size);
|
||||
void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes);
|
||||
UINT EthGetMtu(ETH *e);
|
||||
bool EthSetMtu(ETH *e, UINT mtu);
|
||||
bool EthIsChangeMtuSupported(ETH *e);
|
||||
bool EthGetInterfaceDescriptionUnix(char *name, char *str, UINT size);
|
||||
bool EthIsInterfaceDescriptionSupportedUnix();
|
||||
|
||||
ETH *OpenEthLinuxIpRaw();
|
||||
void CloseEthLinuxIpRaw(ETH *e);
|
||||
UINT EthGetPacketLinuxIpRaw(ETH *e, void **data);
|
||||
UINT EthGetPacketLinuxIpRawForSock(ETH *e, void **data, SOCK *s, UINT proto);
|
||||
void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size);
|
||||
bool EthProcessIpPacketInnerIpRaw(ETH *e, PKT *p);
|
||||
void EthSendIpPacketInnerIpRaw(ETH *e, void *data, UINT size, USHORT protocol);
|
||||
|
||||
#ifdef UNIX_SOLARIS
|
||||
// Function prototype for Solaris
|
||||
bool DlipReceiveAck(int fd);
|
||||
bool DlipPromiscuous(int fd, UINT level);
|
||||
bool DlipBindRequest(int fd);
|
||||
#endif // OS_SOLARIS
|
||||
|
||||
int UnixEthOpenRawSocket();
|
||||
|
||||
#endif // BRIDGEUNIX_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// BridgeUnix.h
|
||||
// Header of BridgeUnix.c
|
||||
|
||||
#ifndef BRIDGEUNIX_H
|
||||
#define BRIDGEUNIX_H
|
||||
|
||||
// Macro
|
||||
#ifndef SOL_PACKET
|
||||
#define SOL_PACKET 263
|
||||
#endif
|
||||
#ifndef ifr_newname
|
||||
#define ifr_newname ifr_ifru.ifru_slave
|
||||
#endif
|
||||
|
||||
// Constants
|
||||
#define UNIX_ETH_TMP_BUFFER_SIZE (2000)
|
||||
#define SOLARIS_MAXDLBUF (32768)
|
||||
#define BRIDGE_MAX_QUEUE_SIZE (4096*1500)
|
||||
|
||||
// ETH structure
|
||||
struct ETH
|
||||
{
|
||||
char *Name; // Adapter name
|
||||
char *Title; // Adapter title
|
||||
CANCEL *Cancel; // Cancel object
|
||||
int IfIndex; // Index
|
||||
int Socket; // Socket
|
||||
UINT InitialMtu; // Initial MTU value
|
||||
UINT CurrentMtu; // Current MTU value
|
||||
int SocketBsdIf; // BSD interface operation socket
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
|
||||
#ifdef BRIDGE_PCAP
|
||||
void *Pcap; // Pcap descriptor
|
||||
QUEUE *Queue; // Queue of the relay thread
|
||||
UINT QueueSize; // Number of bytes in Queue
|
||||
THREAD *CaptureThread; // Pcap relay thread
|
||||
#endif // BRIDGE_PCAP
|
||||
|
||||
#ifdef BRIDGE_BPF
|
||||
UINT BufSize; // Buffer size to read the BPF (error for other)
|
||||
#ifdef BRIDGE_BPF_THREAD
|
||||
QUEUE *Queue; // Queue of the relay thread
|
||||
UINT QueueSize; // Number of bytes in Queue
|
||||
THREAD *CaptureThread; // BPF relay thread
|
||||
#else // BRIDGE_BPF_THREAD
|
||||
UCHAR *Buffer; // Buffer to read the BPF
|
||||
UCHAR *Next;
|
||||
int Rest;
|
||||
#endif // BRIDGE_BPF_THREAD
|
||||
#endif // BRIDGE_BPF
|
||||
|
||||
VLAN *Tap; // tap
|
||||
bool Linux_IsAuxDataSupported; // Is PACKET_AUXDATA supported
|
||||
|
||||
bool IsRawIpMode; // RAW IP mode
|
||||
SOCK *RawTcp, *RawUdp, *RawIcmp; // RAW sockets
|
||||
bool RawIp_HasError;
|
||||
UCHAR RawIpMyMacAddr[6];
|
||||
UCHAR RawIpYourMacAddr[6];
|
||||
IP MyIP;
|
||||
IP YourIP;
|
||||
QUEUE *RawIpSendQueue;
|
||||
IP MyPhysicalIP;
|
||||
IP MyPhysicalIPForce;
|
||||
UCHAR *RawIP_TmpBuffer;
|
||||
UINT RawIP_TmpBufferSize;
|
||||
};
|
||||
|
||||
#if defined( BRIDGE_BPF ) || defined( BRIDGE_PCAP )
|
||||
struct CAPTUREBLOCK{
|
||||
UINT Size;
|
||||
UCHAR *Buf;
|
||||
};
|
||||
#endif // BRIDGE_BPF
|
||||
|
||||
|
||||
// Function prototype
|
||||
void InitEth();
|
||||
void FreeEth();
|
||||
bool IsEthSupported();
|
||||
bool IsEthSupportedLinux();
|
||||
bool IsEthSupportedSolaris();
|
||||
bool IsEthSupportedPcap();
|
||||
TOKEN_LIST *GetEthList();
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip);
|
||||
TOKEN_LIST *GetEthListLinux(bool enum_normal, bool enum_rawip);
|
||||
TOKEN_LIST *GetEthListSolaris();
|
||||
TOKEN_LIST *GetEthListPcap();
|
||||
ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
ETH *OpenEthLinux(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
ETH *OpenEthSolaris(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
ETH *OpenEthPcap(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
bool ParseUnixEthDeviceName(char *dst_devname, UINT dst_devname_size, char *src_name);
|
||||
void CloseEth(ETH *e);
|
||||
CANCEL *EthGetCancel(ETH *e);
|
||||
UINT EthGetPacket(ETH *e, void **data);
|
||||
UINT EthGetPacketLinux(ETH *e, void **data);
|
||||
UINT EthGetPacketSolaris(ETH *e, void **data);
|
||||
UINT EthGetPacketPcap(ETH *e, void **data);
|
||||
UINT EthGetPacketBpf(ETH *e, void **data);
|
||||
void EthPutPacket(ETH *e, void *data, UINT size);
|
||||
void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes);
|
||||
UINT EthGetMtu(ETH *e);
|
||||
bool EthSetMtu(ETH *e, UINT mtu);
|
||||
bool EthIsChangeMtuSupported(ETH *e);
|
||||
bool EthGetInterfaceDescriptionUnix(char *name, char *str, UINT size);
|
||||
bool EthIsInterfaceDescriptionSupportedUnix();
|
||||
|
||||
ETH *OpenEthLinuxIpRaw();
|
||||
void CloseEthLinuxIpRaw(ETH *e);
|
||||
UINT EthGetPacketLinuxIpRaw(ETH *e, void **data);
|
||||
UINT EthGetPacketLinuxIpRawForSock(ETH *e, void **data, SOCK *s, UINT proto);
|
||||
void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size);
|
||||
bool EthProcessIpPacketInnerIpRaw(ETH *e, PKT *p);
|
||||
void EthSendIpPacketInnerIpRaw(ETH *e, void *data, UINT size, USHORT protocol);
|
||||
|
||||
#ifdef UNIX_SOLARIS
|
||||
// Function prototype for Solaris
|
||||
bool DlipReceiveAck(int fd);
|
||||
bool DlipPromiscuous(int fd, UINT level);
|
||||
bool DlipBindRequest(int fd);
|
||||
#endif // OS_SOLARIS
|
||||
|
||||
int UnixEthOpenRawSocket();
|
||||
|
||||
#endif // BRIDGEUNIX_H
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,162 +1,162 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// BridgeWin32.h
|
||||
// Header of BridgeWin32.c
|
||||
|
||||
#ifndef BRIDGEWIN32_H
|
||||
#define BRIDGEWIN32_H
|
||||
|
||||
#define BRIDGE_WIN32_PACKET_DLL "Packet.dll"
|
||||
#define BRIDGE_WIN32_PCD_DLL "|see.dll"
|
||||
#define BRIDGE_WIN32_PCD_SYS "|DriverPackages\\See\\x86\\See_x86.sys"
|
||||
#define BRIDGE_WIN32_PCD_DLL_X64 "|see_x64.dll"
|
||||
#define BRIDGE_WIN32_PCD_SYS_X64 "|DriverPackages\\See\\x64\\See_x64.sys"
|
||||
#define BRIDGE_WIN32_PCD_REGKEY "SYSTEM\\CurrentControlSet\\services\\SEE"
|
||||
#define BRIDGE_WIN32_PCD_BUILDVALUE "CurrentInstalledBuild"
|
||||
|
||||
#define BRIDGE_WIN32_ETH_BUFFER (1048576)
|
||||
|
||||
|
||||
typedef void *HANDLE;
|
||||
|
||||
#ifdef BRIDGE_C
|
||||
|
||||
// Header for Internal function (for BridgeWin32.c)
|
||||
typedef struct WP
|
||||
{
|
||||
bool Inited;
|
||||
HINSTANCE hPacketDll;
|
||||
PCHAR (*PacketGetVersion)();
|
||||
PCHAR (*PacketGetDriverVersion)();
|
||||
BOOLEAN (*PacketSetMinToCopy)(LPADAPTER AdapterObject,int nbytes);
|
||||
BOOLEAN (*PacketSetNumWrites)(LPADAPTER AdapterObject,int nwrites);
|
||||
BOOLEAN (*PacketSetMode)(LPADAPTER AdapterObject,int mode);
|
||||
BOOLEAN (*PacketSetReadTimeout)(LPADAPTER AdapterObject,int timeout);
|
||||
BOOLEAN (*PacketSetBpf)(LPADAPTER AdapterObject,struct bpf_program *fp);
|
||||
INT (*PacketSetSnapLen)(LPADAPTER AdapterObject,int snaplen);
|
||||
BOOLEAN (*PacketGetStats)(LPADAPTER AdapterObject,struct bpf_stat *s);
|
||||
BOOLEAN (*PacketGetStatsEx)(LPADAPTER AdapterObject,struct bpf_stat *s);
|
||||
BOOLEAN (*PacketSetBuff)(LPADAPTER AdapterObject,int dim);
|
||||
BOOLEAN (*PacketGetNetType)(LPADAPTER AdapterObject,NetType *type);
|
||||
LPADAPTER (*PacketOpenAdapter)(PCHAR AdapterName);
|
||||
BOOLEAN (*PacketSendPacket)(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync);
|
||||
INT (*PacketSendPackets)(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync);
|
||||
LPPACKET (*PacketAllocatePacket)(void);
|
||||
VOID (*PacketInitPacket)(LPPACKET lpPacket,PVOID Buffer,UINT Length);
|
||||
VOID (*PacketFreePacket)(LPPACKET lpPacket);
|
||||
BOOLEAN (*PacketReceivePacket)(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync);
|
||||
BOOLEAN (*PacketSetHwFilter)(LPADAPTER AdapterObject,ULONG Filter);
|
||||
BOOLEAN (*PacketGetAdapterNames)(PTSTR pStr,PULONG BufferSize);
|
||||
BOOLEAN (*PacketGetNetInfoEx)(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries);
|
||||
BOOLEAN (*PacketRequest)(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData);
|
||||
HANDLE (*PacketGetReadEvent)(LPADAPTER AdapterObject);
|
||||
BOOLEAN (*PacketSetDumpName)(LPADAPTER AdapterObject, void *name, int len);
|
||||
BOOLEAN (*PacketSetDumpLimits)(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks);
|
||||
BOOLEAN (*PacketIsDumpEnded)(LPADAPTER AdapterObject, BOOLEAN sync);
|
||||
BOOL (*PacketStopDriver)();
|
||||
VOID (*PacketCloseAdapter)(LPADAPTER lpAdapter);
|
||||
BOOLEAN (*PacketSetLoopbackBehavior)(LPADAPTER AdapterObject, UINT LoopbackBehavior);
|
||||
} WP;
|
||||
|
||||
// Adapter list
|
||||
typedef struct WP_ADAPTER
|
||||
{
|
||||
char Name[MAX_SIZE];
|
||||
char Title[MAX_SIZE];
|
||||
char Guid[MAX_SIZE];
|
||||
UINT Id;
|
||||
} WP_ADAPTER;
|
||||
|
||||
// Internal function prototype
|
||||
void InitEthAdaptersList();
|
||||
void FreeEthAdaptersList();
|
||||
int CompareWpAdapter(void *p1, void *p2);
|
||||
LIST *GetEthAdapterList();
|
||||
LIST *GetEthAdapterListInternal();
|
||||
bool InitWpWithLoadLibrary(WP *wp, HINSTANCE h);
|
||||
bool IsPcdSupported();
|
||||
HINSTANCE InstallPcdDriver();
|
||||
HINSTANCE InstallPcdDriverInternal();
|
||||
UINT LoadPcdDriverBuild();
|
||||
void SavePcdDriverBuild(UINT build);
|
||||
|
||||
#endif // BRIDGE_C
|
||||
|
||||
typedef struct _ADAPTER ADAPTER;
|
||||
typedef struct _PACKET PACKET;
|
||||
|
||||
// ETH structure
|
||||
struct ETH
|
||||
{
|
||||
char *Name; // Adapter name
|
||||
char *Title; // Adapter title
|
||||
ADAPTER *Adapter; // Adapter
|
||||
CANCEL *Cancel; // Cancel object
|
||||
UCHAR *Buffer; // Buffer
|
||||
UINT BufferSize; // Buffer size
|
||||
PACKET *Packet; // Packet
|
||||
PACKET *PutPacket; // Write packet
|
||||
QUEUE *PacketQueue; // Packet queue
|
||||
UINT64 LastSetSingleCpu; // Date and time set to a single CPU to last
|
||||
bool LoopbackBlock; // Whether to block the loop back packet
|
||||
bool Empty; // It is empty
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
bool HasFatalError; // A fatal error occurred on the transmission side
|
||||
|
||||
SU *Su; // SeLow handle
|
||||
SU_ADAPTER *SuAdapter; // SeLow adapter handle
|
||||
|
||||
// Unused
|
||||
bool IsRawIpMode; // RAW IP mode
|
||||
UCHAR RawIpMyMacAddr[6];
|
||||
UCHAR RawIpYourMacAddr[6];
|
||||
IP MyPhysicalIPForce;
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
void InitEth();
|
||||
void FreeEth();
|
||||
bool IsEthSupported();
|
||||
bool IsEthSupportedInner();
|
||||
TOKEN_LIST *GetEthList();
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip);
|
||||
ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
ETH *OpenEthInternal(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
void CloseEth(ETH *e);
|
||||
CANCEL *EthGetCancel(ETH *e);
|
||||
UINT EthGetPacket(ETH *e, void **data);
|
||||
void EthPutPacket(ETH *e, void *data, UINT size);
|
||||
void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes);
|
||||
void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name);
|
||||
bool IsWin32BridgeWithSee();
|
||||
UINT EthGetMtu(ETH *e);
|
||||
bool EthSetMtu(ETH *e, UINT mtu);
|
||||
bool EthIsChangeMtuSupported(ETH *e);
|
||||
|
||||
bool Win32EthIsSuSupported();
|
||||
|
||||
void Win32EthSetShowAllIf(bool b);
|
||||
bool Win32EthGetShowAllIf();
|
||||
|
||||
bool EnumEthVLanWin32(RPC_ENUM_ETH_VLAN *t);
|
||||
bool GetClassRegKeyWin32(char *key, UINT key_size, char *short_key, UINT short_key_size, char *guid);
|
||||
int CmpRpcEnumEthVLan(void *p1, void *p2);
|
||||
void GetVLanSupportStatus(RPC_ENUM_ETH_VLAN_ITEM *e);
|
||||
void GetVLanEnableStatus(RPC_ENUM_ETH_VLAN_ITEM *e);
|
||||
bool SetVLanEnableStatus(char *title, bool enable);
|
||||
RPC_ENUM_ETH_VLAN_ITEM *FindEthVLanItem(RPC_ENUM_ETH_VLAN *t, char *name);
|
||||
char *SearchDeviceInstanceIdFromShortKey(char *short_key);
|
||||
void Win32EthMakeCombinedName(char *dst, UINT dst_size, char *nicname, char *guid);
|
||||
UINT Win32EthGenIdFromGuid(char *guid);
|
||||
UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str);
|
||||
|
||||
struct WP_ADAPTER *Win32EthSearch(char *name);
|
||||
bool Win32IsUsingSeLow();
|
||||
void Win32SetEnableSeLow(bool b);
|
||||
bool Win32GetEnableSeLow();
|
||||
|
||||
#endif // BRIDGEWIN32_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// BridgeWin32.h
|
||||
// Header of BridgeWin32.c
|
||||
|
||||
#ifndef BRIDGEWIN32_H
|
||||
#define BRIDGEWIN32_H
|
||||
|
||||
#define BRIDGE_WIN32_PACKET_DLL "Packet.dll"
|
||||
#define BRIDGE_WIN32_PCD_DLL "|see.dll"
|
||||
#define BRIDGE_WIN32_PCD_SYS "|DriverPackages\\See\\x86\\See_x86.sys"
|
||||
#define BRIDGE_WIN32_PCD_DLL_X64 "|see_x64.dll"
|
||||
#define BRIDGE_WIN32_PCD_SYS_X64 "|DriverPackages\\See\\x64\\See_x64.sys"
|
||||
#define BRIDGE_WIN32_PCD_REGKEY "SYSTEM\\CurrentControlSet\\services\\SEE"
|
||||
#define BRIDGE_WIN32_PCD_BUILDVALUE "CurrentInstalledBuild"
|
||||
|
||||
#define BRIDGE_WIN32_ETH_BUFFER (1048576)
|
||||
|
||||
|
||||
typedef void *HANDLE;
|
||||
|
||||
#ifdef BRIDGE_C
|
||||
|
||||
// Header for Internal function (for BridgeWin32.c)
|
||||
typedef struct WP
|
||||
{
|
||||
bool Inited;
|
||||
HINSTANCE hPacketDll;
|
||||
PCHAR (*PacketGetVersion)();
|
||||
PCHAR (*PacketGetDriverVersion)();
|
||||
BOOLEAN (*PacketSetMinToCopy)(LPADAPTER AdapterObject,int nbytes);
|
||||
BOOLEAN (*PacketSetNumWrites)(LPADAPTER AdapterObject,int nwrites);
|
||||
BOOLEAN (*PacketSetMode)(LPADAPTER AdapterObject,int mode);
|
||||
BOOLEAN (*PacketSetReadTimeout)(LPADAPTER AdapterObject,int timeout);
|
||||
BOOLEAN (*PacketSetBpf)(LPADAPTER AdapterObject,struct bpf_program *fp);
|
||||
INT (*PacketSetSnapLen)(LPADAPTER AdapterObject,int snaplen);
|
||||
BOOLEAN (*PacketGetStats)(LPADAPTER AdapterObject,struct bpf_stat *s);
|
||||
BOOLEAN (*PacketGetStatsEx)(LPADAPTER AdapterObject,struct bpf_stat *s);
|
||||
BOOLEAN (*PacketSetBuff)(LPADAPTER AdapterObject,int dim);
|
||||
BOOLEAN (*PacketGetNetType)(LPADAPTER AdapterObject,NetType *type);
|
||||
LPADAPTER (*PacketOpenAdapter)(PCHAR AdapterName);
|
||||
BOOLEAN (*PacketSendPacket)(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync);
|
||||
INT (*PacketSendPackets)(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync);
|
||||
LPPACKET (*PacketAllocatePacket)(void);
|
||||
VOID (*PacketInitPacket)(LPPACKET lpPacket,PVOID Buffer,UINT Length);
|
||||
VOID (*PacketFreePacket)(LPPACKET lpPacket);
|
||||
BOOLEAN (*PacketReceivePacket)(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync);
|
||||
BOOLEAN (*PacketSetHwFilter)(LPADAPTER AdapterObject,ULONG Filter);
|
||||
BOOLEAN (*PacketGetAdapterNames)(PTSTR pStr,PULONG BufferSize);
|
||||
BOOLEAN (*PacketGetNetInfoEx)(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries);
|
||||
BOOLEAN (*PacketRequest)(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData);
|
||||
HANDLE (*PacketGetReadEvent)(LPADAPTER AdapterObject);
|
||||
BOOLEAN (*PacketSetDumpName)(LPADAPTER AdapterObject, void *name, int len);
|
||||
BOOLEAN (*PacketSetDumpLimits)(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks);
|
||||
BOOLEAN (*PacketIsDumpEnded)(LPADAPTER AdapterObject, BOOLEAN sync);
|
||||
BOOL (*PacketStopDriver)();
|
||||
VOID (*PacketCloseAdapter)(LPADAPTER lpAdapter);
|
||||
BOOLEAN (*PacketSetLoopbackBehavior)(LPADAPTER AdapterObject, UINT LoopbackBehavior);
|
||||
} WP;
|
||||
|
||||
// Adapter list
|
||||
typedef struct WP_ADAPTER
|
||||
{
|
||||
char Name[MAX_SIZE];
|
||||
char Title[MAX_SIZE];
|
||||
char Guid[MAX_SIZE];
|
||||
UINT Id;
|
||||
} WP_ADAPTER;
|
||||
|
||||
// Internal function prototype
|
||||
void InitEthAdaptersList();
|
||||
void FreeEthAdaptersList();
|
||||
int CompareWpAdapter(void *p1, void *p2);
|
||||
LIST *GetEthAdapterList();
|
||||
LIST *GetEthAdapterListInternal();
|
||||
bool InitWpWithLoadLibrary(WP *wp, HINSTANCE h);
|
||||
bool IsPcdSupported();
|
||||
HINSTANCE InstallPcdDriver();
|
||||
HINSTANCE InstallPcdDriverInternal();
|
||||
UINT LoadPcdDriverBuild();
|
||||
void SavePcdDriverBuild(UINT build);
|
||||
|
||||
#endif // BRIDGE_C
|
||||
|
||||
typedef struct _ADAPTER ADAPTER;
|
||||
typedef struct _PACKET PACKET;
|
||||
|
||||
// ETH structure
|
||||
struct ETH
|
||||
{
|
||||
char *Name; // Adapter name
|
||||
char *Title; // Adapter title
|
||||
ADAPTER *Adapter; // Adapter
|
||||
CANCEL *Cancel; // Cancel object
|
||||
UCHAR *Buffer; // Buffer
|
||||
UINT BufferSize; // Buffer size
|
||||
PACKET *Packet; // Packet
|
||||
PACKET *PutPacket; // Write packet
|
||||
QUEUE *PacketQueue; // Packet queue
|
||||
UINT64 LastSetSingleCpu; // Date and time set to a single CPU to last
|
||||
bool LoopbackBlock; // Whether to block the loop back packet
|
||||
bool Empty; // It is empty
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
bool HasFatalError; // A fatal error occurred on the transmission side
|
||||
|
||||
SU *Su; // SeLow handle
|
||||
SU_ADAPTER *SuAdapter; // SeLow adapter handle
|
||||
|
||||
// Unused
|
||||
bool IsRawIpMode; // RAW IP mode
|
||||
UCHAR RawIpMyMacAddr[6];
|
||||
UCHAR RawIpYourMacAddr[6];
|
||||
IP MyPhysicalIPForce;
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
void InitEth();
|
||||
void FreeEth();
|
||||
bool IsEthSupported();
|
||||
bool IsEthSupportedInner();
|
||||
TOKEN_LIST *GetEthList();
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip);
|
||||
ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
ETH *OpenEthInternal(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
void CloseEth(ETH *e);
|
||||
CANCEL *EthGetCancel(ETH *e);
|
||||
UINT EthGetPacket(ETH *e, void **data);
|
||||
void EthPutPacket(ETH *e, void *data, UINT size);
|
||||
void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes);
|
||||
void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name);
|
||||
bool IsWin32BridgeWithSee();
|
||||
UINT EthGetMtu(ETH *e);
|
||||
bool EthSetMtu(ETH *e, UINT mtu);
|
||||
bool EthIsChangeMtuSupported(ETH *e);
|
||||
|
||||
bool Win32EthIsSuSupported();
|
||||
|
||||
void Win32EthSetShowAllIf(bool b);
|
||||
bool Win32EthGetShowAllIf();
|
||||
|
||||
bool EnumEthVLanWin32(RPC_ENUM_ETH_VLAN *t);
|
||||
bool GetClassRegKeyWin32(char *key, UINT key_size, char *short_key, UINT short_key_size, char *guid);
|
||||
int CmpRpcEnumEthVLan(void *p1, void *p2);
|
||||
void GetVLanSupportStatus(RPC_ENUM_ETH_VLAN_ITEM *e);
|
||||
void GetVLanEnableStatus(RPC_ENUM_ETH_VLAN_ITEM *e);
|
||||
bool SetVLanEnableStatus(char *title, bool enable);
|
||||
RPC_ENUM_ETH_VLAN_ITEM *FindEthVLanItem(RPC_ENUM_ETH_VLAN *t, char *name);
|
||||
char *SearchDeviceInstanceIdFromShortKey(char *short_key);
|
||||
void Win32EthMakeCombinedName(char *dst, UINT dst_size, char *nicname, char *guid);
|
||||
UINT Win32EthGenIdFromGuid(char *guid);
|
||||
UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str);
|
||||
|
||||
struct WP_ADAPTER *Win32EthSearch(char *name);
|
||||
bool Win32IsUsingSeLow();
|
||||
void Win32SetEnableSeLow(bool b);
|
||||
bool Win32GetEnableSeLow();
|
||||
|
||||
#endif // BRIDGEWIN32_H
|
||||
|
||||
|
||||
|
25440
src/Cedar/CM.c
25440
src/Cedar/CM.c
File diff suppressed because it is too large
Load Diff
104
src/Cedar/CM.h
104
src/Cedar/CM.h
@ -1,52 +1,52 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// CM.h
|
||||
// Header of CM.c
|
||||
|
||||
#ifndef CM_H
|
||||
#define CM_H
|
||||
|
||||
// Constants
|
||||
#define CM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client Manager"
|
||||
#define SECURE_MANAGER_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\SmartCard Manager"
|
||||
#define CM_TRAFFIC_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Traffic Test Tool"
|
||||
#define CM_VGC_REG_KEY "Software\\University of Tsukuba\\VPN Gate Client Plugin"
|
||||
|
||||
|
||||
#define CM_TRY_EXEC_UI_HELPER_INTERVAL 5000
|
||||
|
||||
#define CM_DEFAULT_WIDTH 800
|
||||
#define CM_DEFAULT_HEIGHT 600
|
||||
|
||||
#define WM_CM_NOTIFY (WM_APP + 999)
|
||||
|
||||
#define CM_IMPORT_FILENAME_MSG 1267
|
||||
#define CM_IMPORT_FILENAME_MSG_OVERWRITE 1268
|
||||
|
||||
#define CM_NUM_RECENT 8
|
||||
|
||||
#define PUBLIC_SERVER_HTML "http://www.softether.com/jp/special/se2hub.aspx"
|
||||
#define PUBLIC_SERVER_HTML_EN "http://www.softether.com/jp/special/se2hub_en.aspx"
|
||||
#define PUBLIC_SERVER_TAG L"help:no; status:no; DialogWidth:600px; dialogHeight=700px"
|
||||
#define PUBLIC_SERVER_NAME "public.softether.com"
|
||||
|
||||
#define VOICE_SSK 0 // ssk
|
||||
#define VOICE_AHO 1 // aho
|
||||
|
||||
// The code for external export
|
||||
|
||||
// Structure
|
||||
|
||||
// Function prototype
|
||||
void CMExec();
|
||||
void CmTraffic(HWND hWnd);
|
||||
void *CmStartUacHelper();
|
||||
void CmStopUacHelper(void *p);
|
||||
void *CmExecUiHelperMain();
|
||||
UINT CmGetSecureBitmapId(char *dest_hostname);
|
||||
|
||||
#endif // CM_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// CM.h
|
||||
// Header of CM.c
|
||||
|
||||
#ifndef CM_H
|
||||
#define CM_H
|
||||
|
||||
// Constants
|
||||
#define CM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client Manager"
|
||||
#define SECURE_MANAGER_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\SmartCard Manager"
|
||||
#define CM_TRAFFIC_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Traffic Test Tool"
|
||||
#define CM_VGC_REG_KEY "Software\\University of Tsukuba\\VPN Gate Client Plugin"
|
||||
|
||||
|
||||
#define CM_TRY_EXEC_UI_HELPER_INTERVAL 5000
|
||||
|
||||
#define CM_DEFAULT_WIDTH 800
|
||||
#define CM_DEFAULT_HEIGHT 600
|
||||
|
||||
#define WM_CM_NOTIFY (WM_APP + 999)
|
||||
|
||||
#define CM_IMPORT_FILENAME_MSG 1267
|
||||
#define CM_IMPORT_FILENAME_MSG_OVERWRITE 1268
|
||||
|
||||
#define CM_NUM_RECENT 8
|
||||
|
||||
#define PUBLIC_SERVER_HTML "http://www.softether.com/jp/special/se2hub.aspx"
|
||||
#define PUBLIC_SERVER_HTML_EN "http://www.softether.com/jp/special/se2hub_en.aspx"
|
||||
#define PUBLIC_SERVER_TAG L"help:no; status:no; DialogWidth:600px; dialogHeight=700px"
|
||||
#define PUBLIC_SERVER_NAME "public.softether.com"
|
||||
|
||||
#define VOICE_SSK 0 // ssk
|
||||
#define VOICE_AHO 1 // aho
|
||||
|
||||
// The code for external export
|
||||
|
||||
// Structure
|
||||
|
||||
// Function prototype
|
||||
void CMExec();
|
||||
void CmTraffic(HWND hWnd);
|
||||
void *CmStartUacHelper();
|
||||
void CmStopUacHelper(void *p);
|
||||
void *CmExecUiHelperMain();
|
||||
UINT CmGetSecureBitmapId(char *dest_hostname);
|
||||
|
||||
#endif // CM_H
|
||||
|
||||
|
||||
|
1090
src/Cedar/CMInner.h
1090
src/Cedar/CMInner.h
File diff suppressed because it is too large
Load Diff
3236
src/Cedar/Cedar.c
3236
src/Cedar/Cedar.c
File diff suppressed because it is too large
Load Diff
2372
src/Cedar/Cedar.h
2372
src/Cedar/Cedar.h
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,9 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// CedarPch.c
|
||||
// Cedar Pre-compile Header Generating Code
|
||||
|
||||
#include "CedarPch.h"
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// CedarPch.c
|
||||
// Cedar Pre-compile Header Generating Code
|
||||
|
||||
#include "CedarPch.h"
|
||||
|
||||
|
@ -1,20 +1,20 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// CedarPch.h
|
||||
// Header file for grecompile header generation for Cedar
|
||||
|
||||
#include <GlobalConst.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include <Cedar/Cedar.h>
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// CedarPch.h
|
||||
// Header file for grecompile header generation for Cedar
|
||||
|
||||
#include <GlobalConst.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include <Cedar/Cedar.h>
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
21644
src/Cedar/Client.c
21644
src/Cedar/Client.c
File diff suppressed because it is too large
Load Diff
1520
src/Cedar/Client.h
1520
src/Cedar/Client.h
File diff suppressed because it is too large
Load Diff
49140
src/Cedar/Command.c
49140
src/Cedar/Command.c
File diff suppressed because it is too large
Load Diff
1198
src/Cedar/Command.h
1198
src/Cedar/Command.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,273 +1,273 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
// © 2020 Nokia
|
||||
|
||||
// Connection.h
|
||||
// Header of Connection.c
|
||||
|
||||
#ifndef CONNECTION_H
|
||||
#define CONNECTION_H
|
||||
|
||||
// Magic number indicating that the packet is compressed
|
||||
#define CONNECTION_BULK_COMPRESS_SIGNATURE 0xDEADBEEFCAFEFACEULL
|
||||
|
||||
#define KEEP_ALIVE_STRING "Internet Connection Keep Alive Packet"
|
||||
|
||||
#define UPDATE_LAST_COMM_TIME(v, n) {if ((v) <= (n)) { v = (n); } }
|
||||
|
||||
// KEEP CONNECT structure
|
||||
struct KEEP
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
bool Server; // Server mode
|
||||
volatile bool Halt; // Stop flag
|
||||
bool Enable; // Enable flag
|
||||
char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name
|
||||
UINT ServerPort; // Server port number
|
||||
bool UdpMode; // UDP mode
|
||||
UINT Interval; // Packet transmission interval
|
||||
THREAD *Thread; // Connection thread
|
||||
EVENT *HaltEvent; // Stop event
|
||||
CANCEL *Cancel; // Cancel
|
||||
};
|
||||
|
||||
// SECURE_SIGN Structure
|
||||
struct SECURE_SIGN
|
||||
{
|
||||
char SecurePublicCertName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device certificate name
|
||||
char SecurePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name
|
||||
X *ClientCert; // Client certificate
|
||||
UCHAR Random[SHA1_SIZE]; // Random value for signature
|
||||
UCHAR Signature[4096 / 8]; // Signed data
|
||||
UINT UseSecureDeviceId;
|
||||
UINT BitmapId; // Bitmap ID
|
||||
};
|
||||
|
||||
// Function type declaration
|
||||
typedef bool (CHECK_CERT_PROC)(SESSION *s, CONNECTION *c, X *server_x, bool *expired);
|
||||
typedef bool (SECURE_SIGN_PROC)(SESSION *s, CONNECTION *c, SECURE_SIGN *sign);
|
||||
|
||||
// RC4 key pair
|
||||
struct RC4_KEY_PAIR
|
||||
{
|
||||
UCHAR ServerToClientKey[16];
|
||||
UCHAR ClientToServerKey[16];
|
||||
};
|
||||
|
||||
// Client Options
|
||||
struct CLIENT_OPTION
|
||||
{
|
||||
wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Connection setting name
|
||||
char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name
|
||||
UINT Port; // Port number
|
||||
UINT PortUDP; // UDP port number (0: Use only TCP)
|
||||
UINT ProxyType; // Type of proxy
|
||||
char ProxyName[MAX_HOST_NAME_LEN + 1]; // Proxy server name
|
||||
UINT ProxyPort; // Port number of the proxy server
|
||||
char ProxyUsername[PROXY_MAX_USERNAME_LEN + 1]; // Maximum user name length
|
||||
char ProxyPassword[PROXY_MAX_PASSWORD_LEN + 1]; // Maximum password length
|
||||
char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP proxy header
|
||||
UINT NumRetry; // Automatic retries
|
||||
UINT RetryInterval; // Retry interval
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
|
||||
UINT MaxConnection; // Maximum number of concurrent TCP connections
|
||||
bool UseEncrypt; // Use encrypted communication
|
||||
bool UseCompress; // Use data compression
|
||||
bool HalfConnection; // Use half connection in TCP
|
||||
bool NoRoutingTracking; // Disable the routing tracking
|
||||
char DeviceName[MAX_DEVICE_NAME_LEN + 1]; // VLAN device name
|
||||
UINT AdditionalConnectionInterval; // Connection attempt interval when additional connection establish
|
||||
UINT ConnectionDisconnectSpan; // Disconnection interval
|
||||
bool HideStatusWindow; // Hide the status window
|
||||
bool HideNicInfoWindow; // Hide the NIC status window
|
||||
bool RequireMonitorMode; // Monitor port mode
|
||||
bool RequireBridgeRoutingMode; // Bridge or routing mode
|
||||
bool DisableQoS; // Disable the VoIP / QoS function
|
||||
bool FromAdminPack; // For Administration Pack
|
||||
bool NoUdpAcceleration; // Do not use UDP acceleration mode
|
||||
UCHAR HostUniqueKey[SHA1_SIZE]; // Host unique key
|
||||
};
|
||||
|
||||
// Client authentication data
|
||||
struct CLIENT_AUTH
|
||||
{
|
||||
UINT AuthType; // Authentication type
|
||||
char Username[MAX_USERNAME_LEN + 1]; // User name
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Hashed passwords
|
||||
char PlainPassword[MAX_PASSWORD_LEN + 1]; // Password
|
||||
X *ClientX; // Client certificate
|
||||
K *ClientK; // Client private key
|
||||
char SecurePublicCertName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device certificate name
|
||||
char SecurePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name
|
||||
char OpensslEnginePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name
|
||||
char OpensslEngineName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name
|
||||
CHECK_CERT_PROC *CheckCertProc; // Server certificate confirmation procedure
|
||||
SECURE_SIGN_PROC *SecureSignProc; // Security signing procedure
|
||||
};
|
||||
|
||||
// TCP socket data structure
|
||||
struct TCPSOCK
|
||||
{
|
||||
SOCK *Sock; // Socket
|
||||
FIFO *RecvFifo; // Reception buffer
|
||||
FIFO *SendFifo; // Transmission buffer
|
||||
UINT Mode; // Read mode
|
||||
UINT WantSize; // Requested data size
|
||||
UINT NextBlockNum; // Total number of blocks that can be read next
|
||||
UINT NextBlockSize; // Block size that is planned to read next
|
||||
UINT CurrentPacketNum; // Current packet number
|
||||
UINT64 LastCommTime; // Last communicated time
|
||||
UINT64 LastRecvTime; // Time the last data received
|
||||
UINT LateCount; // The number of delay occurences
|
||||
UINT Direction; // Direction
|
||||
UINT64 NextKeepAliveTime; // Next time to send a KeepAlive packet
|
||||
RC4_KEY_PAIR Rc4KeyPair; // RC4 key pair
|
||||
CRYPT *SendKey; // Transmission key
|
||||
CRYPT *RecvKey; // Reception key
|
||||
UINT64 DisconnectTick; // Time to disconnect this connection
|
||||
UINT64 EstablishedTick; // Establishment time
|
||||
};
|
||||
|
||||
// TCP communication data structure
|
||||
struct TCP
|
||||
{
|
||||
LIST *TcpSockList; // TCP socket list
|
||||
};
|
||||
|
||||
// UDP communication data structure
|
||||
struct UDP
|
||||
{
|
||||
SOCK *s; // UDP socket (for transmission)
|
||||
IP ip; // Destination IP address
|
||||
UINT port; // Destination port number
|
||||
UINT64 NextKeepAliveTime; // Next time to send a KeepAlive packet
|
||||
UINT64 Seq; // Packet sequence number
|
||||
UINT64 RecvSeq;
|
||||
QUEUE *BufferQueue; // Queue of buffer to be sent
|
||||
};
|
||||
|
||||
// Data block
|
||||
struct BLOCK
|
||||
{
|
||||
BOOL Compressed; // Compression flag
|
||||
UINT Size; // Block size
|
||||
UINT SizeofData; // Data size
|
||||
UCHAR *Buf; // Buffer
|
||||
bool PriorityQoS; // Priority packet for VoIP / QoS function
|
||||
UINT Ttl; // TTL value (Used only in ICMP NAT of Virtual.c)
|
||||
UINT Param1; // Parameter 1
|
||||
bool IsFlooding; // Is flooding packet
|
||||
UCHAR RawFlagRetUdpAccel; // Raw flag returned by UDP accel
|
||||
};
|
||||
|
||||
// Connection structure
|
||||
struct CONNECTION
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
CEDAR *Cedar; // Cedar
|
||||
struct SESSION *Session; // Session
|
||||
UINT Protocol; // Protocol
|
||||
SOCK *FirstSock; // Socket for negotiation
|
||||
SOCK *TubeSock; // Socket for in-process communication
|
||||
TCP *Tcp; // TCP communication data structure
|
||||
UDP *Udp; // UDP communication data structure
|
||||
bool ServerMode; // Server mode
|
||||
UINT Status; // Status
|
||||
char *Name; // Connection name
|
||||
THREAD *Thread; // Thread
|
||||
volatile bool Halt; // Stop flag
|
||||
UCHAR Random[SHA1_SIZE]; // Random number for Authentication
|
||||
UINT ServerVer; // Server version
|
||||
UINT ServerBuild; // Server build number
|
||||
UINT ClientVer; // Client version
|
||||
UINT ClientBuild; // Client build number
|
||||
char ServerStr[MAX_SERVER_STR_LEN + 1]; // Server string
|
||||
char ClientStr[MAX_CLIENT_STR_LEN + 1]; // Client string
|
||||
UINT Err; // Error value
|
||||
bool ClientConnectError_NoSavePassword; // Don't save the password for the specified user name
|
||||
QUEUE *ReceivedBlocks; // Block queue that is received
|
||||
QUEUE *SendBlocks; // Block queue planned to be sent
|
||||
QUEUE *SendBlocks2; // Send queue (high priority)
|
||||
COUNTER *CurrentNumConnection; // Counter of the number of current connections
|
||||
LIST *ConnectingThreads; // List of connected threads
|
||||
LIST *ConnectingSocks; // List of the connected sockets
|
||||
bool flag1; // Flag 1
|
||||
UCHAR *RecvBuf; // Receive buffer
|
||||
char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name
|
||||
UINT ServerPort; // Port number
|
||||
bool RestoreServerNameAndPort; // Flag to restore the server name and port number to original
|
||||
bool UseTicket; // Ticket using flag
|
||||
UCHAR Ticket[SHA1_SIZE]; // Ticket
|
||||
UINT CurrentSendQueueSize; // Total size of the transmission queue
|
||||
X *ServerX; // Server certificate
|
||||
X *ClientX; // Client certificate
|
||||
char *CipherName; // Encryption algorithm name
|
||||
UINT64 ConnectedTick; // Time it is connected
|
||||
IP ClientIp; // Client IP address
|
||||
char ClientHostname[MAX_HOST_NAME_LEN + 1]; // Client host name
|
||||
UINT Type; // Type
|
||||
void *hWndForUI; // Parent window
|
||||
bool IsInProc; // In-process
|
||||
char InProcPrefix[64]; // Prefix
|
||||
UINT InProcLayer; // InProc layer
|
||||
UINT AdditionalConnectionFailedCounter; // Additional connection failure counter
|
||||
UINT64 LastCounterResetTick; // Time the counter was reset finally
|
||||
bool WasSstp; // Processed the SSTP
|
||||
bool WasDatProxy; // DAT proxy processed
|
||||
UCHAR CToken_Hash[SHA1_SIZE]; // CTOKEN_HASH
|
||||
UINT LastTcpQueueSize; // The last queue size of TCP sockets
|
||||
UINT LastPacketQueueSize; // The last queue size of packets
|
||||
UINT LastRecvFifoTotalSize; // The last RecvFifo total size
|
||||
UINT LastRecvBlocksNum; // The last ReceivedBlocks num
|
||||
bool IsJsonRpc; // Is JSON-RPC
|
||||
bool JsonRpcAuthed; // JSON-RPC Authed
|
||||
LISTENER *Listener; // Listener ref
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Function prototypes
|
||||
|
||||
CONNECTION *NewClientConnection(SESSION *s);
|
||||
CONNECTION *NewClientConnectionEx(SESSION *s, char *client_str, UINT client_ver, UINT client_build);
|
||||
CONNECTION *NewServerConnection(CEDAR *cedar, SOCK *s, THREAD *t);
|
||||
void ReleaseConnection(CONNECTION *c);
|
||||
void CleanupConnection(CONNECTION *c);
|
||||
int CompareConnection(void *p1, void *p2);
|
||||
void StopConnection(CONNECTION *c, bool no_wait);
|
||||
void ConnectionAccept(CONNECTION *c);
|
||||
void StartTunnelingMode(CONNECTION *c);
|
||||
void EndTunnelingMode(CONNECTION *c);
|
||||
void DisconnectTcpSockets(CONNECTION *c);
|
||||
void ConnectionReceive(CONNECTION *c, CANCEL *c1, CANCEL *c2);
|
||||
void ConnectionSend(CONNECTION *c, UINT64 now);
|
||||
TCPSOCK *NewTcpSock(SOCK *s);
|
||||
void FreeTcpSock(TCPSOCK *ts);
|
||||
BLOCK *NewBlock(void *data, UINT size, int compress);
|
||||
void FreeBlock(BLOCK *b);
|
||||
void StopAllAdditionalConnectThread(CONNECTION *c);
|
||||
UINT GenNextKeepAliveSpan(CONNECTION *c);
|
||||
void SendKeepAlive(CONNECTION *c, TCPSOCK *ts);
|
||||
void DisconnectUDPSockets(CONNECTION *c);
|
||||
void PutUDPPacketData(CONNECTION *c, void *data, UINT size);
|
||||
void SendDataWithUDP(SOCK *s, CONNECTION *c);
|
||||
void InsertReceivedBlockToQueue(CONNECTION *c, BLOCK *block, bool no_lock);
|
||||
UINT TcpSockRecv(SESSION *s, TCPSOCK *ts, void *data, UINT size);
|
||||
UINT TcpSockSend(SESSION *s, TCPSOCK *ts, void *data, UINT size);
|
||||
void WriteSendFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size);
|
||||
void WriteRecvFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size);
|
||||
CLIENT_AUTH *CopyClientAuth(CLIENT_AUTH *a);
|
||||
BUF *NewKeepPacket(bool server_mode);
|
||||
void KeepThread(THREAD *thread, void *param);
|
||||
KEEP *StartKeep();
|
||||
void StopKeep(KEEP *k);
|
||||
void InRpcSecureSign(SECURE_SIGN *t, PACK *p);
|
||||
void OutRpcSecureSign(PACK *p, SECURE_SIGN *t);
|
||||
void FreeRpcSecureSign(SECURE_SIGN *t);
|
||||
void NormalizeEthMtu(BRIDGE *b, CONNECTION *c, UINT packet_size);
|
||||
UINT GetMachineRand();
|
||||
|
||||
|
||||
|
||||
#endif // CONNECTION_H
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
// © 2020 Nokia
|
||||
|
||||
// Connection.h
|
||||
// Header of Connection.c
|
||||
|
||||
#ifndef CONNECTION_H
|
||||
#define CONNECTION_H
|
||||
|
||||
// Magic number indicating that the packet is compressed
|
||||
#define CONNECTION_BULK_COMPRESS_SIGNATURE 0xDEADBEEFCAFEFACEULL
|
||||
|
||||
#define KEEP_ALIVE_STRING "Internet Connection Keep Alive Packet"
|
||||
|
||||
#define UPDATE_LAST_COMM_TIME(v, n) {if ((v) <= (n)) { v = (n); } }
|
||||
|
||||
// KEEP CONNECT structure
|
||||
struct KEEP
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
bool Server; // Server mode
|
||||
volatile bool Halt; // Stop flag
|
||||
bool Enable; // Enable flag
|
||||
char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name
|
||||
UINT ServerPort; // Server port number
|
||||
bool UdpMode; // UDP mode
|
||||
UINT Interval; // Packet transmission interval
|
||||
THREAD *Thread; // Connection thread
|
||||
EVENT *HaltEvent; // Stop event
|
||||
CANCEL *Cancel; // Cancel
|
||||
};
|
||||
|
||||
// SECURE_SIGN Structure
|
||||
struct SECURE_SIGN
|
||||
{
|
||||
char SecurePublicCertName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device certificate name
|
||||
char SecurePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name
|
||||
X *ClientCert; // Client certificate
|
||||
UCHAR Random[SHA1_SIZE]; // Random value for signature
|
||||
UCHAR Signature[4096 / 8]; // Signed data
|
||||
UINT UseSecureDeviceId;
|
||||
UINT BitmapId; // Bitmap ID
|
||||
};
|
||||
|
||||
// Function type declaration
|
||||
typedef bool (CHECK_CERT_PROC)(SESSION *s, CONNECTION *c, X *server_x, bool *expired);
|
||||
typedef bool (SECURE_SIGN_PROC)(SESSION *s, CONNECTION *c, SECURE_SIGN *sign);
|
||||
|
||||
// RC4 key pair
|
||||
struct RC4_KEY_PAIR
|
||||
{
|
||||
UCHAR ServerToClientKey[16];
|
||||
UCHAR ClientToServerKey[16];
|
||||
};
|
||||
|
||||
// Client Options
|
||||
struct CLIENT_OPTION
|
||||
{
|
||||
wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Connection setting name
|
||||
char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name
|
||||
UINT Port; // Port number
|
||||
UINT PortUDP; // UDP port number (0: Use only TCP)
|
||||
UINT ProxyType; // Type of proxy
|
||||
char ProxyName[MAX_HOST_NAME_LEN + 1]; // Proxy server name
|
||||
UINT ProxyPort; // Port number of the proxy server
|
||||
char ProxyUsername[PROXY_MAX_USERNAME_LEN + 1]; // Maximum user name length
|
||||
char ProxyPassword[PROXY_MAX_PASSWORD_LEN + 1]; // Maximum password length
|
||||
char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP proxy header
|
||||
UINT NumRetry; // Automatic retries
|
||||
UINT RetryInterval; // Retry interval
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
|
||||
UINT MaxConnection; // Maximum number of concurrent TCP connections
|
||||
bool UseEncrypt; // Use encrypted communication
|
||||
bool UseCompress; // Use data compression
|
||||
bool HalfConnection; // Use half connection in TCP
|
||||
bool NoRoutingTracking; // Disable the routing tracking
|
||||
char DeviceName[MAX_DEVICE_NAME_LEN + 1]; // VLAN device name
|
||||
UINT AdditionalConnectionInterval; // Connection attempt interval when additional connection establish
|
||||
UINT ConnectionDisconnectSpan; // Disconnection interval
|
||||
bool HideStatusWindow; // Hide the status window
|
||||
bool HideNicInfoWindow; // Hide the NIC status window
|
||||
bool RequireMonitorMode; // Monitor port mode
|
||||
bool RequireBridgeRoutingMode; // Bridge or routing mode
|
||||
bool DisableQoS; // Disable the VoIP / QoS function
|
||||
bool FromAdminPack; // For Administration Pack
|
||||
bool NoUdpAcceleration; // Do not use UDP acceleration mode
|
||||
UCHAR HostUniqueKey[SHA1_SIZE]; // Host unique key
|
||||
};
|
||||
|
||||
// Client authentication data
|
||||
struct CLIENT_AUTH
|
||||
{
|
||||
UINT AuthType; // Authentication type
|
||||
char Username[MAX_USERNAME_LEN + 1]; // User name
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Hashed passwords
|
||||
char PlainPassword[MAX_PASSWORD_LEN + 1]; // Password
|
||||
X *ClientX; // Client certificate
|
||||
K *ClientK; // Client private key
|
||||
char SecurePublicCertName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device certificate name
|
||||
char SecurePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name
|
||||
char OpensslEnginePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name
|
||||
char OpensslEngineName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name
|
||||
CHECK_CERT_PROC *CheckCertProc; // Server certificate confirmation procedure
|
||||
SECURE_SIGN_PROC *SecureSignProc; // Security signing procedure
|
||||
};
|
||||
|
||||
// TCP socket data structure
|
||||
struct TCPSOCK
|
||||
{
|
||||
SOCK *Sock; // Socket
|
||||
FIFO *RecvFifo; // Reception buffer
|
||||
FIFO *SendFifo; // Transmission buffer
|
||||
UINT Mode; // Read mode
|
||||
UINT WantSize; // Requested data size
|
||||
UINT NextBlockNum; // Total number of blocks that can be read next
|
||||
UINT NextBlockSize; // Block size that is planned to read next
|
||||
UINT CurrentPacketNum; // Current packet number
|
||||
UINT64 LastCommTime; // Last communicated time
|
||||
UINT64 LastRecvTime; // Time the last data received
|
||||
UINT LateCount; // The number of delay occurences
|
||||
UINT Direction; // Direction
|
||||
UINT64 NextKeepAliveTime; // Next time to send a KeepAlive packet
|
||||
RC4_KEY_PAIR Rc4KeyPair; // RC4 key pair
|
||||
CRYPT *SendKey; // Transmission key
|
||||
CRYPT *RecvKey; // Reception key
|
||||
UINT64 DisconnectTick; // Time to disconnect this connection
|
||||
UINT64 EstablishedTick; // Establishment time
|
||||
};
|
||||
|
||||
// TCP communication data structure
|
||||
struct TCP
|
||||
{
|
||||
LIST *TcpSockList; // TCP socket list
|
||||
};
|
||||
|
||||
// UDP communication data structure
|
||||
struct UDP
|
||||
{
|
||||
SOCK *s; // UDP socket (for transmission)
|
||||
IP ip; // Destination IP address
|
||||
UINT port; // Destination port number
|
||||
UINT64 NextKeepAliveTime; // Next time to send a KeepAlive packet
|
||||
UINT64 Seq; // Packet sequence number
|
||||
UINT64 RecvSeq;
|
||||
QUEUE *BufferQueue; // Queue of buffer to be sent
|
||||
};
|
||||
|
||||
// Data block
|
||||
struct BLOCK
|
||||
{
|
||||
BOOL Compressed; // Compression flag
|
||||
UINT Size; // Block size
|
||||
UINT SizeofData; // Data size
|
||||
UCHAR *Buf; // Buffer
|
||||
bool PriorityQoS; // Priority packet for VoIP / QoS function
|
||||
UINT Ttl; // TTL value (Used only in ICMP NAT of Virtual.c)
|
||||
UINT Param1; // Parameter 1
|
||||
bool IsFlooding; // Is flooding packet
|
||||
UCHAR RawFlagRetUdpAccel; // Raw flag returned by UDP accel
|
||||
};
|
||||
|
||||
// Connection structure
|
||||
struct CONNECTION
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
CEDAR *Cedar; // Cedar
|
||||
struct SESSION *Session; // Session
|
||||
UINT Protocol; // Protocol
|
||||
SOCK *FirstSock; // Socket for negotiation
|
||||
SOCK *TubeSock; // Socket for in-process communication
|
||||
TCP *Tcp; // TCP communication data structure
|
||||
UDP *Udp; // UDP communication data structure
|
||||
bool ServerMode; // Server mode
|
||||
UINT Status; // Status
|
||||
char *Name; // Connection name
|
||||
THREAD *Thread; // Thread
|
||||
volatile bool Halt; // Stop flag
|
||||
UCHAR Random[SHA1_SIZE]; // Random number for Authentication
|
||||
UINT ServerVer; // Server version
|
||||
UINT ServerBuild; // Server build number
|
||||
UINT ClientVer; // Client version
|
||||
UINT ClientBuild; // Client build number
|
||||
char ServerStr[MAX_SERVER_STR_LEN + 1]; // Server string
|
||||
char ClientStr[MAX_CLIENT_STR_LEN + 1]; // Client string
|
||||
UINT Err; // Error value
|
||||
bool ClientConnectError_NoSavePassword; // Don't save the password for the specified user name
|
||||
QUEUE *ReceivedBlocks; // Block queue that is received
|
||||
QUEUE *SendBlocks; // Block queue planned to be sent
|
||||
QUEUE *SendBlocks2; // Send queue (high priority)
|
||||
COUNTER *CurrentNumConnection; // Counter of the number of current connections
|
||||
LIST *ConnectingThreads; // List of connected threads
|
||||
LIST *ConnectingSocks; // List of the connected sockets
|
||||
bool flag1; // Flag 1
|
||||
UCHAR *RecvBuf; // Receive buffer
|
||||
char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name
|
||||
UINT ServerPort; // Port number
|
||||
bool RestoreServerNameAndPort; // Flag to restore the server name and port number to original
|
||||
bool UseTicket; // Ticket using flag
|
||||
UCHAR Ticket[SHA1_SIZE]; // Ticket
|
||||
UINT CurrentSendQueueSize; // Total size of the transmission queue
|
||||
X *ServerX; // Server certificate
|
||||
X *ClientX; // Client certificate
|
||||
char *CipherName; // Encryption algorithm name
|
||||
UINT64 ConnectedTick; // Time it is connected
|
||||
IP ClientIp; // Client IP address
|
||||
char ClientHostname[MAX_HOST_NAME_LEN + 1]; // Client host name
|
||||
UINT Type; // Type
|
||||
void *hWndForUI; // Parent window
|
||||
bool IsInProc; // In-process
|
||||
char InProcPrefix[64]; // Prefix
|
||||
UINT InProcLayer; // InProc layer
|
||||
UINT AdditionalConnectionFailedCounter; // Additional connection failure counter
|
||||
UINT64 LastCounterResetTick; // Time the counter was reset finally
|
||||
bool WasSstp; // Processed the SSTP
|
||||
bool WasDatProxy; // DAT proxy processed
|
||||
UCHAR CToken_Hash[SHA1_SIZE]; // CTOKEN_HASH
|
||||
UINT LastTcpQueueSize; // The last queue size of TCP sockets
|
||||
UINT LastPacketQueueSize; // The last queue size of packets
|
||||
UINT LastRecvFifoTotalSize; // The last RecvFifo total size
|
||||
UINT LastRecvBlocksNum; // The last ReceivedBlocks num
|
||||
bool IsJsonRpc; // Is JSON-RPC
|
||||
bool JsonRpcAuthed; // JSON-RPC Authed
|
||||
LISTENER *Listener; // Listener ref
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Function prototypes
|
||||
|
||||
CONNECTION *NewClientConnection(SESSION *s);
|
||||
CONNECTION *NewClientConnectionEx(SESSION *s, char *client_str, UINT client_ver, UINT client_build);
|
||||
CONNECTION *NewServerConnection(CEDAR *cedar, SOCK *s, THREAD *t);
|
||||
void ReleaseConnection(CONNECTION *c);
|
||||
void CleanupConnection(CONNECTION *c);
|
||||
int CompareConnection(void *p1, void *p2);
|
||||
void StopConnection(CONNECTION *c, bool no_wait);
|
||||
void ConnectionAccept(CONNECTION *c);
|
||||
void StartTunnelingMode(CONNECTION *c);
|
||||
void EndTunnelingMode(CONNECTION *c);
|
||||
void DisconnectTcpSockets(CONNECTION *c);
|
||||
void ConnectionReceive(CONNECTION *c, CANCEL *c1, CANCEL *c2);
|
||||
void ConnectionSend(CONNECTION *c, UINT64 now);
|
||||
TCPSOCK *NewTcpSock(SOCK *s);
|
||||
void FreeTcpSock(TCPSOCK *ts);
|
||||
BLOCK *NewBlock(void *data, UINT size, int compress);
|
||||
void FreeBlock(BLOCK *b);
|
||||
void StopAllAdditionalConnectThread(CONNECTION *c);
|
||||
UINT GenNextKeepAliveSpan(CONNECTION *c);
|
||||
void SendKeepAlive(CONNECTION *c, TCPSOCK *ts);
|
||||
void DisconnectUDPSockets(CONNECTION *c);
|
||||
void PutUDPPacketData(CONNECTION *c, void *data, UINT size);
|
||||
void SendDataWithUDP(SOCK *s, CONNECTION *c);
|
||||
void InsertReceivedBlockToQueue(CONNECTION *c, BLOCK *block, bool no_lock);
|
||||
UINT TcpSockRecv(SESSION *s, TCPSOCK *ts, void *data, UINT size);
|
||||
UINT TcpSockSend(SESSION *s, TCPSOCK *ts, void *data, UINT size);
|
||||
void WriteSendFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size);
|
||||
void WriteRecvFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size);
|
||||
CLIENT_AUTH *CopyClientAuth(CLIENT_AUTH *a);
|
||||
BUF *NewKeepPacket(bool server_mode);
|
||||
void KeepThread(THREAD *thread, void *param);
|
||||
KEEP *StartKeep();
|
||||
void StopKeep(KEEP *k);
|
||||
void InRpcSecureSign(SECURE_SIGN *t, PACK *p);
|
||||
void OutRpcSecureSign(PACK *p, SECURE_SIGN *t);
|
||||
void FreeRpcSecureSign(SECURE_SIGN *t);
|
||||
void NormalizeEthMtu(BRIDGE *b, CONNECTION *c, UINT packet_size);
|
||||
UINT GetMachineRand();
|
||||
|
||||
|
||||
|
||||
#endif // CONNECTION_H
|
||||
|
4922
src/Cedar/Console.c
4922
src/Cedar/Console.c
File diff suppressed because it is too large
Load Diff
@ -1,144 +1,144 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Console.h
|
||||
// Header of Console.c
|
||||
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
|
||||
// Constant
|
||||
#define MAX_PROMPT_STRSIZE 65536
|
||||
#define WIN32_DEFAULT_CONSOLE_WIDTH 100
|
||||
|
||||
// Types of console
|
||||
#define CONSOLE_LOCAL 0 // Local console
|
||||
#define CONSOLE_CSV 1 // CSV output mode
|
||||
|
||||
// Parameters completion prompt function
|
||||
typedef wchar_t *(PROMPT_PROC)(CONSOLE *c, void *param);
|
||||
|
||||
// Parameter validation prompt function
|
||||
typedef bool (EVAL_PROC)(CONSOLE *c, wchar_t *str, void *param);
|
||||
|
||||
// Definition of the parameter item
|
||||
struct PARAM
|
||||
{
|
||||
char *Name; // Parameter name
|
||||
PROMPT_PROC *PromptProc; // Prompt function that automatically invoked if the parameter is not specified
|
||||
// (This is not called in the case of NULL)
|
||||
void *PromptProcParam; // Any pointers to pass to the prompt function
|
||||
EVAL_PROC *EvalProc; // Parameter string validation function
|
||||
void *EvalProcParam; // Any pointers to be passed to the validation function
|
||||
char *Tmp; // Temporary variable
|
||||
};
|
||||
|
||||
// Parameter value of the internal data
|
||||
struct PARAM_VALUE
|
||||
{
|
||||
char *Name; // Name
|
||||
char *StrValue; // String value
|
||||
wchar_t *UniStrValue; // Unicode string value
|
||||
UINT IntValue; // Integer value
|
||||
};
|
||||
|
||||
// Console service structure
|
||||
struct CONSOLE
|
||||
{
|
||||
UINT ConsoleType; // Type of console
|
||||
UINT RetCode; // The last exit code
|
||||
void *Param; // Data of any
|
||||
void (*Free)(CONSOLE *c); // Release function
|
||||
wchar_t *(*ReadLine)(CONSOLE *c, wchar_t *prompt, bool nofile); // Function to read one line
|
||||
char *(*ReadPassword)(CONSOLE *c, wchar_t *prompt); // Function to read the password
|
||||
bool (*Write)(CONSOLE *c, wchar_t *str); // Function to write a string
|
||||
UINT (*GetWidth)(CONSOLE *c); // Get the width of the screen
|
||||
bool ProgrammingMode; // Programming Mode
|
||||
LOCK *OutputLock; // Output Lock
|
||||
};
|
||||
|
||||
// Local console parameters
|
||||
struct LOCAL_CONSOLE_PARAM
|
||||
{
|
||||
IO *InFile; // Input file
|
||||
BUF *InBuf; // Input buffer
|
||||
IO *OutFile; // Output file
|
||||
UINT Win32_OldConsoleWidth; // Previous console size
|
||||
};
|
||||
|
||||
// Command procedure
|
||||
typedef UINT (COMMAND_PROC)(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
|
||||
|
||||
// Definition of command
|
||||
struct CMD
|
||||
{
|
||||
char *Name; // Command name
|
||||
COMMAND_PROC *Proc; // Procedure function
|
||||
};
|
||||
|
||||
// Evaluate the minimum / maximum value of the parameter
|
||||
struct CMD_EVAL_MIN_MAX
|
||||
{
|
||||
char *StrName;
|
||||
UINT MinValue, MaxValue;
|
||||
};
|
||||
|
||||
|
||||
// Function prototype
|
||||
wchar_t *Prompt(wchar_t *prompt_str);
|
||||
char *PromptA(wchar_t *prompt_str);
|
||||
bool PasswordPrompt(char *password, UINT size);
|
||||
void *SetConsoleRaw();
|
||||
void RestoreConsole(void *p);
|
||||
wchar_t *ParseCommandEx(wchar_t *str, wchar_t *name, TOKEN_LIST **param_list);
|
||||
wchar_t *ParseCommand(wchar_t *str, wchar_t *name);
|
||||
TOKEN_LIST *GetCommandNameList(wchar_t *str);
|
||||
char *ParseCommandA(wchar_t *str, char *name);
|
||||
LIST *NewParamValueList();
|
||||
int CmpParamValue(void *p1, void *p2);
|
||||
void FreeParamValueList(LIST *o);
|
||||
PARAM_VALUE *FindParamValue(LIST *o, char *name);
|
||||
char *GetParamStr(LIST *o, char *name);
|
||||
wchar_t *GetParamUniStr(LIST *o, char *name);
|
||||
UINT GetParamInt(LIST *o, char *name);
|
||||
bool GetParamYes(LIST *o, char *name);
|
||||
LIST *ParseCommandList(CONSOLE *c, char *cmd_name, wchar_t *command, PARAM param[], UINT num_param);
|
||||
bool IsNameInRealName(char *input_name, char *real_name);
|
||||
void GetOmissionName(char *dst, UINT size, char *src);
|
||||
bool IsOmissionName(char *input_name, char *real_name);
|
||||
TOKEN_LIST *GetRealnameCandidate(char *input_name, TOKEN_LIST *real_name_list);
|
||||
bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param);
|
||||
UINT GetConsoleWidth(CONSOLE *c);
|
||||
bool DispatchNextCmd(CONSOLE *c, char *prompt, CMD cmd[], UINT num_cmd, void *param);
|
||||
bool DispatchNextCmdEx(CONSOLE *c, wchar_t *exec_command, char *prompt, CMD cmd[], UINT num_cmd, void *param);
|
||||
void PrintCandidateHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *candidate_list, UINT left_space);
|
||||
UNI_TOKEN_LIST *SeparateStringByWidth(wchar_t *str, UINT width);
|
||||
UINT GetNextWordWidth(wchar_t *str);
|
||||
bool IsWordChar(wchar_t c);
|
||||
void GetCommandHelpStr(char *command_name, wchar_t **description, wchar_t **args, wchar_t **help);
|
||||
void GetCommandParamHelpStr(char *command_name, char *param_name, wchar_t **description);
|
||||
bool CmdEvalMinMax(CONSOLE *c, wchar_t *str, void *param);
|
||||
wchar_t *CmdPrompt(CONSOLE *c, void *param);
|
||||
bool CmdEvalNotEmpty(CONSOLE *c, wchar_t *str, void *param);
|
||||
bool CmdEvalInt1(CONSOLE *c, wchar_t *str, void *param);
|
||||
bool CmdEvalIsFile(CONSOLE *c, wchar_t *str, void *param);
|
||||
bool CmdEvalSafe(CONSOLE *c, wchar_t *str, void *param);
|
||||
void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list);
|
||||
int CompareCandidateStr(void *p1, void *p2);
|
||||
bool IsHelpStr(char *str);
|
||||
|
||||
CONSOLE *NewLocalConsole(wchar_t *infile, wchar_t *outfile);
|
||||
void ConsoleLocalFree(CONSOLE *c);
|
||||
wchar_t *ConsoleLocalReadLine(CONSOLE *c, wchar_t *prompt, bool nofile);
|
||||
char *ConsoleLocalReadPassword(CONSOLE *c, wchar_t *prompt);
|
||||
bool ConsoleLocalWrite(CONSOLE *c, wchar_t *str);
|
||||
void ConsoleWriteOutFile(CONSOLE *c, wchar_t *str, bool add_last_crlf);
|
||||
wchar_t *ConsoleReadNextFromInFile(CONSOLE *c);
|
||||
UINT ConsoleLocalGetWidth(CONSOLE *c);
|
||||
|
||||
|
||||
#endif // CONSOLE_H
|
||||
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Console.h
|
||||
// Header of Console.c
|
||||
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
|
||||
// Constant
|
||||
#define MAX_PROMPT_STRSIZE 65536
|
||||
#define WIN32_DEFAULT_CONSOLE_WIDTH 100
|
||||
|
||||
// Types of console
|
||||
#define CONSOLE_LOCAL 0 // Local console
|
||||
#define CONSOLE_CSV 1 // CSV output mode
|
||||
|
||||
// Parameters completion prompt function
|
||||
typedef wchar_t *(PROMPT_PROC)(CONSOLE *c, void *param);
|
||||
|
||||
// Parameter validation prompt function
|
||||
typedef bool (EVAL_PROC)(CONSOLE *c, wchar_t *str, void *param);
|
||||
|
||||
// Definition of the parameter item
|
||||
struct PARAM
|
||||
{
|
||||
char *Name; // Parameter name
|
||||
PROMPT_PROC *PromptProc; // Prompt function that automatically invoked if the parameter is not specified
|
||||
// (This is not called in the case of NULL)
|
||||
void *PromptProcParam; // Any pointers to pass to the prompt function
|
||||
EVAL_PROC *EvalProc; // Parameter string validation function
|
||||
void *EvalProcParam; // Any pointers to be passed to the validation function
|
||||
char *Tmp; // Temporary variable
|
||||
};
|
||||
|
||||
// Parameter value of the internal data
|
||||
struct PARAM_VALUE
|
||||
{
|
||||
char *Name; // Name
|
||||
char *StrValue; // String value
|
||||
wchar_t *UniStrValue; // Unicode string value
|
||||
UINT IntValue; // Integer value
|
||||
};
|
||||
|
||||
// Console service structure
|
||||
struct CONSOLE
|
||||
{
|
||||
UINT ConsoleType; // Type of console
|
||||
UINT RetCode; // The last exit code
|
||||
void *Param; // Data of any
|
||||
void (*Free)(CONSOLE *c); // Release function
|
||||
wchar_t *(*ReadLine)(CONSOLE *c, wchar_t *prompt, bool nofile); // Function to read one line
|
||||
char *(*ReadPassword)(CONSOLE *c, wchar_t *prompt); // Function to read the password
|
||||
bool (*Write)(CONSOLE *c, wchar_t *str); // Function to write a string
|
||||
UINT (*GetWidth)(CONSOLE *c); // Get the width of the screen
|
||||
bool ProgrammingMode; // Programming Mode
|
||||
LOCK *OutputLock; // Output Lock
|
||||
};
|
||||
|
||||
// Local console parameters
|
||||
struct LOCAL_CONSOLE_PARAM
|
||||
{
|
||||
IO *InFile; // Input file
|
||||
BUF *InBuf; // Input buffer
|
||||
IO *OutFile; // Output file
|
||||
UINT Win32_OldConsoleWidth; // Previous console size
|
||||
};
|
||||
|
||||
// Command procedure
|
||||
typedef UINT (COMMAND_PROC)(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
|
||||
|
||||
// Definition of command
|
||||
struct CMD
|
||||
{
|
||||
char *Name; // Command name
|
||||
COMMAND_PROC *Proc; // Procedure function
|
||||
};
|
||||
|
||||
// Evaluate the minimum / maximum value of the parameter
|
||||
struct CMD_EVAL_MIN_MAX
|
||||
{
|
||||
char *StrName;
|
||||
UINT MinValue, MaxValue;
|
||||
};
|
||||
|
||||
|
||||
// Function prototype
|
||||
wchar_t *Prompt(wchar_t *prompt_str);
|
||||
char *PromptA(wchar_t *prompt_str);
|
||||
bool PasswordPrompt(char *password, UINT size);
|
||||
void *SetConsoleRaw();
|
||||
void RestoreConsole(void *p);
|
||||
wchar_t *ParseCommandEx(wchar_t *str, wchar_t *name, TOKEN_LIST **param_list);
|
||||
wchar_t *ParseCommand(wchar_t *str, wchar_t *name);
|
||||
TOKEN_LIST *GetCommandNameList(wchar_t *str);
|
||||
char *ParseCommandA(wchar_t *str, char *name);
|
||||
LIST *NewParamValueList();
|
||||
int CmpParamValue(void *p1, void *p2);
|
||||
void FreeParamValueList(LIST *o);
|
||||
PARAM_VALUE *FindParamValue(LIST *o, char *name);
|
||||
char *GetParamStr(LIST *o, char *name);
|
||||
wchar_t *GetParamUniStr(LIST *o, char *name);
|
||||
UINT GetParamInt(LIST *o, char *name);
|
||||
bool GetParamYes(LIST *o, char *name);
|
||||
LIST *ParseCommandList(CONSOLE *c, char *cmd_name, wchar_t *command, PARAM param[], UINT num_param);
|
||||
bool IsNameInRealName(char *input_name, char *real_name);
|
||||
void GetOmissionName(char *dst, UINT size, char *src);
|
||||
bool IsOmissionName(char *input_name, char *real_name);
|
||||
TOKEN_LIST *GetRealnameCandidate(char *input_name, TOKEN_LIST *real_name_list);
|
||||
bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param);
|
||||
UINT GetConsoleWidth(CONSOLE *c);
|
||||
bool DispatchNextCmd(CONSOLE *c, char *prompt, CMD cmd[], UINT num_cmd, void *param);
|
||||
bool DispatchNextCmdEx(CONSOLE *c, wchar_t *exec_command, char *prompt, CMD cmd[], UINT num_cmd, void *param);
|
||||
void PrintCandidateHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *candidate_list, UINT left_space);
|
||||
UNI_TOKEN_LIST *SeparateStringByWidth(wchar_t *str, UINT width);
|
||||
UINT GetNextWordWidth(wchar_t *str);
|
||||
bool IsWordChar(wchar_t c);
|
||||
void GetCommandHelpStr(char *command_name, wchar_t **description, wchar_t **args, wchar_t **help);
|
||||
void GetCommandParamHelpStr(char *command_name, char *param_name, wchar_t **description);
|
||||
bool CmdEvalMinMax(CONSOLE *c, wchar_t *str, void *param);
|
||||
wchar_t *CmdPrompt(CONSOLE *c, void *param);
|
||||
bool CmdEvalNotEmpty(CONSOLE *c, wchar_t *str, void *param);
|
||||
bool CmdEvalInt1(CONSOLE *c, wchar_t *str, void *param);
|
||||
bool CmdEvalIsFile(CONSOLE *c, wchar_t *str, void *param);
|
||||
bool CmdEvalSafe(CONSOLE *c, wchar_t *str, void *param);
|
||||
void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list);
|
||||
int CompareCandidateStr(void *p1, void *p2);
|
||||
bool IsHelpStr(char *str);
|
||||
|
||||
CONSOLE *NewLocalConsole(wchar_t *infile, wchar_t *outfile);
|
||||
void ConsoleLocalFree(CONSOLE *c);
|
||||
wchar_t *ConsoleLocalReadLine(CONSOLE *c, wchar_t *prompt, bool nofile);
|
||||
char *ConsoleLocalReadPassword(CONSOLE *c, wchar_t *prompt);
|
||||
bool ConsoleLocalWrite(CONSOLE *c, wchar_t *str);
|
||||
void ConsoleWriteOutFile(CONSOLE *c, wchar_t *str, bool add_last_crlf);
|
||||
wchar_t *ConsoleReadNextFromInFile(CONSOLE *c);
|
||||
UINT ConsoleLocalGetWidth(CONSOLE *c);
|
||||
|
||||
|
||||
#endif // CONSOLE_H
|
||||
|
||||
|
||||
|
||||
|
1822
src/Cedar/DDNS.c
1822
src/Cedar/DDNS.c
File diff suppressed because it is too large
Load Diff
290
src/Cedar/DDNS.h
290
src/Cedar/DDNS.h
@ -1,145 +1,145 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// DDNS.h
|
||||
// Header of DDNS.c
|
||||
|
||||
#ifndef DDNS_H
|
||||
#define DDNS_H
|
||||
|
||||
// Certificate hash
|
||||
#define DDNS_CERT_HASH "78BF0499A99396907C9F49DD13571C81FE26E6F5" \
|
||||
"439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \
|
||||
"EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3" \
|
||||
"74DF99D4B1B5F0488A388B50D347D26013DC67A5" \
|
||||
"6EBB39AFCA8C900635CFC11218CF293A612457E4"
|
||||
|
||||
#define DDNS_SNI_VER_STRING "DDNS"
|
||||
|
||||
|
||||
// Destination URL
|
||||
#define DDNS_URL_V4_GLOBAL "https://x%c.x%c.dev.servers.ddns.softether-network.net/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V6_GLOBAL "https://x%c.x%c.dev.servers-v6.ddns.softether-network.net/ddns/ddns.aspx"
|
||||
#define DDNS_URL2_V4_GLOBAL "http://get-my-ip.ddns.softether-network.net/ddns/getmyip.ashx"
|
||||
#define DDNS_URL2_V6_GLOBAL "http://get-my-ip-v6.ddns.softether-network.net/ddns/getmyip.ashx"
|
||||
|
||||
#define DDNS_REPLACE_URL_FOR_EAST_BFLETS "https://senet-flets.v6.softether.co.jp/ddns/ddns.aspx"
|
||||
#define DDNS_REPLACE_URL_FOR_EAST_NGN "https://senet.aoi.flets-east.jp/ddns/ddns.aspx"
|
||||
#define DDNS_REPLACE_URL_FOR_WEST_NGN "https://senet.p-ns.flets-west.jp/ddns/ddns.aspx"
|
||||
|
||||
#define DDNS_REPLACE_URL2_FOR_EAST_BFLETS "http://senet-flets.v6.softether.co.jp/ddns/getmyip.ashx"
|
||||
#define DDNS_REPLACE_URL2_FOR_EAST_NGN "http://senet.aoi.flets-east.jp/ddns/getmyip.ashx"
|
||||
#define DDNS_REPLACE_URL2_FOR_WEST_NGN "http://senet.p-ns.flets-west.jp/ddns/getmyip.ashx"
|
||||
|
||||
// For China: Free version
|
||||
#define DDNS_URL_V4_ALT "https://x%c.x%c.dev.servers.ddns.uxcom.jp/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V6_ALT "https://x%c.x%c.dev.servers-v6.ddns.uxcom.jp/ddns/ddns.aspx"
|
||||
#define DDNS_URL2_V4_ALT "http://get-my-ip.ddns.uxcom.jp/ddns/getmyip.ashx"
|
||||
#define DDNS_URL2_V6_ALT "http://get-my-ip-v6.ddns.uxcom.jp/ddns/getmyip.ashx"
|
||||
|
||||
#define DDNS_RPC_MAX_RECV_SIZE DYN32(DDNS_RPC_MAX_RECV_SIZE, (128 * 1024 * 1024))
|
||||
|
||||
// Connection Timeout
|
||||
#define DDNS_CONNECT_TIMEOUT DYN32(DDNS_CONNECT_TIMEOUT, (15 * 1000))
|
||||
|
||||
// Communication time-out
|
||||
#define DDNS_COMM_TIMEOUT DYN32(DDNS_COMM_TIMEOUT, (60 * 1000))
|
||||
|
||||
// Maximum length of the host name
|
||||
#define DDNS_MAX_HOSTNAME 31
|
||||
|
||||
// DDNS Version
|
||||
#define DDNS_VERSION 1
|
||||
|
||||
// Period until the next registration in case of success
|
||||
#define DDNS_REGISTER_INTERVAL_OK_MIN DYN32(DDNS_REGISTER_INTERVAL_OK_MIN, (1 * 60 * 60 * 1000))
|
||||
#define DDNS_REGISTER_INTERVAL_OK_MAX DYN32(DDNS_REGISTER_INTERVAL_OK_MAX, (2 * 60 * 60 * 1000))
|
||||
|
||||
// Period until the next registration in case of failure
|
||||
#define DDNS_REGISTER_INTERVAL_NG_MIN DYN32(DDNS_REGISTER_INTERVAL_NG_MIN, (1 * 60 * 1000))
|
||||
#define DDNS_REGISTER_INTERVAL_NG_MAX DYN32(DDNS_REGISTER_INTERVAL_NG_MAX, (5 * 60 * 1000))
|
||||
|
||||
// The self IP address acquisition interval (If last trial succeeded)
|
||||
#define DDNS_GETMYIP_INTERVAL_OK_MIN DYN32(DDNS_GETMYIP_INTERVAL_OK_MIN, (10 * 60 * 1000))
|
||||
#define DDNS_GETMYIP_INTERVAL_OK_MAX DYN32(DDNS_GETMYIP_INTERVAL_OK_MAX, (20 * 60 * 1000))
|
||||
|
||||
// The self IP address acquisition interval (If last trial failed)
|
||||
#define DDNS_GETMYIP_INTERVAL_NG_MIN DYN32(DDNS_GETMYIP_INTERVAL_NG_MIN, (1 * 60 * 1000))
|
||||
#define DDNS_GETMYIP_INTERVAL_NG_MAX DYN32(DDNS_GETMYIP_INTERVAL_NG_MAX, (5 * 60 * 1000))
|
||||
|
||||
// Time difference to communicate with the DDNS server after a predetermined time has elapsed since the VPN Azure is disconnected
|
||||
#define DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF DYN32(DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF, (120 * 1000))
|
||||
#define DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX DYN32(DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX, (10 * 60 * 1000))
|
||||
|
||||
// DDNS Client
|
||||
struct DDNS_CLIENT
|
||||
{
|
||||
CEDAR *Cedar; // Cedar
|
||||
THREAD *Thread; // Thread
|
||||
UCHAR Key[SHA1_SIZE]; // Key
|
||||
LOCK *Lock; // Lock
|
||||
volatile bool Halt; // Halt flag
|
||||
EVENT *Event; // Halt event
|
||||
char CurrentHostName[DDNS_MAX_HOSTNAME + 1]; // Current host name
|
||||
char CurrentFqdn[MAX_SIZE]; // Current FQDN
|
||||
char DnsSuffix[MAX_SIZE]; // DNS suffix
|
||||
char CurrentIPv4[MAX_SIZE]; // Current IPv4 address
|
||||
char CurrentIPv6[MAX_SIZE]; // Current IPv6 address
|
||||
UINT Err_IPv4, Err_IPv6; // Last error
|
||||
UINT Err_IPv4_GetMyIp, Err_IPv6_GetMyIp; // Last error (obtaining self IP address)
|
||||
bool KeyChanged; // Flag to indicate that the key has been changed
|
||||
char LastMyIPv4[MAX_SIZE]; // Self IPv4 address that were acquired on last
|
||||
char LastMyIPv6[MAX_SIZE]; // Self IPv6 address that were acquired on last
|
||||
char CurrentAzureIp[MAX_SIZE]; // IP address of Azure Server to be used
|
||||
UINT64 CurrentAzureTimestamp; // Time stamp to be presented to the Azure Server
|
||||
char CurrentAzureSignature[MAX_SIZE]; // Signature to be presented to the Azure Server
|
||||
char AzureCertHash[MAX_SIZE]; // Azure Server certificate hash
|
||||
INTERNET_SETTING InternetSetting; // Internet connection settings
|
||||
|
||||
UINT64 NextRegisterTick_IPv4, NextRegisterTick_IPv6; // Next register time
|
||||
UINT64 NextGetMyIpTick_IPv4, NextGetMyIpTick_IPv6; // Next self IP acquisition time
|
||||
};
|
||||
|
||||
// DDNS Register Param
|
||||
struct DDNS_REGISTER_PARAM
|
||||
{
|
||||
char NewHostname[DDNS_MAX_HOSTNAME + 1]; // Host name after the change
|
||||
};
|
||||
|
||||
// The current status of the DDNS
|
||||
struct DDNS_CLIENT_STATUS
|
||||
{
|
||||
UINT Err_IPv4, Err_IPv6; // Last error
|
||||
wchar_t ErrStr_IPv4[MAX_SIZE];
|
||||
wchar_t ErrStr_IPv6[MAX_SIZE];
|
||||
char CurrentHostName[DDNS_MAX_HOSTNAME + 1]; // Current host name
|
||||
char CurrentFqdn[MAX_SIZE]; // Current FQDN
|
||||
char DnsSuffix[MAX_SIZE]; // DNS suffix
|
||||
char CurrentIPv4[MAX_SIZE]; // Current IPv4 address
|
||||
char CurrentIPv6[MAX_SIZE]; // Current IPv6 address
|
||||
char CurrentAzureIp[MAX_SIZE]; // IP address of Azure Server to be used
|
||||
UINT64 CurrentAzureTimestamp; // Time stamp to be presented to the Azure Server
|
||||
char CurrentAzureSignature[MAX_SIZE]; // Signature to be presented to the Azure Server
|
||||
char AzureCertHash[MAX_SIZE]; // Azure Server certificate hash
|
||||
INTERNET_SETTING InternetSetting; // Internet settings
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
DDNS_CLIENT *NewDDNSClient(CEDAR *cedar, UCHAR *key, INTERNET_SETTING *t);
|
||||
void FreeDDNSClient(DDNS_CLIENT *c);
|
||||
void DCGenNewKey(UCHAR *key);
|
||||
void DCThread(THREAD *thread, void *param);
|
||||
UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace_v6);
|
||||
UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use_ssl, char *replace_v6);
|
||||
UINT DCGetMyIp(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, char *replace_v6);
|
||||
void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st);
|
||||
UINT DCChangeHostName(DDNS_CLIENT *c, char *hostname);
|
||||
void DCSetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t);
|
||||
void DCGetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t);
|
||||
|
||||
|
||||
|
||||
#endif // DDNS_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// DDNS.h
|
||||
// Header of DDNS.c
|
||||
|
||||
#ifndef DDNS_H
|
||||
#define DDNS_H
|
||||
|
||||
// Certificate hash
|
||||
#define DDNS_CERT_HASH "78BF0499A99396907C9F49DD13571C81FE26E6F5" \
|
||||
"439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \
|
||||
"EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3" \
|
||||
"74DF99D4B1B5F0488A388B50D347D26013DC67A5" \
|
||||
"6EBB39AFCA8C900635CFC11218CF293A612457E4"
|
||||
|
||||
#define DDNS_SNI_VER_STRING "DDNS"
|
||||
|
||||
|
||||
// Destination URL
|
||||
#define DDNS_URL_V4_GLOBAL "https://x%c.x%c.dev.servers.ddns.softether-network.net/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V6_GLOBAL "https://x%c.x%c.dev.servers-v6.ddns.softether-network.net/ddns/ddns.aspx"
|
||||
#define DDNS_URL2_V4_GLOBAL "http://get-my-ip.ddns.softether-network.net/ddns/getmyip.ashx"
|
||||
#define DDNS_URL2_V6_GLOBAL "http://get-my-ip-v6.ddns.softether-network.net/ddns/getmyip.ashx"
|
||||
|
||||
#define DDNS_REPLACE_URL_FOR_EAST_BFLETS "https://senet-flets.v6.softether.co.jp/ddns/ddns.aspx"
|
||||
#define DDNS_REPLACE_URL_FOR_EAST_NGN "https://senet.aoi.flets-east.jp/ddns/ddns.aspx"
|
||||
#define DDNS_REPLACE_URL_FOR_WEST_NGN "https://senet.p-ns.flets-west.jp/ddns/ddns.aspx"
|
||||
|
||||
#define DDNS_REPLACE_URL2_FOR_EAST_BFLETS "http://senet-flets.v6.softether.co.jp/ddns/getmyip.ashx"
|
||||
#define DDNS_REPLACE_URL2_FOR_EAST_NGN "http://senet.aoi.flets-east.jp/ddns/getmyip.ashx"
|
||||
#define DDNS_REPLACE_URL2_FOR_WEST_NGN "http://senet.p-ns.flets-west.jp/ddns/getmyip.ashx"
|
||||
|
||||
// For China: Free version
|
||||
#define DDNS_URL_V4_ALT "https://x%c.x%c.dev.servers.ddns.uxcom.jp/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V6_ALT "https://x%c.x%c.dev.servers-v6.ddns.uxcom.jp/ddns/ddns.aspx"
|
||||
#define DDNS_URL2_V4_ALT "http://get-my-ip.ddns.uxcom.jp/ddns/getmyip.ashx"
|
||||
#define DDNS_URL2_V6_ALT "http://get-my-ip-v6.ddns.uxcom.jp/ddns/getmyip.ashx"
|
||||
|
||||
#define DDNS_RPC_MAX_RECV_SIZE DYN32(DDNS_RPC_MAX_RECV_SIZE, (128 * 1024 * 1024))
|
||||
|
||||
// Connection Timeout
|
||||
#define DDNS_CONNECT_TIMEOUT DYN32(DDNS_CONNECT_TIMEOUT, (15 * 1000))
|
||||
|
||||
// Communication time-out
|
||||
#define DDNS_COMM_TIMEOUT DYN32(DDNS_COMM_TIMEOUT, (60 * 1000))
|
||||
|
||||
// Maximum length of the host name
|
||||
#define DDNS_MAX_HOSTNAME 31
|
||||
|
||||
// DDNS Version
|
||||
#define DDNS_VERSION 1
|
||||
|
||||
// Period until the next registration in case of success
|
||||
#define DDNS_REGISTER_INTERVAL_OK_MIN DYN32(DDNS_REGISTER_INTERVAL_OK_MIN, (1 * 60 * 60 * 1000))
|
||||
#define DDNS_REGISTER_INTERVAL_OK_MAX DYN32(DDNS_REGISTER_INTERVAL_OK_MAX, (2 * 60 * 60 * 1000))
|
||||
|
||||
// Period until the next registration in case of failure
|
||||
#define DDNS_REGISTER_INTERVAL_NG_MIN DYN32(DDNS_REGISTER_INTERVAL_NG_MIN, (1 * 60 * 1000))
|
||||
#define DDNS_REGISTER_INTERVAL_NG_MAX DYN32(DDNS_REGISTER_INTERVAL_NG_MAX, (5 * 60 * 1000))
|
||||
|
||||
// The self IP address acquisition interval (If last trial succeeded)
|
||||
#define DDNS_GETMYIP_INTERVAL_OK_MIN DYN32(DDNS_GETMYIP_INTERVAL_OK_MIN, (10 * 60 * 1000))
|
||||
#define DDNS_GETMYIP_INTERVAL_OK_MAX DYN32(DDNS_GETMYIP_INTERVAL_OK_MAX, (20 * 60 * 1000))
|
||||
|
||||
// The self IP address acquisition interval (If last trial failed)
|
||||
#define DDNS_GETMYIP_INTERVAL_NG_MIN DYN32(DDNS_GETMYIP_INTERVAL_NG_MIN, (1 * 60 * 1000))
|
||||
#define DDNS_GETMYIP_INTERVAL_NG_MAX DYN32(DDNS_GETMYIP_INTERVAL_NG_MAX, (5 * 60 * 1000))
|
||||
|
||||
// Time difference to communicate with the DDNS server after a predetermined time has elapsed since the VPN Azure is disconnected
|
||||
#define DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF DYN32(DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF, (120 * 1000))
|
||||
#define DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX DYN32(DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX, (10 * 60 * 1000))
|
||||
|
||||
// DDNS Client
|
||||
struct DDNS_CLIENT
|
||||
{
|
||||
CEDAR *Cedar; // Cedar
|
||||
THREAD *Thread; // Thread
|
||||
UCHAR Key[SHA1_SIZE]; // Key
|
||||
LOCK *Lock; // Lock
|
||||
volatile bool Halt; // Halt flag
|
||||
EVENT *Event; // Halt event
|
||||
char CurrentHostName[DDNS_MAX_HOSTNAME + 1]; // Current host name
|
||||
char CurrentFqdn[MAX_SIZE]; // Current FQDN
|
||||
char DnsSuffix[MAX_SIZE]; // DNS suffix
|
||||
char CurrentIPv4[MAX_SIZE]; // Current IPv4 address
|
||||
char CurrentIPv6[MAX_SIZE]; // Current IPv6 address
|
||||
UINT Err_IPv4, Err_IPv6; // Last error
|
||||
UINT Err_IPv4_GetMyIp, Err_IPv6_GetMyIp; // Last error (obtaining self IP address)
|
||||
bool KeyChanged; // Flag to indicate that the key has been changed
|
||||
char LastMyIPv4[MAX_SIZE]; // Self IPv4 address that were acquired on last
|
||||
char LastMyIPv6[MAX_SIZE]; // Self IPv6 address that were acquired on last
|
||||
char CurrentAzureIp[MAX_SIZE]; // IP address of Azure Server to be used
|
||||
UINT64 CurrentAzureTimestamp; // Time stamp to be presented to the Azure Server
|
||||
char CurrentAzureSignature[MAX_SIZE]; // Signature to be presented to the Azure Server
|
||||
char AzureCertHash[MAX_SIZE]; // Azure Server certificate hash
|
||||
INTERNET_SETTING InternetSetting; // Internet connection settings
|
||||
|
||||
UINT64 NextRegisterTick_IPv4, NextRegisterTick_IPv6; // Next register time
|
||||
UINT64 NextGetMyIpTick_IPv4, NextGetMyIpTick_IPv6; // Next self IP acquisition time
|
||||
};
|
||||
|
||||
// DDNS Register Param
|
||||
struct DDNS_REGISTER_PARAM
|
||||
{
|
||||
char NewHostname[DDNS_MAX_HOSTNAME + 1]; // Host name after the change
|
||||
};
|
||||
|
||||
// The current status of the DDNS
|
||||
struct DDNS_CLIENT_STATUS
|
||||
{
|
||||
UINT Err_IPv4, Err_IPv6; // Last error
|
||||
wchar_t ErrStr_IPv4[MAX_SIZE];
|
||||
wchar_t ErrStr_IPv6[MAX_SIZE];
|
||||
char CurrentHostName[DDNS_MAX_HOSTNAME + 1]; // Current host name
|
||||
char CurrentFqdn[MAX_SIZE]; // Current FQDN
|
||||
char DnsSuffix[MAX_SIZE]; // DNS suffix
|
||||
char CurrentIPv4[MAX_SIZE]; // Current IPv4 address
|
||||
char CurrentIPv6[MAX_SIZE]; // Current IPv6 address
|
||||
char CurrentAzureIp[MAX_SIZE]; // IP address of Azure Server to be used
|
||||
UINT64 CurrentAzureTimestamp; // Time stamp to be presented to the Azure Server
|
||||
char CurrentAzureSignature[MAX_SIZE]; // Signature to be presented to the Azure Server
|
||||
char AzureCertHash[MAX_SIZE]; // Azure Server certificate hash
|
||||
INTERNET_SETTING InternetSetting; // Internet settings
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
DDNS_CLIENT *NewDDNSClient(CEDAR *cedar, UCHAR *key, INTERNET_SETTING *t);
|
||||
void FreeDDNSClient(DDNS_CLIENT *c);
|
||||
void DCGenNewKey(UCHAR *key);
|
||||
void DCThread(THREAD *thread, void *param);
|
||||
UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace_v6);
|
||||
UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use_ssl, char *replace_v6);
|
||||
UINT DCGetMyIp(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, char *replace_v6);
|
||||
void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st);
|
||||
UINT DCChangeHostName(DDNS_CLIENT *c, char *hostname);
|
||||
void DCSetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t);
|
||||
void DCGetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t);
|
||||
|
||||
|
||||
|
||||
#endif // DDNS_H
|
||||
|
||||
|
||||
|
@ -1,159 +1,159 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Database.c
|
||||
// License database
|
||||
|
||||
#include "CedarPch.h"
|
||||
|
||||
// Get the License status string
|
||||
wchar_t *LiGetLicenseStatusStr(UINT i)
|
||||
{
|
||||
wchar_t *ret = _UU("LICENSE_STATUS_OTHERERROR");
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case LICENSE_STATUS_OK:
|
||||
ret = _UU("LICENSE_STATUS_OK");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_EXPIRED:
|
||||
ret = _UU("LICENSE_STATUS_EXPIRED");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_ID_DIFF:
|
||||
ret = _UU("LICENSE_STATUS_ID_DIFF");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_DUP:
|
||||
ret = _UU("LICENSE_STATUS_DUP");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_INSUFFICIENT:
|
||||
ret = _UU("LICENSE_STATUS_INSUFFICIENT");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_COMPETITION:
|
||||
ret = _UU("LICENSE_STATUS_COMPETITION");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_NONSENSE:
|
||||
ret = _UU("LICENSE_STATUS_NONSENSE");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_CPU:
|
||||
ret = _UU("LICENSE_STATUS_CPU");
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *li_keybit_chars = "ABCDEFGHJKLMNPQRSTUVWXYZ12345678";
|
||||
|
||||
// Convert the string to a key bit
|
||||
bool LiStrToKeyBit(UCHAR *keybit, char *keystr)
|
||||
{
|
||||
UINT x[36];
|
||||
UINT i, wp;
|
||||
char *str;
|
||||
// Validate arguments
|
||||
if (keybit == NULL || keystr == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
str = CopyStr(keystr);
|
||||
Trim(str);
|
||||
|
||||
wp = 0;
|
||||
if (StrLen(str) != 41)
|
||||
{
|
||||
Free(str);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0;i < 36;i++)
|
||||
{
|
||||
char c = str[wp++];
|
||||
UINT j;
|
||||
|
||||
if (((i % 6) == 5) && (i != 35))
|
||||
{
|
||||
if (str[wp++] != '-')
|
||||
{
|
||||
Free(str);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
x[i] = INFINITE;
|
||||
for (j = 0;j < 32;j++)
|
||||
{
|
||||
if (ToUpper(c) == li_keybit_chars[j])
|
||||
{
|
||||
x[i] = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (x[i] == INFINITE)
|
||||
{
|
||||
Free(str);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Zero(keybit, 23);
|
||||
|
||||
keybit[0] = x[0] << 1 | x[1] >> 4;
|
||||
keybit[1] = x[1] << 4 | x[2] >> 1;
|
||||
keybit[2] = x[2] << 7 | x[3] << 2 | x[4] >> 3;
|
||||
keybit[3] = x[4] << 5 | x[5];
|
||||
|
||||
keybit[4] = x[6] << 3 | x[7] >> 2;
|
||||
keybit[5] = x[7] << 6 | x[8] << 1 | x[9] >> 4;
|
||||
keybit[6] = x[9] << 4 | x[10] >> 1;
|
||||
keybit[7] = x[10] << 7 | x[11] << 2 | x[12] >> 3;
|
||||
keybit[8] = x[12] << 5 | x[13];
|
||||
|
||||
keybit[9] = x[14] << 3 | x[15] >> 2;
|
||||
keybit[10] = x[15] << 6 | x[16] << 1 | x[17] >> 4;
|
||||
keybit[11] = x[17] << 4 | x[18] >> 1;
|
||||
keybit[12] = x[18] << 7 | x[19] << 2 | x[20] >> 3;
|
||||
keybit[13] = x[20] << 5 | x[21];
|
||||
|
||||
keybit[14] = x[22] << 3 | x[23] >> 2;
|
||||
keybit[15] = x[23] << 6 | x[24] << 1 | x[25] >> 4;
|
||||
keybit[16] = x[25] << 4 | x[26] >> 1;
|
||||
keybit[17] = x[26] << 7 | x[27] << 2 | x[28] >> 3;
|
||||
keybit[18] = x[28] << 5 | x[29];
|
||||
|
||||
keybit[19] = x[30] << 3 | x[31] >> 2;
|
||||
keybit[20] = x[31] << 6 | x[32] << 1 | x[33] >> 4;
|
||||
keybit[21] = x[33] << 4 | x[34] >> 1;
|
||||
keybit[22] = x[34] << 7 | x[35] << 2;
|
||||
|
||||
Free(str);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Determine whether the string is a license key
|
||||
bool LiIsLicenseKey(char *str)
|
||||
{
|
||||
UCHAR keybit[23];
|
||||
// Validate arguments
|
||||
if (str == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (LiStrToKeyBit(keybit, str) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Database.c
|
||||
// License database
|
||||
|
||||
#include "CedarPch.h"
|
||||
|
||||
// Get the License status string
|
||||
wchar_t *LiGetLicenseStatusStr(UINT i)
|
||||
{
|
||||
wchar_t *ret = _UU("LICENSE_STATUS_OTHERERROR");
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case LICENSE_STATUS_OK:
|
||||
ret = _UU("LICENSE_STATUS_OK");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_EXPIRED:
|
||||
ret = _UU("LICENSE_STATUS_EXPIRED");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_ID_DIFF:
|
||||
ret = _UU("LICENSE_STATUS_ID_DIFF");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_DUP:
|
||||
ret = _UU("LICENSE_STATUS_DUP");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_INSUFFICIENT:
|
||||
ret = _UU("LICENSE_STATUS_INSUFFICIENT");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_COMPETITION:
|
||||
ret = _UU("LICENSE_STATUS_COMPETITION");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_NONSENSE:
|
||||
ret = _UU("LICENSE_STATUS_NONSENSE");
|
||||
break;
|
||||
|
||||
case LICENSE_STATUS_CPU:
|
||||
ret = _UU("LICENSE_STATUS_CPU");
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *li_keybit_chars = "ABCDEFGHJKLMNPQRSTUVWXYZ12345678";
|
||||
|
||||
// Convert the string to a key bit
|
||||
bool LiStrToKeyBit(UCHAR *keybit, char *keystr)
|
||||
{
|
||||
UINT x[36];
|
||||
UINT i, wp;
|
||||
char *str;
|
||||
// Validate arguments
|
||||
if (keybit == NULL || keystr == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
str = CopyStr(keystr);
|
||||
Trim(str);
|
||||
|
||||
wp = 0;
|
||||
if (StrLen(str) != 41)
|
||||
{
|
||||
Free(str);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0;i < 36;i++)
|
||||
{
|
||||
char c = str[wp++];
|
||||
UINT j;
|
||||
|
||||
if (((i % 6) == 5) && (i != 35))
|
||||
{
|
||||
if (str[wp++] != '-')
|
||||
{
|
||||
Free(str);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
x[i] = INFINITE;
|
||||
for (j = 0;j < 32;j++)
|
||||
{
|
||||
if (ToUpper(c) == li_keybit_chars[j])
|
||||
{
|
||||
x[i] = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (x[i] == INFINITE)
|
||||
{
|
||||
Free(str);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Zero(keybit, 23);
|
||||
|
||||
keybit[0] = x[0] << 1 | x[1] >> 4;
|
||||
keybit[1] = x[1] << 4 | x[2] >> 1;
|
||||
keybit[2] = x[2] << 7 | x[3] << 2 | x[4] >> 3;
|
||||
keybit[3] = x[4] << 5 | x[5];
|
||||
|
||||
keybit[4] = x[6] << 3 | x[7] >> 2;
|
||||
keybit[5] = x[7] << 6 | x[8] << 1 | x[9] >> 4;
|
||||
keybit[6] = x[9] << 4 | x[10] >> 1;
|
||||
keybit[7] = x[10] << 7 | x[11] << 2 | x[12] >> 3;
|
||||
keybit[8] = x[12] << 5 | x[13];
|
||||
|
||||
keybit[9] = x[14] << 3 | x[15] >> 2;
|
||||
keybit[10] = x[15] << 6 | x[16] << 1 | x[17] >> 4;
|
||||
keybit[11] = x[17] << 4 | x[18] >> 1;
|
||||
keybit[12] = x[18] << 7 | x[19] << 2 | x[20] >> 3;
|
||||
keybit[13] = x[20] << 5 | x[21];
|
||||
|
||||
keybit[14] = x[22] << 3 | x[23] >> 2;
|
||||
keybit[15] = x[23] << 6 | x[24] << 1 | x[25] >> 4;
|
||||
keybit[16] = x[25] << 4 | x[26] >> 1;
|
||||
keybit[17] = x[26] << 7 | x[27] << 2 | x[28] >> 3;
|
||||
keybit[18] = x[28] << 5 | x[29];
|
||||
|
||||
keybit[19] = x[30] << 3 | x[31] >> 2;
|
||||
keybit[20] = x[31] << 6 | x[32] << 1 | x[33] >> 4;
|
||||
keybit[21] = x[33] << 4 | x[34] >> 1;
|
||||
keybit[22] = x[34] << 7 | x[35] << 2;
|
||||
|
||||
Free(str);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Determine whether the string is a license key
|
||||
bool LiIsLicenseKey(char *str)
|
||||
{
|
||||
UCHAR keybit[23];
|
||||
// Validate arguments
|
||||
if (str == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (LiStrToKeyBit(keybit, str) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Database.h
|
||||
// Header of Database.c
|
||||
|
||||
#ifndef DATABASE_H
|
||||
#define DATABASE_H
|
||||
|
||||
wchar_t *LiGetLicenseStatusStr(UINT i);
|
||||
bool LiIsLicenseKey(char *str);
|
||||
bool LiStrToKeyBit(UCHAR *keybit, char *keystr);
|
||||
|
||||
|
||||
#endif // DATABASE_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Database.h
|
||||
// Header of Database.c
|
||||
|
||||
#ifndef DATABASE_H
|
||||
#define DATABASE_H
|
||||
|
||||
wchar_t *LiGetLicenseStatusStr(UINT i);
|
||||
bool LiIsLicenseKey(char *str);
|
||||
bool LiStrToKeyBit(UCHAR *keybit, char *keystr);
|
||||
|
||||
|
||||
#endif // DATABASE_H
|
||||
|
||||
|
||||
|
2792
src/Cedar/EM.c
2792
src/Cedar/EM.c
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,16 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// EM.h
|
||||
// Header of EM.c
|
||||
|
||||
#ifndef EM_H
|
||||
#define EM_H
|
||||
|
||||
// Public function
|
||||
void EMExec();
|
||||
|
||||
#endif // EM_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// EM.h
|
||||
// Header of EM.c
|
||||
|
||||
#ifndef EM_H
|
||||
#define EM_H
|
||||
|
||||
// Public function
|
||||
void EMExec();
|
||||
|
||||
#endif // EM_H
|
||||
|
||||
|
||||
|
@ -1,43 +1,43 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// EMInner.h
|
||||
// Inner header of EM.c
|
||||
|
||||
// Constants
|
||||
#define EM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\EtherLogger\\Manager"
|
||||
|
||||
// Inner structure
|
||||
typedef struct EM_ADD
|
||||
{
|
||||
RPC *Rpc;
|
||||
bool NewMode;
|
||||
char DeviceName[MAX_SIZE];
|
||||
} EM_ADD;
|
||||
|
||||
// Inner functions
|
||||
void EMMain(RPC *r);
|
||||
UINT EmMainDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void EmMainInit(HWND hWnd, RPC *r);
|
||||
void EmMainUpdate(HWND hWnd, RPC *r);
|
||||
void EmMainRefresh(HWND hWnd, RPC *r);
|
||||
void EmAdd(HWND hWnd, RPC *r, char *device_name);
|
||||
UINT EmAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void EmAddInit(HWND hWnd, EM_ADD *p);
|
||||
void EmDlgToHubLog(HWND hWnd, HUB_LOG *g);
|
||||
void EmHubLogToDlg(HWND hWnd, HUB_LOG *g);
|
||||
void EmAddOk(HWND hWnd, EM_ADD *p);
|
||||
void EmAddUpdate(HWND hWnd, EM_ADD *p);
|
||||
UINT EmPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
UINT EmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void EmLicenseDlgInit(HWND hWnd, RPC *s);
|
||||
void EmLicenseDlgRefresh(HWND hWnd, RPC *s);
|
||||
void EmLicenseDlgUpdate(HWND hWnd, RPC *s);
|
||||
bool EmLicenseAdd(HWND hWnd, RPC *s);
|
||||
UINT EmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void EmLicenseAddDlgInit(HWND hWnd, RPC *s);
|
||||
void EmLicenseAddDlgUpdate(HWND hWnd, RPC *s);
|
||||
void EmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus);
|
||||
void EmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size);
|
||||
void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s);
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// EMInner.h
|
||||
// Inner header of EM.c
|
||||
|
||||
// Constants
|
||||
#define EM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\EtherLogger\\Manager"
|
||||
|
||||
// Inner structure
|
||||
typedef struct EM_ADD
|
||||
{
|
||||
RPC *Rpc;
|
||||
bool NewMode;
|
||||
char DeviceName[MAX_SIZE];
|
||||
} EM_ADD;
|
||||
|
||||
// Inner functions
|
||||
void EMMain(RPC *r);
|
||||
UINT EmMainDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void EmMainInit(HWND hWnd, RPC *r);
|
||||
void EmMainUpdate(HWND hWnd, RPC *r);
|
||||
void EmMainRefresh(HWND hWnd, RPC *r);
|
||||
void EmAdd(HWND hWnd, RPC *r, char *device_name);
|
||||
UINT EmAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void EmAddInit(HWND hWnd, EM_ADD *p);
|
||||
void EmDlgToHubLog(HWND hWnd, HUB_LOG *g);
|
||||
void EmHubLogToDlg(HWND hWnd, HUB_LOG *g);
|
||||
void EmAddOk(HWND hWnd, EM_ADD *p);
|
||||
void EmAddUpdate(HWND hWnd, EM_ADD *p);
|
||||
UINT EmPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
UINT EmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void EmLicenseDlgInit(HWND hWnd, RPC *s);
|
||||
void EmLicenseDlgRefresh(HWND hWnd, RPC *s);
|
||||
void EmLicenseDlgUpdate(HWND hWnd, RPC *s);
|
||||
bool EmLicenseAdd(HWND hWnd, RPC *s);
|
||||
UINT EmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void EmLicenseAddDlgInit(HWND hWnd, RPC *s);
|
||||
void EmLicenseAddDlgUpdate(HWND hWnd, RPC *s);
|
||||
void EmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus);
|
||||
void EmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size);
|
||||
void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s);
|
||||
|
2516
src/Cedar/EtherLog.c
2516
src/Cedar/EtherLog.c
File diff suppressed because it is too large
Load Diff
@ -1,171 +1,171 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// EtherLog.h
|
||||
// Header of EtherLog.c
|
||||
|
||||
#ifndef ETHERLOG_H
|
||||
#define ETHERLOG_H
|
||||
|
||||
// Whether this is a beta version
|
||||
#define ELOG_IS_BETA true
|
||||
|
||||
// Beta expiration date
|
||||
#define ELOG_BETA_EXPIRES_YEAR 2008
|
||||
#define ELOG_BETA_EXPIRES_MONTH 12
|
||||
#define ELOG_BETA_EXPIRES_DAY 2
|
||||
|
||||
// Version information
|
||||
//#define EL_VER 201
|
||||
//#define EL_BUILD 1600
|
||||
//#define EL_BETA 1
|
||||
#define MAX_LOGGING_QUEUE_LEN 100000
|
||||
|
||||
// RPC related
|
||||
struct RPC_ADD_DEVICE
|
||||
{
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
HUB_LOG LogSetting; // Log settings
|
||||
bool NoPromiscuous; // Without promiscuous mode
|
||||
};
|
||||
|
||||
struct RPC_DELETE_DEVICE
|
||||
{
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
};
|
||||
|
||||
struct RPC_ENUM_DEVICE_ITEM
|
||||
{
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
bool Active; // Running flag
|
||||
};
|
||||
|
||||
struct RPC_ENUM_DEVICE
|
||||
{
|
||||
UINT NumItem; // Number of items
|
||||
RPC_ENUM_DEVICE_ITEM *Items; // Items
|
||||
bool IsLicenseSupported; // Whether the license system is supported
|
||||
};
|
||||
|
||||
// License status of the service
|
||||
struct RPC_EL_LICENSE_STATUS
|
||||
{
|
||||
BOOL Valid; // Enable flag
|
||||
UINT64 SystemId; // System ID
|
||||
UINT64 SystemExpires; // System expiration date
|
||||
};
|
||||
|
||||
// Device
|
||||
struct EL_DEVICE
|
||||
{
|
||||
EL *el; // EL
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
HUB_LOG LogSetting; // Log settings
|
||||
THREAD *Thread; // Thread
|
||||
CANCEL *Cancel1; // Cancel 1
|
||||
CANCEL *Cancel2; // Cancel 2
|
||||
volatile bool Halt; // Halting flag
|
||||
bool Active; // Running flag
|
||||
bool NoPromiscuous; // Without promiscuous mode
|
||||
LOG *Logger; // Logger
|
||||
};
|
||||
|
||||
// License status
|
||||
struct EL_LICENSE_STATUS
|
||||
{
|
||||
BOOL Valid; // Enable flag
|
||||
UINT64 SystemId; // System ID
|
||||
UINT64 Expires; // Expiration date
|
||||
};
|
||||
|
||||
// EtherLogger
|
||||
struct EL
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
CEDAR *Cedar; // Cedar
|
||||
LIST *DeviceList; // Device list
|
||||
CFG_RW *CfgRw; // Config R/W
|
||||
UINT Port; // Port number
|
||||
LISTENER *Listener; // Listener
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Password
|
||||
LIST *AdminThreadList; // Management thread list
|
||||
LIST *AdminSockList; // Management socket list
|
||||
LICENSE_SYSTEM *LicenseSystem; // License system
|
||||
EL_LICENSE_STATUS *LicenseStatus; // License status
|
||||
UINT64 AutoDeleteCheckDiskFreeSpaceMin; // Minimum free disk space
|
||||
ERASER *Eraser; // Eraser
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
void ElStart();
|
||||
void ElStop();
|
||||
EL *NewEl();
|
||||
void ReleaseEl(EL *e);
|
||||
void CleanupEl(EL *e);
|
||||
void ElInitConfig(EL *e);
|
||||
void ElFreeConfig(EL *e);
|
||||
bool ElLoadConfig(EL *e);
|
||||
void ElLoadConfigFromFolder(EL *e, FOLDER *root);
|
||||
void ElSaveConfig(EL *e);
|
||||
void ElSaveConfigToFolder(EL *e, FOLDER *root);
|
||||
int ElCompareDevice(void *p1, void *p2);
|
||||
bool ElAddCaptureDevice(EL *e, char *name, HUB_LOG *log, bool no_promiscuous);
|
||||
bool ElDeleteCaptureDevice(EL *e, char *name);
|
||||
bool ElSetCaptureDeviceLogSetting(EL *e, char *name, HUB_LOG *log);
|
||||
void ElCaptureThread(THREAD *thread, void *param);
|
||||
void ElStartListener(EL *e);
|
||||
void ElStopListener(EL *e);
|
||||
void ElListenerProc(THREAD *thread, void *param);
|
||||
PACK *ElRpcServer(RPC *r, char *name, PACK *p);
|
||||
void ElParseCurrentLicenseStatus(LICENSE_SYSTEM *s, EL_LICENSE_STATUS *st);
|
||||
bool ElIsBetaExpired();
|
||||
|
||||
|
||||
UINT EtAddDevice(EL *e, RPC_ADD_DEVICE *t);
|
||||
UINT EtDelDevice(EL *e, RPC_DELETE_DEVICE *t);
|
||||
UINT EtSetDevice(EL *e, RPC_ADD_DEVICE *t);
|
||||
UINT EtGetDevice(EL *e, RPC_ADD_DEVICE *t);
|
||||
UINT EtEnumDevice(EL *e, RPC_ENUM_DEVICE *t);
|
||||
UINT EtEnumAllDevice(EL *e, RPC_ENUM_DEVICE *t);
|
||||
UINT EtSetPassword(EL *e, RPC_SET_PASSWORD *t);
|
||||
UINT EtAddLicenseKey(EL *a, RPC_TEST *t);
|
||||
UINT EtDelLicenseKey(EL *a, RPC_TEST *t);
|
||||
UINT EtEnumLicenseKey(EL *a, RPC_ENUM_LICENSE_KEY *t);
|
||||
UINT EtGetLicenseStatus(EL *a, RPC_EL_LICENSE_STATUS *t);
|
||||
UINT EtGetBridgeSupport(EL *a, RPC_BRIDGE_SUPPORT *t);
|
||||
UINT EtRebootServer(EL *a, RPC_TEST *t);
|
||||
|
||||
UINT EcAddDevice(RPC *r, RPC_ADD_DEVICE *t);
|
||||
UINT EcDelDevice(RPC *r, RPC_DELETE_DEVICE *t);
|
||||
UINT EcSetDevice(RPC *r, RPC_ADD_DEVICE *t);
|
||||
UINT EcGetDevice(RPC *r, RPC_ADD_DEVICE *t);
|
||||
UINT EcEnumDevice(RPC *r, RPC_ENUM_DEVICE *t);
|
||||
UINT EcEnumAllDevice(RPC *r, RPC_ENUM_DEVICE *t);
|
||||
UINT EcSetPassword(RPC *r, RPC_SET_PASSWORD *t);
|
||||
UINT EcDelLicenseKey(RPC *r, RPC_TEST *t);
|
||||
UINT EcEnumLicenseKey(RPC *r, RPC_ENUM_LICENSE_KEY *t);
|
||||
UINT EcGetLicenseStatus(RPC *r, RPC_EL_LICENSE_STATUS *t);
|
||||
UINT EcGetBridgeSupport(RPC *r, RPC_BRIDGE_SUPPORT *t);
|
||||
UINT EcRebootServer(RPC *r, RPC_TEST *t);
|
||||
|
||||
UINT EcConnect(char *host, UINT port, char *password, RPC **rpc);
|
||||
void EcDisconnect(RPC *rpc);
|
||||
|
||||
void InRpcAddDevice(RPC_ADD_DEVICE *t, PACK *p);
|
||||
void OutRpcAddDevice(PACK *p, RPC_ADD_DEVICE *t);
|
||||
void InRpcDeleteDevice(RPC_DELETE_DEVICE *t, PACK *p);
|
||||
void OutRpcDeleteDevice(PACK *p, RPC_DELETE_DEVICE *t);
|
||||
void InRpcEnumDevice(RPC_ENUM_DEVICE *t, PACK *p);
|
||||
void OutRpcEnumDevice(PACK *p, RPC_ENUM_DEVICE *t);
|
||||
void FreeRpcEnumDevice(RPC_ENUM_DEVICE *t);
|
||||
void InRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t, PACK *p);
|
||||
void OutRpcEnumLicenseKey(PACK *p, RPC_ENUM_LICENSE_KEY *t);
|
||||
void FreeRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t);
|
||||
void InRpcElLicenseStatus(RPC_EL_LICENSE_STATUS *t, PACK *p);
|
||||
void OutRpcElLicenseStatus(PACK *p, RPC_EL_LICENSE_STATUS *t);
|
||||
|
||||
#endif // ETHERLOG_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// EtherLog.h
|
||||
// Header of EtherLog.c
|
||||
|
||||
#ifndef ETHERLOG_H
|
||||
#define ETHERLOG_H
|
||||
|
||||
// Whether this is a beta version
|
||||
#define ELOG_IS_BETA true
|
||||
|
||||
// Beta expiration date
|
||||
#define ELOG_BETA_EXPIRES_YEAR 2008
|
||||
#define ELOG_BETA_EXPIRES_MONTH 12
|
||||
#define ELOG_BETA_EXPIRES_DAY 2
|
||||
|
||||
// Version information
|
||||
//#define EL_VER 201
|
||||
//#define EL_BUILD 1600
|
||||
//#define EL_BETA 1
|
||||
#define MAX_LOGGING_QUEUE_LEN 100000
|
||||
|
||||
// RPC related
|
||||
struct RPC_ADD_DEVICE
|
||||
{
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
HUB_LOG LogSetting; // Log settings
|
||||
bool NoPromiscuous; // Without promiscuous mode
|
||||
};
|
||||
|
||||
struct RPC_DELETE_DEVICE
|
||||
{
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
};
|
||||
|
||||
struct RPC_ENUM_DEVICE_ITEM
|
||||
{
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
bool Active; // Running flag
|
||||
};
|
||||
|
||||
struct RPC_ENUM_DEVICE
|
||||
{
|
||||
UINT NumItem; // Number of items
|
||||
RPC_ENUM_DEVICE_ITEM *Items; // Items
|
||||
bool IsLicenseSupported; // Whether the license system is supported
|
||||
};
|
||||
|
||||
// License status of the service
|
||||
struct RPC_EL_LICENSE_STATUS
|
||||
{
|
||||
BOOL Valid; // Enable flag
|
||||
UINT64 SystemId; // System ID
|
||||
UINT64 SystemExpires; // System expiration date
|
||||
};
|
||||
|
||||
// Device
|
||||
struct EL_DEVICE
|
||||
{
|
||||
EL *el; // EL
|
||||
char DeviceName[MAX_SIZE]; // Device name
|
||||
HUB_LOG LogSetting; // Log settings
|
||||
THREAD *Thread; // Thread
|
||||
CANCEL *Cancel1; // Cancel 1
|
||||
CANCEL *Cancel2; // Cancel 2
|
||||
volatile bool Halt; // Halting flag
|
||||
bool Active; // Running flag
|
||||
bool NoPromiscuous; // Without promiscuous mode
|
||||
LOG *Logger; // Logger
|
||||
};
|
||||
|
||||
// License status
|
||||
struct EL_LICENSE_STATUS
|
||||
{
|
||||
BOOL Valid; // Enable flag
|
||||
UINT64 SystemId; // System ID
|
||||
UINT64 Expires; // Expiration date
|
||||
};
|
||||
|
||||
// EtherLogger
|
||||
struct EL
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
CEDAR *Cedar; // Cedar
|
||||
LIST *DeviceList; // Device list
|
||||
CFG_RW *CfgRw; // Config R/W
|
||||
UINT Port; // Port number
|
||||
LISTENER *Listener; // Listener
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Password
|
||||
LIST *AdminThreadList; // Management thread list
|
||||
LIST *AdminSockList; // Management socket list
|
||||
LICENSE_SYSTEM *LicenseSystem; // License system
|
||||
EL_LICENSE_STATUS *LicenseStatus; // License status
|
||||
UINT64 AutoDeleteCheckDiskFreeSpaceMin; // Minimum free disk space
|
||||
ERASER *Eraser; // Eraser
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
void ElStart();
|
||||
void ElStop();
|
||||
EL *NewEl();
|
||||
void ReleaseEl(EL *e);
|
||||
void CleanupEl(EL *e);
|
||||
void ElInitConfig(EL *e);
|
||||
void ElFreeConfig(EL *e);
|
||||
bool ElLoadConfig(EL *e);
|
||||
void ElLoadConfigFromFolder(EL *e, FOLDER *root);
|
||||
void ElSaveConfig(EL *e);
|
||||
void ElSaveConfigToFolder(EL *e, FOLDER *root);
|
||||
int ElCompareDevice(void *p1, void *p2);
|
||||
bool ElAddCaptureDevice(EL *e, char *name, HUB_LOG *log, bool no_promiscuous);
|
||||
bool ElDeleteCaptureDevice(EL *e, char *name);
|
||||
bool ElSetCaptureDeviceLogSetting(EL *e, char *name, HUB_LOG *log);
|
||||
void ElCaptureThread(THREAD *thread, void *param);
|
||||
void ElStartListener(EL *e);
|
||||
void ElStopListener(EL *e);
|
||||
void ElListenerProc(THREAD *thread, void *param);
|
||||
PACK *ElRpcServer(RPC *r, char *name, PACK *p);
|
||||
void ElParseCurrentLicenseStatus(LICENSE_SYSTEM *s, EL_LICENSE_STATUS *st);
|
||||
bool ElIsBetaExpired();
|
||||
|
||||
|
||||
UINT EtAddDevice(EL *e, RPC_ADD_DEVICE *t);
|
||||
UINT EtDelDevice(EL *e, RPC_DELETE_DEVICE *t);
|
||||
UINT EtSetDevice(EL *e, RPC_ADD_DEVICE *t);
|
||||
UINT EtGetDevice(EL *e, RPC_ADD_DEVICE *t);
|
||||
UINT EtEnumDevice(EL *e, RPC_ENUM_DEVICE *t);
|
||||
UINT EtEnumAllDevice(EL *e, RPC_ENUM_DEVICE *t);
|
||||
UINT EtSetPassword(EL *e, RPC_SET_PASSWORD *t);
|
||||
UINT EtAddLicenseKey(EL *a, RPC_TEST *t);
|
||||
UINT EtDelLicenseKey(EL *a, RPC_TEST *t);
|
||||
UINT EtEnumLicenseKey(EL *a, RPC_ENUM_LICENSE_KEY *t);
|
||||
UINT EtGetLicenseStatus(EL *a, RPC_EL_LICENSE_STATUS *t);
|
||||
UINT EtGetBridgeSupport(EL *a, RPC_BRIDGE_SUPPORT *t);
|
||||
UINT EtRebootServer(EL *a, RPC_TEST *t);
|
||||
|
||||
UINT EcAddDevice(RPC *r, RPC_ADD_DEVICE *t);
|
||||
UINT EcDelDevice(RPC *r, RPC_DELETE_DEVICE *t);
|
||||
UINT EcSetDevice(RPC *r, RPC_ADD_DEVICE *t);
|
||||
UINT EcGetDevice(RPC *r, RPC_ADD_DEVICE *t);
|
||||
UINT EcEnumDevice(RPC *r, RPC_ENUM_DEVICE *t);
|
||||
UINT EcEnumAllDevice(RPC *r, RPC_ENUM_DEVICE *t);
|
||||
UINT EcSetPassword(RPC *r, RPC_SET_PASSWORD *t);
|
||||
UINT EcDelLicenseKey(RPC *r, RPC_TEST *t);
|
||||
UINT EcEnumLicenseKey(RPC *r, RPC_ENUM_LICENSE_KEY *t);
|
||||
UINT EcGetLicenseStatus(RPC *r, RPC_EL_LICENSE_STATUS *t);
|
||||
UINT EcGetBridgeSupport(RPC *r, RPC_BRIDGE_SUPPORT *t);
|
||||
UINT EcRebootServer(RPC *r, RPC_TEST *t);
|
||||
|
||||
UINT EcConnect(char *host, UINT port, char *password, RPC **rpc);
|
||||
void EcDisconnect(RPC *rpc);
|
||||
|
||||
void InRpcAddDevice(RPC_ADD_DEVICE *t, PACK *p);
|
||||
void OutRpcAddDevice(PACK *p, RPC_ADD_DEVICE *t);
|
||||
void InRpcDeleteDevice(RPC_DELETE_DEVICE *t, PACK *p);
|
||||
void OutRpcDeleteDevice(PACK *p, RPC_DELETE_DEVICE *t);
|
||||
void InRpcEnumDevice(RPC_ENUM_DEVICE *t, PACK *p);
|
||||
void OutRpcEnumDevice(PACK *p, RPC_ENUM_DEVICE *t);
|
||||
void FreeRpcEnumDevice(RPC_ENUM_DEVICE *t);
|
||||
void InRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t, PACK *p);
|
||||
void OutRpcEnumLicenseKey(PACK *p, RPC_ENUM_LICENSE_KEY *t);
|
||||
void FreeRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t);
|
||||
void InRpcElLicenseStatus(RPC_EL_LICENSE_STATUS *t, PACK *p);
|
||||
void OutRpcElLicenseStatus(PACK *p, RPC_EL_LICENSE_STATUS *t);
|
||||
|
||||
#endif // ETHERLOG_H
|
||||
|
||||
|
||||
|
14428
src/Cedar/Hub.c
14428
src/Cedar/Hub.c
File diff suppressed because it is too large
Load Diff
1078
src/Cedar/Hub.h
1078
src/Cedar/Hub.h
File diff suppressed because it is too large
Load Diff
5226
src/Cedar/IPC.c
5226
src/Cedar/IPC.c
File diff suppressed because it is too large
Load Diff
482
src/Cedar/IPC.h
482
src/Cedar/IPC.h
@ -1,241 +1,241 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// IPC.h
|
||||
// Header of IPC.c
|
||||
|
||||
#ifndef IPC_H
|
||||
#define IPC_H
|
||||
|
||||
// Constants
|
||||
#define IPC_ARP_LIFETIME (3 * 60 * 1000)
|
||||
#define IPC_ARP_GIVEUPTIME (1 * 1000)
|
||||
#define IPC_DHCP_TIMEOUT (5 * 1000)
|
||||
#define IPC_DHCP_MIN_LEASE 5
|
||||
#define IPC_DHCP_DEFAULT_LEASE 3600
|
||||
|
||||
#define IPC_MAX_PACKET_QUEUE_LEN 10000
|
||||
|
||||
#define IPC_DHCP_VENDOR_ID "MSFT 5.0"
|
||||
|
||||
#define IPC_PASSWORD_MSCHAPV2_TAG "xH7DiNlurDhcYV4a:"
|
||||
|
||||
#define IPC_LAYER_2 2
|
||||
#define IPC_LAYER_3 3
|
||||
|
||||
// IPv6 constants
|
||||
#define IPC_IPV6_NDT_LIFETIME (30 * 1000) // as per REACHABLE_TIME constant of RFC4861
|
||||
#define IPC_IPV6_NDT_GIVEUPTIME (3 * 1000) // as per MAX_MULTICAST_SOLICIT * RETRANS_TIMER constants of RFC4861
|
||||
#define IPC_IPV6_RA_INTERVAL (2 * 1000) // Windows gets stuck if it is bigger
|
||||
#define IPC_IPV6_RA_MAX_RETRIES 2 // Windows seems to be stuck when it doesn't receive an answer in due time
|
||||
|
||||
// Protocol status
|
||||
#define IPC_PROTO_STATUS_CLOSED 0x0
|
||||
#define IPC_PROTO_STATUS_CONFIG 0x1
|
||||
#define IPC_PROTO_STATUS_CONFIG_WAIT 0x2
|
||||
#define IPC_PROTO_STATUS_OPENED 0x10
|
||||
#define IPC_PROTO_STATUS_REJECTED 0x100
|
||||
|
||||
#define IPC_PROTO_SET_STATUS(ipc, proto, value) ((ipc) != NULL ? ((ipc->proto) = (value)) : 0)
|
||||
#define IPC_PROTO_GET_STATUS(ipc, proto) ((ipc) != NULL ? (ipc->proto) : IPC_PROTO_STATUS_REJECTED)
|
||||
|
||||
// ARP table entry
|
||||
struct IPC_ARP
|
||||
{
|
||||
IP Ip; // IP address
|
||||
bool Resolved; // Whether the MAC address have been resolved
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UINT64 GiveupTime; // Time to give up (in the case of unresolved)
|
||||
UINT64 ExpireTime; // Expiration date (If resolved)
|
||||
QUEUE *PacketQueue; // Transmission packet queue
|
||||
};
|
||||
|
||||
// DHCP release queue
|
||||
struct IPC_DHCP_RELEASE_QUEUE
|
||||
{
|
||||
DHCP_OPTION_LIST Req;
|
||||
UINT TranId;
|
||||
UCHAR MacAddress[6];
|
||||
};
|
||||
|
||||
// IPC_SESSION_SHARED_BUFFER_DATA
|
||||
struct IPC_SESSION_SHARED_BUFFER_DATA
|
||||
{
|
||||
char ProtocolDetails[256];
|
||||
bool EnableUdpAccel;
|
||||
bool UsingUdpAccel;
|
||||
};
|
||||
|
||||
// IPC_PARAM
|
||||
struct IPC_PARAM
|
||||
{
|
||||
char ClientName[MAX_SIZE];
|
||||
char Postfix[MAX_SIZE];
|
||||
char HubName[MAX_HUBNAME_LEN + 1];
|
||||
char UserName[MAX_USERNAME_LEN + 1];
|
||||
char Password[MAX_PASSWORD_LEN + 1];
|
||||
IP ClientIp;
|
||||
UINT ClientPort;
|
||||
IP ServerIp;
|
||||
UINT ServerPort;
|
||||
char ClientHostname[MAX_SIZE];
|
||||
char CryptName[MAX_SIZE];
|
||||
bool BridgeMode;
|
||||
UINT Mss;
|
||||
bool IsL3Mode;
|
||||
X *ClientCertificate;
|
||||
UINT Layer;
|
||||
};
|
||||
|
||||
// DHCPv4 response awaiter
|
||||
struct IPC_DHCPV4_AWAIT
|
||||
{
|
||||
bool IsAwaiting;
|
||||
DHCPV4_DATA *DhcpData;
|
||||
UINT TransCode;
|
||||
UINT OpCode;
|
||||
};
|
||||
|
||||
// IPC_ASYNC object
|
||||
struct IPC_ASYNC
|
||||
{
|
||||
CEDAR *Cedar; // Cedar
|
||||
IPC_PARAM Param; // Parameters for creating IPC
|
||||
THREAD *Thread; // Thread
|
||||
SOCK_EVENT *SockEvent; // Socket events that is set when the connection is completed
|
||||
bool Done; // Processing completion flag
|
||||
IPC *Ipc; // IPC object (if it fails to connect, the value is NULL)
|
||||
TUBE *TubeForDisconnect; // Tube for disconnection notification
|
||||
UINT ErrorCode; // Error code in the case of failing to connect
|
||||
DHCP_OPTION_LIST L3ClientAddressOption; // Client IP address option (Only in the case of L3 mode)
|
||||
UINT64 L3DhcpRenewInterval; // DHCP update interval
|
||||
UINT64 L3NextDhcpRenewTick; // DHCP renewal time of the next
|
||||
bool DhcpAllocFailed; // Failed to get IP address from the DHCP server
|
||||
};
|
||||
|
||||
// IPC object
|
||||
struct IPC
|
||||
{
|
||||
CEDAR *Cedar;
|
||||
char HubName[MAX_HUBNAME_LEN + 1];
|
||||
char UserName[MAX_USERNAME_LEN + 1];
|
||||
char Password[MAX_PASSWORD_LEN + 1];
|
||||
char ClientHostname[MAX_SIZE];
|
||||
UCHAR random[SHA1_SIZE];
|
||||
char SessionName[MAX_SESSION_NAME_LEN + 1];
|
||||
char ConnectionName[MAX_CONNECTION_NAME_LEN + 1];
|
||||
POLICY *Policy;
|
||||
SOCK *Sock;
|
||||
INTERRUPT_MANAGER *Interrupt; // Interrupt manager
|
||||
IP ClientIPAddress; // IP address of the client
|
||||
IP SubnetMask; // Subnet mask of the client
|
||||
IP DefaultGateway; // Default gateway address
|
||||
IP BroadcastAddress; // Broadcast address
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UCHAR Padding[2];
|
||||
LIST *ArpTable; // ARP table
|
||||
QUEUE *IPv4ReceivedQueue; // IPv4 reception queue
|
||||
UINT IPv4State;
|
||||
IPC_DHCPV4_AWAIT DHCPv4Awaiter;
|
||||
TUBE_FLUSH_LIST *FlushList; // Tube Flush List
|
||||
UCHAR MsChapV2_ServerResponse[20]; // Server response
|
||||
DHCP_CLASSLESS_ROUTE_TABLE ClasslessRoute; // Classless routing table
|
||||
SHARED_BUFFER *IpcSessionSharedBuffer; // A shared buffer between IPC and Session
|
||||
IPC_SESSION_SHARED_BUFFER_DATA *IpcSessionShared; // Shared data between IPC and Session
|
||||
UINT Layer;
|
||||
|
||||
// IPv6 stuff
|
||||
QUEUE *IPv6ReceivedQueue; // IPv6 reception queue
|
||||
UINT IPv6State;
|
||||
LIST *IPv6NeighborTable; // Neighbor Discovery Table
|
||||
LIST *IPv6RouterAdvs; // Router offered prefixes
|
||||
UINT64 IPv6ClientEUI; // The EUI of the client (for the SLAAC autoconf)
|
||||
UINT64 IPv6ServerEUI; // The EUI of the server (from the RA discovery)
|
||||
};
|
||||
|
||||
// MS-CHAPv2 authentication information
|
||||
struct IPC_MSCHAP_V2_AUTHINFO
|
||||
{
|
||||
char MsChapV2_PPPUsername[MAX_SIZE]; // MS-CHAPv2 Username
|
||||
UCHAR MsChapV2_ServerChallenge[16]; // MS-CHAPv2 Server Challenge
|
||||
UCHAR MsChapV2_ClientChallenge[16]; // MS-CHAPv2 Client Challenge
|
||||
UCHAR MsChapV2_ClientResponse[24]; // MS-CHAPv2 Client Response
|
||||
EAP_CLIENT *MsChapV2_EapClient; // EAP client
|
||||
};
|
||||
|
||||
struct IPC_IPV6_ROUTER_ADVERTISEMENT
|
||||
{
|
||||
IP RoutedPrefix;
|
||||
IP RoutedMask;
|
||||
IP RouterAddress;
|
||||
UCHAR RouterMacAddress[6];
|
||||
UCHAR RouterLinkLayerAddress[6];
|
||||
};
|
||||
|
||||
IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password,
|
||||
UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port,
|
||||
char *client_hostname, char *crypt_name,
|
||||
bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate,
|
||||
UINT layer);
|
||||
IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code);
|
||||
IPC *NewIPCBySock(CEDAR *cedar, SOCK *s, void *mac_address);
|
||||
void FreeIPC(IPC *ipc);
|
||||
bool IsIPCConnected(IPC *ipc);
|
||||
void IPCSetSockEventWhenRecvL2Packet(IPC *ipc, SOCK_EVENT *e);
|
||||
void IPCSendL2(IPC *ipc, void *data, UINT size);
|
||||
void IPCSendIPv4(IPC *ipc, void *data, UINT size);
|
||||
BLOCK *IPCRecvL2(IPC *ipc);
|
||||
BLOCK *IPCRecvIPv4(IPC *ipc);
|
||||
void IPCProcessInterrupts(IPC *ipc);
|
||||
void IPCProcessL3EventsIPv4Only(IPC *ipc);
|
||||
void IPCProcessL3Events(IPC *ipc);
|
||||
void IPCProcessL3EventsEx(IPC *ipc, UINT64 now);
|
||||
bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw, DHCP_CLASSLESS_ROUTE_TABLE *rt);
|
||||
IPC_ARP *IPCNewARP(IP *ip, UCHAR *mac_address);
|
||||
void IPCFreeARP(IPC_ARP *a);
|
||||
int IPCCmpArpTable(void *p1, void *p2);
|
||||
void IPCSendIPv4Unicast(IPC *ipc, void *data, UINT size, IP *next_ip);
|
||||
IPC_ARP *IPCSearchArpTable(LIST *arpTable, IP *ip);
|
||||
void IPCSendIPv4WithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr);
|
||||
void IPCFlushArpTable(IPC *ipc);
|
||||
void IPCFlushArpTableEx(IPC *ipc, UINT64 now);
|
||||
void IPCProcessArp(IPC *ipc, BLOCK *b);
|
||||
void IPCAssociateOnArpTable(IPC *ipc, IP *ip, UCHAR *mac_address);
|
||||
|
||||
|
||||
|
||||
DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube);
|
||||
BUF *IPCBuildDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt);
|
||||
BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt);
|
||||
bool IPCDhcpAllocateIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube);
|
||||
bool IPCDhcpRequestInformIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube, IP *client_ip);
|
||||
void IPCDhcpRenewIP(IPC *ipc, IP *dhcp_server);
|
||||
void IPCDhcpFreeIP(IPC *ipc, IP *dhcp_server);
|
||||
IPC_ASYNC *NewIPCAsync(CEDAR *cedar, IPC_PARAM *param, SOCK_EVENT *sock_event);
|
||||
void IPCAsyncThreadProc(THREAD *thread, void *param);
|
||||
void FreeIPCAsync(IPC_ASYNC *a);
|
||||
|
||||
// IPv6 stuff
|
||||
// Memory management
|
||||
void IPCIPv6Init(IPC *ipc);
|
||||
void IPCIPv6Free(IPC *ipc);
|
||||
// NDT
|
||||
void IPCIPv6AssociateOnNDT(IPC *ipc, IP *ip, UCHAR *mac_address);
|
||||
void IPCIPv6AssociateOnNDTEx(IPC *ipc, IP *ip, UCHAR *mac_address, bool isNeighborAdv);
|
||||
void IPCIPv6FlushNDT(IPC *ipc);
|
||||
void IPCIPv6FlushNDTEx(IPC *ipc, UINT64 now);
|
||||
bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, UINT64 eui);
|
||||
// RA
|
||||
void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip);
|
||||
bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA);
|
||||
UINT64 IPCIPv6GetServerEui(IPC *ipc);
|
||||
// Data flow
|
||||
BLOCK *IPCIPv6Recv(IPC *ipc);
|
||||
void IPCIPv6Send(IPC *ipc, void *data, UINT size);
|
||||
void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr);
|
||||
void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip);
|
||||
|
||||
bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password);
|
||||
|
||||
#endif // IPC_H
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// IPC.h
|
||||
// Header of IPC.c
|
||||
|
||||
#ifndef IPC_H
|
||||
#define IPC_H
|
||||
|
||||
// Constants
|
||||
#define IPC_ARP_LIFETIME (3 * 60 * 1000)
|
||||
#define IPC_ARP_GIVEUPTIME (1 * 1000)
|
||||
#define IPC_DHCP_TIMEOUT (5 * 1000)
|
||||
#define IPC_DHCP_MIN_LEASE 5
|
||||
#define IPC_DHCP_DEFAULT_LEASE 3600
|
||||
|
||||
#define IPC_MAX_PACKET_QUEUE_LEN 10000
|
||||
|
||||
#define IPC_DHCP_VENDOR_ID "MSFT 5.0"
|
||||
|
||||
#define IPC_PASSWORD_MSCHAPV2_TAG "xH7DiNlurDhcYV4a:"
|
||||
|
||||
#define IPC_LAYER_2 2
|
||||
#define IPC_LAYER_3 3
|
||||
|
||||
// IPv6 constants
|
||||
#define IPC_IPV6_NDT_LIFETIME (30 * 1000) // as per REACHABLE_TIME constant of RFC4861
|
||||
#define IPC_IPV6_NDT_GIVEUPTIME (3 * 1000) // as per MAX_MULTICAST_SOLICIT * RETRANS_TIMER constants of RFC4861
|
||||
#define IPC_IPV6_RA_INTERVAL (2 * 1000) // Windows gets stuck if it is bigger
|
||||
#define IPC_IPV6_RA_MAX_RETRIES 2 // Windows seems to be stuck when it doesn't receive an answer in due time
|
||||
|
||||
// Protocol status
|
||||
#define IPC_PROTO_STATUS_CLOSED 0x0
|
||||
#define IPC_PROTO_STATUS_CONFIG 0x1
|
||||
#define IPC_PROTO_STATUS_CONFIG_WAIT 0x2
|
||||
#define IPC_PROTO_STATUS_OPENED 0x10
|
||||
#define IPC_PROTO_STATUS_REJECTED 0x100
|
||||
|
||||
#define IPC_PROTO_SET_STATUS(ipc, proto, value) ((ipc) != NULL ? ((ipc->proto) = (value)) : 0)
|
||||
#define IPC_PROTO_GET_STATUS(ipc, proto) ((ipc) != NULL ? (ipc->proto) : IPC_PROTO_STATUS_REJECTED)
|
||||
|
||||
// ARP table entry
|
||||
struct IPC_ARP
|
||||
{
|
||||
IP Ip; // IP address
|
||||
bool Resolved; // Whether the MAC address have been resolved
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UINT64 GiveupTime; // Time to give up (in the case of unresolved)
|
||||
UINT64 ExpireTime; // Expiration date (If resolved)
|
||||
QUEUE *PacketQueue; // Transmission packet queue
|
||||
};
|
||||
|
||||
// DHCP release queue
|
||||
struct IPC_DHCP_RELEASE_QUEUE
|
||||
{
|
||||
DHCP_OPTION_LIST Req;
|
||||
UINT TranId;
|
||||
UCHAR MacAddress[6];
|
||||
};
|
||||
|
||||
// IPC_SESSION_SHARED_BUFFER_DATA
|
||||
struct IPC_SESSION_SHARED_BUFFER_DATA
|
||||
{
|
||||
char ProtocolDetails[256];
|
||||
bool EnableUdpAccel;
|
||||
bool UsingUdpAccel;
|
||||
};
|
||||
|
||||
// IPC_PARAM
|
||||
struct IPC_PARAM
|
||||
{
|
||||
char ClientName[MAX_SIZE];
|
||||
char Postfix[MAX_SIZE];
|
||||
char HubName[MAX_HUBNAME_LEN + 1];
|
||||
char UserName[MAX_USERNAME_LEN + 1];
|
||||
char Password[MAX_PASSWORD_LEN + 1];
|
||||
IP ClientIp;
|
||||
UINT ClientPort;
|
||||
IP ServerIp;
|
||||
UINT ServerPort;
|
||||
char ClientHostname[MAX_SIZE];
|
||||
char CryptName[MAX_SIZE];
|
||||
bool BridgeMode;
|
||||
UINT Mss;
|
||||
bool IsL3Mode;
|
||||
X *ClientCertificate;
|
||||
UINT Layer;
|
||||
};
|
||||
|
||||
// DHCPv4 response awaiter
|
||||
struct IPC_DHCPV4_AWAIT
|
||||
{
|
||||
bool IsAwaiting;
|
||||
DHCPV4_DATA *DhcpData;
|
||||
UINT TransCode;
|
||||
UINT OpCode;
|
||||
};
|
||||
|
||||
// IPC_ASYNC object
|
||||
struct IPC_ASYNC
|
||||
{
|
||||
CEDAR *Cedar; // Cedar
|
||||
IPC_PARAM Param; // Parameters for creating IPC
|
||||
THREAD *Thread; // Thread
|
||||
SOCK_EVENT *SockEvent; // Socket events that is set when the connection is completed
|
||||
bool Done; // Processing completion flag
|
||||
IPC *Ipc; // IPC object (if it fails to connect, the value is NULL)
|
||||
TUBE *TubeForDisconnect; // Tube for disconnection notification
|
||||
UINT ErrorCode; // Error code in the case of failing to connect
|
||||
DHCP_OPTION_LIST L3ClientAddressOption; // Client IP address option (Only in the case of L3 mode)
|
||||
UINT64 L3DhcpRenewInterval; // DHCP update interval
|
||||
UINT64 L3NextDhcpRenewTick; // DHCP renewal time of the next
|
||||
bool DhcpAllocFailed; // Failed to get IP address from the DHCP server
|
||||
};
|
||||
|
||||
// IPC object
|
||||
struct IPC
|
||||
{
|
||||
CEDAR *Cedar;
|
||||
char HubName[MAX_HUBNAME_LEN + 1];
|
||||
char UserName[MAX_USERNAME_LEN + 1];
|
||||
char Password[MAX_PASSWORD_LEN + 1];
|
||||
char ClientHostname[MAX_SIZE];
|
||||
UCHAR random[SHA1_SIZE];
|
||||
char SessionName[MAX_SESSION_NAME_LEN + 1];
|
||||
char ConnectionName[MAX_CONNECTION_NAME_LEN + 1];
|
||||
POLICY *Policy;
|
||||
SOCK *Sock;
|
||||
INTERRUPT_MANAGER *Interrupt; // Interrupt manager
|
||||
IP ClientIPAddress; // IP address of the client
|
||||
IP SubnetMask; // Subnet mask of the client
|
||||
IP DefaultGateway; // Default gateway address
|
||||
IP BroadcastAddress; // Broadcast address
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UCHAR Padding[2];
|
||||
LIST *ArpTable; // ARP table
|
||||
QUEUE *IPv4ReceivedQueue; // IPv4 reception queue
|
||||
UINT IPv4State;
|
||||
IPC_DHCPV4_AWAIT DHCPv4Awaiter;
|
||||
TUBE_FLUSH_LIST *FlushList; // Tube Flush List
|
||||
UCHAR MsChapV2_ServerResponse[20]; // Server response
|
||||
DHCP_CLASSLESS_ROUTE_TABLE ClasslessRoute; // Classless routing table
|
||||
SHARED_BUFFER *IpcSessionSharedBuffer; // A shared buffer between IPC and Session
|
||||
IPC_SESSION_SHARED_BUFFER_DATA *IpcSessionShared; // Shared data between IPC and Session
|
||||
UINT Layer;
|
||||
|
||||
// IPv6 stuff
|
||||
QUEUE *IPv6ReceivedQueue; // IPv6 reception queue
|
||||
UINT IPv6State;
|
||||
LIST *IPv6NeighborTable; // Neighbor Discovery Table
|
||||
LIST *IPv6RouterAdvs; // Router offered prefixes
|
||||
UINT64 IPv6ClientEUI; // The EUI of the client (for the SLAAC autoconf)
|
||||
UINT64 IPv6ServerEUI; // The EUI of the server (from the RA discovery)
|
||||
};
|
||||
|
||||
// MS-CHAPv2 authentication information
|
||||
struct IPC_MSCHAP_V2_AUTHINFO
|
||||
{
|
||||
char MsChapV2_PPPUsername[MAX_SIZE]; // MS-CHAPv2 Username
|
||||
UCHAR MsChapV2_ServerChallenge[16]; // MS-CHAPv2 Server Challenge
|
||||
UCHAR MsChapV2_ClientChallenge[16]; // MS-CHAPv2 Client Challenge
|
||||
UCHAR MsChapV2_ClientResponse[24]; // MS-CHAPv2 Client Response
|
||||
EAP_CLIENT *MsChapV2_EapClient; // EAP client
|
||||
};
|
||||
|
||||
struct IPC_IPV6_ROUTER_ADVERTISEMENT
|
||||
{
|
||||
IP RoutedPrefix;
|
||||
IP RoutedMask;
|
||||
IP RouterAddress;
|
||||
UCHAR RouterMacAddress[6];
|
||||
UCHAR RouterLinkLayerAddress[6];
|
||||
};
|
||||
|
||||
IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password,
|
||||
UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port,
|
||||
char *client_hostname, char *crypt_name,
|
||||
bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate,
|
||||
UINT layer);
|
||||
IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code);
|
||||
IPC *NewIPCBySock(CEDAR *cedar, SOCK *s, void *mac_address);
|
||||
void FreeIPC(IPC *ipc);
|
||||
bool IsIPCConnected(IPC *ipc);
|
||||
void IPCSetSockEventWhenRecvL2Packet(IPC *ipc, SOCK_EVENT *e);
|
||||
void IPCSendL2(IPC *ipc, void *data, UINT size);
|
||||
void IPCSendIPv4(IPC *ipc, void *data, UINT size);
|
||||
BLOCK *IPCRecvL2(IPC *ipc);
|
||||
BLOCK *IPCRecvIPv4(IPC *ipc);
|
||||
void IPCProcessInterrupts(IPC *ipc);
|
||||
void IPCProcessL3EventsIPv4Only(IPC *ipc);
|
||||
void IPCProcessL3Events(IPC *ipc);
|
||||
void IPCProcessL3EventsEx(IPC *ipc, UINT64 now);
|
||||
bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw, DHCP_CLASSLESS_ROUTE_TABLE *rt);
|
||||
IPC_ARP *IPCNewARP(IP *ip, UCHAR *mac_address);
|
||||
void IPCFreeARP(IPC_ARP *a);
|
||||
int IPCCmpArpTable(void *p1, void *p2);
|
||||
void IPCSendIPv4Unicast(IPC *ipc, void *data, UINT size, IP *next_ip);
|
||||
IPC_ARP *IPCSearchArpTable(LIST *arpTable, IP *ip);
|
||||
void IPCSendIPv4WithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr);
|
||||
void IPCFlushArpTable(IPC *ipc);
|
||||
void IPCFlushArpTableEx(IPC *ipc, UINT64 now);
|
||||
void IPCProcessArp(IPC *ipc, BLOCK *b);
|
||||
void IPCAssociateOnArpTable(IPC *ipc, IP *ip, UCHAR *mac_address);
|
||||
|
||||
|
||||
|
||||
DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube);
|
||||
BUF *IPCBuildDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt);
|
||||
BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt);
|
||||
bool IPCDhcpAllocateIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube);
|
||||
bool IPCDhcpRequestInformIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube, IP *client_ip);
|
||||
void IPCDhcpRenewIP(IPC *ipc, IP *dhcp_server);
|
||||
void IPCDhcpFreeIP(IPC *ipc, IP *dhcp_server);
|
||||
IPC_ASYNC *NewIPCAsync(CEDAR *cedar, IPC_PARAM *param, SOCK_EVENT *sock_event);
|
||||
void IPCAsyncThreadProc(THREAD *thread, void *param);
|
||||
void FreeIPCAsync(IPC_ASYNC *a);
|
||||
|
||||
// IPv6 stuff
|
||||
// Memory management
|
||||
void IPCIPv6Init(IPC *ipc);
|
||||
void IPCIPv6Free(IPC *ipc);
|
||||
// NDT
|
||||
void IPCIPv6AssociateOnNDT(IPC *ipc, IP *ip, UCHAR *mac_address);
|
||||
void IPCIPv6AssociateOnNDTEx(IPC *ipc, IP *ip, UCHAR *mac_address, bool isNeighborAdv);
|
||||
void IPCIPv6FlushNDT(IPC *ipc);
|
||||
void IPCIPv6FlushNDTEx(IPC *ipc, UINT64 now);
|
||||
bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, UINT64 eui);
|
||||
// RA
|
||||
void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip);
|
||||
bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA);
|
||||
UINT64 IPCIPv6GetServerEui(IPC *ipc);
|
||||
// Data flow
|
||||
BLOCK *IPCIPv6Recv(IPC *ipc);
|
||||
void IPCIPv6Send(IPC *ipc, void *data, UINT size);
|
||||
void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr);
|
||||
void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip);
|
||||
|
||||
bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password);
|
||||
|
||||
#endif // IPC_H
|
||||
|
4198
src/Cedar/Layer3.c
4198
src/Cedar/Layer3.c
File diff suppressed because it is too large
Load Diff
@ -1,149 +1,149 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Layer3.h
|
||||
// Header of Layer3.c
|
||||
|
||||
#ifndef LAYER3_H
|
||||
#define LAYER3_H
|
||||
|
||||
// Constants
|
||||
#define L3_USERNAME "L3SW_"
|
||||
|
||||
|
||||
// L3 ARP table entry
|
||||
struct L3ARPENTRY
|
||||
{
|
||||
UINT IpAddress; // IP address
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UCHAR Padding[2];
|
||||
UINT64 Expire; // Expiration date
|
||||
};
|
||||
|
||||
// L3 ARP resolution waiting list entry
|
||||
struct L3ARPWAIT
|
||||
{
|
||||
UINT IpAddress; // IP address
|
||||
UINT64 LastSentTime; // Time which the data has been sent last
|
||||
UINT64 Expire; // Expiration date
|
||||
};
|
||||
|
||||
// L3 IP packet table
|
||||
struct L3PACKET
|
||||
{
|
||||
PKT *Packet; // Packet data body
|
||||
UINT64 Expire; // Expiration date
|
||||
UINT NextHopIp; // Local delivery destination IP address
|
||||
};
|
||||
|
||||
// L3 routing table definition
|
||||
struct L3TABLE
|
||||
{
|
||||
UINT NetworkAddress; // Network address
|
||||
UINT SubnetMask; // Subnet mask
|
||||
UINT GatewayAddress; // Gateway address
|
||||
UINT Metric; // Metric
|
||||
};
|
||||
|
||||
// L3 interface definition
|
||||
struct L3IF
|
||||
{
|
||||
L3SW *Switch; // Layer-3 switch
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name
|
||||
UINT IpAddress; // IP address
|
||||
UINT SubnetMask; // Subnet mask
|
||||
|
||||
HUB *Hub; // Virtual HUB
|
||||
SESSION *Session; // Session
|
||||
LIST *ArpTable; // ARP table
|
||||
LIST *ArpWaitTable; // ARP waiting table
|
||||
QUEUE *IpPacketQueue; // IP packet queue (for reception from other interfaces)
|
||||
LIST *IpWaitList; // IP waiting list
|
||||
QUEUE *SendQueue; // Transmission queue
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UCHAR Padding[2];
|
||||
UINT64 LastDeleteOldArpTable; // Time that old ARP table entries are cleared
|
||||
LIST *CancelList; // Cancellation list
|
||||
UINT64 LastBeaconSent; // Time which the beacon has been sent last
|
||||
};
|
||||
|
||||
// L3 switch definition
|
||||
struct L3SW
|
||||
{
|
||||
char Name[MAX_HUBNAME_LEN + 1]; // Name
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
CEDAR *Cedar; // Cedar
|
||||
bool Active; // During operation flag
|
||||
bool Online; // Online flag
|
||||
volatile bool Halt; // Halting flag
|
||||
LIST *IfList; // Interface list
|
||||
LIST *TableList; // Routing table list
|
||||
THREAD *Thread; // Thread
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Function prototype
|
||||
int CmpL3Sw(void *p1, void *p2);
|
||||
int CmpL3ArpEntry(void *p1, void *p2);
|
||||
int CmpL3ArpWaitTable(void *p1, void *p2);
|
||||
int CmpL3Table(void *p1, void *p2);
|
||||
int CmpL3If(void *p1, void *p2);
|
||||
void InitCedarLayer3(CEDAR *c);
|
||||
void FreeCedarLayer3(CEDAR *c);
|
||||
L3SW *NewL3Sw(CEDAR *c, char *name);
|
||||
void ReleaseL3Sw(L3SW *s);
|
||||
void CleanupL3Sw(L3SW *s);
|
||||
bool L3AddIf(L3SW *s, char *hubname, UINT ip, UINT subnet);
|
||||
bool L3DelIf(L3SW *s, char *hubname);
|
||||
bool L3AddTable(L3SW *s, L3TABLE *tbl);
|
||||
bool L3DelTable(L3SW *s, L3TABLE *tbl);
|
||||
L3IF *L3SearchIf(L3SW *s, char *hubname);
|
||||
L3SW *L3GetSw(CEDAR *c, char *name);
|
||||
L3SW *L3AddSw(CEDAR *c, char *name);
|
||||
bool L3DelSw(CEDAR *c, char *name);
|
||||
void L3FreeAllSw(CEDAR *c);
|
||||
void L3SwStart(L3SW *s);
|
||||
void L3SwStop(L3SW *s);
|
||||
void L3SwThread(THREAD *t, void *param);
|
||||
void L3Test(SERVER *s);
|
||||
void L3InitAllInterfaces(L3SW *s);
|
||||
void L3FreeAllInterfaces(L3SW *s);
|
||||
void L3IfThread(THREAD *t, void *param);
|
||||
void L3InitInterface(L3IF *f);
|
||||
void L3FreeInterface(L3IF *f);
|
||||
L3IF *L3GetNextIf(L3SW *s, UINT ip, UINT *next_hop);
|
||||
L3TABLE *L3GetBestRoute(L3SW *s, UINT ip);
|
||||
UINT L3GetNextPacket(L3IF *f, void **data);
|
||||
void L3Polling(L3IF *f);
|
||||
void L3PollingBeacon(L3IF *f);
|
||||
void L3DeleteOldArpTable(L3IF *f);
|
||||
void L3DeleteOldIpWaitList(L3IF *f);
|
||||
void L3PollingArpWaitTable(L3IF *f);
|
||||
void L3SendL2Now(L3IF *f, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size);
|
||||
void L3SendArpRequestNow(L3IF *f, UINT dest_ip);
|
||||
void L3SendArpResponseNow(L3IF *f, UCHAR *dest_mac, UINT dest_ip, UINT src_ip);
|
||||
void L3GenerateMacAddress(L3IF *f);
|
||||
L3ARPENTRY *L3SearchArpTable(L3IF *f, UINT ip);
|
||||
void L3SendIpNow(L3IF *f, L3ARPENTRY *a, L3PACKET *p);
|
||||
void L3SendIp(L3IF *f, L3PACKET *p);
|
||||
void L3RecvArp(L3IF *f, PKT *p);
|
||||
void L3RecvArpRequest(L3IF *f, PKT *p);
|
||||
void L3RecvArpResponse(L3IF *f, PKT *p);
|
||||
void L3KnownArp(L3IF *f, UINT ip, UCHAR *mac);
|
||||
void L3SendArp(L3IF *f, UINT ip);
|
||||
void L3InsertArpTable(L3IF *f, UINT ip, UCHAR *mac);
|
||||
void L3SendWaitingIp(L3IF *f, UCHAR *mac, UINT ip, L3ARPENTRY *a);
|
||||
void L3PutPacket(L3IF *f, void *data, UINT size);
|
||||
void L3RecvL2(L3IF *f, PKT *p);
|
||||
void L3StoreIpPacketToIf(L3IF *src_if, L3IF *dst_if, L3PACKET *p);
|
||||
void L3RecvIp(L3IF *f, PKT *p, bool self);
|
||||
void L3PollingIpQueue(L3IF *f);
|
||||
|
||||
|
||||
#endif // LAYER3_H
|
||||
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Layer3.h
|
||||
// Header of Layer3.c
|
||||
|
||||
#ifndef LAYER3_H
|
||||
#define LAYER3_H
|
||||
|
||||
// Constants
|
||||
#define L3_USERNAME "L3SW_"
|
||||
|
||||
|
||||
// L3 ARP table entry
|
||||
struct L3ARPENTRY
|
||||
{
|
||||
UINT IpAddress; // IP address
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UCHAR Padding[2];
|
||||
UINT64 Expire; // Expiration date
|
||||
};
|
||||
|
||||
// L3 ARP resolution waiting list entry
|
||||
struct L3ARPWAIT
|
||||
{
|
||||
UINT IpAddress; // IP address
|
||||
UINT64 LastSentTime; // Time which the data has been sent last
|
||||
UINT64 Expire; // Expiration date
|
||||
};
|
||||
|
||||
// L3 IP packet table
|
||||
struct L3PACKET
|
||||
{
|
||||
PKT *Packet; // Packet data body
|
||||
UINT64 Expire; // Expiration date
|
||||
UINT NextHopIp; // Local delivery destination IP address
|
||||
};
|
||||
|
||||
// L3 routing table definition
|
||||
struct L3TABLE
|
||||
{
|
||||
UINT NetworkAddress; // Network address
|
||||
UINT SubnetMask; // Subnet mask
|
||||
UINT GatewayAddress; // Gateway address
|
||||
UINT Metric; // Metric
|
||||
};
|
||||
|
||||
// L3 interface definition
|
||||
struct L3IF
|
||||
{
|
||||
L3SW *Switch; // Layer-3 switch
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name
|
||||
UINT IpAddress; // IP address
|
||||
UINT SubnetMask; // Subnet mask
|
||||
|
||||
HUB *Hub; // Virtual HUB
|
||||
SESSION *Session; // Session
|
||||
LIST *ArpTable; // ARP table
|
||||
LIST *ArpWaitTable; // ARP waiting table
|
||||
QUEUE *IpPacketQueue; // IP packet queue (for reception from other interfaces)
|
||||
LIST *IpWaitList; // IP waiting list
|
||||
QUEUE *SendQueue; // Transmission queue
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UCHAR Padding[2];
|
||||
UINT64 LastDeleteOldArpTable; // Time that old ARP table entries are cleared
|
||||
LIST *CancelList; // Cancellation list
|
||||
UINT64 LastBeaconSent; // Time which the beacon has been sent last
|
||||
};
|
||||
|
||||
// L3 switch definition
|
||||
struct L3SW
|
||||
{
|
||||
char Name[MAX_HUBNAME_LEN + 1]; // Name
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
CEDAR *Cedar; // Cedar
|
||||
bool Active; // During operation flag
|
||||
bool Online; // Online flag
|
||||
volatile bool Halt; // Halting flag
|
||||
LIST *IfList; // Interface list
|
||||
LIST *TableList; // Routing table list
|
||||
THREAD *Thread; // Thread
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Function prototype
|
||||
int CmpL3Sw(void *p1, void *p2);
|
||||
int CmpL3ArpEntry(void *p1, void *p2);
|
||||
int CmpL3ArpWaitTable(void *p1, void *p2);
|
||||
int CmpL3Table(void *p1, void *p2);
|
||||
int CmpL3If(void *p1, void *p2);
|
||||
void InitCedarLayer3(CEDAR *c);
|
||||
void FreeCedarLayer3(CEDAR *c);
|
||||
L3SW *NewL3Sw(CEDAR *c, char *name);
|
||||
void ReleaseL3Sw(L3SW *s);
|
||||
void CleanupL3Sw(L3SW *s);
|
||||
bool L3AddIf(L3SW *s, char *hubname, UINT ip, UINT subnet);
|
||||
bool L3DelIf(L3SW *s, char *hubname);
|
||||
bool L3AddTable(L3SW *s, L3TABLE *tbl);
|
||||
bool L3DelTable(L3SW *s, L3TABLE *tbl);
|
||||
L3IF *L3SearchIf(L3SW *s, char *hubname);
|
||||
L3SW *L3GetSw(CEDAR *c, char *name);
|
||||
L3SW *L3AddSw(CEDAR *c, char *name);
|
||||
bool L3DelSw(CEDAR *c, char *name);
|
||||
void L3FreeAllSw(CEDAR *c);
|
||||
void L3SwStart(L3SW *s);
|
||||
void L3SwStop(L3SW *s);
|
||||
void L3SwThread(THREAD *t, void *param);
|
||||
void L3Test(SERVER *s);
|
||||
void L3InitAllInterfaces(L3SW *s);
|
||||
void L3FreeAllInterfaces(L3SW *s);
|
||||
void L3IfThread(THREAD *t, void *param);
|
||||
void L3InitInterface(L3IF *f);
|
||||
void L3FreeInterface(L3IF *f);
|
||||
L3IF *L3GetNextIf(L3SW *s, UINT ip, UINT *next_hop);
|
||||
L3TABLE *L3GetBestRoute(L3SW *s, UINT ip);
|
||||
UINT L3GetNextPacket(L3IF *f, void **data);
|
||||
void L3Polling(L3IF *f);
|
||||
void L3PollingBeacon(L3IF *f);
|
||||
void L3DeleteOldArpTable(L3IF *f);
|
||||
void L3DeleteOldIpWaitList(L3IF *f);
|
||||
void L3PollingArpWaitTable(L3IF *f);
|
||||
void L3SendL2Now(L3IF *f, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size);
|
||||
void L3SendArpRequestNow(L3IF *f, UINT dest_ip);
|
||||
void L3SendArpResponseNow(L3IF *f, UCHAR *dest_mac, UINT dest_ip, UINT src_ip);
|
||||
void L3GenerateMacAddress(L3IF *f);
|
||||
L3ARPENTRY *L3SearchArpTable(L3IF *f, UINT ip);
|
||||
void L3SendIpNow(L3IF *f, L3ARPENTRY *a, L3PACKET *p);
|
||||
void L3SendIp(L3IF *f, L3PACKET *p);
|
||||
void L3RecvArp(L3IF *f, PKT *p);
|
||||
void L3RecvArpRequest(L3IF *f, PKT *p);
|
||||
void L3RecvArpResponse(L3IF *f, PKT *p);
|
||||
void L3KnownArp(L3IF *f, UINT ip, UCHAR *mac);
|
||||
void L3SendArp(L3IF *f, UINT ip);
|
||||
void L3InsertArpTable(L3IF *f, UINT ip, UCHAR *mac);
|
||||
void L3SendWaitingIp(L3IF *f, UCHAR *mac, UINT ip, L3ARPENTRY *a);
|
||||
void L3PutPacket(L3IF *f, void *data, UINT size);
|
||||
void L3RecvL2(L3IF *f, PKT *p);
|
||||
void L3StoreIpPacketToIf(L3IF *src_if, L3IF *dst_if, L3PACKET *p);
|
||||
void L3RecvIp(L3IF *f, PKT *p, bool self);
|
||||
void L3PollingIpQueue(L3IF *f);
|
||||
|
||||
|
||||
#endif // LAYER3_H
|
||||
|
||||
|
||||
|
||||
|
1356
src/Cedar/Link.c
1356
src/Cedar/Link.c
File diff suppressed because it is too large
Load Diff
130
src/Cedar/Link.h
130
src/Cedar/Link.h
@ -1,65 +1,65 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Link.h
|
||||
// Header of Link.c
|
||||
|
||||
#ifndef LINK_H
|
||||
#define LINK_H
|
||||
|
||||
struct LINK
|
||||
{
|
||||
bool Started; // Running flag
|
||||
volatile bool Halting; // Halting flag
|
||||
bool Offline; // Offline
|
||||
bool NoOnline; // Do not set to online flag
|
||||
REF *ref; // Reference counter
|
||||
LOCK *lock; // Lock
|
||||
CEDAR *Cedar; // Cedar
|
||||
HUB *Hub; // HUB
|
||||
SESSION *ClientSession; // Client session
|
||||
SESSION *ServerSession; // Server session
|
||||
CLIENT_OPTION *Option; // Client Option
|
||||
CLIENT_AUTH *Auth; // Authentication data
|
||||
POLICY *Policy; // Policy
|
||||
QUEUE *SendPacketQueue; // Transmission packet queue
|
||||
UINT CurrentSendPacketQueueSize; // Current send packet queue size
|
||||
UINT LastError; // Last error
|
||||
bool CheckServerCert; // To check the server certificate
|
||||
X *ServerCert; // Server certificate
|
||||
bool LockFlag; // Lock flag
|
||||
bool *StopAllLinkFlag; // Stop all link flag
|
||||
UINT LastServerConnectionReceivedBlocksNum; // Last server connection recv queue num
|
||||
UINT Flag1;
|
||||
};
|
||||
|
||||
|
||||
PACKET_ADAPTER *LinkGetPacketAdapter();
|
||||
bool LinkPaInit(SESSION *s);
|
||||
CANCEL *LinkPaGetCancel(SESSION *s);
|
||||
UINT LinkPaGetNextPacket(SESSION *s, void **data);
|
||||
bool LinkPaPutPacket(SESSION *s, void *data, UINT size);
|
||||
void LinkPaFree(SESSION *s);
|
||||
|
||||
void LinkServerSessionThread(THREAD *t, void *param);
|
||||
LINK *NewLink(CEDAR *cedar, HUB *hub, CLIENT_OPTION *option, CLIENT_AUTH *auth, POLICY *policy);
|
||||
void StartLink(LINK *k);
|
||||
void StopLink(LINK *k);
|
||||
void DelLink(HUB *hub, LINK *k);
|
||||
void LockLink(LINK *k);
|
||||
void UnlockLink(LINK *k);
|
||||
void StopAllLink(HUB *h);
|
||||
void StartAllLink(HUB *h);
|
||||
void SetLinkOnline(LINK *k);
|
||||
void SetLinkOffline(LINK *k);
|
||||
void ReleaseLink(LINK *k);
|
||||
void CleanupLink(LINK *k);
|
||||
void ReleaseAllLink(HUB *h);
|
||||
void NormalizeLinkPolicy(POLICY *p);
|
||||
|
||||
#endif // LINK_H
|
||||
|
||||
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Link.h
|
||||
// Header of Link.c
|
||||
|
||||
#ifndef LINK_H
|
||||
#define LINK_H
|
||||
|
||||
struct LINK
|
||||
{
|
||||
bool Started; // Running flag
|
||||
volatile bool Halting; // Halting flag
|
||||
bool Offline; // Offline
|
||||
bool NoOnline; // Do not set to online flag
|
||||
REF *ref; // Reference counter
|
||||
LOCK *lock; // Lock
|
||||
CEDAR *Cedar; // Cedar
|
||||
HUB *Hub; // HUB
|
||||
SESSION *ClientSession; // Client session
|
||||
SESSION *ServerSession; // Server session
|
||||
CLIENT_OPTION *Option; // Client Option
|
||||
CLIENT_AUTH *Auth; // Authentication data
|
||||
POLICY *Policy; // Policy
|
||||
QUEUE *SendPacketQueue; // Transmission packet queue
|
||||
UINT CurrentSendPacketQueueSize; // Current send packet queue size
|
||||
UINT LastError; // Last error
|
||||
bool CheckServerCert; // To check the server certificate
|
||||
X *ServerCert; // Server certificate
|
||||
bool LockFlag; // Lock flag
|
||||
bool *StopAllLinkFlag; // Stop all link flag
|
||||
UINT LastServerConnectionReceivedBlocksNum; // Last server connection recv queue num
|
||||
UINT Flag1;
|
||||
};
|
||||
|
||||
|
||||
PACKET_ADAPTER *LinkGetPacketAdapter();
|
||||
bool LinkPaInit(SESSION *s);
|
||||
CANCEL *LinkPaGetCancel(SESSION *s);
|
||||
UINT LinkPaGetNextPacket(SESSION *s, void **data);
|
||||
bool LinkPaPutPacket(SESSION *s, void *data, UINT size);
|
||||
void LinkPaFree(SESSION *s);
|
||||
|
||||
void LinkServerSessionThread(THREAD *t, void *param);
|
||||
LINK *NewLink(CEDAR *cedar, HUB *hub, CLIENT_OPTION *option, CLIENT_AUTH *auth, POLICY *policy);
|
||||
void StartLink(LINK *k);
|
||||
void StopLink(LINK *k);
|
||||
void DelLink(HUB *hub, LINK *k);
|
||||
void LockLink(LINK *k);
|
||||
void UnlockLink(LINK *k);
|
||||
void StopAllLink(HUB *h);
|
||||
void StartAllLink(HUB *h);
|
||||
void SetLinkOnline(LINK *k);
|
||||
void SetLinkOffline(LINK *k);
|
||||
void ReleaseLink(LINK *k);
|
||||
void CleanupLink(LINK *k);
|
||||
void ReleaseAllLink(HUB *h);
|
||||
void NormalizeLinkPolicy(POLICY *p);
|
||||
|
||||
#endif // LINK_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
2022
src/Cedar/Listener.c
2022
src/Cedar/Listener.c
File diff suppressed because it is too large
Load Diff
@ -1,108 +1,108 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Listener.h
|
||||
// Header of Listener.c
|
||||
|
||||
#ifndef LISTENER_H
|
||||
#define LISTENER_H
|
||||
|
||||
|
||||
// Function to call when receiving a new connection
|
||||
typedef void (NEW_CONNECTION_PROC)(CONNECTION *c);
|
||||
|
||||
|
||||
|
||||
// Listener structure
|
||||
struct LISTENER
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
CEDAR *Cedar; // Cedar
|
||||
UINT Protocol; // Protocol
|
||||
UINT Port; // Port number
|
||||
THREAD *Thread; // Operating thread
|
||||
SOCK *Sock; // Socket
|
||||
EVENT *Event; // Event
|
||||
volatile bool Halt; // Halting flag
|
||||
UINT Status; // State
|
||||
|
||||
|
||||
THREAD_PROC *ThreadProc; // Thread procedure
|
||||
void *ThreadParam; // Thread parameters
|
||||
bool LocalOnly; // Can be connected only from localhost
|
||||
bool ShadowIPv6; // Flag indicating that the shadow IPv6 listener
|
||||
LISTENER *ShadowListener; // Reference to managing shadow IPv6 listener
|
||||
bool DisableDos; // Disable the DoS attack detection
|
||||
volatile UINT *NatTGlobalUdpPort; // NAT-T global UDP port number
|
||||
UCHAR RandPortId; // NAT-T UDP random port ID
|
||||
bool EnableConditionalAccept; // The flag of whether to enable the Conditional Accept
|
||||
};
|
||||
|
||||
// Parameters of TCPAcceptedThread
|
||||
struct TCP_ACCEPTED_PARAM
|
||||
{
|
||||
LISTENER *r;
|
||||
SOCK *s;
|
||||
};
|
||||
|
||||
// UDP entry
|
||||
struct UDP_ENTRY
|
||||
{
|
||||
UINT SessionKey32; // 32bit session key
|
||||
SESSION *Session; // Reference to the session
|
||||
};
|
||||
|
||||
// Dynamic listener
|
||||
struct DYNAMIC_LISTENER
|
||||
{
|
||||
UINT Protocol; // Protocol
|
||||
UINT Port; // Port
|
||||
LOCK *Lock; // Lock
|
||||
CEDAR *Cedar; // Cedar
|
||||
bool *EnablePtr; // A pointer to the flag of the valid / invalid state
|
||||
LISTENER *Listener; // Listener
|
||||
};
|
||||
|
||||
|
||||
// Function prototype
|
||||
LISTENER *NewListener(CEDAR *cedar, UINT proto, UINT port);
|
||||
LISTENER *NewListenerEx(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param);
|
||||
LISTENER *NewListenerEx2(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only);
|
||||
LISTENER *NewListenerEx3(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6);
|
||||
LISTENER *NewListenerEx4(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6,
|
||||
volatile UINT *natt_global_udp_port, UCHAR rand_port_id);
|
||||
LISTENER *NewListenerEx5(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6,
|
||||
volatile UINT *natt_global_udp_port, UCHAR rand_port_id, bool enable_ca);
|
||||
void ReleaseListener(LISTENER *r);
|
||||
void CleanupListener(LISTENER *r);
|
||||
void ListenerThread(THREAD *thread, void *param);
|
||||
void ListenerTCPMainLoop(LISTENER *r);
|
||||
void StopListener(LISTENER *r);
|
||||
int CompareListener(void *p1, void *p2);
|
||||
void TCPAccepted(LISTENER *r, SOCK *s);
|
||||
void EnableDosProtect();
|
||||
void DisableDosProtect();
|
||||
void TCPAcceptedThread(THREAD *t, void *param);
|
||||
void ListenerUDPMainLoop(LISTENER *r);
|
||||
void UDPReceivedPacket(CEDAR *cedar, SOCK *s, IP *ip, UINT port, void *data, UINT size);
|
||||
int CompareUDPEntry(void *p1, void *p2);
|
||||
void CleanupUDPEntry(CEDAR *cedar);
|
||||
void AddUDPEntry(CEDAR *cedar, SESSION *session);
|
||||
void DelUDPEntry(CEDAR *cedar, SESSION *session);
|
||||
SESSION *GetSessionFromUDPEntry(CEDAR *cedar, UINT key32);
|
||||
UINT GetMaxConnectionsPerIp();
|
||||
void SetMaxConnectionsPerIp(UINT num);
|
||||
UINT GetMaxUnestablishedConnections();
|
||||
void SetMaxUnestablishedConnections(UINT num);
|
||||
DYNAMIC_LISTENER *NewDynamicListener(CEDAR *c, bool *enable_ptr, UINT protocol, UINT port);
|
||||
void ApplyDynamicListener(DYNAMIC_LISTENER *d);
|
||||
void FreeDynamicListener(DYNAMIC_LISTENER *d);
|
||||
bool ListenerRUDPRpcRecvProc(RUDP_STACK *r, UDPPACKET *p);
|
||||
void ListenerSetProcRecvRpcEnable(bool b);
|
||||
|
||||
|
||||
#endif // LISTENER_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Listener.h
|
||||
// Header of Listener.c
|
||||
|
||||
#ifndef LISTENER_H
|
||||
#define LISTENER_H
|
||||
|
||||
|
||||
// Function to call when receiving a new connection
|
||||
typedef void (NEW_CONNECTION_PROC)(CONNECTION *c);
|
||||
|
||||
|
||||
|
||||
// Listener structure
|
||||
struct LISTENER
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
REF *ref; // Reference counter
|
||||
CEDAR *Cedar; // Cedar
|
||||
UINT Protocol; // Protocol
|
||||
UINT Port; // Port number
|
||||
THREAD *Thread; // Operating thread
|
||||
SOCK *Sock; // Socket
|
||||
EVENT *Event; // Event
|
||||
volatile bool Halt; // Halting flag
|
||||
UINT Status; // State
|
||||
|
||||
|
||||
THREAD_PROC *ThreadProc; // Thread procedure
|
||||
void *ThreadParam; // Thread parameters
|
||||
bool LocalOnly; // Can be connected only from localhost
|
||||
bool ShadowIPv6; // Flag indicating that the shadow IPv6 listener
|
||||
LISTENER *ShadowListener; // Reference to managing shadow IPv6 listener
|
||||
bool DisableDos; // Disable the DoS attack detection
|
||||
volatile UINT *NatTGlobalUdpPort; // NAT-T global UDP port number
|
||||
UCHAR RandPortId; // NAT-T UDP random port ID
|
||||
bool EnableConditionalAccept; // The flag of whether to enable the Conditional Accept
|
||||
};
|
||||
|
||||
// Parameters of TCPAcceptedThread
|
||||
struct TCP_ACCEPTED_PARAM
|
||||
{
|
||||
LISTENER *r;
|
||||
SOCK *s;
|
||||
};
|
||||
|
||||
// UDP entry
|
||||
struct UDP_ENTRY
|
||||
{
|
||||
UINT SessionKey32; // 32bit session key
|
||||
SESSION *Session; // Reference to the session
|
||||
};
|
||||
|
||||
// Dynamic listener
|
||||
struct DYNAMIC_LISTENER
|
||||
{
|
||||
UINT Protocol; // Protocol
|
||||
UINT Port; // Port
|
||||
LOCK *Lock; // Lock
|
||||
CEDAR *Cedar; // Cedar
|
||||
bool *EnablePtr; // A pointer to the flag of the valid / invalid state
|
||||
LISTENER *Listener; // Listener
|
||||
};
|
||||
|
||||
|
||||
// Function prototype
|
||||
LISTENER *NewListener(CEDAR *cedar, UINT proto, UINT port);
|
||||
LISTENER *NewListenerEx(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param);
|
||||
LISTENER *NewListenerEx2(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only);
|
||||
LISTENER *NewListenerEx3(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6);
|
||||
LISTENER *NewListenerEx4(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6,
|
||||
volatile UINT *natt_global_udp_port, UCHAR rand_port_id);
|
||||
LISTENER *NewListenerEx5(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6,
|
||||
volatile UINT *natt_global_udp_port, UCHAR rand_port_id, bool enable_ca);
|
||||
void ReleaseListener(LISTENER *r);
|
||||
void CleanupListener(LISTENER *r);
|
||||
void ListenerThread(THREAD *thread, void *param);
|
||||
void ListenerTCPMainLoop(LISTENER *r);
|
||||
void StopListener(LISTENER *r);
|
||||
int CompareListener(void *p1, void *p2);
|
||||
void TCPAccepted(LISTENER *r, SOCK *s);
|
||||
void EnableDosProtect();
|
||||
void DisableDosProtect();
|
||||
void TCPAcceptedThread(THREAD *t, void *param);
|
||||
void ListenerUDPMainLoop(LISTENER *r);
|
||||
void UDPReceivedPacket(CEDAR *cedar, SOCK *s, IP *ip, UINT port, void *data, UINT size);
|
||||
int CompareUDPEntry(void *p1, void *p2);
|
||||
void CleanupUDPEntry(CEDAR *cedar);
|
||||
void AddUDPEntry(CEDAR *cedar, SESSION *session);
|
||||
void DelUDPEntry(CEDAR *cedar, SESSION *session);
|
||||
SESSION *GetSessionFromUDPEntry(CEDAR *cedar, UINT key32);
|
||||
UINT GetMaxConnectionsPerIp();
|
||||
void SetMaxConnectionsPerIp(UINT num);
|
||||
UINT GetMaxUnestablishedConnections();
|
||||
void SetMaxUnestablishedConnections(UINT num);
|
||||
DYNAMIC_LISTENER *NewDynamicListener(CEDAR *c, bool *enable_ptr, UINT protocol, UINT port);
|
||||
void ApplyDynamicListener(DYNAMIC_LISTENER *d);
|
||||
void FreeDynamicListener(DYNAMIC_LISTENER *d);
|
||||
bool ListenerRUDPRpcRecvProc(RUDP_STACK *r, UDPPACKET *p);
|
||||
void ListenerSetProcRecvRpcEnable(bool b);
|
||||
|
||||
|
||||
#endif // LISTENER_H
|
||||
|
||||
|
||||
|
5656
src/Cedar/Logging.c
5656
src/Cedar/Logging.c
File diff suppressed because it is too large
Load Diff
@ -1,165 +1,165 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Logging.h
|
||||
// Header of Logging.c
|
||||
|
||||
#ifndef LOGGING_H
|
||||
#define LOGGING_H
|
||||
|
||||
|
||||
// Port number for HTTP monitoring
|
||||
#define LOG_HTTP_PORT 80
|
||||
|
||||
|
||||
#define MAX_LOG_SIZE_DEFAULT 1073741823ULL
|
||||
|
||||
typedef char *(RECORD_PARSE_PROC)(RECORD *rec);
|
||||
|
||||
// Packet log structure
|
||||
struct PACKET_LOG
|
||||
{
|
||||
CEDAR *Cedar;
|
||||
struct PKT *Packet;
|
||||
char *SrcSessionName;
|
||||
char *DestSessionName;
|
||||
bool WritePhysicalIP;
|
||||
char SrcPhysicalIP[64];
|
||||
char DestPhysicalIP[64];
|
||||
bool PurePacket; // Packet not cloned
|
||||
bool PurePacketNoPayload; // Packet not cloned (without payload)
|
||||
SESSION *SrcSession;
|
||||
bool NoLog; // Not to write a log
|
||||
};
|
||||
|
||||
// Log save options of the HUB
|
||||
struct HUB_LOG
|
||||
{
|
||||
bool SaveSecurityLog; // To save the security log
|
||||
UINT SecurityLogSwitchType; // Switching type of security log
|
||||
bool SavePacketLog; // To save the packet log
|
||||
UINT PacketLogSwitchType; // Switching type of packet log
|
||||
UINT PacketLogConfig[NUM_PACKET_LOG]; // Packet log settings
|
||||
};
|
||||
|
||||
// Record
|
||||
struct RECORD
|
||||
{
|
||||
UINT64 Tick; // Time
|
||||
RECORD_PARSE_PROC *ParseProc; // Parsing procedure
|
||||
void *Data; // Data
|
||||
};
|
||||
|
||||
// LOG object
|
||||
struct LOG
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
THREAD *Thread; // Thread
|
||||
char *DirName; // Destination directory name
|
||||
char *Prefix; // File name
|
||||
UINT SwitchType; // Switching type of log file
|
||||
QUEUE *RecordQueue; // Record queue
|
||||
volatile bool Halt; // Halting flag
|
||||
EVENT *Event; // Event for Log
|
||||
EVENT *FlushEvent; // Flash completion event
|
||||
bool CacheFlag;
|
||||
UINT64 LastTick;
|
||||
UINT LastSwitchType;
|
||||
char LastStr[MAX_SIZE];
|
||||
UINT64 CurrentFilePointer; // The current file pointer
|
||||
UINT CurrentLogNumber; // Log file number of the current
|
||||
bool log_number_incremented;
|
||||
};
|
||||
|
||||
|
||||
// ERASER object
|
||||
struct ERASER
|
||||
{
|
||||
LOG *Log; // Logger
|
||||
UINT64 MinFreeSpace; // Disk space to start deleting files
|
||||
char *DirName; // Directory name
|
||||
volatile bool Halt; // Halting flag
|
||||
THREAD *Thread; // Thread
|
||||
bool LastFailed; // Whether deletion of the file failed at the end
|
||||
EVENT *HaltEvent; // Halting event
|
||||
};
|
||||
|
||||
// List of files that can be deleted
|
||||
typedef struct ERASE_FILE
|
||||
{
|
||||
char *FullPath; // Full path
|
||||
UINT64 UpdateTime; // Updating date
|
||||
} ERASE_FILE;
|
||||
|
||||
// SYSLOG object
|
||||
struct SLOG
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
SOCK *Udp; // UDP socket
|
||||
IP DestIp; // Destination IP address
|
||||
UINT DestPort; // Destination port number
|
||||
char HostName[MAX_HOST_NAME_LEN + 1]; // Host name
|
||||
UINT64 NextPollIp; // Time of examination of the IP address at the end
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
LOG *NewLog(char *dir, char *prefix, UINT switch_type);
|
||||
void FreeLog(LOG *g);
|
||||
void LogThread(THREAD *thread, void *param);
|
||||
void WaitLogFlush(LOG *g);
|
||||
void LockLog(LOG *g);
|
||||
void UnlockLog(LOG *g);
|
||||
void InsertRecord(LOG *g, void *data, RECORD_PARSE_PROC *proc);
|
||||
void InsertStringRecord(LOG *g, char *str);
|
||||
void InsertUnicodeRecord(LOG *g, wchar_t *unistr);
|
||||
char *StringRecordParseProc(RECORD *rec);
|
||||
bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr);
|
||||
void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type);
|
||||
void WriteRecordToBuffer(BUF *b, RECORD *r);
|
||||
void SetLogSwitchType(LOG *g, UINT switch_type);
|
||||
bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now);
|
||||
char *PacketLogParseProc(RECORD *rec);
|
||||
UINT CalcPacketLoggingLevel(HUB *hub, PKT *packet);
|
||||
UINT CalcPacketLoggingLevelEx(HUB_LOG *g, PKT *packet);
|
||||
char *GenCsvLine(TOKEN_LIST *t);
|
||||
void ReplaceForCsv(char *str);
|
||||
char *PortStr(CEDAR *cedar, UINT port, bool udp);
|
||||
char *TcpFlagStr(UCHAR flag);
|
||||
void SiSetDefaultLogSetting(HUB_LOG *g);
|
||||
void DebugLog(CEDAR *c, char *fmt, ...);
|
||||
void SLog(CEDAR *c, char *name, ...);
|
||||
void WriteHubLog(HUB *h, wchar_t *str);
|
||||
void HLog(HUB *h, char *name, ...);
|
||||
void NLog(VH *v, char *name, ...);
|
||||
void PPPLog(PPP_SESSION *p, char *name, ...);
|
||||
void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...);
|
||||
void EtherIPLog(ETHERIP_SERVER *s, char *name, ...);
|
||||
void WriteServerLog(CEDAR *c, wchar_t *str);
|
||||
void ALog(ADMIN *a, HUB *h, char *name, ...);
|
||||
void CLog(CLIENT *c, char *name, ...);
|
||||
void WriteClientLog(CLIENT *c, wchar_t *str);
|
||||
ERASER *NewEraser(LOG *log, UINT64 min_size);
|
||||
void FreeEraser(ERASER *e);
|
||||
void ELog(ERASER *e, char *name, ...);
|
||||
void EraserThread(THREAD *t, void *p);
|
||||
void EraserMain(ERASER *e);
|
||||
bool CheckEraserDiskFreeSpace(ERASER *e);
|
||||
int CompareEraseFile(void *p1, void *p2);
|
||||
LIST *GenerateEraseFileList(ERASER *e);
|
||||
void FreeEraseFileList(LIST *o);
|
||||
void EnumEraseFile(LIST *o, char *dirname);
|
||||
SLOG *NewSysLog(char *hostname, UINT port, IP *ip);
|
||||
void SetSysLog(SLOG *g, char *hostname, UINT port);
|
||||
void FreeSysLog(SLOG *g);
|
||||
void SendSysLog(SLOG *g, wchar_t *str);
|
||||
char *BuildHttpLogStr(HTTPLOG *h);
|
||||
void MakeSafeLogStr(char *str);
|
||||
void AddLogBufToStr(BUF *b, char *name, char *value);
|
||||
void SetEraserCheckInterval(UINT interval);
|
||||
UINT GetEraserCheckInterval();
|
||||
void SetMaxLogSize(UINT64 size);
|
||||
UINT64 GetMaxLogSize();
|
||||
|
||||
#endif // LOGGING_G
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Logging.h
|
||||
// Header of Logging.c
|
||||
|
||||
#ifndef LOGGING_H
|
||||
#define LOGGING_H
|
||||
|
||||
|
||||
// Port number for HTTP monitoring
|
||||
#define LOG_HTTP_PORT 80
|
||||
|
||||
|
||||
#define MAX_LOG_SIZE_DEFAULT 1073741823ULL
|
||||
|
||||
typedef char *(RECORD_PARSE_PROC)(RECORD *rec);
|
||||
|
||||
// Packet log structure
|
||||
struct PACKET_LOG
|
||||
{
|
||||
CEDAR *Cedar;
|
||||
struct PKT *Packet;
|
||||
char *SrcSessionName;
|
||||
char *DestSessionName;
|
||||
bool WritePhysicalIP;
|
||||
char SrcPhysicalIP[64];
|
||||
char DestPhysicalIP[64];
|
||||
bool PurePacket; // Packet not cloned
|
||||
bool PurePacketNoPayload; // Packet not cloned (without payload)
|
||||
SESSION *SrcSession;
|
||||
bool NoLog; // Not to write a log
|
||||
};
|
||||
|
||||
// Log save options of the HUB
|
||||
struct HUB_LOG
|
||||
{
|
||||
bool SaveSecurityLog; // To save the security log
|
||||
UINT SecurityLogSwitchType; // Switching type of security log
|
||||
bool SavePacketLog; // To save the packet log
|
||||
UINT PacketLogSwitchType; // Switching type of packet log
|
||||
UINT PacketLogConfig[NUM_PACKET_LOG]; // Packet log settings
|
||||
};
|
||||
|
||||
// Record
|
||||
struct RECORD
|
||||
{
|
||||
UINT64 Tick; // Time
|
||||
RECORD_PARSE_PROC *ParseProc; // Parsing procedure
|
||||
void *Data; // Data
|
||||
};
|
||||
|
||||
// LOG object
|
||||
struct LOG
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
THREAD *Thread; // Thread
|
||||
char *DirName; // Destination directory name
|
||||
char *Prefix; // File name
|
||||
UINT SwitchType; // Switching type of log file
|
||||
QUEUE *RecordQueue; // Record queue
|
||||
volatile bool Halt; // Halting flag
|
||||
EVENT *Event; // Event for Log
|
||||
EVENT *FlushEvent; // Flash completion event
|
||||
bool CacheFlag;
|
||||
UINT64 LastTick;
|
||||
UINT LastSwitchType;
|
||||
char LastStr[MAX_SIZE];
|
||||
UINT64 CurrentFilePointer; // The current file pointer
|
||||
UINT CurrentLogNumber; // Log file number of the current
|
||||
bool log_number_incremented;
|
||||
};
|
||||
|
||||
|
||||
// ERASER object
|
||||
struct ERASER
|
||||
{
|
||||
LOG *Log; // Logger
|
||||
UINT64 MinFreeSpace; // Disk space to start deleting files
|
||||
char *DirName; // Directory name
|
||||
volatile bool Halt; // Halting flag
|
||||
THREAD *Thread; // Thread
|
||||
bool LastFailed; // Whether deletion of the file failed at the end
|
||||
EVENT *HaltEvent; // Halting event
|
||||
};
|
||||
|
||||
// List of files that can be deleted
|
||||
typedef struct ERASE_FILE
|
||||
{
|
||||
char *FullPath; // Full path
|
||||
UINT64 UpdateTime; // Updating date
|
||||
} ERASE_FILE;
|
||||
|
||||
// SYSLOG object
|
||||
struct SLOG
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
SOCK *Udp; // UDP socket
|
||||
IP DestIp; // Destination IP address
|
||||
UINT DestPort; // Destination port number
|
||||
char HostName[MAX_HOST_NAME_LEN + 1]; // Host name
|
||||
UINT64 NextPollIp; // Time of examination of the IP address at the end
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
LOG *NewLog(char *dir, char *prefix, UINT switch_type);
|
||||
void FreeLog(LOG *g);
|
||||
void LogThread(THREAD *thread, void *param);
|
||||
void WaitLogFlush(LOG *g);
|
||||
void LockLog(LOG *g);
|
||||
void UnlockLog(LOG *g);
|
||||
void InsertRecord(LOG *g, void *data, RECORD_PARSE_PROC *proc);
|
||||
void InsertStringRecord(LOG *g, char *str);
|
||||
void InsertUnicodeRecord(LOG *g, wchar_t *unistr);
|
||||
char *StringRecordParseProc(RECORD *rec);
|
||||
bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr);
|
||||
void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type);
|
||||
void WriteRecordToBuffer(BUF *b, RECORD *r);
|
||||
void SetLogSwitchType(LOG *g, UINT switch_type);
|
||||
bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now);
|
||||
char *PacketLogParseProc(RECORD *rec);
|
||||
UINT CalcPacketLoggingLevel(HUB *hub, PKT *packet);
|
||||
UINT CalcPacketLoggingLevelEx(HUB_LOG *g, PKT *packet);
|
||||
char *GenCsvLine(TOKEN_LIST *t);
|
||||
void ReplaceForCsv(char *str);
|
||||
char *PortStr(CEDAR *cedar, UINT port, bool udp);
|
||||
char *TcpFlagStr(UCHAR flag);
|
||||
void SiSetDefaultLogSetting(HUB_LOG *g);
|
||||
void DebugLog(CEDAR *c, char *fmt, ...);
|
||||
void SLog(CEDAR *c, char *name, ...);
|
||||
void WriteHubLog(HUB *h, wchar_t *str);
|
||||
void HLog(HUB *h, char *name, ...);
|
||||
void NLog(VH *v, char *name, ...);
|
||||
void PPPLog(PPP_SESSION *p, char *name, ...);
|
||||
void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...);
|
||||
void EtherIPLog(ETHERIP_SERVER *s, char *name, ...);
|
||||
void WriteServerLog(CEDAR *c, wchar_t *str);
|
||||
void ALog(ADMIN *a, HUB *h, char *name, ...);
|
||||
void CLog(CLIENT *c, char *name, ...);
|
||||
void WriteClientLog(CLIENT *c, wchar_t *str);
|
||||
ERASER *NewEraser(LOG *log, UINT64 min_size);
|
||||
void FreeEraser(ERASER *e);
|
||||
void ELog(ERASER *e, char *name, ...);
|
||||
void EraserThread(THREAD *t, void *p);
|
||||
void EraserMain(ERASER *e);
|
||||
bool CheckEraserDiskFreeSpace(ERASER *e);
|
||||
int CompareEraseFile(void *p1, void *p2);
|
||||
LIST *GenerateEraseFileList(ERASER *e);
|
||||
void FreeEraseFileList(LIST *o);
|
||||
void EnumEraseFile(LIST *o, char *dirname);
|
||||
SLOG *NewSysLog(char *hostname, UINT port, IP *ip);
|
||||
void SetSysLog(SLOG *g, char *hostname, UINT port);
|
||||
void FreeSysLog(SLOG *g);
|
||||
void SendSysLog(SLOG *g, wchar_t *str);
|
||||
char *BuildHttpLogStr(HTTPLOG *h);
|
||||
void MakeSafeLogStr(char *str);
|
||||
void AddLogBufToStr(BUF *b, char *name, char *value);
|
||||
void SetEraserCheckInterval(UINT interval);
|
||||
UINT GetEraserCheckInterval();
|
||||
void SetMaxLogSize(UINT64 size);
|
||||
UINT64 GetMaxLogSize();
|
||||
|
||||
#endif // LOGGING_G
|
||||
|
||||
|
3074
src/Cedar/NM.c
3074
src/Cedar/NM.c
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,16 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// NM.h
|
||||
// Header of NM.c
|
||||
|
||||
#ifndef NM_H
|
||||
#define NM_H
|
||||
|
||||
// External function
|
||||
void NMExec();
|
||||
|
||||
#endif // NM_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// NM.h
|
||||
// Header of NM.c
|
||||
|
||||
#ifndef NM_H
|
||||
#define NM_H
|
||||
|
||||
// External function
|
||||
void NMExec();
|
||||
|
||||
#endif // NM_H
|
||||
|
||||
|
||||
|
@ -1,72 +1,72 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// NMInner.h
|
||||
// The internal header of NM.c
|
||||
|
||||
|
||||
// Constants
|
||||
#define NM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager"
|
||||
#define NM_SETTING_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager\\Settings"
|
||||
|
||||
#define NM_REFRESH_TIME 1000
|
||||
#define NM_NAT_REFRESH_TIME 1000
|
||||
#define NM_DHCP_REFRESH_TIME 1000
|
||||
|
||||
// Nat Admin structure
|
||||
typedef struct NM
|
||||
{
|
||||
CEDAR *Cedar; // Cedar
|
||||
} NM;
|
||||
|
||||
// Connection structure
|
||||
typedef struct NM_CONNECT
|
||||
{
|
||||
RPC *Rpc; // RPC
|
||||
char *Hostname;
|
||||
UINT Port;
|
||||
} NM_CONNECT;
|
||||
|
||||
// Login
|
||||
typedef struct NM_LOGIN
|
||||
{
|
||||
char *Hostname;
|
||||
UINT Port;
|
||||
UCHAR hashed_password[SHA1_SIZE];
|
||||
} NM_LOGIN;
|
||||
|
||||
// Internal function
|
||||
void InitNM();
|
||||
void FreeNM();
|
||||
void MainNM();
|
||||
RPC *NmConnect(char *hostname, UINT port);
|
||||
UINT NmConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
UINT NmLogin(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmMainDlg(RPC *r);
|
||||
UINT NmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmMainDlgInit(HWND hWnd, RPC *r);
|
||||
void NmMainDlgRefresh(HWND hWnd, RPC *r);
|
||||
void NmEditClientConfig(HWND hWnd, RPC *r);
|
||||
void NmEditVhOption(HWND hWnd, SM_HUB *r);
|
||||
UINT NmEditVhOptionProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmEditVhOptionInit(HWND hWnd, SM_HUB *r);
|
||||
void NmEditVhOptionUpdate(HWND hWnd, SM_HUB *r);
|
||||
void NmEditVhOptionOnOk(HWND hWnd, SM_HUB *r);
|
||||
void NmEditVhOptionFormToVH(HWND hWnd, VH_OPTION *t);
|
||||
bool NmStatus(HWND hWnd, SM_SERVER *s, void *param);
|
||||
bool NmInfo(HWND hWnd, SM_SERVER *s, void *param);
|
||||
void NmNat(HWND hWnd, SM_HUB *r);
|
||||
UINT NmNatProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmNatInit(HWND hWnd, SM_HUB *r);
|
||||
void NmNatRefresh(HWND hWnd, SM_HUB *r);
|
||||
void NmDhcp(HWND hWnd, SM_HUB *r);
|
||||
UINT NmDhcpProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmDhcpRefresh(HWND hWnd, SM_HUB *r);
|
||||
void NmDhcpInit(HWND hWnd, SM_HUB *r);
|
||||
void NmChangePassword(HWND hWnd, RPC *r);
|
||||
UINT NmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
bool NmEditPushRoute(HWND hWnd, SM_HUB *r);
|
||||
UINT NmEditPushRouteProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// NMInner.h
|
||||
// The internal header of NM.c
|
||||
|
||||
|
||||
// Constants
|
||||
#define NM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager"
|
||||
#define NM_SETTING_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager\\Settings"
|
||||
|
||||
#define NM_REFRESH_TIME 1000
|
||||
#define NM_NAT_REFRESH_TIME 1000
|
||||
#define NM_DHCP_REFRESH_TIME 1000
|
||||
|
||||
// Nat Admin structure
|
||||
typedef struct NM
|
||||
{
|
||||
CEDAR *Cedar; // Cedar
|
||||
} NM;
|
||||
|
||||
// Connection structure
|
||||
typedef struct NM_CONNECT
|
||||
{
|
||||
RPC *Rpc; // RPC
|
||||
char *Hostname;
|
||||
UINT Port;
|
||||
} NM_CONNECT;
|
||||
|
||||
// Login
|
||||
typedef struct NM_LOGIN
|
||||
{
|
||||
char *Hostname;
|
||||
UINT Port;
|
||||
UCHAR hashed_password[SHA1_SIZE];
|
||||
} NM_LOGIN;
|
||||
|
||||
// Internal function
|
||||
void InitNM();
|
||||
void FreeNM();
|
||||
void MainNM();
|
||||
RPC *NmConnect(char *hostname, UINT port);
|
||||
UINT NmConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
UINT NmLogin(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmMainDlg(RPC *r);
|
||||
UINT NmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmMainDlgInit(HWND hWnd, RPC *r);
|
||||
void NmMainDlgRefresh(HWND hWnd, RPC *r);
|
||||
void NmEditClientConfig(HWND hWnd, RPC *r);
|
||||
void NmEditVhOption(HWND hWnd, SM_HUB *r);
|
||||
UINT NmEditVhOptionProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmEditVhOptionInit(HWND hWnd, SM_HUB *r);
|
||||
void NmEditVhOptionUpdate(HWND hWnd, SM_HUB *r);
|
||||
void NmEditVhOptionOnOk(HWND hWnd, SM_HUB *r);
|
||||
void NmEditVhOptionFormToVH(HWND hWnd, VH_OPTION *t);
|
||||
bool NmStatus(HWND hWnd, SM_SERVER *s, void *param);
|
||||
bool NmInfo(HWND hWnd, SM_SERVER *s, void *param);
|
||||
void NmNat(HWND hWnd, SM_HUB *r);
|
||||
UINT NmNatProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmNatInit(HWND hWnd, SM_HUB *r);
|
||||
void NmNatRefresh(HWND hWnd, SM_HUB *r);
|
||||
void NmDhcp(HWND hWnd, SM_HUB *r);
|
||||
UINT NmDhcpProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void NmDhcpRefresh(HWND hWnd, SM_HUB *r);
|
||||
void NmDhcpInit(HWND hWnd, SM_HUB *r);
|
||||
void NmChangePassword(HWND hWnd, RPC *r);
|
||||
UINT NmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
bool NmEditPushRoute(HWND hWnd, SM_HUB *r);
|
||||
UINT NmEditPushRouteProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
|
||||
|
||||
|
3636
src/Cedar/Nat.c
3636
src/Cedar/Nat.c
File diff suppressed because it is too large
Load Diff
424
src/Cedar/Nat.h
424
src/Cedar/Nat.h
@ -1,212 +1,212 @@
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Nat.h
|
||||
// Header of Nat.c
|
||||
|
||||
#ifndef NAT_H
|
||||
#define NAT_H
|
||||
|
||||
// Constants
|
||||
#define NAT_CONFIG_FILE_NAME "$vpn_router.config" // NAT configuration file
|
||||
#define DEFAULT_NAT_ADMIN_PORT 2828 // Default port number for management
|
||||
#define NAT_ADMIN_PORT_LISTEN_INTERVAL 1000 // Interval for trying to open a port for management
|
||||
#define NAT_FILE_SAVE_INTERVAL (30 * 1000) // Interval to save
|
||||
|
||||
|
||||
// NAT object
|
||||
struct NAT
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Administrative password
|
||||
VH_OPTION Option; // Option
|
||||
CEDAR *Cedar; // Cedar
|
||||
UINT AdminPort; // Management port number
|
||||
bool Online; // Online flag
|
||||
VH *Virtual; // Virtual host object
|
||||
CLIENT_OPTION *ClientOption; // Client Option
|
||||
CLIENT_AUTH *ClientAuth; // Client authentication data
|
||||
CFG_RW *CfgRw; // Config file R/W
|
||||
THREAD *AdminAcceptThread; // Management connection reception thread
|
||||
SOCK *AdminListenSock; // Management port socket
|
||||
EVENT *HaltEvent; // Halting event
|
||||
volatile bool Halt; // Halting flag
|
||||
LIST *AdminList; // Management thread list
|
||||
X *AdminX; // Server certificate for management
|
||||
K *AdminK; // Server private key for management
|
||||
SNAT *SecureNAT; // SecureNAT object
|
||||
};
|
||||
|
||||
// NAT management connection
|
||||
struct NAT_ADMIN
|
||||
{
|
||||
NAT *Nat; // NAT
|
||||
SOCK *Sock; // Socket
|
||||
THREAD *Thread; // Thread
|
||||
};
|
||||
|
||||
// RPC_DUMMY
|
||||
struct RPC_DUMMY
|
||||
{
|
||||
UINT DummyValue;
|
||||
};
|
||||
|
||||
// RPC_NAT_STATUS
|
||||
struct RPC_NAT_STATUS
|
||||
{
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
|
||||
UINT NumTcpSessions; // Number of TCP sessions
|
||||
UINT NumUdpSessions; // Ntmber of UDP sessions
|
||||
UINT NumIcmpSessions; // Number of ICMP sessions
|
||||
UINT NumDnsSessions; // Number of DNS sessions
|
||||
UINT NumDhcpClients; // Number of DHCP clients
|
||||
bool IsKernelMode; // Whether kernel mode
|
||||
bool IsRawIpMode; // Whether raw IP mode
|
||||
};
|
||||
|
||||
// RPC_NAT_INFO *
|
||||
struct RPC_NAT_INFO
|
||||
{
|
||||
char NatProductName[128]; // Server product name
|
||||
char NatVersionString[128]; // Server version string
|
||||
char NatBuildInfoString[128]; // Server build information string
|
||||
UINT NatVerInt; // Server version integer value
|
||||
UINT NatBuildInt; // Server build number integer value
|
||||
char NatHostName[MAX_HOST_NAME_LEN + 1]; // Server host name
|
||||
OS_INFO OsInfo; // OS information
|
||||
MEMINFO MemInfo; // Memory information
|
||||
};
|
||||
|
||||
// RPC_ENUM_NAT_ITEM
|
||||
struct RPC_ENUM_NAT_ITEM
|
||||
{
|
||||
UINT Id; // ID
|
||||
UINT Protocol; // Protocol
|
||||
UINT SrcIp; // Source IP address
|
||||
char SrcHost[MAX_HOST_NAME_LEN + 1]; // Source host name
|
||||
UINT SrcPort; // Source port number
|
||||
UINT DestIp; // Destination IP address
|
||||
char DestHost[MAX_HOST_NAME_LEN + 1]; // Destination host name
|
||||
UINT DestPort; // Destination port number
|
||||
UINT64 CreatedTime; // Connection time
|
||||
UINT64 LastCommTime; // Last communication time
|
||||
UINT64 SendSize; // Transmission size
|
||||
UINT64 RecvSize; // Receive size
|
||||
UINT TcpStatus; // TCP state
|
||||
};
|
||||
|
||||
// RPC_ENUM_NAT *
|
||||
struct RPC_ENUM_NAT
|
||||
{
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
|
||||
UINT NumItem; // Number of items
|
||||
RPC_ENUM_NAT_ITEM *Items; // Item
|
||||
};
|
||||
|
||||
// RPC_ENUM_DHCP_ITEM
|
||||
struct RPC_ENUM_DHCP_ITEM
|
||||
{
|
||||
UINT Id; // ID
|
||||
UINT64 LeasedTime; // Lease time
|
||||
UINT64 ExpireTime; // Expiration date
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UCHAR Padding[2]; // Padding
|
||||
UINT IpAddress; // IP address
|
||||
UINT Mask; // Subnet mask
|
||||
char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name
|
||||
};
|
||||
|
||||
// RPC_ENUM_DHCP *
|
||||
struct RPC_ENUM_DHCP
|
||||
{
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
|
||||
UINT NumItem; // Number of items
|
||||
RPC_ENUM_DHCP_ITEM *Items; // Item
|
||||
};
|
||||
|
||||
|
||||
// Function prototype
|
||||
NAT *NiNewNat();
|
||||
NAT *NiNewNatEx(SNAT *snat, VH_OPTION *o);
|
||||
void NiFreeNat(NAT *n);
|
||||
void NiInitConfig(NAT *n);
|
||||
void NiFreeConfig(NAT *n);
|
||||
void NiInitDefaultConfig(NAT *n);
|
||||
void NiSetDefaultVhOption(NAT *n, VH_OPTION *o);
|
||||
void NiClearUnsupportedVhOptionForDynamicHub(VH_OPTION *o, bool initial);
|
||||
void NiWriteConfig(NAT *n);
|
||||
void NiWriteVhOption(NAT *n, FOLDER *root);
|
||||
void NiWriteVhOptionEx(VH_OPTION *o, FOLDER *root);
|
||||
void NiWriteClientData(NAT *n, FOLDER *root);
|
||||
void NiLoadVhOption(NAT *n, FOLDER *root);
|
||||
void NiLoadVhOptionEx(VH_OPTION *o, FOLDER *root);
|
||||
bool NiLoadConfig(NAT *n, FOLDER *root);
|
||||
void NiLoadClientData(NAT *n, FOLDER *root);
|
||||
void NiInitAdminAccept(NAT *n);
|
||||
void NiFreeAdminAccept(NAT *n);
|
||||
void NiListenThread(THREAD *thread, void *param);
|
||||
void NiAdminThread(THREAD *thread, void *param);
|
||||
void NiAdminMain(NAT *n, SOCK *s);
|
||||
PACK *NiRpcServer(RPC *r, char *name, PACK *p);
|
||||
|
||||
RPC *NatAdminConnect(CEDAR *cedar, char *hostname, UINT port, void *hashed_password, UINT *err);
|
||||
void NatAdminDisconnect(RPC *r);
|
||||
|
||||
void NtStartNat();
|
||||
void NtStopNat();
|
||||
void NtInit();
|
||||
void NtFree();
|
||||
|
||||
|
||||
UINT NtOnline(NAT *n, RPC_DUMMY *t);
|
||||
UINT NtOffline(NAT *n, RPC_DUMMY *t);
|
||||
UINT NtSetHostOption(NAT *n, VH_OPTION *t);
|
||||
UINT NtGetHostOption(NAT *n, VH_OPTION *t);
|
||||
UINT NtSetClientConfig(NAT *n, RPC_CREATE_LINK *t);
|
||||
UINT NtGetClientConfig(NAT *n, RPC_CREATE_LINK *t);
|
||||
UINT NtGetStatus(NAT *n, RPC_NAT_STATUS *t);
|
||||
UINT NtGetInfo(NAT *n, RPC_NAT_INFO *t);
|
||||
UINT NtEnumNatList(NAT *n, RPC_ENUM_NAT *t);
|
||||
UINT NtEnumDhcpList(NAT *n, RPC_ENUM_DHCP *t);
|
||||
UINT NtSetPassword(NAT *n, RPC_SET_PASSWORD *t);
|
||||
|
||||
|
||||
UINT NcOnline(RPC *r, RPC_DUMMY *t);
|
||||
UINT NcOffline(RPC *r, RPC_DUMMY *t);
|
||||
UINT NcSetHostOption(RPC *r, VH_OPTION *t);
|
||||
UINT NcGetHostOption(RPC *r, VH_OPTION *t);
|
||||
UINT NcSetClientConfig(RPC *r, RPC_CREATE_LINK *t);
|
||||
UINT NcGetClientConfig(RPC *r, RPC_CREATE_LINK *t);
|
||||
UINT NcGetStatus(RPC *r, RPC_NAT_STATUS *t);
|
||||
UINT NcGetInfo(RPC *r, RPC_NAT_INFO *t);
|
||||
UINT NcEnumNatList(RPC *r, RPC_ENUM_NAT *t);
|
||||
UINT NcEnumDhcpList(RPC *r, RPC_ENUM_DHCP *t);
|
||||
UINT NcSetPassword(RPC *r, RPC_SET_PASSWORD *t);
|
||||
|
||||
|
||||
|
||||
|
||||
void InRpcEnumDhcp(RPC_ENUM_DHCP *t, PACK *p);
|
||||
void OutRpcEnumDhcp(PACK *p, RPC_ENUM_DHCP *t);
|
||||
void FreeRpcEnumDhcp(RPC_ENUM_DHCP *t);
|
||||
void InRpcEnumNat(RPC_ENUM_NAT *t, PACK *p);
|
||||
void OutRpcEnumNat(PACK *p, RPC_ENUM_NAT *t);
|
||||
void FreeRpcEnumNat(RPC_ENUM_NAT *t);
|
||||
void InRpcNatInfo(RPC_NAT_INFO *t, PACK *p);
|
||||
void OutRpcNatInfo(PACK *p, RPC_NAT_INFO *t);
|
||||
void FreeRpcNatInfo(RPC_NAT_INFO *t);
|
||||
void InRpcNatStatus(RPC_NAT_STATUS *t, PACK *p);
|
||||
void OutRpcNatStatus(PACK *p, RPC_NAT_STATUS *t);
|
||||
void FreeRpcNatStatus(RPC_NAT_STATUS *t);
|
||||
void InVhOption(VH_OPTION *t, PACK *p);
|
||||
void OutVhOption(PACK *p, VH_OPTION *t);
|
||||
void InRpcDummy(RPC_DUMMY *t, PACK *p);
|
||||
void OutRpcDummy(PACK *p, RPC_DUMMY *t);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // NAT_H
|
||||
|
||||
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
|
||||
|
||||
// Nat.h
|
||||
// Header of Nat.c
|
||||
|
||||
#ifndef NAT_H
|
||||
#define NAT_H
|
||||
|
||||
// Constants
|
||||
#define NAT_CONFIG_FILE_NAME "$vpn_router.config" // NAT configuration file
|
||||
#define DEFAULT_NAT_ADMIN_PORT 2828 // Default port number for management
|
||||
#define NAT_ADMIN_PORT_LISTEN_INTERVAL 1000 // Interval for trying to open a port for management
|
||||
#define NAT_FILE_SAVE_INTERVAL (30 * 1000) // Interval to save
|
||||
|
||||
|
||||
// NAT object
|
||||
struct NAT
|
||||
{
|
||||
LOCK *lock; // Lock
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Administrative password
|
||||
VH_OPTION Option; // Option
|
||||
CEDAR *Cedar; // Cedar
|
||||
UINT AdminPort; // Management port number
|
||||
bool Online; // Online flag
|
||||
VH *Virtual; // Virtual host object
|
||||
CLIENT_OPTION *ClientOption; // Client Option
|
||||
CLIENT_AUTH *ClientAuth; // Client authentication data
|
||||
CFG_RW *CfgRw; // Config file R/W
|
||||
THREAD *AdminAcceptThread; // Management connection reception thread
|
||||
SOCK *AdminListenSock; // Management port socket
|
||||
EVENT *HaltEvent; // Halting event
|
||||
volatile bool Halt; // Halting flag
|
||||
LIST *AdminList; // Management thread list
|
||||
X *AdminX; // Server certificate for management
|
||||
K *AdminK; // Server private key for management
|
||||
SNAT *SecureNAT; // SecureNAT object
|
||||
};
|
||||
|
||||
// NAT management connection
|
||||
struct NAT_ADMIN
|
||||
{
|
||||
NAT *Nat; // NAT
|
||||
SOCK *Sock; // Socket
|
||||
THREAD *Thread; // Thread
|
||||
};
|
||||
|
||||
// RPC_DUMMY
|
||||
struct RPC_DUMMY
|
||||
{
|
||||
UINT DummyValue;
|
||||
};
|
||||
|
||||
// RPC_NAT_STATUS
|
||||
struct RPC_NAT_STATUS
|
||||
{
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
|
||||
UINT NumTcpSessions; // Number of TCP sessions
|
||||
UINT NumUdpSessions; // Ntmber of UDP sessions
|
||||
UINT NumIcmpSessions; // Number of ICMP sessions
|
||||
UINT NumDnsSessions; // Number of DNS sessions
|
||||
UINT NumDhcpClients; // Number of DHCP clients
|
||||
bool IsKernelMode; // Whether kernel mode
|
||||
bool IsRawIpMode; // Whether raw IP mode
|
||||
};
|
||||
|
||||
// RPC_NAT_INFO *
|
||||
struct RPC_NAT_INFO
|
||||
{
|
||||
char NatProductName[128]; // Server product name
|
||||
char NatVersionString[128]; // Server version string
|
||||
char NatBuildInfoString[128]; // Server build information string
|
||||
UINT NatVerInt; // Server version integer value
|
||||
UINT NatBuildInt; // Server build number integer value
|
||||
char NatHostName[MAX_HOST_NAME_LEN + 1]; // Server host name
|
||||
OS_INFO OsInfo; // OS information
|
||||
MEMINFO MemInfo; // Memory information
|
||||
};
|
||||
|
||||
// RPC_ENUM_NAT_ITEM
|
||||
struct RPC_ENUM_NAT_ITEM
|
||||
{
|
||||
UINT Id; // ID
|
||||
UINT Protocol; // Protocol
|
||||
UINT SrcIp; // Source IP address
|
||||
char SrcHost[MAX_HOST_NAME_LEN + 1]; // Source host name
|
||||
UINT SrcPort; // Source port number
|
||||
UINT DestIp; // Destination IP address
|
||||
char DestHost[MAX_HOST_NAME_LEN + 1]; // Destination host name
|
||||
UINT DestPort; // Destination port number
|
||||
UINT64 CreatedTime; // Connection time
|
||||
UINT64 LastCommTime; // Last communication time
|
||||
UINT64 SendSize; // Transmission size
|
||||
UINT64 RecvSize; // Receive size
|
||||
UINT TcpStatus; // TCP state
|
||||
};
|
||||
|
||||
// RPC_ENUM_NAT *
|
||||
struct RPC_ENUM_NAT
|
||||
{
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
|
||||
UINT NumItem; // Number of items
|
||||
RPC_ENUM_NAT_ITEM *Items; // Item
|
||||
};
|
||||
|
||||
// RPC_ENUM_DHCP_ITEM
|
||||
struct RPC_ENUM_DHCP_ITEM
|
||||
{
|
||||
UINT Id; // ID
|
||||
UINT64 LeasedTime; // Lease time
|
||||
UINT64 ExpireTime; // Expiration date
|
||||
UCHAR MacAddress[6]; // MAC address
|
||||
UCHAR Padding[2]; // Padding
|
||||
UINT IpAddress; // IP address
|
||||
UINT Mask; // Subnet mask
|
||||
char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name
|
||||
};
|
||||
|
||||
// RPC_ENUM_DHCP *
|
||||
struct RPC_ENUM_DHCP
|
||||
{
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
|
||||
UINT NumItem; // Number of items
|
||||
RPC_ENUM_DHCP_ITEM *Items; // Item
|
||||
};
|
||||
|
||||
|
||||
// Function prototype
|
||||
NAT *NiNewNat();
|
||||
NAT *NiNewNatEx(SNAT *snat, VH_OPTION *o);
|
||||
void NiFreeNat(NAT *n);
|
||||
void NiInitConfig(NAT *n);
|
||||
void NiFreeConfig(NAT *n);
|
||||
void NiInitDefaultConfig(NAT *n);
|
||||
void NiSetDefaultVhOption(NAT *n, VH_OPTION *o);
|
||||
void NiClearUnsupportedVhOptionForDynamicHub(VH_OPTION *o, bool initial);
|
||||
void NiWriteConfig(NAT *n);
|
||||
void NiWriteVhOption(NAT *n, FOLDER *root);
|
||||
void NiWriteVhOptionEx(VH_OPTION *o, FOLDER *root);
|
||||
void NiWriteClientData(NAT *n, FOLDER *root);
|
||||
void NiLoadVhOption(NAT *n, FOLDER *root);
|
||||
void NiLoadVhOptionEx(VH_OPTION *o, FOLDER *root);
|
||||
bool NiLoadConfig(NAT *n, FOLDER *root);
|
||||
void NiLoadClientData(NAT *n, FOLDER *root);
|
||||
void NiInitAdminAccept(NAT *n);
|
||||
void NiFreeAdminAccept(NAT *n);
|
||||
void NiListenThread(THREAD *thread, void *param);
|
||||
void NiAdminThread(THREAD *thread, void *param);
|
||||
void NiAdminMain(NAT *n, SOCK *s);
|
||||
PACK *NiRpcServer(RPC *r, char *name, PACK *p);
|
||||
|
||||
RPC *NatAdminConnect(CEDAR *cedar, char *hostname, UINT port, void *hashed_password, UINT *err);
|
||||
void NatAdminDisconnect(RPC *r);
|
||||
|
||||
void NtStartNat();
|
||||
void NtStopNat();
|
||||
void NtInit();
|
||||
void NtFree();
|
||||
|
||||
|
||||
UINT NtOnline(NAT *n, RPC_DUMMY *t);
|
||||
UINT NtOffline(NAT *n, RPC_DUMMY *t);
|
||||
UINT NtSetHostOption(NAT *n, VH_OPTION *t);
|
||||
UINT NtGetHostOption(NAT *n, VH_OPTION *t);
|
||||
UINT NtSetClientConfig(NAT *n, RPC_CREATE_LINK *t);
|
||||
UINT NtGetClientConfig(NAT *n, RPC_CREATE_LINK *t);
|
||||
UINT NtGetStatus(NAT *n, RPC_NAT_STATUS *t);
|
||||
UINT NtGetInfo(NAT *n, RPC_NAT_INFO *t);
|
||||
UINT NtEnumNatList(NAT *n, RPC_ENUM_NAT *t);
|
||||
UINT NtEnumDhcpList(NAT *n, RPC_ENUM_DHCP *t);
|
||||
UINT NtSetPassword(NAT *n, RPC_SET_PASSWORD *t);
|
||||
|
||||
|
||||
UINT NcOnline(RPC *r, RPC_DUMMY *t);
|
||||
UINT NcOffline(RPC *r, RPC_DUMMY *t);
|
||||
UINT NcSetHostOption(RPC *r, VH_OPTION *t);
|
||||
UINT NcGetHostOption(RPC *r, VH_OPTION *t);
|
||||
UINT NcSetClientConfig(RPC *r, RPC_CREATE_LINK *t);
|
||||
UINT NcGetClientConfig(RPC *r, RPC_CREATE_LINK *t);
|
||||
UINT NcGetStatus(RPC *r, RPC_NAT_STATUS *t);
|
||||
UINT NcGetInfo(RPC *r, RPC_NAT_INFO *t);
|
||||
UINT NcEnumNatList(RPC *r, RPC_ENUM_NAT *t);
|
||||
UINT NcEnumDhcpList(RPC *r, RPC_ENUM_DHCP *t);
|
||||
UINT NcSetPassword(RPC *r, RPC_SET_PASSWORD *t);
|
||||
|
||||
|
||||
|
||||
|
||||
void InRpcEnumDhcp(RPC_ENUM_DHCP *t, PACK *p);
|
||||
void OutRpcEnumDhcp(PACK *p, RPC_ENUM_DHCP *t);
|
||||
void FreeRpcEnumDhcp(RPC_ENUM_DHCP *t);
|
||||
void InRpcEnumNat(RPC_ENUM_NAT *t, PACK *p);
|
||||
void OutRpcEnumNat(PACK *p, RPC_ENUM_NAT *t);
|
||||
void FreeRpcEnumNat(RPC_ENUM_NAT *t);
|
||||
void InRpcNatInfo(RPC_NAT_INFO *t, PACK *p);
|
||||
void OutRpcNatInfo(PACK *p, RPC_NAT_INFO *t);
|
||||
void FreeRpcNatInfo(RPC_NAT_INFO *t);
|
||||
void InRpcNatStatus(RPC_NAT_STATUS *t, PACK *p);
|
||||
void OutRpcNatStatus(PACK *p, RPC_NAT_STATUS *t);
|
||||
void FreeRpcNatStatus(RPC_NAT_STATUS *t);
|
||||
void InVhOption(VH_OPTION *t, PACK *p);
|
||||
void OutVhOption(PACK *p, VH_OPTION *t);
|
||||
void InRpcDummy(RPC_DUMMY *t, PACK *p);
|
||||
void OutRpcDummy(PACK *p, RPC_DUMMY *t);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // NAT_H
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user