]>
git.ipfire.org Git - people/stevee/network.git/blob - ppp/pppoe-server
33da580edab1c17f5536d7b56101d743f8ba0c67
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 # This is a wrapper script which does some on-the-fly configuration of the
23 # pppoe-server daemon, which does not support any configuration files.
25 LOG_FACILITY
="pppoe-server"
26 .
/usr
/lib
/network
/functions
29 assert zone_exists
${zone}
33 # Read the configuration file of this hook.
34 config_read $
(zone_dir
${zone})/configs
/pppoe-server
37 pppd_options
="${RUN_DIR}/${zone}/pppoe-server-options"
38 pool_file
="${RUN_DIR}/${zone}/pppoe-server-pool"
42 # Cleanup all temporary files.
43 rm -f ${pppd_options} ${pool_file}
49 # Don't let the server fork to background.
52 # Add the interface to listen to.
53 pppoe_cmdline
="${pppoe_cmdline} -I ${zone}"
55 # Enable kernel-mode PPPoE.
56 # (The version that is shipped with IPFire does not
57 # support the userspace implementation and therefore
58 # kernel-mode PPPoE is enabled by default).
59 #pppoe_cmdline="${pppoe_cmdline} -k"
61 # Randomize session IDs.
62 pppoe_cmdline
="${pppoe_cmdline} -r"
64 # Add the service name.
65 if isset SERVICE_NAME
; then
66 pppoe_cmdline
="${pppoe_cmdline} -S ${SERVICE_NAME// /_}"
69 # Add the max. number of sessions per MAC address.
70 if [ ${MAX_SESSIONS} -gt 0 ]; then
71 pppoe_cmdline
="${pppoe_cmdline} -x ${MAX_SESSIONS}"
74 # Create the pppoe-server-options file.
75 pppoe_server_options
${pppd_options} ${zone}
76 pppoe_cmdline
="${pppoe_cmdline} -O ${pppd_options}"
78 # Configure the IP addresses.
79 local_address
=$
(ipv4_get_network
${SUBNET})
80 pppoe_cmdline
="${pppoe_cmdline} -L ${local_address}"
82 # Create the address pool.
83 pppoe_server_poolfile
${pool_file} ${SUBNET}
84 pppoe_cmdline
="${pppoe_cmdline} -p ${pool_file}"
86 log INFO
"Starting pppoe-server daemon..."
87 log DEBUG
"pppoe-server options: ${pppoe_cmdline}"
89 # Now exec the actual pppoe-server binary.
90 exec pppoe-server
${pppoe_cmdline}
92 error
"Could not execute pppoe-server. Exiting."