|
@ -13,20 +13,14 @@ pppoe_triggers() { |
|
|
config_get server_interfaces "$cfg" server_interface |
|
|
config_get server_interfaces "$cfg" server_interface |
|
|
config_get client_interfaces "$cfg" client_interface |
|
|
config_get client_interfaces "$cfg" client_interface |
|
|
config_get both_interfaces "$cfg" both_interfaces |
|
|
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" "|" |
|
|
|
|
|
|
|
|
for interface in $server_interfaces $client_interfaces $both_interfaces; do |
|
|
|
|
|
procd_add_reload_interface_trigger $interface |
|
|
done |
|
|
done |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
pppoe_relay_instance() { |
|
|
pppoe_relay_instance() { |
|
|
local cfg="$1" |
|
|
local cfg="$1" |
|
|
local enabled interface server_interfaces client_interfaces both_interfaces maxsessions timeout OPTIONS |
|
|
|
|
|
|
|
|
local enabled interface device server_interfaces client_interfaces both_interfaces maxsessions timeout OPTIONS |
|
|
config_get_bool enabled "$cfg" enabled 1 |
|
|
config_get_bool enabled "$cfg" enabled 1 |
|
|
[ "$enabled" -gt 0 ] || return 0 |
|
|
[ "$enabled" -gt 0 ] || return 0 |
|
|
config_get server_interfaces "$cfg" server_interface |
|
|
config_get server_interfaces "$cfg" server_interface |
|
@ -39,23 +33,34 @@ pppoe_relay_instance() { |
|
|
if [ "$use_non_uci_config" -gt 0 ]; then |
|
|
if [ "$use_non_uci_config" -gt 0 ]; then |
|
|
. /etc/default/pppoe-relay |
|
|
. /etc/default/pppoe-relay |
|
|
else |
|
|
else |
|
|
[ -z "${server_interfaces}${client_interfaces}${both_interfaces}" ] && return 1 |
|
|
|
|
|
|
|
|
local NEED_INTFS=SC |
|
|
|
|
|
. /lib/functions/network.sh |
|
|
for interface in $server_interfaces; do |
|
|
for interface in $server_interfaces; do |
|
|
append OPTIONS "-S $interface" |
|
|
|
|
|
|
|
|
if network_get_physdev device $interface; then |
|
|
|
|
|
append OPTIONS "-S $device" |
|
|
|
|
|
NEED_INTFS=${NEED_INTFS/S/} |
|
|
|
|
|
fi |
|
|
done |
|
|
done |
|
|
for interface in $client_interfaces; do |
|
|
for interface in $client_interfaces; do |
|
|
append OPTIONS "-C $interface" |
|
|
|
|
|
|
|
|
if network_get_physdev device $interface; then |
|
|
|
|
|
append OPTIONS "-C $device" |
|
|
|
|
|
NEED_INTFS=${NEED_INTFS/C/} |
|
|
|
|
|
fi |
|
|
done |
|
|
done |
|
|
for interface in $both_interfaces; do |
|
|
for interface in $both_interfaces; do |
|
|
append OPTIONS "-B $interface" |
|
|
|
|
|
|
|
|
if network_get_physdev device $interface; then |
|
|
|
|
|
append OPTIONS "-B $device" |
|
|
|
|
|
NEED_INTFS=${NEED_INTFS/?/} |
|
|
|
|
|
fi |
|
|
done |
|
|
done |
|
|
|
|
|
[ -z "${NEED_INTFS}" ] || return 1 # need at least 2 interfaces, one for server(s) and one for client(s) |
|
|
[ -n "$maxsessions" ] && append OPTIONS "-n $maxsessions" |
|
|
[ -n "$maxsessions" ] && append OPTIONS "-n $maxsessions" |
|
|
[ -n "$timeout" ] && append OPTIONS "-i $timeout" |
|
|
[ -n "$timeout" ] && append OPTIONS "-i $timeout" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
procd_open_instance |
|
|
procd_open_instance |
|
|
procd_set_param command /usr/sbin/pppoe-relay -F |
|
|
|
|
|
procd_append_param command $OPTIONS |
|
|
|
|
|
|
|
|
procd_set_param command /usr/sbin/pppoe-relay -F $OPTIONS |
|
|
|
|
|
procd_set_param respawn |
|
|
procd_close_instance |
|
|
procd_close_instance |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -66,12 +71,9 @@ start_service() { |
|
|
config_foreach pppoe_relay_instance pppoe_relay |
|
|
config_foreach pppoe_relay_instance pppoe_relay |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
reload_triggers() { |
|
|
|
|
|
local interfaces |
|
|
|
|
|
|
|
|
service_triggers() { |
|
|
|
|
|
procd_add_reload_trigger "pppoe" |
|
|
|
|
|
|
|
|
config_load pppoe |
|
|
config_load pppoe |
|
|
config_foreach pppoe_triggers pppoe_relay |
|
|
config_foreach pppoe_triggers pppoe_relay |
|
|
|
|
|
|
|
|
procd_add_reload_trigger "pppoe" |
|
|
|
|
|
procd_add_interface_trigger "$interfaces" |
|
|
|
|
|
} |
|
|
} |