summaryrefslogtreecommitdiff
path: root/sbin/slaacd/slaacd.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2024-08-24 09:42:41 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2024-08-24 09:42:41 +0000
commitffaf41f3ccc59f7930b81dc9f2649da26c7e7c59 (patch)
treede709639eb103e0ecde998b1820fa200656f9be6 /sbin/slaacd/slaacd.c
parent5a69726c7ec7b48d9d70476ebe02a8560a17942f (diff)
Helper function for logging imsg type names.
OK tb as part of a larger diff
Diffstat (limited to 'sbin/slaacd/slaacd.c')
-rw-r--r--sbin/slaacd/slaacd.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c
index 05af06e68de..8d3f183d716 100644
--- a/sbin/slaacd/slaacd.c
+++ b/sbin/slaacd/slaacd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.c,v 1.69 2024/04/21 17:33:05 florian Exp $ */
+/* $OpenBSD: slaacd.c,v 1.70 2024/08/24 09:42:40 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -899,3 +899,54 @@ open_icmp6sock(int rdomain)
main_imsg_compose_frontend(IMSG_ICMP6SOCK, icmp6sock, &rdomain,
sizeof(rdomain));
}
+
+#ifndef SMALL
+
+#define I2S(x) case x: return #x
+
+const char*
+i2s(uint32_t type)
+{
+ static char unknown[sizeof("IMSG_4294967295")];
+
+ switch (type) {
+ I2S(IMSG_NONE);
+ I2S(IMSG_CTL_LOG_VERBOSE);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO_RA);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO_RA_PREFIX);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO_RA_RDNS);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO_ADDR_PROPOSALS);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO_ADDR_PROPOSAL);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO_DFR_PROPOSALS);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO_DFR_PROPOSAL);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO_RDNS_PROPOSALS);
+ I2S(IMSG_CTL_SHOW_INTERFACE_INFO_RDNS_PROPOSAL);
+ I2S(IMSG_CTL_END);
+ I2S(IMSG_PROPOSE_RDNS);
+ I2S(IMSG_REPROPOSE_RDNS);
+ I2S(IMSG_CTL_SEND_SOLICITATION);
+ I2S(IMSG_SOCKET_IPC);
+ I2S(IMSG_OPEN_ICMP6SOCK);
+ I2S(IMSG_ICMP6SOCK);
+ I2S(IMSG_ROUTESOCK);
+ I2S(IMSG_CONTROLFD);
+ I2S(IMSG_STARTUP);
+ I2S(IMSG_UPDATE_IF);
+ I2S(IMSG_REMOVE_IF);
+ I2S(IMSG_RA);
+ I2S(IMSG_CONFIGURE_ADDRESS);
+ I2S(IMSG_WITHDRAW_ADDRESS);
+ I2S(IMSG_DEL_ADDRESS);
+ I2S(IMSG_DEL_ROUTE);
+ I2S(IMSG_CONFIGURE_DFR);
+ I2S(IMSG_WITHDRAW_DFR);
+ I2S(IMSG_DUP_ADDRESS);
+ default:
+ snprintf(unknown, sizeof(unknown), "IMSG_%u", type);
+ return unknown;
+ }
+}
+#undef I2S
+
+#endif /* SMALL */