summaryrefslogtreecommitdiffstats
path: root/plugins-root/check_icmp.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2026-03-27 11:14:20 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2026-03-27 11:14:20 +0100
commit1113bbcd92d85b85579aa7feef511241e58fb0f5 (patch)
treed69b7bcfe2f7e80fda9a1f4ddd38209d6cb7aaf0 /plugins-root/check_icmp.c
parent99283972fe3a74d3a1dea12c4099f76286130a67 (diff)
parenta71ce153082565e5728424749475593dc0623492 (diff)
downloadmonitoring-plugins-1113bbcd92d85b85579aa7feef511241e58fb0f5.tar.gz
merged with mastercheck_snmp_fixes
Diffstat (limited to 'plugins-root/check_icmp.c')
-rw-r--r--plugins-root/check_icmp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index e536e31c..1390a03e 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -812,6 +812,15 @@ void parse_address(const struct sockaddr_storage *addr, char *dst, socklen_t siz
812} 812}
813 813
814int main(int argc, char **argv) { 814int main(int argc, char **argv) {
815#ifdef __OpenBSD__
816 /* - rpath is required to read --extra-opts (given up later)
817 * - inet is required for sockets
818 * - dns is required for name lookups (given up later)
819 * - id is required for temporary privilege drops in configparsing and for
820 * permanent privilege dropping after opening the socket (given up later) */
821 pledge("stdio rpath inet dns id", NULL);
822#endif // __OpenBSD__
823
815 setlocale(LC_ALL, ""); 824 setlocale(LC_ALL, "");
816 bindtextdomain(PACKAGE, LOCALEDIR); 825 bindtextdomain(PACKAGE, LOCALEDIR);
817 textdomain(PACKAGE); 826 textdomain(PACKAGE);
@@ -836,6 +845,10 @@ int main(int argc, char **argv) {
836 crash("failed to parse config"); 845 crash("failed to parse config");
837 } 846 }
838 847
848#ifdef __OpenBSD__
849 pledge("stdio inet dns id", NULL);
850#endif // __OpenBSD__
851
839 const check_icmp_config config = tmp_config.config; 852 const check_icmp_config config = tmp_config.config;
840 853
841 if (config.output_format_is_set) { 854 if (config.output_format_is_set) {
@@ -898,6 +911,10 @@ int main(int argc, char **argv) {
898 return 1; 911 return 1;
899 } 912 }
900 913
914#ifdef __OpenBSD__
915 pledge("stdio inet", NULL);
916#endif // __OpenBSD__
917
901 if (sockset.socket4) { 918 if (sockset.socket4) {
902 int result = setsockopt(sockset.socket4, SOL_IP, IP_TTL, &config.ttl, sizeof(config.ttl)); 919 int result = setsockopt(sockset.socket4, SOL_IP, IP_TTL, &config.ttl, sizeof(config.ttl));
903 if (debug) { 920 if (debug) {