2006-10-04 20:57:49 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2012-05-28 15:38:58 +00:00
|
|
|
# Copyright (C) 2006-2012 OpenWrt.org
|
2011-11-09 23:43:35 +00:00
|
|
|
|
2007-05-10 10:38:53 +00:00
|
|
|
START=50
|
2006-08-06 14:27:00 +00:00
|
|
|
|
2011-11-17 10:47:19 +00:00
|
|
|
section_enabled() {
|
|
|
|
local enabled
|
|
|
|
config_get_bool enabled "$1" 'enabled' 0
|
|
|
|
[ $enabled -gt 0 ]
|
|
|
|
}
|
|
|
|
|
|
|
|
append_interface() {
|
|
|
|
local name="$1"
|
2012-05-28 15:38:58 +00:00
|
|
|
local device
|
|
|
|
network_get_device device "$name"
|
|
|
|
append args "${device:-$name}"
|
2011-11-17 10:47:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
start_instance() {
|
|
|
|
local section="$1"
|
|
|
|
local permanent
|
|
|
|
local interfaces
|
|
|
|
local args=""
|
|
|
|
|
|
|
|
section_enabled "$section" || return 1
|
|
|
|
|
|
|
|
config_get_bool permanent "$section" 'permanent' 0
|
|
|
|
[ $permanent -eq 0 ] || append args "-p"
|
|
|
|
|
|
|
|
config_list_foreach "$section" 'interfaces' append_interface
|
|
|
|
|
|
|
|
service_start /usr/sbin/parprouted $args
|
|
|
|
}
|
2006-08-06 14:27:00 +00:00
|
|
|
|
2006-10-04 20:57:49 +00:00
|
|
|
start() {
|
2012-11-16 13:41:07 +00:00
|
|
|
. /lib/functions/network.sh
|
2012-05-28 15:38:58 +00:00
|
|
|
|
2011-11-17 10:47:19 +00:00
|
|
|
config_load 'parprouted'
|
|
|
|
config_foreach start_instance 'parprouted'
|
2006-10-04 20:57:49 +00:00
|
|
|
}
|
2006-08-06 14:27:00 +00:00
|
|
|
|
2006-10-04 20:57:49 +00:00
|
|
|
stop() {
|
2011-11-17 10:47:19 +00:00
|
|
|
service_stop /usr/sbin/parprouted
|
2006-10-04 20:57:49 +00:00
|
|
|
}
|