# Use IPv6 prefix delegation.
PREFIX_DELEGATION="true"
-function hook_check_settings() {
+hook_check_settings() {
assert isset USERNAME
assert isset PASSWORD
assert isset PREFIX_DELEGATION
}
-function hook_parse_cmdline() {
+hook_parse_cmdline() {
while [ $# -gt 0 ]; do
case "${1}" in
--access-concentrator=*)
done
}
-function hook_up() {
+hook_up() {
local zone=${1}
assert isset zone
zone_settings_read "${zone}"
+ # Load the pppoe kernel module
+ module_load "pppoe"
+
# Bring up the port.
port_up "${port}"
exit ${EXIT_OK}
}
-function hook_down() {
+hook_down() {
local zone=${1}
assert isset zone
pppd_stop ${zone}
# Bring down the port.
- log DEBUG "Bringing down port '${PORT}'."
- port_down ${PORT}
+ local port=$(__hook_get_port "${zone}")
+ if isset port; then
+ log DEBUG "Bringing down port '${port}'"
+ port_down "${port}"
+ fi
exit ${EXIT_OK}
}
-function hook_hotplug() {
+hook_hotplug() {
local zone="${1}"
case "$(hotplug_action)" in
exit ${EXIT_NOT_HANDLED}
}
-function hook_discover() {
+hook_discover() {
local device=${1}
# This obviously only works on ethernet (or compatible) devices
exit ${DISCOVER_OK}
}
-function hook_status() {
+hook_status() {
local zone=${1}
assert isset zone
cli_headline 2 "Point-to-Point-over-Ethernet protocol"
local proto
for proto in ${IP_SUPPORTED_PROTOCOLS}; do
- routing_db_exists ${zone} ${proto} || continue
+ db_exists "${zone}/${proto}" || continue
local headline
case "${proto}" in
esac
cli_headline 3 "${headline}"
- cli_print_fmt1 3 "IP address" "$(routing_db_get ${zone} ${proto} local-ip-address)"
- cli_print_fmt1 3 "Gateway" "$(routing_db_get ${zone} ${proto} remote-ip-address)"
- cli_print_fmt1 3 "DNS servers" "$(routing_db_get ${zone} ${proto} dns)"
+ cli_print_fmt1 3 "IP address" "$(db_get "${zone}/${proto}/local-ip-address")"
+ cli_print_fmt1 3 "Gateway" "$(db_get "${zone}/${proto}/remote-ip-address")"
+ cli_print_fmt1 3 "DNS servers" "$(db_get "${zone}/${proto}/domain-name-servers")"
cli_space
- cli_print_fmt1 3 "MAC-Remote" "$(routing_db_get ${zone} ${proto} remote-address)"
+ cli_print_fmt1 3 "MAC-Remote" "$(db_get "${zone}/${proto}/remote-address")"
cli_space
done
exit ${EXIT_OK}
}
-function hook_ppp_write_config() {
+hook_ppp_write_config() {
local zone=${1}
assert isset zone
exit ${EXIT_OK}
}
-function __hook_get_port() {
+__hook_get_port() {
local zone="${1}"
local port
return ${EXIT_ERROR}
}
-function hook_port_attach() {
+hook_port_attach() {
# Excepting at least two arguments here
assert [ $# -ge 2 ]
exit ${EXIT_OK}
}
-function hook_port_detach() {
+hook_port_detach() {
assert [ $# -eq 2 ]
local zone="${1}"
exit ${EXIT_OK}
}
-function hook_ppp_ipv6_up() {
+hook_ppp_ipv6_up() {
local zone="${1}"
ppp_common_ipv6_up "${zone}"
exit ${EXIT_OK}
}
-function hook_ppp_ipv6_down() {
+hook_ppp_ipv6_down() {
local zone="${1}"
ppp_common_ipv6_down "${zone}"