]>
git.ipfire.org Git - people/stevee/network.git/blob - src/functions/functions.pppoe-server
5c9860b096d8ecd894ca2066d3ff04fa95063147
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2012 IPFire Network Development Team #
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 ###############################################################################
23 # Load the pppoe kernel module
27 pppoe_server_start
() {
31 # Initialise the system for this
34 service_start
"pppoe-server@${zone}.service"
41 service_stop
"pppoe-server@${zone}.service"
44 pppoe_server_status
() {
48 service_status
"pppoe-server@${zone}.service"
51 pppoe_server_options
() {
61 local default_asyncmap
="true"
63 local lcp_echo_failure
=5
64 local lcp_echo_interval
=60
69 while [ $# -gt 0 ]; do
72 auth
=$
(cli_get_val
${1})
75 default_asyncmap
=$
(cli_get_val
${1})
78 dns_servers
="${dns_servers} $(cli_get_val ${1})"
81 lcp_echo_failure
=$
(cli_get_val
${1})
82 assert isinteger
${lcp_echo_failure}
84 --lcp-echo-interval=*)
85 lcp_echo_interval
=$
(cli_get_val
${1})
86 assert isinteger
${lcp_echo_interval}
89 proxyarp
=$
(cli_get_val
${1})
92 required_auths
="${required_auths} $(cli_get_val ${1})"
98 mkdir
-p $
(dirname ${file}) 2>/dev
/null
99 config_header
"pppoe-server options configuration file" > ${file}
103 print
"# Authentication"
104 if enabled auth
; then
112 # If there are only a number of auth algorithms allowed, we
114 if isset required_auths
; then
115 print
"# Required authentication methods" >> ${file}
117 for method
in ${required_auths}; do
118 print
"require-${method}"
124 if isset dns_servers
; then
125 print
"# DNS servers" >> ${file}
127 for server
in ${dns_servers}; do
128 print
"ms-dns ${server}"
134 if enabled default_asyncmap
; then
136 print
"# Default asyncmap"
137 print
"default-asyncmap"
144 print
"# LCP settings"
145 print
"lcp-echo-failure ${lcp_echo_failure}"
146 print
"lcp-echo-interval ${lcp_echo_interval}"
153 if enabled proxyarp
; then
161 # Default options, we always set.
164 print
"nodefaultroute"
172 pppoe_server_poolfile
() {
179 config_header
"PPPoE server IP address pool file" > ${file}
181 # The network address will be the gateway address.
182 local netaddr
=$
(ipv4_get_network
${subnet})
185 for addr
in $
(ipv4_range_explicit
${subnet}); do
186 [ "${addr}" = "${netaddr}" ] && continue