From 88928399279bb5fa5459d157c4c684450021dd25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zsombor=20Bodn=C3=A1r?= <zsombor.bodnar@kszk.bme.hu>
Date: Fri, 27 Aug 2021 11:25:24 +0200
Subject: [PATCH] SM-19

---
 CMakeLists.txt                                |  3 +-
 ...chmatrix-kea-dhcp4.conf => kea-dhcp4.conf} |  2 +-
 config/schmatrix-kea-ctrl-agent.conf          | 13 ------
 config/schmatrix-keactrl.conf                 | 41 -------------------
 src/callouts.cc                               |  2 +-
 5 files changed, 3 insertions(+), 58 deletions(-)
 rename config/{schmatrix-kea-dhcp4.conf => kea-dhcp4.conf} (98%)
 delete mode 100644 config/schmatrix-kea-ctrl-agent.conf
 delete mode 100644 config/schmatrix-keactrl.conf

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb04091..9a9e05b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,5 +31,4 @@ target_include_directories(${PROJECT_NAME} PRIVATE /usr/include/kea
 
 install(TARGETS ${PROJECT_NAME}
         LIBRARY DESTINATION /usr/lib/x86_64-linux-gnu/kea/hooks)
-install(FILES config/schmatrix-kea-dhcp4.conf config/schmatrix-keactrl.conf
-        DESTINATION /etc/kea/)
+install(FILES config/kea-dhcp4.conf DESTINATION /etc/kea/)
diff --git a/config/schmatrix-kea-dhcp4.conf b/config/kea-dhcp4.conf
similarity index 98%
rename from config/schmatrix-kea-dhcp4.conf
rename to config/kea-dhcp4.conf
index 998a1ac..2979da7 100644
--- a/config/schmatrix-kea-dhcp4.conf
+++ b/config/kea-dhcp4.conf
@@ -24,7 +24,7 @@
                 "parameters": {
                     "host": "localhost",
                     "port": "5432",
-                    "database": "postgres",
+                    "database": "schmatrix",
                     "username": "dhcp",
                     "password": "dhcp"
                 }
diff --git a/config/schmatrix-kea-ctrl-agent.conf b/config/schmatrix-kea-ctrl-agent.conf
deleted file mode 100644
index 1dee70e..0000000
--- a/config/schmatrix-kea-ctrl-agent.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-    "Control-agent": {
-        "http-host": "127.0.0.1",
-        "http-port": 8080,
-        "control-sockets": {
-            "dhcp4": {
-                "comment": "main server",
-                "socket-type": "unix",
-                "socket-name": "/tmp/kea-dhcp4-ctrl.sock"
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/config/schmatrix-keactrl.conf b/config/schmatrix-keactrl.conf
deleted file mode 100644
index 172e5c9..0000000
--- a/config/schmatrix-keactrl.conf
+++ /dev/null
@@ -1,41 +0,0 @@
-# This is a configuration file for keactrl script which controls
-# the startup, shutdown, reconfiguration and gathering the status
-# of the Kea's processes.
-
-# Note that control agent must be launched after servers and netconf last.
-
-# prefix holds the location where the Kea is installed.
-prefix=/usr
-
-# Location of Kea configuration files.
-kea_dhcp4_config_file=/etc/kea/schmatrix-kea-dhcp4.conf
-kea_dhcp6_config_file=/etc/kea/kea-dhcp6.conf
-kea_dhcp_ddns_config_file=/etc/kea/kea-dhcp-ddns.conf
-kea_ctrl_agent_config_file=/etc/kea/schmatrix-kea-ctrl-agent.conf
-kea_netconf_config_file=/etc/kea/kea-netconf.conf
-
-# Location of Kea binaries.
-exec_prefix=${prefix}
-dhcp4_srv=${exec_prefix}/sbin/kea-dhcp4
-dhcp6_srv=${exec_prefix}/sbin/kea-dhcp6
-dhcp_ddns_srv=${exec_prefix}/sbin/kea-dhcp-ddns
-ctrl_agent_srv=${exec_prefix}/sbin/kea-ctrl-agent
-netconf_srv=${exec_prefix}/sbin/kea-netconf
-
-# Start DHCPv4 server?
-dhcp4=yes
-
-# Start DHCPv6 server?
-dhcp6=no
-
-# Start DHCP DDNS server?
-dhcp_ddns=no
-
-# Start Control Agent?
-ctrl_agent=no
-
-# Start Netconf?
-netconf=no
-
-# Be verbose?
-kea_verbose=no
diff --git a/src/callouts.cc b/src/callouts.cc
index 394f355..12f6285 100644
--- a/src/callouts.cc
+++ b/src/callouts.cc
@@ -187,7 +187,7 @@ int lease4_decline(isc::hooks::CalloutHandle &handle) {
   // set IP conflict to true
   const char *values[] = {mac_address.c_str()};
   isc::db::PgSqlResult r(PQexecPrepared(*g_pg_sql_connection, "set_ip_conflict",
-                                        2, values, nullptr, nullptr, 0));
+                                        1, values, nullptr, nullptr, 0));
 
   return 0;
 }
-- 
GitLab