-/* $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>
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 */
-/* $OpenBSD: slaacd.h,v 1.38 2022/07/12 16:55:00 florian Exp $ */
+/* $OpenBSD: slaacd.h,v 1.39 2024/08/24 09:42:40 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
int, void *, uint16_t);
#ifndef SMALL
const char *sin6_to_str(struct sockaddr_in6 *);
+const char *i2s(uint32_t);
#else
#define sin6_to_str(x...) ""
+#define i2s(x...) ""
#endif /* SMALL */