]>
git.ipfire.org Git - people/ms/network.git/blob - functions.pppoe-server
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 ###############################################################################
22 function pppoe_server_start
() {
26 service_start
"pppoe-server@${zone}.service"
29 function pppoe_server_stop
() {
33 service_stop
"pppoe-server@${zone}.service"
36 function pppoe_server_status
() {
40 service_status
"pppoe-server@${zone}.service"
43 function pppoe_server_options
() {
53 local default_asyncmap
="true"
55 local lcp_echo_failure
=5
56 local lcp_echo_interval
=60
61 while [ $# -gt 0 ]; do
64 auth
=$
(cli_get_val
${1})
67 default_asyncmap
=$
(cli_get_val
${1})
70 dns_servers
="${dns_servers} $(cli_get_val ${1})"
73 lcp_echo_failure
=$
(cli_get_val
${1})
74 assert isinteger
${lcp_echo_failure}
76 --lcp-echo-interval=*)
77 lcp_echo_interval
=$
(cli_get_val
${1})
78 assert isinteger
${lcp_echo_interval}
81 proxyarp
=$
(cli_get_val
${1})
84 required_auths
="${required_auths} $(cli_get_val ${1})"
90 mkdir
-p $
(dirname ${file}) 2>/dev
/null
91 config_header
"pppoe-server options configuration file" > ${file}
95 print
"# Authentication"
104 # If there are only a number of auth algorithms allowed, we
106 if isset required_auths
; then
107 print
"# Required authentication methods" >> ${file}
109 for method
in ${required_auths}; do
110 print
"require-${method}"
116 if isset dns_servers
; then
117 print
"# DNS servers" >> ${file}
119 for server
in ${dns_servers}; do
120 print
"ms-dns ${server}"
126 if enabled default_asyncmap
; then
128 print
"# Default asyncmap"
129 print
"default-asyncmap"
136 print
"# LCP settings"
137 print
"lcp-echo-failure ${lcp_echo_failure}"
138 print
"lcp-echo-interval ${lcp_echo_interval}"
145 if enabled proxyarp
; then
153 # Default options, we always set.
156 print
"nodefaultroute"
164 function pppoe_server_poolfile
() {
171 config_header
"PPPoE server IP address pool file" > ${file}
173 # The network address will be the gateway address.
174 local netaddr
=$
(ipv4_get_network
${subnet})
177 for addr
in $
(ipv4_range_explicit
${subnet}); do
178 [ "${addr}" = "${netaddr}" ] && continue