rp-pppoe: Add back from oldpackages with build fixes and enhanced packaging

Add back from oldpackages with fixes for build errors and UCIfication
(for LuCI app submitted in a related PR (against LuCI repo)).

NOTE: Untested packages have been marked with @BROKEN.  This can
be undone of others report success with the sniffer

Signed-off-by: Daniel Dickinson <lede@daniel.thecshore.com>
This commit is contained in:
Daniel Dickinson
2016-05-21 20:35:10 -04:00
parent b6f8e32089
commit 847706ba5a
13 changed files with 455 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
#debug
logfile /dev/null
noipdefault
noaccomp
nopcomp
nocrtscts
lock
maxfail 0
lcp-echo-failure 5
lcp-echo-interval 1
+2
View File
@@ -0,0 +1,2 @@
# client server secret IP addresses
* * * *
@@ -0,0 +1,9 @@
# PPP options for the PPPoE server
# LIC: GPL
require-pap
login
lcp-echo-interval 10
lcp-echo-failure 2
mru 1492
mtu 1492
+11
View File
@@ -0,0 +1,11 @@
#ifndef _NET_PPP_DEFS_H
#define _NET_PPP_DEFS_H
#define __need_time_t
#include <time.h>
#include <asm/types.h>
#include <linux/ppp_defs.h>
#endif
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
if [ -e /etc/default/pppoe-relay ]; then
if [ -z "$(uci get pppoe.@pppoe_relay[-1] 2>/dev/null)" ]; then
uci add pppoe pppoe_relay
fi
uci set pppoe.@pppoe-relay[-1].use_non_uci_config=1
uci commit pppoe
fi
+72
View File
@@ -0,0 +1,72 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=50
USE_PROCD=1
pppoe_triggers() {
local cfg="$1"
local interface server_interfaces client_interfaces both_interfaces
config_get server_interfaces "$cfg" server_interface
config_get client_interfaces "$cfg" client_interface
config_get both_interfaces "$cfg" both_interfaces
for interface in $server_interfaces; do
append interfaces "$interface" "|"
done
for interface in $client_interfaces; do
append interfaces "$interface" "|"
done
for interface in $both_interfaces; do
append interfaces "$interface" "|"
done
}
pppoe_relay_instance() {
local cfg="$1"
local interface server_interfaces client_interfaces both_interfaces maxsessions timeout OPTIONS
config_get server_interfaces "$cfg" server_interface
config_get client_interfaces "$cfg" client_interface
config_get both_interfaces "$cfg" both_interfaces
config_get maxsessions "$cfg" maxsesssions
config_get timeout "$cfg" timeout
config_get_bool use_non_uci_config "$cfg" use_non_uci_config 0
if [ "$use_non_uci_config" -gt 0 ]; then
. /etc/default/pppoe-relay
else
[ -z "${server_interfaces}${client_interfaces}${both_interfaces}" ] && return 1
for interface in $server_interfaces; do
append OPTIONS "-S $interface"
done
for interface in $client_interfaces; do
append OPTIONS "-C $interface"
done
for interface in $both_interfaces; do
append OPTIONS "-B $interface"
done
[ -n "$maxsesssions" ] && append OPTIONS "-n $maxsesssions"
[ -n "$timeout" ] && append OPTIONS "-i $timeout"
fi
procd_open_instance
procd_set_param command /usr/sbin/pppoe-relay -F
procd_append_param command $OPTIONS
procd_close_instance
}
start_service() {
local use_non_uci_config
config_load pppoe
config_foreach pppoe_relay_instance pppoe_relay
}
reload_triggers() {
local interfaces
config_load pppoe
config_foreach pppoe_triggers pppoe_relay
procd_add_reload_trigger "pppoe"
procd_add_interface_trigger "$interfaces"
}
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
if [ -e /etc/default/pppoe-server ]; then
if [ -z "$(uci get pppoe.@pppoe_server[-1] 2>/dev/null)" ]; then
uci add pppoe pppoe_server_
fi
uci set pppoe.@pppoe-server[-1].use_non_uci_config=1
uci commit pppoe
fi
+74
View File
@@ -0,0 +1,74 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=50
USE_PROCD=1
pppoe_triggers() {
local cfg="$1"
local interface
config_get interface "$cfg" interface
}
pppoe_instance() {
local cfg="$1"
local interface ac_name service_names service_name maxsessionsperpeer localip firstremoteip maxsessions optionsfiles randomsession unit offset timeout mss sync OPTIONS
config_get interface "$cfg" interface
config_get ac_name "$cfg" ac_name
config_get service_names "$cfg" service_name
config_get maxsessionsperpeer "$cfg" maxsesssionsperpeer
config_get localip "$cfg" localip
config_get firstremoteip "$cfg" firstremoteip
config_get maxsessions "$cfg" maxsessions
config_get optionsfile "$cfg" optionsfile
config_get_bool randomsession "$cfg" randomsession 1
config_get_bool unit "$cfg" unit 0
config_get offset "$cfg" offset
config_get timeout "$cfg" timeout
config_get mss "$cfg" mss
config_get_bool sync "$cfg" sync 0
config_get use_non_uci_config "$cfg" use_non_uci_config 0
if [ "$use_non_uci_config" -gt 0 ]; then
. /etc/default/pppoe-server
else
[ -z "$interface" ] && return 1
[ -n "$ac_name" ] && append OPTIONS "-C $ac_name"
for service_name in $service_names; do
append OPTIONS "-S $service_name"
done
append OPTIONS "-I $interface"
[ -n "$maxsesssionsperpeer" ] && append OPTIONS "-x $maxsesssionsperpeer"
[ -n "$localip" ] && append OPTIONS "-L $localip"
[ -n "$firstremoteip" ] && append OPTIONS "-R $firstremoteip"
[ -n "maxsessions" ] && append OPTIONS "-N $maxsessions"
[ -n "optionsfile" ] && append OPTIONS "-O $optionsfile"
[ "$randomsession" = "1" ] && append OPTIONS "-r"
[ "$unit" = "1" ] && append OPTIONS "-u"
[ -n "$offset" ] && append OPTIONS "-o $offset"
[ -n "$timeout" ] && append OPTIONS "-T $timeout"
[ -n "$mss" ] && append OPTIONS "-m $mss"
[ "$sync" = "1" ] && append OPTIONS "-s"
fi
procd_open_instance
procd_set_param command /usr/sbin/pppoe-server -F
procd_append_param command $OPTIONS
procd_set_param file /etc/ppp/options
procd_append_param file /etc/ppp/pppoe-server-options
procd_close_instance
}
start_service() {
config_load pppoe
config_foreach pppoe_instance pppoe_server
}
service_triggers() {
local interface
config_load pppoe
config_foreach pppoe_triggers pppoe_server
procd_add_reload_trigger "pppoe"
procd_add_interface_trigger "$interface"
}
+23
View File
@@ -0,0 +1,23 @@
#config pppoe_server
# option interface eth1
# option ac_name access-concentrator-name
# list service_name service-name1
# list service_name service-name2
# option maxsessionsperpeer 0
# option localip 192.168.2.1
# option firsremoteip 192.168.2.2
# option maxsessions 64
# option optionsfile /etc/ppp/pppoe-server-options
# option randomsessions 1
# option unit 0
# option offset 0
# option timeout 60
# option mss 1468
# option sync 0
#config pppoe_relay
# list server_interface eth1
# list client_interface eth0
# list both_interface eth2
# option maxsessions 64
# option timeout 60