diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/driver/AUTHORS | 1 | ||||
-rw-r--r-- | kernel/driver/COPYING | 340 | ||||
-rw-r--r-- | kernel/driver/ChangeLog | 0 | ||||
-rw-r--r-- | kernel/driver/Doxyfile | 275 | ||||
-rw-r--r-- | kernel/driver/INSTALL | 167 | ||||
-rw-r--r-- | kernel/driver/Makefile | 42 | ||||
-rw-r--r-- | kernel/driver/NEWS | 0 | ||||
-rw-r--r-- | kernel/driver/README | 0 | ||||
-rw-r--r-- | kernel/driver/TODO | 0 | ||||
-rwxr-xr-x | kernel/driver/find_kernel_headers | 21 | ||||
-rw-r--r-- | kernel/driver/gre.c | 140 | ||||
-rw-r--r-- | kernel/driver/gre.h | 18 | ||||
-rw-r--r-- | kernel/driver/if_pppox.h | 222 | ||||
-rw-r--r-- | kernel/driver/pptp.c | 1254 | ||||
-rw-r--r-- | kernel/patch/patch-2.6.18 | 1110 | ||||
-rw-r--r-- | kernel/patch/ppp-generic-smp-2.6.26.patch | 165 | ||||
-rw-r--r-- | kernel/patch/ppp-generic-smp-2.6.28.patch | 163 |
17 files changed, 0 insertions, 3918 deletions
diff --git a/kernel/driver/AUTHORS b/kernel/driver/AUTHORS deleted file mode 100644 index b93df1d..0000000 --- a/kernel/driver/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Kozlov D. <xeb@mail.ru> diff --git a/kernel/driver/COPYING b/kernel/driver/COPYING deleted file mode 100644 index 5b6e7c6..0000000 --- a/kernel/driver/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/kernel/driver/ChangeLog b/kernel/driver/ChangeLog deleted file mode 100644 index e69de29..0000000 --- a/kernel/driver/ChangeLog +++ /dev/null diff --git a/kernel/driver/Doxyfile b/kernel/driver/Doxyfile deleted file mode 100644 index 1a7d258..0000000 --- a/kernel/driver/Doxyfile +++ /dev/null @@ -1,275 +0,0 @@ -# Doxyfile 1.4.1-KDevelop - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = pptp.kdevelop -PROJECT_NUMBER = 0.1 -OUTPUT_DIRECTORY = -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = /home/dima/Projects/bg2/sectrr/ -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -SUBGROUPING = YES -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = YES -FILE_VERSION_FILTER = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = /home/dima/Projects/pptp/pptp -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.C \ - *.CC \ - *.C++ \ - *.II \ - *.I++ \ - *.H \ - *.HH \ - *.H++ \ - *.CS \ - *.PHP \ - *.PHP3 \ - *.M \ - *.MM \ - *.C \ - *.H \ - *.tlh \ - *.diff \ - *.patch \ - *.moc \ - *.xpm \ - *.dox -RECURSIVE = yes -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = * -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = YES -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = yes -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = pptp.tag -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 1000 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/kernel/driver/INSTALL b/kernel/driver/INSTALL deleted file mode 100644 index 02a4a07..0000000 --- a/kernel/driver/INSTALL +++ /dev/null @@ -1,167 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes a while. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Type `make install' to install the programs and any data files and - documentation. - - 4. You can remove the program binaries and object files from the - source code directory by typing `make clean'. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. - diff --git a/kernel/driver/Makefile b/kernel/driver/Makefile deleted file mode 100644 index 8871216..0000000 --- a/kernel/driver/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -MDIR = extra - -KDIR ?= $(shell sh find_kernel_headers) - -obj-m += pptp.o -#obj-m += gre.o - -CURRENT = $(shell uname -r) - - -ifndef MAKING_MODULES -all: kernel_headers - make -C $(KDIR) SUBDIRS=$(PWD) modules -endif - -ifneq (,$(findstring 2.4.,$(CURRENT))) -install: - @if test ! -d /lib/modules/$(CURRENT)/extra; then \ - mkdir /lib/modules/$(CURRENT)/extra; \ - fi; \ - cp -v $(TARGET).o /lib/modules/$(CURRENT)/extra/$(TARGET).o && /sbin/depmod -a -else -install: - make -C $(KDIR) M=$(PWD) modules_install -endif - -kernel_headers: - @if test -z "$(KDIR)"; then \ - echo "kernel headers not found"; \ - exit 1; \ - else \ - echo "using \"$(KDIR)\" kernel headers"; \ - fi - -default: all - -clean: - -rm -f *.o *.ko .*.cmd .*.flags *.mod.c - -ifneq (,$(findstring 2.4.,$(CURRENT))) -include $(KDIR)/Rules.make -endif diff --git a/kernel/driver/NEWS b/kernel/driver/NEWS deleted file mode 100644 index e69de29..0000000 --- a/kernel/driver/NEWS +++ /dev/null diff --git a/kernel/driver/README b/kernel/driver/README deleted file mode 100644 index e69de29..0000000 --- a/kernel/driver/README +++ /dev/null diff --git a/kernel/driver/TODO b/kernel/driver/TODO deleted file mode 100644 index e69de29..0000000 --- a/kernel/driver/TODO +++ /dev/null diff --git a/kernel/driver/find_kernel_headers b/kernel/driver/find_kernel_headers deleted file mode 100755 index 3d0e505..0000000 --- a/kernel/driver/find_kernel_headers +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -if test -n "${KDIR}"; then - if test -f ${KDIR}/include/linux/version.h; then - echo ${KDIR} - exit 0 - else - exit 1 - fi -else - if test -f /usr/src/linux/include/linux/version.h; then - echo /usr/src/linux - exit 0 - elif test -f /lib/modules/`uname -r`/build/include/linux/version.h; then - echo /lib/modules/`uname -r`/build - exit 0 - else - exit 1 - fi -fi -
\ No newline at end of file diff --git a/kernel/driver/gre.c b/kernel/driver/gre.c deleted file mode 100644 index cda0576..0000000 --- a/kernel/driver/gre.c +++ /dev/null @@ -1,140 +0,0 @@ -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/kmod.h> -#include <linux/skbuff.h> -#include <linux/in.h> -#include <linux/netdevice.h> -#include <linux/version.h> -#include <linux/spinlock.h> -#include <net/protocol.h> - -#include "gre.h" - - -struct gre_protocol *gre_proto[GREPROTO_MAX] ____cacheline_aligned_in_smp; -static DEFINE_RWLOCK(gre_proto_lock); - -int gre_add_protocol(struct gre_protocol *proto, u8 version) -{ - int ret; - - if (version >= GREPROTO_MAX) - return -1; - - write_lock_bh(&gre_proto_lock); - if (gre_proto[version]) { - ret = -1; - } else { - gre_proto[version]=proto; - ret = 0; - } - write_unlock_bh(&gre_proto_lock); - - return ret; -} -int gre_del_protocol(struct gre_protocol *proto, u8 version) -{ - int ret; - - if (version >= GREPROTO_MAX) - return -1; - - write_lock_bh(&gre_proto_lock); - if (gre_proto[version] == proto) { - gre_proto[version] = NULL; - ret = 0; - } else { - ret = -1; - } - write_unlock_bh(&gre_proto_lock); - - return ret; -} -static int gre_rcv(struct sk_buff *skb) -{ - u8 ver; - int ret; - - if (!pskb_may_pull(skb, 12)) - goto drop_nolock; - - ver = skb->data[1]&0x7f; - if (ver >= GREPROTO_MAX) - goto drop_nolock; - - read_lock(&gre_proto_lock); - if (!gre_proto[ver] || !gre_proto[ver]->handler) - goto drop; - - ret = gre_proto[ver]->handler(skb); - read_unlock(&gre_proto_lock); - - return ret; - -drop: - read_unlock(&gre_proto_lock); -drop_nolock: - kfree_skb(skb); - return NET_RX_DROP; -} -static void gre_err(struct sk_buff *skb, u32 info) -{ - u8 ver; - - printk("err\n"); - - if (!pskb_may_pull(skb, 12)) - goto drop_nolock; - - ver=skb->data[1]; - if (ver>=GREPROTO_MAX) - goto drop_nolock; - - read_lock(&gre_proto_lock); - if (!gre_proto[ver] || !gre_proto[ver]->err_handler) - goto drop; - - gre_proto[ver]->err_handler(skb,info); - read_unlock(&gre_proto_lock); - - return; - -drop: - read_unlock(&gre_proto_lock); -drop_nolock: - kfree_skb(skb); -} - - -static struct net_protocol net_gre_protocol = { - .handler = gre_rcv, - .err_handler = gre_err, -// .netns_ok=1, -}; - -static int __init gre_init(void) -{ - printk(KERN_INFO "GRE over IPv4 demultiplexor driver"); - - if (inet_add_protocol(&net_gre_protocol, IPPROTO_GRE) < 0) { - printk(KERN_INFO "gre: can't add protocol\n"); - return -EAGAIN; - } - - return 0; -} - -static void __exit gre_exit(void) -{ - inet_del_protocol(&net_gre_protocol, IPPROTO_GRE); -} - -module_init(gre_init); -module_exit(gre_exit); - -MODULE_DESCRIPTION("GRE over IPv4 demultiplexor driver"); -MODULE_AUTHOR("Kozlov D. (xeb@mail.ru)"); -MODULE_LICENSE("GPL"); -EXPORT_SYMBOL_GPL(gre_add_protocol); -EXPORT_SYMBOL_GPL(gre_del_protocol); - diff --git a/kernel/driver/gre.h b/kernel/driver/gre.h deleted file mode 100644 index 2ca7f74..0000000 --- a/kernel/driver/gre.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __LINUX_GRE_H -#define __LINUX_GRE_H - -#include <linux/skbuff.h> - -#define GREPROTO_CISCO 0 -#define GREPROTO_PPTP 1 -#define GREPROTO_MAX 2 - -struct gre_protocol { - int (*handler)(struct sk_buff *skb); - void (*err_handler)(struct sk_buff *skb, u32 info); -}; - -int gre_add_protocol(struct gre_protocol *proto, u8 version); -int gre_del_protocol(struct gre_protocol *proto, u8 version); - -#endif diff --git a/kernel/driver/if_pppox.h b/kernel/driver/if_pppox.h deleted file mode 100644 index bc05b53..0000000 --- a/kernel/driver/if_pppox.h +++ /dev/null @@ -1,222 +0,0 @@ -/*************************************************************************** - * Linux PPP over X - Generic PPP transport layer sockets - * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516) - * - * This file supplies definitions required by the PPP over Ethernet driver - * (pppox.c). All version information wrt this file is located in pppox.c - * - * License: - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#ifndef __LINUX_IF_PPPOX_H -#define __LINUX_IF_PPPOX_H - - -#include <asm/types.h> -#include <asm/byteorder.h> -#include <linux/version.h> - -#ifdef __KERNEL__ -#include <linux/in.h> -#include <linux/if_ether.h> -#include <linux/if.h> -#include <linux/netdevice.h> -#include <linux/ppp_channel.h> -#endif /* __KERNEL__ */ - -/* For user-space programs to pick up these definitions - * which they wouldn't get otherwise without defining __KERNEL__ - */ -#ifndef AF_PPPOX -#define AF_PPPOX 24 -#define PF_PPPOX AF_PPPOX -#endif /* !(AF_PPPOX) */ - -/************************************************************************ - * PPPoE addressing definition - */ -typedef __u16 sid_t; -struct pppoe_addr{ - sid_t sid; /* Session identifier */ - unsigned char remote[ETH_ALEN]; /* Remote address */ - char dev[IFNAMSIZ]; /* Local device to use */ -}; - -struct pptp_addr{ - __u16 call_id; - struct in_addr sin_addr; -}; -/************************************************************************ - * Protocols supported by AF_PPPOX - */ -#define PX_PROTO_OE 0 /* Currently just PPPoE */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22) -#define PX_PROTO_PPTP 1 -#define PX_MAX_PROTO 2 -#else -#define PX_PROTO_PPTP 2 -#define PX_MAX_PROTO 3 -#endif - -struct sockaddr_pppox { - sa_family_t sa_family; /* address family, AF_PPPOX */ - unsigned int sa_protocol; /* protocol identifier */ - union{ - struct pppoe_addr pppoe; - struct pptp_addr pptp; - }sa_addr; -}__attribute__ ((packed)); - - -/********************************************************************* - * - * ioctl interface for defining forwarding of connections - * - ********************************************************************/ - -#define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t) -#define PPPOEIOCDFWD _IO(0xB1 ,1) -/*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/ - -/* Codes to identify message types */ -#define PADI_CODE 0x09 -#define PADO_CODE 0x07 -#define PADR_CODE 0x19 -#define PADS_CODE 0x65 -#define PADT_CODE 0xa7 -struct pppoe_tag { - __u16 tag_type; - __u16 tag_len; - char tag_data[0]; -} __attribute ((packed)); - -/* Tag identifiers */ -#define PTT_EOL __constant_htons(0x0000) -#define PTT_SRV_NAME __constant_htons(0x0101) -#define PTT_AC_NAME __constant_htons(0x0102) -#define PTT_HOST_UNIQ __constant_htons(0x0103) -#define PTT_AC_COOKIE __constant_htons(0x0104) -#define PTT_VENDOR __constant_htons(0x0105) -#define PTT_RELAY_SID __constant_htons(0x0110) -#define PTT_SRV_ERR __constant_htons(0x0201) -#define PTT_SYS_ERR __constant_htons(0x0202) -#define PTT_GEN_ERR __constant_htons(0x0203) - -struct pppoe_hdr { -#if defined(__LITTLE_ENDIAN_BITFIELD) - __u8 ver : 4; - __u8 type : 4; -#elif defined(__BIG_ENDIAN_BITFIELD) - __u8 type : 4; - __u8 ver : 4; -#else -#error "Please fix <asm/byteorder.h>" -#endif - __u8 code; - __u16 sid; - __u16 length; - struct pppoe_tag tag[0]; -} __attribute__ ((packed)); - - -/* Socket options */ -#define PPTP_SO_TIMEOUT 1 - - -#ifdef __KERNEL__ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -struct pppoe_opt { - struct net_device *dev; /* device associated with socket*/ - struct pppoe_addr pa; /* what this socket is bound to*/ - struct sockaddr_pppox relay; /* what socket data will be - relayed to (PPPoE relaying) */ -}; -#endif -struct pptp_opt { - struct pptp_addr src_addr; - struct pptp_addr dst_addr; - __u32 ack_sent, ack_recv; - __u32 seq_sent, seq_recv; - int ppp_flags; -}; -#define PPTP_FLAG_PAUSE 0 -#define PPTP_FLAG_PROC 1 - -#include <net/sock.h> - -struct pppox_sock { - /* struct sock must be the first member of pppox_sock */ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - struct ppp_channel chan; - struct sock *sk; - #else - struct sock sk; - struct ppp_channel chan; - #endif - struct pppox_sock *next; /* for hash table */ - union { - struct pppoe_opt pppoe; - struct pptp_opt pptp; - } proto; - unsigned short num; -}; -#define pppoe_dev proto.pppoe.dev -#define pppoe_pa proto.pppoe.pa -#define pppoe_relay proto.pppoe.relay - -static inline struct pppox_sock *pppox_sk(struct sock *sk) -{ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - return (struct pppox_sock *)sk->protinfo.pppox; - #else - return (struct pppox_sock *)sk; - #endif -} - -static inline struct sock *sk_pppox(struct pppox_sock *po) -{ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - return po->sk; - #else - return (struct sock *)po; - #endif -} - -struct module; - -struct pppox_proto { - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - int (*create)(struct socket *sock); - #else - int (*create)(struct net *net, struct socket *sock); - #endif - int (*ioctl)(struct socket *sock, unsigned int cmd, - unsigned long arg); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) - struct module *owner; - #endif -}; - -extern int register_pppox_proto(int proto_num, struct pppox_proto *pp); -extern void unregister_pppox_proto(int proto_num); -extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ -extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); - -/* PPPoX socket states */ -enum { - PPPOX_NONE = 0, /* initial state */ - PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */ - PPPOX_BOUND = 2, /* bound to ppp device */ - PPPOX_RELAY = 4, /* forwarding is enabled */ - PPPOX_ZOMBIE = 8, /* dead, but still bound to ppp device */ - PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/ -}; - -#endif /* __KERNEL__ */ - -#endif /* !(__LINUX_IF_PPPOX_H) */ diff --git a/kernel/driver/pptp.c b/kernel/driver/pptp.c deleted file mode 100644 index 6780b75..0000000 --- a/kernel/driver/pptp.c +++ /dev/null @@ -1,1254 +0,0 @@ -/* - * Point-to-Point Tunneling Protocol for Linux - * - * Authors: Kozlov D. (xeb@mail.ru) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#include <linux/string.h> -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/errno.h> -#include <linux/netdevice.h> -#include <linux/net.h> -#include <linux/skbuff.h> -#include <linux/init.h> -#include <linux/ppp_channel.h> -#include <linux/ppp_defs.h> -#include "if_pppox.h" -#include <linux/if_ppp.h> -#include <linux/notifier.h> -#include <linux/file.h> -#include <linux/in.h> -#include <linux/ip.h> -#include <linux/netfilter.h> -#include <linux/netfilter_ipv4.h> -#include <linux/version.h> -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -#include <linux/semaphore.h> -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -#include <asm/bitops.h> -#endif - -#include <net/sock.h> -#include <net/protocol.h> -#include <net/ip.h> -#include <net/icmp.h> -#include <net/route.h> - -#include <asm/uaccess.h> - -#define DEBUG -//#define USE_GRE_MOD - -#ifdef USE_GRE_MOD -#include "gre.h" -#endif - -#define PPTP_DRIVER_VERSION "0.8.5" - -static int log_level=0; -static int log_packets=10; - -#define MAX_CALLID 65535 -#define PPP_LCP_ECHOREQ 0x09 -#define PPP_LCP_ECHOREP 0x0A - -static unsigned long *callid_bitmap=NULL; -static struct pppox_sock **callid_sock=NULL; - -#define SC_RCV_BITS (SC_RCV_B7_1|SC_RCV_B7_0|SC_RCV_ODDP|SC_RCV_EVNP) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -#define INIT_TIMER(_timer,_routine,_data) \ -do { \ - (_timer)->function=_routine; \ - (_timer)->data=_data; \ - init_timer(_timer); \ -} while (0); - -static inline void *kzalloc(size_t size,int gfp) -{ - void *p=kmalloc(size,gfp); - memset(p,0,size); - return p; -} - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,20) -static inline void nf_reset(struct sk_buff *skb) -{ -#ifdef CONFIG_NETFILTER - nf_conntrack_put(skb->nfct); - skb->nfct=NULL; -#ifdef CONFIG_NETFILTER_DEBUG - skb->nf_debug=0; -#endif -#endif -} -#define __user -#endif - -/** - * __ffs - find first bit in word. - * @word: The word to search - * - * Undefined if no bit exists, so code should check against 0 first. - */ -static inline unsigned long __ffs(unsigned long word) -{ - int num = 0; - -#if BITS_PER_LONG == 64 - if ((word & 0xffffffff) == 0) { - num += 32; - word >>= 32; - } -#endif - if ((word & 0xffff) == 0) { - num += 16; - word >>= 16; - } - if ((word & 0xff) == 0) { - num += 8; - word >>= 8; - } - if ((word & 0xf) == 0) { - num += 4; - word >>= 4; - } - if ((word & 0x3) == 0) { - num += 2; - word >>= 2; - } - if ((word & 0x1) == 0) - num += 1; - return num; -} - -#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) -/* - * Find the next set bit in a memory region. - */ -static unsigned long find_next_bit(const unsigned long *addr, unsigned long size, - unsigned long offset) -{ - const unsigned long *p = addr + BITOP_WORD(offset); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset %= BITS_PER_LONG; - if (offset) { - tmp = *(p++); - tmp &= (~0UL << offset); - if (size < BITS_PER_LONG) - goto found_first; - if (tmp) - goto found_middle; - size -= BITS_PER_LONG; - result += BITS_PER_LONG; - } - while (size & ~(BITS_PER_LONG-1)) { - if ((tmp = *(p++))) - goto found_middle; - result += BITS_PER_LONG; - size -= BITS_PER_LONG; - } - if (!size) - return result; - tmp = *p; - -found_first: - tmp &= (~0UL >> (BITS_PER_LONG - size)); - if (tmp == 0UL) /* Are any bits set? */ - return result + size; /* Nope. */ -found_middle: - return result + __ffs(tmp); -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -static rwlock_t chan_lock=RW_LOCK_UNLOCKED; -#define SK_STATE(sk) (sk)->state -#else -static DECLARE_MUTEX(chan_lock); -#define SK_STATE(sk) (sk)->sk_state -#endif - -static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb); -static int pptp_ppp_ioctl(struct ppp_channel *chan, unsigned int cmd, - unsigned long arg); -static int pptp_rcv_core(struct sock *sk,struct sk_buff *skb); - -static struct ppp_channel_ops pptp_chan_ops= { - .start_xmit = pptp_xmit, - .ioctl=pptp_ppp_ioctl, -}; - - -#define MISSING_WINDOW 20 -#define WRAPPED( curseq, lastseq) \ - ((((curseq) & 0xffffff00) == 0) && \ - (((lastseq) & 0xffffff00 ) == 0xffffff00)) - -/* gre header structure: -------------------------------------------- */ - -#define PPTP_GRE_PROTO 0x880B -#define PPTP_GRE_VER 0x1 - -#define PPTP_GRE_FLAG_C 0x80 -#define PPTP_GRE_FLAG_R 0x40 -#define PPTP_GRE_FLAG_K 0x20 -#define PPTP_GRE_FLAG_S 0x10 -#define PPTP_GRE_FLAG_A 0x80 - -#define PPTP_GRE_IS_C(f) ((f)&PPTP_GRE_FLAG_C) -#define PPTP_GRE_IS_R(f) ((f)&PPTP_GRE_FLAG_R) -#define PPTP_GRE_IS_K(f) ((f)&PPTP_GRE_FLAG_K) -#define PPTP_GRE_IS_S(f) ((f)&PPTP_GRE_FLAG_S) -#define PPTP_GRE_IS_A(f) ((f)&PPTP_GRE_FLAG_A) - -struct pptp_gre_header { - u8 flags; /* bitfield */ - u8 ver; /* should be PPTP_GRE_VER (enhanced GRE) */ - u16 protocol; /* should be PPTP_GRE_PROTO (ppp-encaps) */ - u16 payload_len; /* size of ppp payload, not inc. gre header */ - u16 call_id; /* peer's call_id for this session */ - u32 seq; /* sequence number. Present if S==1 */ - u32 ack; /* seq number of highest packet recieved by */ - /* sender in this session */ -}; -#define PPTP_HEADER_OVERHEAD (2+sizeof(struct pptp_gre_header)) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -static struct pppox_sock * lookup_chan(u16 call_id, u32 s_addr) -#else -static struct pppox_sock * lookup_chan(u16 call_id, __be32 s_addr) -#endif -{ - struct pppox_sock *sock; - struct pptp_opt *opt; - - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - rcu_read_lock(); - #else - read_lock(&chan_lock); - #endif - sock=callid_sock[call_id]; - if (sock) { - opt=&sock->proto.pptp; - if (opt->dst_addr.sin_addr.s_addr!=s_addr) sock=NULL; - else sock_hold(sk_pppox(sock)); - } - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - rcu_read_unlock(); - #else - read_unlock(&chan_lock); - #endif - - return sock; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -static int lookup_chan_dst(u16 call_id, u32 d_addr) -#else -static int lookup_chan_dst(u16 call_id, __be32 d_addr) -#endif -{ - struct pppox_sock *sock; - struct pptp_opt *opt; - int i; - - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - down(&chan_lock); - #else - read_lock(&chan_lock); - #endif - for(i=find_next_bit(callid_bitmap,MAX_CALLID,1); i<MAX_CALLID; i=find_next_bit(callid_bitmap,MAX_CALLID,i+1)){ - sock=callid_sock[i]; - opt=&sock->proto.pptp; - if (opt->dst_addr.call_id==call_id && opt->dst_addr.sin_addr.s_addr==d_addr) break; - } - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - up(&chan_lock); - #else - read_unlock(&chan_lock); - #endif - - return i<MAX_CALLID; -} - -static int add_chan(struct pppox_sock *sock) -{ - static int call_id=0; - int res=-1; - - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - synchronize_rcu(); - down(&chan_lock); - #else - write_lock_bh(&chan_lock); - #endif - - if (!sock->proto.pptp.src_addr.call_id) - { - call_id=find_next_zero_bit(callid_bitmap,MAX_CALLID,call_id+1); - if (call_id==MAX_CALLID) - call_id=find_next_zero_bit(callid_bitmap,MAX_CALLID,1); - sock->proto.pptp.src_addr.call_id=call_id; - } - else if (test_bit(sock->proto.pptp.src_addr.call_id,callid_bitmap)) - goto exit; - - set_bit(sock->proto.pptp.src_addr.call_id,callid_bitmap); - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - rcu_assign_pointer(callid_sock[sock->proto.pptp.src_addr.call_id],sock); - #else - callid_sock[sock->proto.pptp.src_addr.call_id]=sock; - #endif - res=0; - -exit: - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - up(&chan_lock); - #else - write_unlock_bh(&chan_lock); - #endif - - return res; -} - -static void del_chan(struct pppox_sock *sock) -{ - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - synchronize_rcu(); - down(&chan_lock); - #else - write_lock_bh(&chan_lock); - #endif - clear_bit(sock->proto.pptp.src_addr.call_id,callid_bitmap); - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - rcu_assign_pointer(callid_sock[sock->proto.pptp.src_addr.call_id],NULL); - up(&chan_lock); - #else - callid_sock[sock->proto.pptp.src_addr.call_id]=NULL; - write_unlock_bh(&chan_lock); - #endif -} - -static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) -{ - struct sock *sk = (struct sock *) chan->private; - struct pppox_sock *po = pppox_sk(sk); - struct pptp_opt *opt=&po->proto.pptp; - struct pptp_gre_header *hdr; - unsigned int header_len=sizeof(*hdr); - int err=0; - int islcp; - int len; - unsigned char *data; - u32 seq_recv; - - - struct rtable *rt; /* Route to the other host */ - struct net_device *tdev; /* Device to other host */ - struct iphdr *iph; /* Our new IP header */ - int max_headroom; /* The extra header space needed */ - - if (SK_STATE(sk_pppox(po)) & PPPOX_DEAD) - goto tx_error; - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - { - struct rt_key key = { - .dst=opt->dst_addr.sin_addr.s_addr, - .src=opt->src_addr.sin_addr.s_addr, - .tos=RT_TOS(0), - }; - if ((err=ip_route_output_key(&rt, &key))) { - goto tx_error; - } - } - #else - { - struct flowi fl = { .oif = 0, - .nl_u = { .ip4_u = - { .daddr = opt->dst_addr.sin_addr.s_addr, - .saddr = opt->src_addr.sin_addr.s_addr, - .tos = RT_TOS(0) } }, - .proto = IPPROTO_GRE }; - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - if ((err=ip_route_output_key(&rt, &fl))) { - #else - if ((err=ip_route_output_key(&init_net,&rt, &fl))) { - #endif - goto tx_error; - } - } - #endif - tdev = rt->u.dst.dev; - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - max_headroom = ((tdev->hard_header_len+15)&~15) + sizeof(*iph)+sizeof(*hdr)+2; - #else - max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(*iph)+sizeof(*hdr)+2; - #endif - - - if (skb_headroom(skb) < max_headroom || skb_cloned(skb) || skb_shared(skb)) { - struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); - if (!new_skb) { - ip_rt_put(rt); - goto tx_error; - } - if (skb->sk) - skb_set_owner_w(new_skb, skb->sk); - kfree_skb(skb); - skb = new_skb; - } - - data=skb->data; - islcp=((data[0] << 8) + data[1])== PPP_LCP && 1 <= data[2] && data[2] <= 7; - - /* compress protocol field */ - if ((opt->ppp_flags & SC_COMP_PROT) && data[0]==0 && !islcp) - skb_pull(skb,1); - - /* - * Put in the address/control bytes if necessary - */ - if ((opt->ppp_flags & SC_COMP_AC) == 0 || islcp) { - data=skb_push(skb,2); - data[0]=PPP_ALLSTATIONS; - data[1]=PPP_UI; - } - - len=skb->len; - - seq_recv = opt->seq_recv; - - if (opt->ack_sent == seq_recv) header_len-=sizeof(hdr->ack); - - // Push down and install GRE header - skb_push(skb,header_len); - hdr=(struct pptp_gre_header *)(skb->data); - - hdr->flags = PPTP_GRE_FLAG_K; - hdr->ver = PPTP_GRE_VER; - hdr->protocol = htons(PPTP_GRE_PROTO); - hdr->call_id = htons(opt->dst_addr.call_id); - - hdr->flags |= PPTP_GRE_FLAG_S; - hdr->seq = htonl(++opt->seq_sent); - #ifdef DEBUG - if (log_level>=3 && opt->seq_sent<=log_packets) - printk(KERN_INFO"PPTP[%i]: send packet: seq=%i",opt->src_addr.call_id,opt->seq_sent); - #endif - if (opt->ack_sent != seq_recv) { - /* send ack with this message */ - hdr->ver |= PPTP_GRE_FLAG_A; - hdr->ack = htonl(seq_recv); - opt->ack_sent = seq_recv; - #ifdef DEBUG - if (log_level>=3 && opt->seq_sent<=log_packets) - printk(" ack=%i",seq_recv); - #endif - } - hdr->payload_len = htons(len); - #ifdef DEBUG - if (log_level>=3 && opt->seq_sent<=log_packets) - printk("\n"); - #endif - - /* - * Push down and install the IP header. - */ - - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) - skb_reset_transport_header(skb); - skb_push(skb, sizeof(*iph)); - skb_reset_network_header(skb); - #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) - skb->transport_header = skb->network_header; - skb_push(skb, sizeof(*iph)); - skb_reset_network_header(skb); - #else - skb->h.raw = skb->nh.raw; - skb->nh.raw = skb_push(skb, sizeof(*iph)); - #endif - memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) - IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | - IPSKB_REROUTED); - #endif - - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) - iph = ip_hdr(skb); - #else - iph = skb->nh.iph; - #endif - iph->version = 4; - iph->ihl = sizeof(struct iphdr) >> 2; - if (ip_dont_fragment(sk, &rt->u.dst)) - iph->frag_off = htons(IP_DF); - else - iph->frag_off = 0; - iph->protocol = IPPROTO_GRE; - iph->tos = 0; - iph->daddr = rt->rt_dst; - iph->saddr = rt->rt_src; - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - iph->ttl = sk->protinfo.af_inet.ttl; - #else - iph->ttl = dst_metric(&rt->u.dst, RTAX_HOPLIMIT); - #endif - iph->tot_len = htons(skb->len); - - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) - skb_dst_drop(skb); - skb_dst_set(skb,&rt->u.dst); - #else - dst_release(skb->dst); - skb->dst = &rt->u.dst; - #endif - - nf_reset(skb); - - skb->ip_summed = CHECKSUM_NONE; - ip_select_ident(iph, &rt->u.dst, NULL); - ip_send_check(iph); - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, ip_send); - #elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output); - #else - err = ip_local_out(skb); - #endif - -tx_error: - return 1; -} - -static int pptp_rcv_core(struct sock *sk,struct sk_buff *skb) -{ - struct pppox_sock *po = pppox_sk(sk); - struct pptp_opt *opt=&po->proto.pptp; - int headersize,payload_len,seq; - u8 *payload; - struct pptp_gre_header *header; - - if (!(SK_STATE(sk) & PPPOX_CONNECTED)) { - if (sock_queue_rcv_skb(sk, skb)) - goto drop; - return NET_RX_SUCCESS; - } - - header = (struct pptp_gre_header *)(skb->data); - - /* test if acknowledgement present */ - if (PPTP_GRE_IS_A(header->ver)){ - u32 ack = (PPTP_GRE_IS_S(header->flags))? - header->ack:header->seq; /* ack in different place if S = 0 */ - - ack = ntohl( ack); - - if (ack > opt->ack_recv) opt->ack_recv = ack; - /* also handle sequence number wrap-around */ - if (WRAPPED(ack,opt->ack_recv)) opt->ack_recv = ack; - } - - /* test if payload present */ - if (!PPTP_GRE_IS_S(header->flags)){ - goto drop; - } - - headersize = sizeof(*header); - payload_len = ntohs(header->payload_len); - seq = ntohl(header->seq); - - /* no ack present? */ - if (!PPTP_GRE_IS_A(header->ver)) headersize -= sizeof(header->ack); - /* check for incomplete packet (length smaller than expected) */ - if (skb->len - headersize < payload_len){ - #ifdef DEBUG - if (log_level>=1) - printk(KERN_INFO"PPTP: discarding truncated packet (expected %d, got %d bytes)\n", - payload_len, skb->len - headersize); - #endif - goto drop; - } - - payload=skb->data+headersize; - /* check for expected sequence number */ - if ( seq < opt->seq_recv + 1 || WRAPPED(opt->seq_recv, seq) ){ - if ( (payload[0] == PPP_ALLSTATIONS) && (payload[1] == PPP_UI) && - (PPP_PROTOCOL(payload) == PPP_LCP) && - ((payload[4] == PPP_LCP_ECHOREQ) || (payload[4] == PPP_LCP_ECHOREP)) ){ - #ifdef DEBUG - if ( log_level >= 1) - printk(KERN_INFO"PPTP[%i]: allowing old LCP Echo packet %d (expecting %d)\n", opt->src_addr.call_id, - seq, opt->seq_recv + 1); - #endif - goto allow_packet; - } - #ifdef DEBUG - if ( log_level >= 1) - printk(KERN_INFO"PPTP[%i]: discarding duplicate or old packet %d (expecting %d)\n",opt->src_addr.call_id, - seq, opt->seq_recv + 1); - #endif - }else{ - opt->seq_recv = seq; -allow_packet: - #ifdef DEBUG - if ( log_level >= 3 && opt->seq_sent<=log_packets) - printk(KERN_INFO"PPTP[%i]: accepting packet %d size=%i (%02x %02x %02x %02x %02x %02x)\n",opt->src_addr.call_id, seq,payload_len, - *(payload +0), - *(payload +1), - *(payload +2), - *(payload +3), - *(payload +4), - *(payload +5)); - #endif - - skb_pull(skb,headersize); - - if (payload[0] == PPP_ALLSTATIONS && payload[1] == PPP_UI){ - /* chop off address/control */ - if (skb->len < 3) - goto drop; - skb_pull(skb,2); - } - - if ((*skb->data) & 1){ - /* protocol is compressed */ - skb_push(skb, 1)[0] = 0; - } - - skb->ip_summed=CHECKSUM_NONE; - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,21) - skb_set_network_header(skb,skb->head-skb->data); - #endif - ppp_input(&po->chan,skb); - - return NET_RX_SUCCESS; - } -drop: - kfree_skb(skb); - return NET_RX_DROP; -} - -static int pptp_rcv(struct sk_buff *skb) -{ - struct pppox_sock *po; - struct pptp_gre_header *header; - struct iphdr *iph; - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) - int ret; - struct sock *sk; - #endif - - if (skb->pkt_type != PACKET_HOST) - goto drop; - - /*if (!pskb_may_pull(skb, 12)) - goto drop;*/ - - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) - iph = ip_hdr(skb); - #else - iph = skb->nh.iph; - #endif - - header = (struct pptp_gre_header *)skb->data; - - if ( /* version should be 1 */ - ((header->ver & 0x7F) != PPTP_GRE_VER) || - /* PPTP-GRE protocol for PPTP */ - (ntohs(header->protocol) != PPTP_GRE_PROTO)|| - /* flag C should be clear */ - PPTP_GRE_IS_C(header->flags) || - /* flag R should be clear */ - PPTP_GRE_IS_R(header->flags) || - /* flag K should be set */ - (!PPTP_GRE_IS_K(header->flags)) || - /* routing and recursion ctrl = 0 */ - ((header->flags&0xF) != 0)){ - /* if invalid, discard this packet */ - if (log_level>=1) - printk(KERN_INFO"PPTP: Discarding GRE: %X %X %X %X %X %X\n", - header->ver&0x7F, ntohs(header->protocol), - PPTP_GRE_IS_C(header->flags), - PPTP_GRE_IS_R(header->flags), - PPTP_GRE_IS_K(header->flags), - header->flags & 0xF); - goto drop; - } - - - if ((po=lookup_chan(htons(header->call_id),iph->saddr))) { - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) - skb_dst_drop(skb); - skb_dst_set(skb,NULL); - #else - dst_release(skb->dst); - skb->dst = NULL; - #endif - nf_reset(skb); - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) - sk=sk_pppox(po); - bh_lock_sock(sk); - /* Socket state is unknown, must put skb into backlog. */ - if (sk->lock.users != 0) { - sk_add_backlog(sk, skb); - ret = NET_RX_SUCCESS; - } else { - ret = pptp_rcv_core(sk, skb); - } - bh_unlock_sock(sk); - sock_put(sk); - return ret; - - #else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */ - - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,19) - return sk_receive_skb(sk_pppox(po), skb); - #else - return sk_receive_skb(sk_pppox(po), skb, 0); - #endif - - #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */ - }else { - #ifdef DEBUG - if (log_level>=1) - printk(KERN_INFO"PPTP: Discarding packet from unknown call_id %i\n",htons(header->call_id)); - #endif - } - -drop: - kfree_skb(skb); - return NET_RX_DROP; -} - -static int pptp_bind(struct socket *sock,struct sockaddr *uservaddr,int sockaddr_len) -{ - struct sock *sk = sock->sk; - struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr; - struct pppox_sock *po = pppox_sk(sk); - struct pptp_opt *opt=&po->proto.pptp; - int error=0; - - #ifdef DEBUG - if (log_level>=1) - printk(KERN_INFO"PPTP: bind: addr=%X call_id=%i\n",sp->sa_addr.pptp.sin_addr.s_addr, - sp->sa_addr.pptp.call_id); - #endif - lock_sock(sk); - - opt->src_addr=sp->sa_addr.pptp; - if (add_chan(po)) - { - release_sock(sk); - error=-EBUSY; - } - #ifdef DEBUG - if (log_level>=1) - printk(KERN_INFO"PPTP: using call_id %i\n",opt->src_addr.call_id); - #endif - - release_sock(sk); - return error; -} - -static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr, - int sockaddr_len, int flags) -{ - struct sock *sk = sock->sk; - struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr; - struct pppox_sock *po = pppox_sk(sk); - struct pptp_opt *opt = &po->proto.pptp; - struct rtable *rt; /* Route to the other host */ - int error=0; - - if (sp->sa_protocol != PX_PROTO_PPTP) - return -EINVAL; - - #ifdef DEBUG - if (log_level>=1) - printk(KERN_INFO"PPTP[%i]: connect: addr=%X call_id=%i\n",opt->src_addr.call_id, - sp->sa_addr.pptp.sin_addr.s_addr,sp->sa_addr.pptp.call_id); - #endif - - if (lookup_chan_dst(sp->sa_addr.pptp.call_id,sp->sa_addr.pptp.sin_addr.s_addr)) - return -EALREADY; - - lock_sock(sk); - /* Check for already bound sockets */ - if (SK_STATE(sk) & PPPOX_CONNECTED){ - error = -EBUSY; - goto end; - } - - /* Check for already disconnected sockets, on attempts to disconnect */ - if (SK_STATE(sk) & PPPOX_DEAD){ - error = -EALREADY; - goto end; - } - - if (!opt->src_addr.sin_addr.s_addr || !sp->sa_addr.pptp.sin_addr.s_addr){ - error = -EINVAL; - goto end; - } - - po->chan.private=sk; - po->chan.ops=&pptp_chan_ops; - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - { - struct rt_key key = { - .dst=opt->dst_addr.sin_addr.s_addr, - .src=opt->src_addr.sin_addr.s_addr, - .tos=RT_TOS(0), - }; - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - if (ip_route_output_key(&rt, &key)) { - #else - if (ip_route_output_key(&init_net, &rt, &key)) { - #endif - error = -EHOSTUNREACH; - goto end; - } - } - #else - { - struct flowi fl = { - .nl_u = { .ip4_u = - { .daddr = opt->dst_addr.sin_addr.s_addr, - .saddr = opt->src_addr.sin_addr.s_addr, - .tos = RT_CONN_FLAGS(sk) } }, - .proto = IPPROTO_GRE }; - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) - security_sk_classify_flow(sk, &fl); - #endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - if (ip_route_output_key(&rt, &fl)){ - #else - if (ip_route_output_key(&init_net, &rt, &fl)){ - #endif - error = -EHOSTUNREACH; - goto end; - } - sk_setup_caps(sk, &rt->u.dst); - } - #endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - po->chan.mtu=PPP_MTU; - #else - po->chan.mtu=dst_mtu(&rt->u.dst); - if (!po->chan.mtu) po->chan.mtu=PPP_MTU; - #endif - ip_rt_put(rt); - po->chan.mtu-=PPTP_HEADER_OVERHEAD; - - po->chan.hdrlen=2+sizeof(struct pptp_gre_header); - error = ppp_register_channel(&po->chan); - if (error){ - printk(KERN_ERR "PPTP: failed to register PPP channel (%d)\n",error); - goto end; - } - - opt->dst_addr=sp->sa_addr.pptp; - SK_STATE(sk) = PPPOX_CONNECTED; - - end: - release_sock(sk); - return error; -} - -static int pptp_getname(struct socket *sock, struct sockaddr *uaddr, - int *usockaddr_len, int peer) -{ - int len = sizeof(struct sockaddr_pppox); - struct sockaddr_pppox sp; - - sp.sa_family = AF_PPPOX; - sp.sa_protocol = PX_PROTO_PPTP; - sp.sa_addr.pptp=pppox_sk(sock->sk)->proto.pptp.src_addr; - - memcpy(uaddr, &sp, len); - - *usockaddr_len = len; - - return 0; -} - -static int pptp_release(struct socket *sock) -{ - struct sock *sk = sock->sk; - struct pppox_sock *po; - struct pptp_opt *opt; - int error = 0; - - if (!sk) - return 0; - - lock_sock(sk); - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - if (sk->dead) - #else - if (sock_flag(sk, SOCK_DEAD)) - #endif - { - release_sock(sk); - return -EBADF; - } - - po = pppox_sk(sk); - opt=&po->proto.pptp; - del_chan(po); - - pppox_unbind_sock(sk); - SK_STATE(sk) = PPPOX_DEAD; - - #ifdef DEBUG - if (log_level>=1) - printk(KERN_INFO"PPTP[%i]: release\n",opt->src_addr.call_id); - #endif - - sock_orphan(sk); - sock->sk = NULL; - - release_sock(sk); - sock_put(sk); - - return error; -} - - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -static struct proto pptp_sk_proto = { - .name = "PPTP", - .owner = THIS_MODULE, - .obj_size = sizeof(struct pppox_sock), -}; -#endif - -static struct proto_ops pptp_ops = { - .family = AF_PPPOX, -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - .owner = THIS_MODULE, -#endif - .release = pptp_release, - .bind = pptp_bind, - .connect = pptp_connect, - .socketpair = sock_no_socketpair, - .accept = sock_no_accept, - .getname = pptp_getname, - .poll = sock_no_poll, - .listen = sock_no_listen, - .shutdown = sock_no_shutdown, - .setsockopt = sock_no_setsockopt, - .getsockopt = sock_no_getsockopt, - .sendmsg = sock_no_sendmsg, - .recvmsg = sock_no_recvmsg, - .mmap = sock_no_mmap, - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) - .ioctl = pppox_ioctl, - #endif -}; - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -static void pptp_sock_destruct(struct sock *sk) -{ - skb_queue_purge(&sk->receive_queue); - if (!(SK_STATE(sk) & PPPOX_DEAD)) { - del_chan(pppox_sk(sk)); - pppox_unbind_sock(sk); - } - if (sk->protinfo.destruct_hook) - kfree(sk->protinfo.destruct_hook); - - MOD_DEC_USE_COUNT; -} - -static int pptp_create(struct socket *sock) -{ - int error = -ENOMEM; - struct sock *sk; - struct pppox_sock *po; - struct pptp_opt *opt; - - MOD_INC_USE_COUNT; - - sk = sk_alloc(PF_PPPOX, GFP_KERNEL, 1); - if (!sk) - goto out; - - sock_init_data(sock, sk); - - sock->state = SS_UNCONNECTED; - sock->ops = &pptp_ops; - - //sk->sk_backlog_rcv = pppoe_rcv_core; - sk->state = PPPOX_NONE; - sk->type = SOCK_STREAM; - sk->family = PF_PPPOX; - sk->protocol = PX_PROTO_PPTP; - - sk->protinfo.pppox=kzalloc(sizeof(struct pppox_sock),GFP_KERNEL); - sk->destruct=pptp_sock_destruct; - sk->protinfo.destruct_hook=sk->protinfo.pppox; - - po = pppox_sk(sk); - po->sk=sk; - opt=&po->proto.pptp; - - opt->seq_sent=0; opt->seq_recv=0; - opt->ack_recv=0; opt->ack_sent=0; - - error = 0; -out: - return error; -} -#else -static void pptp_sock_destruct(struct sock *sk) -{ - if (!(SK_STATE(sk) & PPPOX_DEAD)){ - del_chan(pppox_sk(sk)); - pppox_unbind_sock(sk); - } - skb_queue_purge(&sk->sk_receive_queue); -} -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -static int pptp_create(struct socket *sock) -#else -static int pptp_create(struct net *net, struct socket *sock) -#endif -{ - int error = -ENOMEM; - struct sock *sk; - struct pppox_sock *po; - struct pptp_opt *opt; - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - sk = sk_alloc(PF_PPPOX, GFP_KERNEL, &pptp_sk_proto, 1); - #else - sk = sk_alloc(net,PF_PPPOX, GFP_KERNEL, &pptp_sk_proto); - #endif - if (!sk) - goto out; - - sock_init_data(sock, sk); - - sock->state = SS_UNCONNECTED; - sock->ops = &pptp_ops; - - sk->sk_backlog_rcv = pptp_rcv_core; - sk->sk_state = PPPOX_NONE; - sk->sk_type = SOCK_STREAM; - sk->sk_family = PF_PPPOX; - sk->sk_protocol = PX_PROTO_PPTP; - sk->sk_destruct = pptp_sock_destruct; - - po = pppox_sk(sk); - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - po->sk=sk; - #endif - opt=&po->proto.pptp; - - opt->seq_sent=0; opt->seq_recv=0; - opt->ack_recv=0; opt->ack_sent=0; - - error = 0; -out: - return error; -} -#endif - - -static int pptp_ppp_ioctl(struct ppp_channel *chan, unsigned int cmd, - unsigned long arg) -{ - struct sock *sk = (struct sock *) chan->private; - struct pppox_sock *po = pppox_sk(sk); - struct pptp_opt *opt=&po->proto.pptp; - void __user *argp = (void __user *)arg; - int __user *p = argp; - int err, val; - - err = -EFAULT; - switch (cmd) { - case PPPIOCGFLAGS: - val = opt->ppp_flags; - if (put_user(val, p)) - break; - err = 0; - break; - case PPPIOCSFLAGS: - if (get_user(val, p)) - break; - opt->ppp_flags = val & ~SC_RCV_BITS; - err = 0; - break; - default: - err = -ENOTTY; - } - - return err; -} - - -static struct pppox_proto pppox_pptp_proto = { - .create = pptp_create, - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) - .owner = THIS_MODULE, - #endif -}; - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -static struct inet_protocol net_pptp_protocol = { - .handler = pptp_rcv, - //.err_handler = pptp_err, - .protocol = IPPROTO_GRE, - .name = "PPTP", -}; -#else -#ifdef USE_GRE_MOD -static struct gre_protocol gre_pptp_protocol = { -#else -static struct net_protocol net_pptp_protocol = { -#endif - .handler = pptp_rcv, - //.err_handler = pptp_err, -}; -#endif - -static int __init pptp_init_module(void) -{ - int err=0; - printk(KERN_INFO "PPTP driver version " PPTP_DRIVER_VERSION "\n"); - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - inet_add_protocol(&net_pptp_protocol); - #else - #ifdef USE_GRE_MOD - if (gre_add_protocol(&gre_pptp_protocol, GREPROTO_PPTP) < 0) { - #else - if (inet_add_protocol(&net_pptp_protocol, IPPROTO_GRE) < 0) { - #endif - printk(KERN_INFO "PPTP: can't add protocol\n"); - goto out; - } - #endif - - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - err = proto_register(&pptp_sk_proto, 0); - if (err){ - printk(KERN_INFO "PPTP: can't register sk_proto\n"); - goto out_inet_del_protocol; - } - #endif - - err = register_pppox_proto(PX_PROTO_PPTP, &pppox_pptp_proto); - if (err){ - printk(KERN_INFO "PPTP: can't register pppox_proto\n"); - goto out_unregister_sk_proto; - } - - - //assuming PAGESIZE is 4096 bytes - callid_bitmap=(unsigned long*)__get_free_pages(GFP_KERNEL,1); - memset(callid_bitmap,0,PAGE_SIZE<<1); - - #if (BITS_PER_LONG == 32) - callid_sock=(struct pppox_sock **)__get_free_pages(GFP_KERNEL,6); - memset(callid_sock,0,PAGE_SIZE<<6); - #elif (BITS_PER_LONG == 64) - callid_sock=(struct pppox_sock **)__get_free_pages(GFP_KERNEL,7); - memset(callid_sock,0,PAGE_SIZE<<7); - #else - #error unknown size of LONG - #endif - -out: - return err; -out_unregister_sk_proto: - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - proto_unregister(&pptp_sk_proto); - #endif - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -out_inet_del_protocol: -#endif - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - inet_del_protocol(&net_pptp_protocol); - #else - #ifdef USE_GRE_MOD - gre_del_protocol(&gre_pptp_protocol, GREPROTO_PPTP); - #else - inet_del_protocol(&net_pptp_protocol, IPPROTO_GRE); - #endif - #endif - goto out; -} - -static void __exit pptp_exit_module(void) -{ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - flush_scheduled_tasks(); - #else - flush_scheduled_work(); - #endif - - unregister_pppox_proto(PX_PROTO_PPTP); - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - inet_del_protocol(&net_pptp_protocol); - #else - proto_unregister(&pptp_sk_proto); - #ifdef USE_GRE_MOD - gre_del_protocol(&gre_pptp_protocol, GREPROTO_PPTP); - #else - inet_del_protocol(&net_pptp_protocol, IPPROTO_GRE); - #endif - #endif - if (callid_bitmap) free_pages((unsigned long)callid_bitmap,1); - if (callid_sock) { - #if (BITS_PER_LONG == 32) - free_pages((unsigned long)callid_sock,6); - #elif (BITS_PER_LONG == 64) - free_pages((unsigned long)callid_sock,7); - #endif - } -} - -module_init(pptp_init_module); -module_exit(pptp_exit_module); - -MODULE_DESCRIPTION("Point-to-Point Tunneling Protocol for Linux"); -MODULE_AUTHOR("Kozlov D. (xeb@mail.ru)"); -MODULE_LICENSE("GPL"); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -MODULE_PARM(log_level,"i"); -MODULE_PARM(log_packets,"i"); -#else -module_param(log_level,int,0); -module_param(log_packets,int,0); -#endif -MODULE_PARM_DESC(log_level,"Logging level (default=0)"); - - diff --git a/kernel/patch/patch-2.6.18 b/kernel/patch/patch-2.6.18 deleted file mode 100644 index d38121d..0000000 --- a/kernel/patch/patch-2.6.18 +++ /dev/null @@ -1,1110 +0,0 @@ -diff -uprN linux-2.6.18.orig/drivers/net/Kconfig linux-2.6.18.pptp/drivers/net/Kconfig ---- linux-2.6.18.orig/drivers/net/Kconfig 2006-10-30 13:20:24.000000000 +0300 -+++ linux-2.6.18.pptp/drivers/net/Kconfig 2006-10-30 13:21:45.000000000 +0300 -@@ -2687,6 +2687,15 @@ config PPPOE - which contains instruction on how to use this driver (under - the heading "Kernel mode PPPoE"). - -+config PPTP -+ tristate "PPTP (Point-to-Point Tunneling Protocol) (EXPERIMENTAL)" -+ depends on EXPERIMENTAL && PPP -+ help -+ Support for Microsoft Point-to-Point Tunneling Protocol. -+ -+ See http://accel-pptp.sourceforge.net/ for information on -+ configuring PPTP clients and servers to utilize this driver. -+ - config PPPOATM - tristate "PPP over ATM" - depends on ATM && PPP -diff -uprN linux-2.6.18.orig/drivers/net/Makefile linux-2.6.18.pptp/drivers/net/Makefile ---- linux-2.6.18.orig/drivers/net/Makefile 2006-10-30 13:20:23.000000000 +0300 -+++ linux-2.6.18.pptp/drivers/net/Makefile 2006-10-30 13:21:45.000000000 +0300 -@@ -121,6 +121,7 @@ obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate - obj-$(CONFIG_PPP_BSDCOMP) += bsd_comp.o - obj-$(CONFIG_PPP_MPPE) += ppp_mppe.o - obj-$(CONFIG_PPPOE) += pppox.o pppoe.o -+obj-$(CONFIG_PPTP) += pppox.o pptp.o - - obj-$(CONFIG_SLIP) += slip.o - ifeq ($(CONFIG_SLIP_COMPRESSED),y) -diff -uprN linux-2.6.18.orig/drivers/net/pptp.c linux-2.6.18.pptp/drivers/net/pptp.c ---- linux-2.6.18.orig/drivers/net/pptp.c 1970-01-01 03:00:00.000000000 +0300 -+++ linux-2.6.18.pptp/drivers/net/pptp.c 2006-10-30 13:31:37.000000000 +0300 -@@ -0,0 +1,941 @@ -+/* -+ * Point-to-Point Tunneling Protocol for Linux -+ * -+ * Authors: Kozlov D. (xeb@mail.ru) -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version -+ * 2 of the License, or (at your option) any later version. -+ * -+ */ -+ -+#include <linux/string.h> -+#include <linux/module.h> -+#include <linux/kernel.h> -+#include <linux/slab.h> -+#include <linux/errno.h> -+#include <linux/netdevice.h> -+#include <linux/net.h> -+#include <linux/skbuff.h> -+#include <linux/init.h> -+#include <linux/ppp_channel.h> -+#include <linux/ppp_defs.h> -+#include <linux/if_ppp.h> -+#include <linux/if_pppox.h> -+#include <linux/notifier.h> -+#include <linux/file.h> -+#include <linux/proc_fs.h> -+#include <linux/in.h> -+#include <linux/ip.h> -+#include <linux/netfilter.h> -+#include <linux/netfilter_ipv4.h> -+#include <linux/workqueue.h> -+#include <linux/version.h> -+ -+#include <net/sock.h> -+#include <net/protocol.h> -+#include <net/ip.h> -+#include <net/icmp.h> -+#include <net/route.h> -+ -+#include <asm/uaccess.h> -+ -+#define PPTP_DRIVER_VERSION "0.7" -+ -+MODULE_DESCRIPTION("Point-to-Point Tunneling Protocol for Linux"); -+MODULE_AUTHOR("Kozlov D. (xeb@mail.ru)"); -+MODULE_LICENSE("GPL"); -+ -+static int log_level=0; -+static int min_window=5; -+static int max_window=100; -+module_param(min_window,int,5); -+MODULE_PARM_DESC(min_window,"Minimum sliding window size (default=3)"); -+module_param(max_window,int,100); -+MODULE_PARM_DESC(max_window,"Maximum sliding window size (default=100)"); -+module_param(log_level,int,0); -+ -+static struct proc_dir_entry* proc_dir; -+ -+#define HASH_SIZE 16 -+#define HASH(addr) ((addr^(addr>>4))&0xF) -+static DEFINE_RWLOCK(chan_lock); -+static struct pppox_sock *chans[HASH_SIZE]; -+ -+static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb); -+static int read_proc(char *page, char **start, off_t off,int count, -+ int *eof, void *data); -+static int __pptp_rcv(struct pppox_sock *po,struct sk_buff *skb,int new); -+ -+static struct ppp_channel_ops pptp_chan_ops= { -+ .start_xmit = pptp_xmit, -+}; -+ -+ -+/* gre header structure: -------------------------------------------- */ -+ -+#define PPTP_GRE_PROTO 0x880B -+#define PPTP_GRE_VER 0x1 -+ -+#define PPTP_GRE_FLAG_C 0x80 -+#define PPTP_GRE_FLAG_R 0x40 -+#define PPTP_GRE_FLAG_K 0x20 -+#define PPTP_GRE_FLAG_S 0x10 -+#define PPTP_GRE_FLAG_A 0x80 -+ -+#define PPTP_GRE_IS_C(f) ((f)&PPTP_GRE_FLAG_C) -+#define PPTP_GRE_IS_R(f) ((f)&PPTP_GRE_FLAG_R) -+#define PPTP_GRE_IS_K(f) ((f)&PPTP_GRE_FLAG_K) -+#define PPTP_GRE_IS_S(f) ((f)&PPTP_GRE_FLAG_S) -+#define PPTP_GRE_IS_A(f) ((f)&PPTP_GRE_FLAG_A) -+ -+struct pptp_gre_header { -+ u_int8_t flags; /* bitfield */ -+ u_int8_t ver; /* should be PPTP_GRE_VER (enhanced GRE) */ -+ u_int16_t protocol; /* should be PPTP_GRE_PROTO (ppp-encaps) */ -+ u_int16_t payload_len; /* size of ppp payload, not inc. gre header */ -+ u_int16_t call_id; /* peer's call_id for this session */ -+ u_int32_t seq; /* sequence number. Present if S==1 */ -+ u_int32_t ack; /* seq number of highest packet recieved by */ -+ /* sender in this session */ -+}; -+ -+struct gre_statistics { -+ /* statistics for GRE receive */ -+ unsigned int rx_accepted; // data packet accepted -+ unsigned int rx_lost; // data packet did not arrive before timeout -+ unsigned int rx_underwin; // data packet was under window (arrived too late -+ // or duplicate packet) -+ unsigned int rx_buffered; // data packet arrived earlier than expected, -+ // packet(s) before it were lost or reordered -+ unsigned int rx_errors; // OS error on receive -+ unsigned int rx_truncated; // truncated packet -+ unsigned int rx_invalid; // wrong protocol or invalid flags -+ unsigned int rx_acks; // acknowledgement only -+ -+ /* statistics for GRE transmit */ -+ unsigned int tx_sent; // data packet sent -+ unsigned int tx_failed; // -+ unsigned int tx_acks; // sent packet with just ACK -+ -+ __u32 pt_seq; -+ struct timeval pt_time; -+ unsigned int rtt; -+}; -+ -+static struct pppox_sock * lookup_chan(__u16 call_id) -+{ -+ struct pppox_sock *po; -+ read_lock_bh(&chan_lock); -+ for(po=chans[HASH(call_id)]; po; po=po->next) -+ if (po->proto.pptp.src_addr.call_id==call_id) -+ break; -+ read_unlock_bh(&chan_lock); -+ return po; -+} -+ -+static void add_chan(struct pppox_sock *po) -+{ -+ write_lock_bh(&chan_lock); -+ po->next=chans[HASH(po->proto.pptp.src_addr.call_id)]; -+ chans[HASH(po->proto.pptp.src_addr.call_id)]=po; -+ write_unlock_bh(&chan_lock); -+} -+ -+static void add_free_chan(struct pppox_sock *po) -+{ -+ __u16 call_id=1; -+ struct pppox_sock *p; -+ -+ write_lock_bh(&chan_lock); -+ for(call_id=1; call_id<65535; call_id++) { -+ for(p=chans[HASH(call_id)]; p; p=p->next) -+ if (p->proto.pptp.src_addr.call_id==call_id) -+ break; -+ if (!p){ -+ po->proto.pptp.src_addr.call_id=call_id; -+ po->next=chans[HASH(call_id)]; -+ chans[HASH(call_id)]=po; -+ break; -+ } -+ } -+ write_unlock_bh(&chan_lock); -+} -+ -+static void del_chan(struct pppox_sock *po) -+{ -+ struct pppox_sock *p1,*p2; -+ write_lock_bh(&chan_lock); -+ for(p2=NULL,p1=chans[HASH(po->proto.pptp.src_addr.call_id)]; p1 && p1!=po; -+ p2=p1,p1=p1->next); -+ if (p2) p2->next=p1->next; -+ else chans[HASH(po->proto.pptp.src_addr.call_id)]=p1->next; -+ write_unlock_bh(&chan_lock); -+} -+ -+static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) -+{ -+ struct sock *sk = (struct sock *) chan->private; -+ struct pppox_sock *po = pppox_sk(sk); -+ struct pptp_opt *opt=&po->proto.pptp; -+ struct pptp_gre_header *hdr; -+ unsigned int header_len=sizeof(*hdr); -+ int len=skb?skb->len:0; -+ int err=0; -+ -+ struct rtable *rt; /* Route to the other host */ -+ struct net_device *tdev; /* Device to other host */ -+ struct iphdr *iph; /* Our new IP header */ -+ int max_headroom; /* The extra header space needed */ -+ -+ -+ if (skb && opt->seq_sent-opt->ack_recv>opt->window){ -+ opt->pause=1; -+ return 0; -+ } -+ -+ { -+ struct flowi fl = { .oif = 0, -+ .nl_u = { .ip4_u = -+ { .daddr = opt->dst_addr.sin_addr.s_addr, -+ .saddr = opt->src_addr.sin_addr.s_addr, -+ .tos = RT_TOS(0) } }, -+ .proto = IPPROTO_GRE }; -+ if ((err=ip_route_output_key(&rt, &fl))) { -+ goto tx_error; -+ } -+ } -+ tdev = rt->u.dst.dev; -+ -+ max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(*iph)+sizeof(*hdr)+2; -+ -+ if (!skb){ -+ skb=dev_alloc_skb(max_headroom); -+ skb_reserve(skb,max_headroom-skb_headroom(skb)); -+ }else if (skb_headroom(skb) < max_headroom || -+ skb_cloned(skb) || skb_shared(skb)) { -+ struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); -+ if (!new_skb) { -+ ip_rt_put(rt); -+ goto tx_error; -+ } -+ if (skb->sk) -+ skb_set_owner_w(new_skb, skb->sk); -+ dev_kfree_skb(skb); -+ skb = new_skb; -+ } -+ -+ if (skb->len){ -+ int islcp; -+ unsigned char *data=skb->data; -+ islcp=((data[0] << 8) + data[1])== PPP_LCP && 1 <= data[2] && data[2] <= 7; -+ if (islcp) { -+ data=skb_push(skb,2); -+ data[0]=0xff; -+ data[1]=0x03; -+ } -+ } -+ len=skb->len; -+ -+ if (len==0) header_len-=sizeof(hdr->seq); -+ if (opt->ack_sent == opt->seq_recv) header_len-=sizeof(hdr->ack); -+ -+ skb->nh.raw = skb_push(skb, sizeof(*iph)+header_len); -+ memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); -+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | -+ IPSKB_REROUTED); -+ #endif -+ dst_release(skb->dst); -+ skb->dst = &rt->u.dst; -+ -+ /* -+ * Push down and install the IP header. -+ */ -+ -+ iph = skb->nh.iph; -+ iph->version = 4; -+ iph->ihl = sizeof(struct iphdr) >> 2; -+ iph->frag_off = 0;//df; -+ iph->protocol = IPPROTO_GRE; -+ iph->tos = 0; -+ iph->daddr = rt->rt_dst; -+ iph->saddr = rt->rt_src; -+ iph->ttl = dst_metric(&rt->u.dst, RTAX_HOPLIMIT); -+ -+ hdr=(struct pptp_gre_header *)(iph+1); -+ skb->h.raw = (char*)hdr; -+ -+ hdr->flags = PPTP_GRE_FLAG_K; -+ hdr->ver = PPTP_GRE_VER; -+ hdr->protocol = htons(PPTP_GRE_PROTO); -+ hdr->call_id = htons(opt->dst_addr.call_id); -+ -+ if (!len){ -+ hdr->payload_len = 0; -+ hdr->ver |= PPTP_GRE_FLAG_A; -+ /* ack is in odd place because S == 0 */ -+ hdr->seq = htonl(opt->seq_recv); -+ opt->ack_sent = opt->seq_recv; -+ opt->stat->tx_acks++; -+ }else { -+ //if (!opt->seq_sent){ -+ //} -+ -+ hdr->flags |= PPTP_GRE_FLAG_S; -+ hdr->seq = htonl(opt->seq_sent++); -+ if (log_level>=2) -+ printk("PPTP: send packet: seq=%i",opt->seq_sent); -+ if (opt->ack_sent != opt->seq_recv) { -+ /* send ack with this message */ -+ hdr->ver |= PPTP_GRE_FLAG_A; -+ hdr->ack = htonl(opt->seq_recv); -+ opt->ack_sent = opt->seq_recv; -+ if (log_level>=2) -+ printk(" ack=%i",opt->seq_recv); -+ } -+ hdr->payload_len = htons(len); -+ if (log_level>=2) -+ printk("\n"); -+ } -+ -+ nf_reset(skb); -+ -+ skb->ip_summed = CHECKSUM_NONE; -+ iph->tot_len = htons(skb->len); -+ ip_select_ident(iph, &rt->u.dst, NULL); -+ ip_send_check(iph); -+ -+ err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output); -+ if (err == NET_XMIT_SUCCESS || err == NET_XMIT_CN) { -+ opt->stat->tx_sent++; -+ if (!opt->stat->pt_seq){ -+ opt->stat->pt_seq = opt->seq_sent; -+ do_gettimeofday(&opt->stat->pt_time); -+ } -+ }else goto tx_error; -+ -+ return 1; -+ -+tx_error: -+ opt->stat->tx_failed++; -+ if (!len) dev_kfree_skb(skb); -+ return 1; -+} -+ -+static void ack_work(struct pppox_sock *po) -+{ -+ struct pptp_opt *opt=&po->proto.pptp; -+ if (opt->ack_sent != opt->seq_recv) -+ pptp_xmit(&po->chan,0); -+ -+ if (!opt->proc){ -+ char unit[10]; -+ opt->proc=1; -+ sprintf(unit,"ppp%i",ppp_unit_number(&po->chan)); -+ create_proc_read_entry(unit,0,proc_dir,read_proc,po); -+ } -+} -+ -+static int get_seq(struct sk_buff *skb) -+{ -+ struct iphdr *iph; -+ u8 *payload; -+ struct pptp_gre_header *header; -+ -+ iph = (struct iphdr*)skb->data; -+ payload = skb->data + (iph->ihl << 2); -+ header = (struct pptp_gre_header *)(payload); -+ -+ return ntohl(header->seq); -+} -+static void buf_work(struct pppox_sock *po) -+{ -+ struct timeval tv1,tv2; -+ struct sk_buff *skb; -+ struct pptp_opt *opt=&po->proto.pptp; -+ unsigned int t; -+ -+ do_gettimeofday(&tv1); -+ spin_lock_bh(&opt->skb_buf_lock); -+ while((skb=skb_dequeue(&opt->skb_buf))){ -+ if (!__pptp_rcv(po,skb,0)){ -+ skb_get_timestamp(skb,&tv2); -+ t=(tv1.tv_sec-tv2.tv_sec)*1000000+(tv1.tv_usec-tv2.tv_usec); -+ if (t<opt->stat->rtt){ -+ skb_queue_head(&opt->skb_buf,skb); -+ schedule_delayed_work(&opt->buf_work,t/100*HZ/10000); -+ goto exit; -+ } -+ t=get_seq(skb)-1; -+ opt->stat->rx_lost+=t-opt->seq_recv; -+ opt->seq_recv=t; -+ __pptp_rcv(po,skb,0); -+ } -+ } -+exit: -+ spin_unlock_bh(&opt->skb_buf_lock); -+} -+ -+ -+#define MISSING_WINDOW 20 -+#define WRAPPED( curseq, lastseq) \ -+ ((((curseq) & 0xffffff00) == 0) && \ -+ (((lastseq) & 0xffffff00 ) == 0xffffff00)) -+static int __pptp_rcv(struct pppox_sock *po,struct sk_buff *skb,int new) -+{ -+ struct pptp_opt *opt=&po->proto.pptp; -+ int headersize,payload_len,seq; -+ __u8 *payload; -+ struct pptp_gre_header *header; -+ -+ header = (struct pptp_gre_header *)(skb->data); -+ -+ if (new){ -+ /* test if acknowledgement present */ -+ if (PPTP_GRE_IS_A(header->ver)){ -+ __u32 ack = (PPTP_GRE_IS_S(header->flags))? -+ header->ack:header->seq; /* ack in different place if S = 0 */ -+ ack = ntohl( ack); -+ if (ack > opt->ack_recv) opt->ack_recv = ack; -+ /* also handle sequence number wrap-around */ -+ if (WRAPPED(ack,opt->ack_recv)) opt->ack_recv = ack; -+ if (opt->stat->pt_seq && opt->ack_recv > opt->stat->pt_seq){ -+ struct timeval tv; -+ unsigned int rtt; -+ do_gettimeofday(&tv); -+ rtt = (tv.tv_sec - opt->stat->pt_time.tv_sec)*1000000+ -+ tv.tv_usec-opt->stat->pt_time.tv_usec; -+ opt->stat->rtt = (opt->stat->rtt + rtt) / 2; -+ if (opt->stat->rtt>opt->timeout) opt->stat->rtt=opt->timeout; -+ opt->stat->pt_seq=0; -+ } -+ if (opt->pause){ -+ opt->pause=0; -+ ppp_output_wakeup(&po->chan); -+ } -+ } -+ -+ /* test if payload present */ -+ if (!PPTP_GRE_IS_S(header->flags)){ -+ opt->stat->rx_acks++; -+ goto drop; -+ } -+ } -+ -+ headersize = sizeof(*header); -+ payload_len = ntohs(header->payload_len); -+ seq = ntohl(header->seq); -+ -+ /* no ack present? */ -+ if (!PPTP_GRE_IS_A(header->ver)) headersize -= sizeof(header->ack); -+ /* check for incomplete packet (length smaller than expected) */ -+ if (skb->len- headersize < payload_len){ -+ if (log_level>=1) -+ printk("PPTP: discarding truncated packet (expected %d, got %d bytes)\n", -+ payload_len, skb->len- headersize); -+ opt->stat->rx_truncated++; -+ goto drop; -+ } -+ -+ payload=skb->data+headersize; -+ /* check for expected sequence number */ -+ if ((seq == opt->seq_recv + 1) || (!opt->timeout && -+ (seq > opt->seq_recv + 1 || WRAPPED(seq, opt->seq_recv)))){ -+ if ( log_level >= 2 ) -+ printk("PPTP: accepting packet %d size=%i (%02x %02x %02x %02x %02x %02x)\n", seq,payload_len, -+ *(payload +0), -+ *(payload +1), -+ *(payload +2), -+ *(payload +3), -+ *(payload +4), -+ *(payload +5)); -+ opt->stat->rx_accepted++; -+ opt->stat->rx_lost+=seq-(opt->seq_recv + 1); -+ opt->seq_recv = seq; -+ schedule_work(&opt->ack_work); -+ -+ skb_pull(skb,headersize); -+ -+ if (payload[0] == PPP_ALLSTATIONS && payload[1] == PPP_UI){ -+ /* chop off address/control */ -+ if (skb->len < 3) -+ goto drop; -+ skb_pull(skb,2); -+ } -+ -+ if ((*skb->data) & 1){ -+ /* protocol is compressed */ -+ skb_push(skb, 1)[0] = 0; -+ } -+ -+ ppp_input(&po->chan,skb); -+ -+ return 1; -+ /* out of order, check if the number is too low and discard the packet. -+ * (handle sequence number wrap-around, and try to do it right) */ -+ }else if ( seq < opt->seq_recv + 1 || WRAPPED(opt->seq_recv, seq) ){ -+ if ( log_level >= 1) -+ printk("PPTP: discarding duplicate or old packet %d (expecting %d)\n", -+ seq, opt->seq_recv + 1); -+ opt->stat->rx_underwin++; -+ /* sequence number too high, is it reasonably close? */ -+ }else if ( seq < opt->seq_recv + MISSING_WINDOW || -+ WRAPPED(seq, opt->seq_recv + MISSING_WINDOW) ){ -+ opt->stat->rx_buffered++; -+ if ( log_level >= 1 && new ) -+ printk("PPTP: buffering packet %d (expecting %d, lost or reordered)\n", -+ seq, opt->seq_recv+1); -+ return 0; -+ /* no, packet must be discarded */ -+ }else{ -+ if ( log_level >= 1 ) -+ printk("PPTP: discarding bogus packet %d (expecting %d)\n", -+ seq, opt->seq_recv + 1); -+ } -+drop: -+ kfree_skb(skb); -+ return -1; -+} -+ -+ -+static int pptp_rcv(struct sk_buff *skb) -+{ -+ struct pptp_gre_header *header; -+ struct pppox_sock *po; -+ struct pptp_opt *opt; -+ -+ if (!pskb_may_pull(skb, 12)) -+ goto drop; -+ -+ header = (struct pptp_gre_header *)skb->data; -+ -+ if ( /* version should be 1 */ -+ ((header->ver & 0x7F) != PPTP_GRE_VER) || -+ /* PPTP-GRE protocol for PPTP */ -+ (ntohs(header->protocol) != PPTP_GRE_PROTO)|| -+ /* flag C should be clear */ -+ PPTP_GRE_IS_C(header->flags) || -+ /* flag R should be clear */ -+ PPTP_GRE_IS_R(header->flags) || -+ /* flag K should be set */ -+ (!PPTP_GRE_IS_K(header->flags)) || -+ /* routing and recursion ctrl = 0 */ -+ ((header->flags&0xF) != 0)){ -+ /* if invalid, discard this packet */ -+ if (log_level>=1) -+ printk("PPTP: Discarding GRE: %X %X %X %X %X %X\n", -+ header->ver&0x7F, ntohs(header->protocol), -+ PPTP_GRE_IS_C(header->flags), -+ PPTP_GRE_IS_R(header->flags), -+ PPTP_GRE_IS_K(header->flags), -+ header->flags & 0xF); -+ goto drop; -+ } -+ -+ dst_release(skb->dst); -+ skb->dst = NULL; -+ nf_reset(skb); -+ -+ if ((po=lookup_chan(htons(header->call_id)))) { -+ if (!(sk_pppox(po)->sk_state&PPPOX_BOUND)) -+ goto drop; -+ if (__pptp_rcv(po,skb,1)) -+ buf_work(po); -+ else{ -+ struct timeval tv; -+ do_gettimeofday(&tv); -+ skb_set_timestamp(skb,&tv); -+ opt=&po->proto.pptp; -+ spin_lock(&opt->skb_buf_lock); -+ skb_queue_tail(&opt->skb_buf, skb); -+ spin_unlock(&opt->skb_buf_lock); -+ schedule_delayed_work(&opt->buf_work,opt->stat->rtt/100*HZ/10000); -+ } -+ goto out; -+ }else{ -+ if (log_level>=1) -+ printk("PPTP: Discarding packet from unknown call_id %i\n",header->call_id); -+ icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, 0); -+ } -+ -+drop: -+ kfree_skb(skb); -+out: -+ return 0; -+} -+ -+ -+ -+static int proc_output (struct pppox_sock *po,char *buf) -+{ -+ struct gre_statistics *stat=po->proto.pptp.stat; -+ char *p=buf; -+ p+=sprintf(p,"rx accepted = %d\n",stat->rx_accepted); -+ p+=sprintf(p,"rx lost = %d\n",stat->rx_lost); -+ p+=sprintf(p,"rx under win = %d\n",stat->rx_underwin); -+ p+=sprintf(p,"rx buffered = %d\n",stat->rx_buffered); -+ p+=sprintf(p,"rx invalid = %d\n",stat->rx_invalid); -+ p+=sprintf(p,"rx acks = %d\n",stat->rx_acks); -+ p+=sprintf(p,"tx sent = %d\n",stat->tx_sent); -+ p+=sprintf(p,"tx failed = %d\n",stat->tx_failed); -+ p+=sprintf(p,"tx acks = %d\n",stat->tx_acks); -+ -+ return p-buf; -+} -+static int read_proc(char *page, char **start, off_t off,int count, int *eof, void *data) -+{ -+ struct pppox_sock *po = data; -+ int len = proc_output (po,page); -+ if (len <= off+count) *eof = 1; -+ *start = page + off; -+ len -= off; -+ if (len>count) len = count; -+ if (len<0) len = 0; -+ return len; -+} -+ -+static int pptp_bind(struct socket *sock,struct sockaddr *uservaddr,int sockaddr_len) -+{ -+ struct sock *sk = sock->sk; -+ struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr; -+ struct pppox_sock *po = pppox_sk(sk); -+ struct pptp_opt *opt=&po->proto.pptp; -+ int error=0; -+ -+ if (log_level>=1) -+ printk("PPTP: bind: addr=%X call_id=%i\n",sp->sa_addr.pptp.sin_addr.s_addr, -+ sp->sa_addr.pptp.call_id); -+ lock_sock(sk); -+ -+ opt->src_addr=sp->sa_addr.pptp; -+ if (sp->sa_addr.pptp.call_id){ -+ if (lookup_chan(sp->sa_addr.pptp.call_id)){ -+ error=-EBUSY; -+ goto end; -+ } -+ add_chan(po); -+ }else{ -+ add_free_chan(po); -+ if (!opt->src_addr.call_id) -+ error=-EBUSY; -+ if (log_level>=1) -+ printk("PPTP: using call_id %i\n",opt->src_addr.call_id); -+ } -+ -+ end: -+ release_sock(sk); -+ return error; -+} -+ -+static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr, -+ int sockaddr_len, int flags) -+{ -+ struct sock *sk = sock->sk; -+ struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr; -+ struct pppox_sock *po = pppox_sk(sk); -+ struct pptp_opt *opt=&po->proto.pptp; -+ int error=0; -+ -+ if (log_level>=1) -+ printk("PPTP: connect: addr=%X call_id=%i\n", -+ sp->sa_addr.pptp.sin_addr.s_addr,sp->sa_addr.pptp.call_id); -+ -+ lock_sock(sk); -+ -+ if (sp->sa_protocol != PX_PROTO_PPTP){ -+ error = -EINVAL; -+ goto end; -+ } -+ -+ /* Check for already bound sockets */ -+ if (sk->sk_state & PPPOX_CONNECTED){ -+ error = -EBUSY; -+ goto end; -+ } -+ -+ /* Check for already disconnected sockets, on attempts to disconnect */ -+ if (sk->sk_state & PPPOX_DEAD){ -+ error = -EALREADY; -+ goto end; -+ } -+ -+ if (!opt->src_addr.sin_addr.s_addr || !sp->sa_addr.pptp.sin_addr.s_addr){ -+ error = -EINVAL; -+ goto end; -+ } -+ -+ po->chan.private=sk; -+ po->chan.ops=&pptp_chan_ops; -+ po->chan.mtu=PPP_MTU; -+ po->chan.hdrlen=2+sizeof(struct pptp_gre_header); -+ error = ppp_register_channel(&po->chan); -+ if (error){ -+ printk(KERN_ERR "PPTP: failed to register PPP channel (%d)\n",error); -+ goto end; -+ } -+ -+ opt->dst_addr=sp->sa_addr.pptp; -+ sk->sk_state = PPPOX_CONNECTED; -+ -+ end: -+ release_sock(sk); -+ return error; -+} -+ -+static int pptp_getname(struct socket *sock, struct sockaddr *uaddr, -+ int *usockaddr_len, int peer) -+{ -+ int len = sizeof(struct sockaddr_pppox); -+ struct sockaddr_pppox sp; -+ -+ sp.sa_family = AF_PPPOX; -+ sp.sa_protocol = PX_PROTO_PPTP; -+ sp.sa_addr.pptp=pppox_sk(sock->sk)->proto.pptp.src_addr; -+ -+ memcpy(uaddr, &sp, len); -+ -+ *usockaddr_len = len; -+ -+ return 0; -+} -+ -+static int pptp_setsockopt(struct socket *sock, int level, int optname, -+ char* optval, int optlen) -+{ -+ struct sock *sk = sock->sk; -+ struct pppox_sock *po = pppox_sk(sk); -+ struct pptp_opt *opt=&po->proto.pptp; -+ int val; -+ -+ if (optlen!=sizeof(int)) -+ return -EINVAL; -+ -+ if (get_user(val,(int __user*)optval)) -+ return -EFAULT; -+ -+ switch(optname) { -+ case PPTP_SO_TIMEOUT: -+ opt->timeout=val; -+ break; -+ case PPTP_SO_WINDOW: -+ opt->window=val; -+ break; -+ default: -+ return -ENOPROTOOPT; -+ } -+ -+ return 0; -+} -+ -+static int pptp_getsockopt(struct socket *sock, int level, int optname, -+ char* optval, int *optlen) -+{ -+ struct sock *sk = sock->sk; -+ struct pppox_sock *po = pppox_sk(sk); -+ struct pptp_opt *opt=&po->proto.pptp; -+ int len,val; -+ -+ if (get_user(len,(int __user*)optlen)) -+ return -EFAULT; -+ -+ if (len<sizeof(int)) -+ return -EINVAL; -+ -+ switch(optname) { -+ case PPTP_SO_TIMEOUT: -+ val=opt->timeout; -+ break; -+ case PPTP_SO_WINDOW: -+ val=opt->window; -+ break; -+ default: -+ return -ENOPROTOOPT; -+ } -+ -+ if (put_user(sizeof(int),(int __user*)optlen)) -+ return -EFAULT; -+ -+ if (put_user(val,(int __user*)optval)) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+static int pptp_release(struct socket *sock) -+{ -+ struct sock *sk = sock->sk; -+ struct pppox_sock *po; -+ struct pptp_opt *opt; -+ int error = 0; -+ -+ if (!sk) -+ return 0; -+ -+ if (sock_flag(sk, SOCK_DEAD)) -+ return -EBADF; -+ -+ po = pppox_sk(sk); -+ opt=&po->proto.pptp; -+ if (opt->src_addr.sin_addr.s_addr) { -+ cancel_delayed_work(&opt->buf_work); -+ flush_scheduled_work(); -+ del_chan(po); -+ skb_queue_purge(&opt->skb_buf); -+ -+ if (opt->proc){ -+ char unit[10]; -+ sprintf(unit,"ppp%i",ppp_unit_number(&po->chan)); -+ remove_proc_entry(unit,proc_dir); -+ } -+ } -+ -+ pppox_unbind_sock(sk); -+ -+ kfree(opt->stat); -+ -+ /* Signal the death of the socket. */ -+ sk->sk_state = PPPOX_DEAD; -+ -+ sock_orphan(sk); -+ sock->sk = NULL; -+ -+ skb_queue_purge(&sk->sk_receive_queue); -+ sock_put(sk); -+ -+ return error; -+} -+ -+ -+static struct proto pptp_sk_proto = { -+ .name = "PPTP", -+ .owner = THIS_MODULE, -+ .obj_size = sizeof(struct pppox_sock), -+}; -+ -+static const struct proto_ops pptp_ops = { -+ .family = AF_PPPOX, -+ .owner = THIS_MODULE, -+ .release = pptp_release, -+ .bind = pptp_bind, -+ .connect = pptp_connect, -+ .socketpair = sock_no_socketpair, -+ .accept = sock_no_accept, -+ .getname = pptp_getname, -+ .poll = sock_no_poll, -+ .listen = sock_no_listen, -+ .shutdown = sock_no_shutdown, -+ .setsockopt = pptp_setsockopt, -+ .getsockopt = pptp_getsockopt, -+ .sendmsg = sock_no_sendmsg, -+ .recvmsg = sock_no_recvmsg, -+ .mmap = sock_no_mmap, -+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ .ioctl = pppox_ioctl, -+ #endif -+}; -+ -+static int pptp_create(struct socket *sock) -+{ -+ int error = -ENOMEM; -+ struct sock *sk; -+ struct pppox_sock *po; -+ struct pptp_opt *opt; -+ -+ sk = sk_alloc(PF_PPPOX, GFP_KERNEL, &pptp_sk_proto, 1); -+ if (!sk) -+ goto out; -+ -+ sock_init_data(sock, sk); -+ -+ sock->state = SS_UNCONNECTED; -+ sock->ops = &pptp_ops; -+ -+ //sk->sk_backlog_rcv = pppoe_rcv_core; -+ sk->sk_state = PPPOX_NONE; -+ sk->sk_type = SOCK_STREAM; -+ sk->sk_family = PF_PPPOX; -+ sk->sk_protocol = PX_PROTO_PPTP; -+ -+ po = pppox_sk(sk); -+ opt=&po->proto.pptp; -+ -+ opt->window=min_window; -+ opt->timeout=0; -+ opt->seq_sent=0; opt->seq_recv=-1; -+ opt->ack_recv=0; opt->ack_sent=-1; -+ skb_queue_head_init(&opt->skb_buf); -+ opt->skb_buf_lock=SPIN_LOCK_UNLOCKED; -+ INIT_WORK(&opt->ack_work,(void(*)(void*))ack_work,sk); -+ INIT_WORK(&opt->buf_work,(void(*)(void*))buf_work,sk); -+ opt->stat=kzalloc(sizeof(*opt->stat),GFP_KERNEL); -+ -+ error = 0; -+out: -+ return error; -+} -+ -+ -+static struct pppox_proto pppox_pptp_proto = { -+ .create = pptp_create, -+ //.ioctl = pptp_ioctl, -+ .owner = THIS_MODULE, -+}; -+ -+static struct net_protocol net_pptp_protocol = { -+ .handler = pptp_rcv, -+ //.err_handler = ipgre_err, -+}; -+ -+ -+static int pptp_init_module(void) -+{ -+ int err=0; -+ printk(KERN_INFO "PPTP driver version " PPTP_DRIVER_VERSION "\n"); -+ -+ if (inet_add_protocol(&net_pptp_protocol, IPPROTO_GRE) < 0) { -+ printk(KERN_INFO "PPTP: can't add protocol\n"); -+ goto out; -+ } -+ -+ err = proto_register(&pptp_sk_proto, 0); -+ if (err){ -+ printk(KERN_INFO "PPTP: can't register sk_proto\n"); -+ goto out_inet_del_protocol; -+ } -+ -+ err = register_pppox_proto(PX_PROTO_PPTP, &pppox_pptp_proto); -+ if (err){ -+ printk(KERN_INFO "PPTP: can't register pppox_proto\n"); -+ goto out_unregister_sk_proto; -+ } -+ -+ proc_dir=proc_mkdir("pptp",NULL); -+ if (!proc_dir){ -+ printk(KERN_ERR "PPTP: failed to create proc dir\n"); -+ } -+ //console_verbose(); -+ -+out: -+ return err; -+out_unregister_sk_proto: -+ proto_unregister(&pptp_sk_proto); -+out_inet_del_protocol: -+ inet_del_protocol(&net_pptp_protocol, IPPROTO_GRE); -+ goto out; -+} -+ -+static void pptp_exit_module(void) -+{ -+ unregister_pppox_proto(PX_PROTO_PPTP); -+ proto_unregister(&pptp_sk_proto); -+ inet_del_protocol(&net_pptp_protocol, IPPROTO_GRE); -+ -+ if (proc_dir) -+ remove_proc_entry("pptp",NULL); -+} -+ -+ -+module_init(pptp_init_module); -+module_exit(pptp_exit_module); -diff -uprN linux-2.6.18.orig/include/linux/if_pppox.h linux-2.6.18.pptp/include/linux/if_pppox.h ---- linux-2.6.18.orig/include/linux/if_pppox.h 2006-10-30 13:20:48.000000000 +0300 -+++ linux-2.6.18.pptp/include/linux/if_pppox.h 2006-10-30 11:35:35.000000000 +0300 -@@ -1,6 +1,6 @@ - /*************************************************************************** - * Linux PPP over X - Generic PPP transport layer sockets -- * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516) -+ * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516) - * - * This file supplies definitions required by the PPP over Ethernet driver - * (pppox.c). All version information wrt this file is located in pppox.c -@@ -19,6 +19,7 @@ - - #include <asm/types.h> - #include <asm/byteorder.h> -+#include <linux/in.h> - - #ifdef __KERNEL__ - #include <linux/if_ether.h> -@@ -36,29 +37,35 @@ - #define PF_PPPOX AF_PPPOX - #endif /* !(AF_PPPOX) */ - --/************************************************************************ -- * PPPoE addressing definition -- */ --typedef __u16 sid_t; --struct pppoe_addr{ -- sid_t sid; /* Session identifier */ -- unsigned char remote[ETH_ALEN]; /* Remote address */ -- char dev[IFNAMSIZ]; /* Local device to use */ --}; -- --/************************************************************************ -- * Protocols supported by AF_PPPOX -- */ -+/************************************************************************ -+ * PPPoE addressing definition -+ */ -+typedef __u16 sid_t; -+struct pppoe_addr{ -+ sid_t sid; /* Session identifier */ -+ unsigned char remote[ETH_ALEN]; /* Remote address */ -+ char dev[IFNAMSIZ]; /* Local device to use */ -+}; -+ -+struct pptp_addr{ -+ __u16 call_id; -+ struct in_addr sin_addr; -+}; -+/************************************************************************ -+ * Protocols supported by AF_PPPOX -+ */ - #define PX_PROTO_OE 0 /* Currently just PPPoE */ --#define PX_MAX_PROTO 1 -- --struct sockaddr_pppox { -- sa_family_t sa_family; /* address family, AF_PPPOX */ -- unsigned int sa_protocol; /* protocol identifier */ -- union{ -- struct pppoe_addr pppoe; -- }sa_addr; --}__attribute__ ((packed)); -+#define PX_PROTO_PPTP 1 -+#define PX_MAX_PROTO 2 -+ -+struct sockaddr_pppox { -+ sa_family_t sa_family; /* address family, AF_PPPOX */ -+ unsigned int sa_protocol; /* protocol identifier */ -+ union{ -+ struct pppoe_addr pppoe; -+ struct pptp_addr pptp; -+ }sa_addr; -+}__attribute__ ((packed)); - - - /********************************************************************* -@@ -111,6 +118,12 @@ struct pppoe_hdr { - struct pppoe_tag tag[0]; - } __attribute__ ((packed)); - -+ -+/* Socket options */ -+#define PPTP_SO_TIMEOUT 1 -+#define PPTP_SO_WINDOW 2 -+ -+ - #ifdef __KERNEL__ - struct pppoe_opt { - struct net_device *dev; /* device associated with socket*/ -@@ -118,6 +131,21 @@ struct pppoe_opt { - struct sockaddr_pppox relay; /* what socket data will be - relayed to (PPPoE relaying) */ - }; -+struct pptp_opt { -+ struct pptp_addr src_addr; -+ struct pptp_addr dst_addr; -+ int timeout; -+ int window; -+ __u32 ack_sent, ack_recv; -+ __u32 seq_sent, seq_recv; -+ int pause:1; -+ int proc:1; -+ spinlock_t skb_buf_lock; -+ struct sk_buff_head skb_buf; -+ struct work_struct ack_work; //send ack work -+ struct work_struct buf_work; //check bufferd packets work -+ struct gre_statistics *stat; -+}; - - #include <net/sock.h> - -@@ -128,6 +156,7 @@ struct pppox_sock { - struct pppox_sock *next; /* for hash table */ - union { - struct pppoe_opt pppoe; -+ struct pptp_opt pptp; - } proto; - unsigned short num; - }; -diff -uprN linux-2.6.18.orig/MAINTAINERS linux-2.6.18.pptp/MAINTAINERS ---- linux-2.6.18.orig/MAINTAINERS 2006-10-30 13:20:47.000000000 +0300 -+++ linux-2.6.18.pptp/MAINTAINERS 2006-10-30 13:21:45.000000000 +0300 -@@ -2325,6 +2325,11 @@ P: Michal Ostrowski - M: mostrows@speakeasy.net - S: Maintained - -+PPTP -+P: Dmitry Kozlov -+M: xeb@mail.ru -+S: Maintained -+ - PREEMPTIBLE KERNEL - P: Robert Love - M: rml@tech9.net diff --git a/kernel/patch/ppp-generic-smp-2.6.26.patch b/kernel/patch/ppp-generic-smp-2.6.26.patch deleted file mode 100644 index 0354914..0000000 --- a/kernel/patch/ppp-generic-smp-2.6.26.patch +++ /dev/null @@ -1,165 +0,0 @@ ---- a/drivers/net/ppp_generic.c 2008-07-14 01:51:29.000000000 +0400 -+++ b/drivers/net/ppp_generic.c 2009-03-01 00:17:03.000000000 +0300 -@@ -44,6 +44,7 @@ - #include <linux/stddef.h> - #include <linux/device.h> - #include <linux/mutex.h> -+#include <linux/workqueue.h> - #include <net/slhc_vj.h> - #include <asm/atomic.h> - -@@ -114,7 +115,8 @@ - void *rc_state; /* its internal state 98 */ - unsigned long last_xmit; /* jiffies when last pkt sent 9c */ - unsigned long last_recv; /* jiffies when last pkt rcvd a0 */ -- struct net_device *dev; /* network interface device a4 */ -+ struct net_device *dev; /* network interface device a4 */ -+ struct work_struct xmit_work; - #ifdef CONFIG_PPP_MULTILINK - int nxchan; /* next channel to send something on */ - u32 nxseq; /* next sequence number to send */ -@@ -154,6 +156,10 @@ - struct ppp *ppp; /* ppp unit we're connected to */ - struct list_head clist; /* link in list of channels per unit */ - rwlock_t upl; /* protects `ppp' */ -+ -+ struct work_struct recv_work; -+ struct sk_buff_head rq; /* receive queue for pppd */ -+ - #ifdef CONFIG_PPP_MULTILINK - u8 avail; /* flag used in multilink stuff */ - u8 had_frag; /* >= 1 fragments have been sent */ -@@ -270,6 +276,7 @@ - static void ppp_destroy_channel(struct channel *pch); - - static struct class *ppp_class; -+static struct workqueue_struct *kpppd_workqueue; - - /* Translates a PPP protocol number to a NP index (NP == network protocol) */ - static inline int proto_to_npindex(int proto) -@@ -849,6 +856,13 @@ - int err; - - printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n"); -+ -+ kpppd_workqueue = create_workqueue("kpppd"); -+ if (!kpppd_workqueue){ -+ printk(KERN_ERR "failed to create workqueue\n"); -+ return -1; -+ } -+ - err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops); - if (!err) { - ppp_class = class_create(THIS_MODULE, "ppp"); -@@ -858,10 +872,12 @@ - } - device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), "ppp"); - } -- -+ - out: -- if (err) -+ if (err) { -+ destroy_workqueue(kpppd_workqueue); - printk(KERN_ERR "failed to register PPP device (%d)\n", err); -+ } - return err; - - out_chrdev: -@@ -869,6 +885,12 @@ - goto out; - } - -+static void ppp_xmit_work(struct work_struct *work) -+{ -+ struct ppp *ppp=container_of(work,typeof(*ppp),xmit_work); -+ ppp_xmit_process(ppp); -+} -+ - /* - * Network interface unit routines. - */ -@@ -908,7 +930,7 @@ - - netif_stop_queue(dev); - skb_queue_tail(&ppp->file.xq, skb); -- ppp_xmit_process(ppp); -+ queue_work(kpppd_workqueue,&ppp->xmit_work); - return 0; - - outf: -@@ -1453,13 +1475,29 @@ - { - ppp_recv_lock(ppp); - /* ppp->dev == 0 means interface is closing down */ -- if (ppp->dev) -- ppp_receive_frame(ppp, skb, pch); -- else -+ if (ppp->dev) { -+ skb_queue_tail(&pch->rq, skb); -+ queue_work(kpppd_workqueue,&pch->recv_work); -+ } else - kfree_skb(skb); - ppp_recv_unlock(ppp); - } - -+static void ppp_recv_work(struct work_struct *work) -+{ -+ struct channel *pch=container_of(work,typeof(*pch),recv_work); -+ struct sk_buff *skb; -+ -+ ppp_recv_lock(pch->ppp); -+ -+ while((skb=skb_dequeue(&pch->rq))){ -+ if (pch->ppp->dev) -+ ppp_receive_frame(pch->ppp, skb, pch); -+ } -+ -+ ppp_recv_unlock(pch->ppp); -+} -+ - void - ppp_input(struct ppp_channel *chan, struct sk_buff *skb) - { -@@ -2000,6 +2038,8 @@ - chan->ppp = pch; - init_ppp_file(&pch->file, CHANNEL); - pch->file.hdrlen = chan->hdrlen; -+ INIT_WORK(&pch->recv_work,ppp_recv_work); -+ skb_queue_head_init(&pch->rq); - #ifdef CONFIG_PPP_MULTILINK - pch->lastseq = -1; - #endif /* CONFIG_PPP_MULTILINK */ -@@ -2419,6 +2459,7 @@ - INIT_LIST_HEAD(&ppp->channels); - spin_lock_init(&ppp->rlock); - spin_lock_init(&ppp->wlock); -+ INIT_WORK(&ppp->xmit_work,ppp_xmit_work); - #ifdef CONFIG_PPP_MULTILINK - ppp->minseq = -1; - skb_queue_head_init(&ppp->mrq); -@@ -2529,6 +2570,7 @@ - slhc_free(ppp->vj); - ppp->vj = NULL; - } -+ cancel_work_sync(&ppp->xmit_work); - skb_queue_purge(&ppp->file.xq); - skb_queue_purge(&ppp->file.rq); - #ifdef CONFIG_PPP_MULTILINK -@@ -2664,6 +2706,8 @@ - } - skb_queue_purge(&pch->file.xq); - skb_queue_purge(&pch->file.rq); -+ cancel_work_sync(&pch->recv_work); -+ skb_queue_purge(&pch->rq); - kfree(pch); - } - -@@ -2676,6 +2720,7 @@ - unregister_chrdev(PPP_MAJOR, "ppp"); - device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); - class_destroy(ppp_class); -+ destroy_workqueue(kpppd_workqueue); - } - - /* diff --git a/kernel/patch/ppp-generic-smp-2.6.28.patch b/kernel/patch/ppp-generic-smp-2.6.28.patch deleted file mode 100644 index 65a218a..0000000 --- a/kernel/patch/ppp-generic-smp-2.6.28.patch +++ /dev/null @@ -1,163 +0,0 @@ ---- a/drivers/net/ppp_generic.c 2008-12-25 02:26:37.000000000 +0300 -+++ b/drivers/net/ppp_generic.c 2009-03-01 14:54:45.000000000 +0300 -@@ -45,6 +45,7 @@ - #include <linux/stddef.h> - #include <linux/device.h> - #include <linux/mutex.h> -+#include <linux/workqueue.h> - #include <net/slhc_vj.h> - #include <asm/atomic.h> - -@@ -117,6 +118,7 @@ - unsigned long last_recv; /* jiffies when last pkt rcvd a0 */ - struct net_device *dev; /* network interface device a4 */ - int closing; /* is device closing down? a8 */ -+ struct work_struct xmit_work; - #ifdef CONFIG_PPP_MULTILINK - int nxchan; /* next channel to send something on */ - u32 nxseq; /* next sequence number to send */ -@@ -156,6 +158,10 @@ - struct ppp *ppp; /* ppp unit we're connected to */ - struct list_head clist; /* link in list of channels per unit */ - rwlock_t upl; /* protects `ppp' */ -+ -+ struct work_struct recv_work; -+ struct sk_buff_head rq; /* receive queue for pppd */ -+ - #ifdef CONFIG_PPP_MULTILINK - u8 avail; /* flag used in multilink stuff */ - u8 had_frag; /* >= 1 fragments have been sent */ -@@ -272,6 +278,7 @@ - static void ppp_destroy_channel(struct channel *pch); - - static struct class *ppp_class; -+static struct workqueue_struct *kpppd_workqueue; - - /* Translates a PPP protocol number to a NP index (NP == network protocol) */ - static inline int proto_to_npindex(int proto) -@@ -860,6 +867,13 @@ - int err; - - printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n"); -+ -+ kpppd_workqueue = create_workqueue("kpppd"); -+ if (!kpppd_workqueue){ -+ printk(KERN_ERR "failed to create workqueue\n"); -+ return -1; -+ } -+ - err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops); - if (!err) { - ppp_class = class_create(THIS_MODULE, "ppp"); -@@ -870,10 +884,12 @@ - device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL, - "ppp"); - } -- -+ - out: -- if (err) -+ if (err) { -+ destroy_workqueue(kpppd_workqueue); - printk(KERN_ERR "failed to register PPP device (%d)\n", err); -+ } - return err; - - out_chrdev: -@@ -881,6 +897,12 @@ - goto out; - } - -+static void ppp_xmit_work(struct work_struct *work) -+{ -+ struct ppp *ppp=container_of(work,typeof(*ppp),xmit_work); -+ ppp_xmit_process(ppp); -+} -+ - /* - * Network interface unit routines. - */ -@@ -920,7 +942,7 @@ - - netif_stop_queue(dev); - skb_queue_tail(&ppp->file.xq, skb); -- ppp_xmit_process(ppp); -+ queue_work(kpppd_workqueue,&ppp->xmit_work); - return 0; - - outf: -@@ -1464,13 +1486,29 @@ - ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) - { - ppp_recv_lock(ppp); -- if (!ppp->closing) -- ppp_receive_frame(ppp, skb, pch); -- else -+ if (!ppp->closing){ -+ skb_queue_tail(&pch->rq, skb); -+ queue_work(kpppd_workqueue,&pch->recv_work); -+ }else - kfree_skb(skb); - ppp_recv_unlock(ppp); - } - -+static void ppp_recv_work(struct work_struct *work) -+{ -+ struct channel *pch=container_of(work,typeof(*pch),recv_work); -+ struct sk_buff *skb; -+ -+ ppp_recv_lock(pch->ppp); -+ -+ while((skb=skb_dequeue(&pch->rq))){ -+ if (pch->ppp->dev) -+ ppp_receive_frame(pch->ppp, skb, pch); -+ } -+ -+ ppp_recv_unlock(pch->ppp); -+} -+ - void - ppp_input(struct ppp_channel *chan, struct sk_buff *skb) - { -@@ -2014,6 +2052,8 @@ - chan->ppp = pch; - init_ppp_file(&pch->file, CHANNEL); - pch->file.hdrlen = chan->hdrlen; -+ INIT_WORK(&pch->recv_work,ppp_recv_work); -+ skb_queue_head_init(&pch->rq); - #ifdef CONFIG_PPP_MULTILINK - pch->lastseq = -1; - #endif /* CONFIG_PPP_MULTILINK */ -@@ -2429,6 +2469,7 @@ - INIT_LIST_HEAD(&ppp->channels); - spin_lock_init(&ppp->rlock); - spin_lock_init(&ppp->wlock); -+ INIT_WORK(&ppp->xmit_work,ppp_xmit_work); - #ifdef CONFIG_PPP_MULTILINK - ppp->minseq = -1; - skb_queue_head_init(&ppp->mrq); -@@ -2537,6 +2578,7 @@ - slhc_free(ppp->vj); - ppp->vj = NULL; - } -+ cancel_work_sync(&ppp->xmit_work); - skb_queue_purge(&ppp->file.xq); - skb_queue_purge(&ppp->file.rq); - #ifdef CONFIG_PPP_MULTILINK -@@ -2672,6 +2714,8 @@ - } - skb_queue_purge(&pch->file.xq); - skb_queue_purge(&pch->file.rq); -+ cancel_work_sync(&pch->recv_work); -+ skb_queue_purge(&pch->rq); - kfree(pch); - } - -@@ -2684,6 +2728,7 @@ - unregister_chrdev(PPP_MAJOR, "ppp"); - device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); - class_destroy(ppp_class); -+ destroy_workqueue(kpppd_workqueue); - } - - /* |