summaryrefslogtreecommitdiffstats
path: root/plugins-root/check_dhcp.d
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-08-11 21:54:05 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-08-11 21:54:05 +0200
commit7382fa90f84d38cd2ae08c880e9ed6a4ad644d35 (patch)
treee367f424cfb94bd6730e196916a96a9725e61c27 /plugins-root/check_dhcp.d
parentfb39f96ac6f72bb56d17f3e8694134dfea9186e9 (diff)
parent1dfb5a0c10881b43cb60cf93bab63648c61201b5 (diff)
downloadmonitoring-plugins-7382fa90f84d38cd2ae08c880e9ed6a4ad644d35.tar.gz
Merge branch 'master' into refactor/check_users
Diffstat (limited to 'plugins-root/check_dhcp.d')
-rw-r--r--plugins-root/check_dhcp.d/config.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/plugins-root/check_dhcp.d/config.h b/plugins-root/check_dhcp.d/config.h
new file mode 100644
index 00000000..f189068b
--- /dev/null
+++ b/plugins-root/check_dhcp.d/config.h
@@ -0,0 +1,50 @@
1#pragma once
2
3#include "../../config.h"
4#include "../lib/states.h"
5#include <stdbool.h>
6#include <netinet/in.h>
7#include "net/if.h"
8#include "output.h"
9
10typedef struct requested_server_struct {
11 struct in_addr server_address;
12 bool answered;
13 struct requested_server_struct *next;
14} requested_server;
15
16typedef struct check_dhcp_config {
17 bool unicast_mode; /* unicast mode: mimic a DHCP relay */
18 bool exclusive_mode; /* exclusive mode aka "rogue DHCP server detection" */
19 int num_of_requested_servers;
20 struct in_addr dhcp_ip; /* server to query (if in unicast mode) */
21 struct in_addr requested_address;
22 bool request_specific_address;
23
24 int dhcpoffer_timeout;
25 unsigned char *user_specified_mac;
26 char network_interface_name[IFNAMSIZ];
27 requested_server *requested_server_list;
28
29 mp_output_format output_format;
30 bool output_format_is_set;
31} check_dhcp_config;
32
33check_dhcp_config check_dhcp_config_init(void) {
34 check_dhcp_config tmp = {
35 .unicast_mode = false,
36 .exclusive_mode = false,
37 .num_of_requested_servers = 0,
38 .dhcp_ip = {0},
39 .requested_address = {0},
40 .request_specific_address = false,
41
42 .dhcpoffer_timeout = 2,
43 .user_specified_mac = NULL,
44 .network_interface_name = "eth0",
45 .requested_server_list = NULL,
46
47 .output_format_is_set = false,
48 };
49 return tmp;
50}