]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/functions/functions.pppoe-server
hooks: Use cli_get_bool convenience function where ever possible
[people/ms/network.git] / src / functions / functions.pppoe-server
index 5d65d24ecb89aae93471290f410ab7c0a5eb421b..a643d9f8e001df8a579d833a594169bf9208bc60 100644 (file)
@@ -185,22 +185,25 @@ pppoe_server_options() {
 }
 
 pppoe_server_poolfile() {
-       local file=${1}
+       local file="${1}"
        assert isset file
 
-       local subnet=${2}
+       local subnet="${2}"
        assert isset subnet
 
-       config_header "PPPoE server IP address pool file" > ${file}
+       (
+               config_header "PPPoE server IP address pool file"
+
+               i=0
+               for addr in $(ipv4_range_explicit "${subnet}"); do
+                       (( i++ ))
 
-       # The network address will be the gateway address.
-       local netaddr=$(ipv4_get_network ${subnet})
+                       # Skip the first address which is being used for the gateway
+                       [ ${i} -eq 1 ] && continue
 
-       local addr
-       for addr in $(ipv4_range_explicit ${subnet}); do
-               [ "${addr}" = "${netaddr}" ] && continue
-               print "${addr}"
-       done >> ${file}
+                       print "${addr}"
+               done
+       ) > ${file}
 
        return ${EXIT_OK}
 }