From 06e69b035b5af68fc99bb7a8549439e525abe47d Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sat, 30 Jul 2005 20:37:32 +0000 Subject: [PATCH] Add PPPoE server hooks --- etc/inc/vpn.inc | 180 +++++++++++++++++++++++++ etc/version | 2 +- usr/local/www/vpn_pppoe_users.php | 132 ++++++++++++++++++ usr/local/www/vpn_pppoe_users_edit.php | 160 ++++++++++++++++++++++ 4 files changed, 473 insertions(+), 1 deletion(-) create mode 100755 usr/local/www/vpn_pppoe_users.php create mode 100755 usr/local/www/vpn_pppoe_users_edit.php diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 685713b8f7..a5cf992175 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -781,4 +781,184 @@ function vpn_endpoint_determine($tunnel, $curwanip) { return null; } +function vpn_pppoe_configure() { + global $config, $g; + + $syscfg = $config['system']; + $pppoecfg = $config['pppoe']; + + if ($g['booting']) { + if (!$pppoecfg['mode'] || ($pppoecfg['mode'] == "off")) + return 0; + + echo "Configuring PPPoE VPN service... "; + } else { + /* kill mpd */ + killbypid("{$g['varrun_path']}/mpd-vpn.pid"); + + /* wait for process to die */ + sleep(2); + + vpn_pptp_configure(); + } + + /* make sure mpd-vpn directory exists */ + if (!file_exists("{$g['varetc_path']}/mpd-vpn")) + mkdir("{$g['varetc_path']}/mpd-vpn"); + + switch ($pppoecfg['mode']) { + + case 'server': + + /* write mpd.conf */ + $fd = fopen("{$g['varetc_path']}/mpd-vpn/mpd.conf", "a"); + if (!$fd) { + printf("Error: cannot open mpd.conf in vpn_pppoe_configure().\n"); + return 1; + } + $mpdconf = "\n\n"; + $mpdconf .= << \ No newline at end of file diff --git a/etc/version b/etc/version index b0d230ed84..eecd809820 100644 --- a/etc/version +++ b/etc/version @@ -1 +1 @@ -0.71.12 \ No newline at end of file +0.72 \ No newline at end of file diff --git a/usr/local/www/vpn_pppoe_users.php b/usr/local/www/vpn_pppoe_users.php new file mode 100755 index 0000000000..7fb7f92bee --- /dev/null +++ b/usr/local/www/vpn_pppoe_users.php @@ -0,0 +1,132 @@ +#!/usr/local/bin/php + + + + +

+
+ + +

+You must apply the changes in order for them to take effect.
Warning: this will terminate all current PPTP sessions!");?>
+ +

+ + + + + +
+
+ + + + + + + + + + + + + + + + + +
UsernameIP address
+ + +   + +  
+
+
+
+ + + + + + + diff --git a/usr/local/www/vpn_pppoe_users_edit.php b/usr/local/www/vpn_pppoe_users_edit.php new file mode 100755 index 0000000000..aa8fc02692 --- /dev/null +++ b/usr/local/www/vpn_pppoe_users_edit.php @@ -0,0 +1,160 @@ +#!/usr/local/bin/php + + + +

+ +
+ +
+ + + + + + + + + + + + + + + + +
Username + +
Password + +
+  (confirmation)
+ If you want to change the users' password, + enter it here twice.
IP address + +
If you want the user to be assigned a specific IP address, enter it here.
  + + + + +
+
+
+ + + + +