]> git.ipfire.org Git - people/stevee/network.git/commitdiff
Merge branch 'master' of ssh://git.ipfire.org/pub/git/network
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 2 May 2015 21:31:30 +0000 (21:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 2 May 2015 21:31:30 +0000 (21:31 +0000)
Conflicts:
src/functions/functions.dhcpd
src/functions/functions.ipv6

1  2 
src/functions/functions.dhcpd
src/functions/functions.ipv6
src/network

index a4e10e58ddf8d523884d9eb4cba26bb67bee67ef,05e795222e4bad7e4df773cc003e37699778e119..b1f876742e45533791bacbf5a8df5f98292e8d3f
@@@ -972,22 -898,25 +972,22 @@@ _dhcpd_write_options() 
                        key="dhcp6.${key}"
                fi
  
 -              if isset val; then
 -                      if isinteger val; then
 -                              fmt="option %s %d;"
 -                      elif isipaddress val; then
 -                              fmt="option %s %s;"
 -                      else
 -                              fmt="option %s \"%s\";"
 -                      fi
 -                      print "${ident}${fmt}" "${key}" "${val}"
 +              if isinteger val; then
 +                      fmt="option %s %d;"
 +              elif enabled raw || isipaddress val; then
 +                      fmt="option %s %s;"
 +              else
 +                      fmt="option %s \"%s\";"
                fi
 +
 +              print "${ident}${fmt}" "${key}" "${val}"
        done >> ${file}
  
 -      # Append an empty line when options have been written.
 -      if [ -n "${!options[@]}" ]; then
 -              print >> ${file}
 -      fi
 +      # Empty line
 +      print >> ${file}
  }
  
function _dhcpd_read_options() {
+ _dhcpd_read_options() {
        local file=${1}
        assert isset file
  
@@@ -1094,31 -1018,7 +1094,31 @@@ _dhcpd_write_subnet_options() 
        _dhcpd_write_options ${proto} ${file} ${options_list} "\t"
  }
  
- function _dhcpd_search_routers() {
 +_dhcpd_write_subnet_pd() {
 +      # Nothing to do if prefix delegation is not enabled
 +      enabled PREFIX_DELEGATION || return ${EXIT_OK}
 +
 +      local subnet_id="${1}"
 +      assert isset subnet_id
 +
 +      local file="${2}"
 +      assert isset file
 +
 +      local prefix_size="${DELEGATED_PREFIX_SIZE}"
 +      isset prefix_size || prefix_size="${DHCP_DEFAULT_DELEGATED_PREFIX_SIZE}"
 +
 +      assert ipv6_is_valid "${DELEGATED_PREFIX_FIRST}"
 +      assert ipv6_is_valid "${DELEGATED_PREFIX_LAST}"
 +      assert ipv6_prefix_size_is_valid_for_delegation "${prefix_size}"
 +
 +      (
 +              print " # Prefix Delegation"
 +              print " prefix6 ${DELEGATED_PREFIX_FIRST} ${DELEGATED_PREFIX_LAST} /${prefix_size};"
 +              print ""
 +      ) >> "${file}"
 +}
 +
+ _dhcpd_search_routers() {
        local proto=${1}
        assert isset proto
  
index 537819cfb050177954617bbac3389471dca4fd40,5e618dc531994211564b8292251ae6b9a1ed16e9..9026cd88c866ec6ceb07de3aed782f8d71edae32
@@@ -75,19 -127,7 +127,19 @@@ ipv6_prefix_is_valid() 
        return ${EXIT_TRUE}
  }
  
- function ipv6_get_prefix() {
 +ipv6_prefix_size_is_valid_for_delegation() {
 +      local prefix_size="${1}"
 +      assert isinteger prefix_size
 +
 +      # For prefix delegation, the prefix must be between /48 and /64
 +      # (RFC3769, section 3.1)
 +      [[ ${prefix_size} -lt 48 ]] && return ${EXIT_FALSE}
 +      [[ ${prefix_size} -gt 64 ]] && return ${EXIT_FALSE}
 +
 +      return ${EXIT_TRUE}
 +}
 +
+ ipv6_get_prefix() {
        ip_get_prefix "$@"
  }
  
diff --cc src/network
Simple merge