Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ AC_CONFIG_FILES([
pppd/plugins/pppoe/Makefile
pppd/plugins/pppoatm/Makefile
pppd/plugins/pppol2tp/Makefile
pppd/plugins/pptp/Makefile
pppd/plugins/radius/Makefile
pppd/plugins/dhcpv6relay/Makefile
pppdump/Makefile
Expand Down
2 changes: 1 addition & 1 deletion pppd/plugins/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ winbind_la_LDFLAGS = $(PLUGIN_LDFLAGS)
winbind_la_SOURCES = winbind.c

if !SUNOS
SUBDIRS = pppoe pppoatm pppol2tp radius dhcpv6relay
SUBDIRS = pppoe pppoatm pppol2tp pptp radius dhcpv6relay
endif
10 changes: 10 additions & 0 deletions pppd/plugins/pptp/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pppd_plugin_LTLIBRARIES = pptp.la
pppd_plugindir = $(PPPD_PLUGIN_DIR)

noinst_HEADERS = pptp_callmgr.h pptp_ctrl.h pptp_msg.h pptp_options.h \
util.h vector.h dirutil.h pptp_quirks.h orckit_quirks.h

pptp_la_CPPFLAGS = -I${top_srcdir}
pptp_la_LDFLAGS = -module -avoid-version
pptp_la_SOURCES = pptp.c pptp_callmgr.c pptp_ctrl.c util.c vector.c \
dirutil.c pptp_quirks.c orckit_quirks.c
68 changes: 68 additions & 0 deletions pppd/plugins/pptp/dirutil.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* dirutil.c ... directory utilities.
* C. Scott Ananian <cananian@alumni.princeton.edu>
*
* $Id: dirutil.c,v 1.2 2003/06/17 17:25:47 reink Exp $
*/

#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include "dirutil.h"

/* Returned malloc'ed string representing basename */
char *basenamex(char *pathname)
{
char *dup = strdup(pathname);
char *ptr = strrchr(stripslash(dup), '/');
if (ptr == NULL) return dup;
ptr = strdup(ptr+1);
free(dup);
return ptr;
}

/* Return malloc'ed string representing directory name (no trailing slash) */
char *dirnamex(char *pathname)
{
char *dup = strdup(pathname);
char *ptr = strrchr(stripslash(dup), '/');
if (ptr == NULL) { free(dup); return strdup("."); }
if (ptr == dup && dup[0] == '/') ptr++;
*ptr = '\0';
return dup;
}

/* In-place modify a string to remove trailing slashes. Returns arg.
* stripslash("/") returns "/";
*/
char *stripslash(char *pathname) {
int len = strlen(pathname);
while (len > 1 && pathname[len - 1] == '/')
pathname[--len] = '\0';
return pathname;
}

/* ensure dirname exists, creating it if necessary. */
int make_valid_path(char *dir, mode_t mode)
{
struct stat st;
char *tmp = NULL, *path = stripslash(strdup(dir));
int retval;
if (stat(path, &st) == 0) { /* file exists */
if (S_ISDIR(st.st_mode)) { retval = 1; goto end; }
else { retval = 0; goto end; } /* not a directory. Oops. */
}
/* Directory doesn't exist. Let's make it. */
/* Make parent first. */
if (!make_valid_path(tmp = dirnamex(path), mode)) { retval = 0; goto end; }
/* Now make this 'un. */
if (mkdir(path, mode) < 0) { retval = 0; goto end; }
/* Success. */
retval = 1;

end:
if (tmp != NULL) free(tmp);
if (path != NULL) free(path);
return retval;
}
14 changes: 14 additions & 0 deletions pppd/plugins/pptp/dirutil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* dirutil.h ... directory utilities.
* C. Scott Ananian <cananian@alumni.princeton.edu>
*
* $Id: dirutil.h,v 1.1.1.1 2000/12/23 08:19:51 scott Exp $
*/

/* Returned malloc'ed string representing basename */
char *basenamex(char *pathname);
/* Return malloc'ed string representing directory name (no trailing slash) */
char *dirnamex(char *pathname);
/* In-place modify a string to remove trailing slashes. Returns arg. */
char *stripslash(char *pathname);
/* ensure dirname exists, creating it if necessary. */
int make_valid_path(char *dirname, mode_t mode);
86 changes: 86 additions & 0 deletions pppd/plugins/pptp/orckit_quirks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* orckit_quirks.c ...... fix quirks in orckit adsl modems
* mulix <mulix@actcom.co.il>
*
* $Id: orckit_quirks.c,v 1.3 2002/03/01 01:23:36 quozl Exp $
*/

#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#include "pptp_msg.h"
#include "pptp_options.h"
#include "pptp_ctrl.h"
#include "util.h"



/* return 0 on success, non zero otherwise */
int
orckit_atur3_build_hook(struct pptp_out_call_rqst* packet)
{
unsigned int name_length = 10;

struct pptp_out_call_rqst fixed_packet = {
PPTP_HEADER_CTRL(PPTP_OUT_CALL_RQST),
0, /* hton16(call->callid) */
0, /* hton16(call->sernum) */
hton32(PPTP_BPS_MIN), hton32(PPTP_BPS_MAX),
hton32(PPTP_BEARER_DIGITAL), hton32(PPTP_FRAME_ANY),
hton16(PPTP_WINDOW), 0, hton16(name_length), 0,
{'R','E','L','A','Y','_','P','P','P','1',0}, {0}
};

if (!packet)
return -1;

memcpy(packet, &fixed_packet, sizeof(*packet));

return 0;
}

/* return 0 on success, non zero otherwise */
int
orckit_atur3_set_link_hook(struct pptp_set_link_info* packet,
int peer_call_id)
{
struct pptp_set_link_info fixed_packet = {
PPTP_HEADER_CTRL(PPTP_SET_LINK_INFO),
hton16(peer_call_id),
0,
0xffffffff,
0xffffffff};

if (!packet)
return -1;

memcpy(packet, &fixed_packet, sizeof(*packet));
return 0;
}

/* return 0 on success, non 0 otherwise */
int
orckit_atur3_start_ctrl_conn_hook(struct pptp_start_ctrl_conn* packet)
{
struct pptp_start_ctrl_conn fixed_packet = {
{0}, /* we'll set the header later */
hton16(PPTP_VERSION), 0, 0,
hton32(PPTP_FRAME_ASYNC), hton32(PPTP_BEARER_ANALOG),
hton16(0) /* max channels */,
hton16(0x6021),
{'R','E','L','A','Y','_','P','P','P','1',0}, /* hostname */
{'M','S',' ','W','i','n',' ','N','T',0} /* vendor */
};

if (!packet)
return -1;

/* grab the header from the original packet, since we dont
know if this is a request or a reply */
memcpy(&fixed_packet.header, &packet->header, sizeof(struct pptp_header));

/* and now overwrite the full packet, effectively preserving the header */
memcpy(packet, &fixed_packet, sizeof(*packet));
return 0;
}


27 changes: 27 additions & 0 deletions pppd/plugins/pptp/orckit_quirks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* orckit_quirks.h ...... fix quirks in orckit adsl modems
* mulix <mulix@actcom.co.il>
*
* $Id: orckit_quirks.h,v 1.2 2001/11/23 03:42:51 quozl Exp $
*/

#ifndef INC_ORCKIT_QUIRKS_H_
#define INC_ORCKIT_QUIRKS_H_

#include "pptp_options.h"
#include "pptp_ctrl.h"
#include "pptp_msg.h"

/* return 0 on success, non zero otherwise */
int
orckit_atur3_build_hook(struct pptp_out_call_rqst* packt);

/* return 0 on success, non zero otherwise */
int
orckit_atur3_set_link_hook(struct pptp_set_link_info* packet,
int peer_call_id);

/* return 0 on success, non zero otherwise */
int
orckit_atur3_start_ctrl_conn_hook(struct pptp_start_ctrl_conn* packet);

#endif /* INC_ORCKIT_QUIRKS_H_ */
71 changes: 71 additions & 0 deletions pppd/plugins/pptp/pppd-pptp.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.\" manual page [] for ACCEL-PPTP plugin for pppd 2.4
.\" $Id: pppd-pptp.8,v 1.0 2007/10/17 13:27:17 kad Exp $
.\" SH section heading
.\" SS subsection heading
.\" LP paragraph
.\" IP indented paragraph
.\" TP hanging label
.TH PPPD-PPTP 8
.SH NAME
pptp.so \- PPTP VPN plugin for
.BR pppd (8)
.SH SYNOPSIS
.B pppd
[
.I options
]
plugin pptp.so
.SH DESCRIPTION
.LP
The PPTP plugin for pppd performs interaction with pptp kernel module
and has built-in call manager (client part of PPTP).
It pasees necessary paremeters from \fIoptions\fR into kernel module
to configure ppp-pptp channel. If it runs in client mode, then additionally
call manager starts up. PPTPD daemon automaticaly invokes this plugin
in server mode and passes necessary options, so additional configuration
is not needed.

.SH OPTIONS for client mode
The PPTP plugin introduces one additional pppd option:
.TP
.BI "pptp_server " server " (required)"
Specifies ip address or hostname of pptp server.
.TP
.BI "pptp_window " packets " (optional)"
The amount of sliding window size.
Set to 0 to turn off sliding window.
to 3-10 for low speed connections.
to >10 for hi speed connections.
.TP
.BI "pptp_phone " phone " (optional)"
The phone string that sended to pptp server.
.TP
.BI "pptp_timeout " miliseconds " (optional)"
Specifies timeout for waiting "ack" packet from server.

.SH USAGE
Sample configuration file:
.nf
plugin "pptp.so"
pptp_server 192.168.0.1
pptp_window 50
name myname
remotename pptp
noauth
refuse-eap
refuse-chap
refuse-mschap
nobsdcomp
nodeflate
novj
novjccomp
require-mppe-128
lcp-echo-interval 20
lcp-echo-failure 3
.fi

.SH SEE ALSO
.BR pppd (8) " " pptpd (8) " " pptpd.conf (5)

.SH AUTHOR
xeb xeb@mail.ru
Loading
Loading