summaryrefslogtreecommitdiffstats
path: root/plugins-root/check_dhcp.d
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-06-23 13:31:00 +0200
committerGitHub <noreply@github.com>2025-06-23 13:31:00 +0200
commitf43c52194ce60b7a7fec463be0df7025705b8924 (patch)
tree4ee0f8dff73fda121117f12e5aaccb2b514ae3d1 /plugins-root/check_dhcp.d
parent1150082f6042e50c6fe109d15b4e68ea27e0c890 (diff)
parent9f776105d44190587a587b7398f5d907611a20b0 (diff)
downloadmonitoring-plugins-master.tar.gz
Merge pull request #2116 from RincewindsHat/refactor/check_dhcpHEADmaster
Refactor/check dhcp
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}