mirror of https://github.com/hak5/openwrt-owl.git
ppp: Extend uci datamodel with persistency sypport
PPP daemon can be put into persist mode meaning the daemon will not exit after a connection gets terminated but will instead try to reopen the connection. The re-initiation after the link has been terminated can be controlled via holdoff; this is helpfull in scenarios where a BRAS is in denial of service mode due to link setup requests after a BRAS has gone down Following uci parameters have been added : persist (boolean) : Puts the ppp daemon in persist mode maxfail (integer) : Number of consecutive fail attempts which puts the PPP daemon in exit mode holdoff (interget) : Specifies how many seconds to wait before re-initiating link setup after it has been terminated Signed-off-by: Alin Nastac <alin.nastac@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
parent
f478fba663
commit
d7c249fa1c
|
@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
|
||||||
PKG_NAME:=ppp
|
PKG_NAME:=ppp
|
||||||
PKG_VERSION:=2.4.7
|
PKG_VERSION:=2.4.7
|
||||||
PKG_RELEASE:=9
|
PKG_RELEASE:=10
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://download.samba.org/pub/ppp/
|
PKG_SOURCE_URL:=https://download.samba.org/pub/ppp/
|
||||||
|
|
|
@ -79,13 +79,16 @@ ppp_generic_init_config() {
|
||||||
proto_config_add_int mtu
|
proto_config_add_int mtu
|
||||||
proto_config_add_string pppname
|
proto_config_add_string pppname
|
||||||
proto_config_add_string unnumbered
|
proto_config_add_string unnumbered
|
||||||
|
proto_config_add_boolean persist
|
||||||
|
proto_config_add_int maxfail
|
||||||
|
proto_config_add_int holdoff
|
||||||
}
|
}
|
||||||
|
|
||||||
ppp_generic_setup() {
|
ppp_generic_setup() {
|
||||||
local config="$1"; shift
|
local config="$1"; shift
|
||||||
local localip
|
local localip
|
||||||
|
|
||||||
json_get_vars ipv6 demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered
|
json_get_vars ipv6 demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff
|
||||||
if [ "$ipv6" = 0 ]; then
|
if [ "$ipv6" = 0 ]; then
|
||||||
ipv6=""
|
ipv6=""
|
||||||
elif [ -z "$ipv6" -o "$ipv6" = auto ]; then
|
elif [ -z "$ipv6" -o "$ipv6" = auto ]; then
|
||||||
|
@ -98,6 +101,12 @@ ppp_generic_setup() {
|
||||||
else
|
else
|
||||||
demand=""
|
demand=""
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$persist" ]; then
|
||||||
|
[ "${persist}" -lt 1 ] && persist="nopersist" || persist="persist"
|
||||||
|
fi
|
||||||
|
if [ -z "$maxfail" ]; then
|
||||||
|
[ "$persist" = "persist" ] && maxfail=0 || maxfail=1
|
||||||
|
fi
|
||||||
[ -n "$mtu" ] || json_get_var mtu mtu
|
[ -n "$mtu" ] || json_get_var mtu mtu
|
||||||
[ -n "$pppname" ] || pppname="${proto:-ppp}-$config"
|
[ -n "$pppname" ] || pppname="${proto:-ppp}-$config"
|
||||||
[ -n "$unnumbered" ] && {
|
[ -n "$unnumbered" ] && {
|
||||||
|
@ -129,7 +138,8 @@ ppp_generic_setup() {
|
||||||
${autoipv6:+set AUTOIPV6=1} \
|
${autoipv6:+set AUTOIPV6=1} \
|
||||||
nodefaultroute \
|
nodefaultroute \
|
||||||
usepeerdns \
|
usepeerdns \
|
||||||
$demand maxfail 1 \
|
$demand $persist maxfail $maxfail \
|
||||||
|
${holdoff:+holdoff "$holdoff"} \
|
||||||
${username:+user "$username" password "$password"} \
|
${username:+user "$username" password "$password"} \
|
||||||
${connect:+connect "$connect"} \
|
${connect:+connect "$connect"} \
|
||||||
${disconnect:+disconnect "$disconnect"} \
|
${disconnect:+disconnect "$disconnect"} \
|
||||||
|
|
Loading…
Reference in New Issue