#  Configuration for DHCP to use SQL IP Pools.
#
#  See raddb/mods-available/sqlippool for common configuration explanation
#
#  See raddb/policy.d/dhcp_sqlippool for the "glue" code that allows
#  the RADIUS based "sqlippool" module to be used for DHCP.
#
#  See raddb/mods-config/sql/ippool/ for the schemas.
#
#  See raddb/sites-available/dhcp for instructions on how to configure
#  the DHCP server.
#
#  $Id: ee0d3d56db3447083a1d7768e28a30cb76aba53a $

sqlippool dhcp_sqlippool {
	sql_module_instance = "sql"

	ippool_table = "radippool"

	# Name of the check item attribute to be used as a key in the SQL queries
	pool_name = "Pool-Name"

	lease_duration = 7200

	# Client's MAC address is mapped to Calling-Station-Id in policy.conf
	pool_key = "%{Calling-Station-Id}"

	# For now, it works with MySQL.
	$INCLUDE ${modconfdir}/sql/ippool-dhcp/mysql/queries.conf

	# It may also work with sqlite - this is very experimental.
	# Comment out the above line and add the following include.
	# To use sqlite you need to add '%' to safe_characters in
	# raddb/mods-config/sql/main/sqlite/queries.conf.
	# $INCLUDE ${modconfdir}/sql/ippool-dhcp/sqlite/queries.conf

	sqlippool_log_exists = "DHCP: Existing IP: %{reply:Framed-IP-Address} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"

	sqlippool_log_success = "DHCP: Allocated IP: %{reply:Framed-IP-Address} from %{control:${..pool_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"

	sqlippool_log_clear = "DHCP: Released IP %{Framed-IP-Address} (did %{Called-Station-Id} cli %{Calling-Station-Id} user %{User-Name})"

	sqlippool_log_failed = "DHCP: IP Allocation FAILED from %{control:${..pool_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"

	sqlippool_log_nopool = "DHCP: No ${..pool_name} defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"

}
