{% if helpers.exists('OPNsense.freeradius.general.dhcpenabled') and OPNsense.freeradius.general.dhcpenabled == '1' %}

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})"

}

{% endif %}
