2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2010 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 .
/usr
/lib
/network
/header-config
24 HOOK_SETTINGS
="HOOK MTU SERVICE_NAME SUBNET MAX_SESSIONS"
26 # Maximum Transmission Unit.
32 # A subnet. Addresses from this subnet will be given to the remote hosts.
33 # The net address will be the gateway address for the PPPoE server.
36 # Defines the max. number of sessions per MAC address.
43 assert isset MAX_SESSIONS
50 while [ $# -gt 0 ]; do
53 MAX_SESSIONS
=$
(cli_get_val
${1})
56 MTU
=$
(cli_get_val
${1})
59 SERVICE_NAME
=$
(cli_get_val
${1})
62 SUBNET
=$
(cli_get_val
${1})
68 zone_config_settings_write
"${zone}" "${HOOK}" ${HOOK_SETTINGS}
78 # Start the PPPoE server.
79 pppoe_server_start ${zone}
89 if ! device_exists ${zone}; then
90 error "Zone
'${zone}' doesn
't exist."
94 # Stop the PPPoE server.
95 pppoe_server_stop ${zone}
105 if ! device_exists ${zone}; then
106 error "Zone '${zone}' doesn't exist.
"
110 zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
113 if pppoe_server_status
${zone}; then
114 status
="${MSG_HOOK_UP}"
116 status
="${MSG_HOOK_DOWN}"
118 cli_statusline
3 "PPPoE server" "${status}"
120 local gateway
=$
(ipv4_get_network
${SUBNET})
121 cli_print_fmt1
3 "Gateway" "${gateway}"
123 local start_address
=$
(ipv4_encode
${gateway})
124 start_address
=$
(( ${start_address} + 1 ))
125 start_address
=$
(ipv4_decode
${start_address})
126 local end_address
=$
(ipv4_get_broadcast
${SUBNET})
128 cli_print_fmt1
3 "Client range" \
129 "${start_address}-${end_address}"
132 local max_sessions
=${MAX_SESSIONS}
133 if [ "${max_sessions}" = "0" ]; then
134 max_sessions
="unlimited"
136 cli_print_fmt1
3 "${max_sessions} session(s) per MAC"