With the help of tb@ and include-what-you-use.
OK tb@
-/* $OpenBSD: application.c,v 1.40 2023/11/16 14:35:25 martijn Exp $ */
+/* $OpenBSD: application.c,v 1.41 2023/12/21 12:43:30 martijn Exp $ */
/*
* Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org>
*/
#include <sys/queue.h>
+#include <sys/time.h>
#include <sys/tree.h>
+#include <sys/types.h>
#include <assert.h>
#include <errno.h>
-/* $OpenBSD: application_agentx.c,v 1.14 2023/11/06 11:04:41 martijn Exp $ */
+/* $OpenBSD: application_agentx.c,v 1.15 2023/12/21 12:43:30 martijn Exp $ */
/*
* Copyright (c) 2022 Martijn van Duren <martijn@openbsd.org>
*
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
+#include <sys/tree.h>
#include <sys/un.h>
+#include <ber.h>
#include <errno.h>
#include <event.h>
#include <inttypes.h>
-#include <stdlib.h>
+#include <stdint.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-/* $OpenBSD: application_blocklist.c,v 1.1 2022/06/30 11:28:36 martijn Exp $ */
+/* $OpenBSD: application_blocklist.c,v 1.2 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2022 Martijn van Duren <martijn@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <event.h>
+#include <sys/types.h>
+
+#include <stddef.h>
+
+#include <ber.h>
+#include <stdint.h>
#include <stdlib.h>
#include "application.h"
+#include "log.h"
#include "snmpd.h"
struct appl_varbind *appl_blocklist_response(size_t);
-/* $OpenBSD: application_internal.c,v 1.10 2023/12/18 09:42:57 martijn Exp $ */
+/* $OpenBSD: application_internal.c,v 1.11 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2023 Martijn van Duren <martijn@openbsd.org>
*/
#include <sys/tree.h>
+#include <sys/types.h>
+#include <stddef.h>
+
+#include <ber.h>
#include <errno.h>
-#include <event.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include "application.h"
#include "log.h"
#include "mib.h"
#include "smi.h"
+#include "snmp.h"
#include "snmpd.h"
struct appl_internal_object {
-/* $OpenBSD: ax.c,v 1.3 2023/10/24 08:54:52 martijn Exp $ */
+/* $OpenBSD: ax.c,v 1.4 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org>
*
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <strings.h>
#include <unistd.h>
#include "ax.h"
-/* $OpenBSD: ax.h,v 1.2 2023/10/24 08:54:52 martijn Exp $ */
+/* $OpenBSD: ax.h,v 1.3 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/types.h>
+
+#include <endian.h>
#include <stdint.h>
#define AX_PDU_FLAG_INSTANCE_REGISTRATION (1 << 0)
-/* $OpenBSD: log.c,v 1.16 2017/03/21 12:06:56 bluhm Exp $ */
+/* $OpenBSD: log.c,v 1.17 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/types.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
-/* $OpenBSD: parse.y,v 1.85 2023/12/18 16:58:26 martijn Exp $ */
+/* $OpenBSD: parse.y,v 1.86 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
*/
%{
-#include <sys/types.h>
-#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/queue.h>
-#include <sys/tree.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/un.h>
#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <net/if.h>
-
#include <arpa/inet.h>
+#include <netinet/in.h>
+
#include <openssl/sha.h>
+#include <ber.h>
#include <ctype.h>
-#include <unistd.h>
#include <err.h>
#include <errno.h>
-#include <event.h>
#include <grp.h>
#include <inttypes.h>
#include <limits.h>
-#include <stdint.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
#include <netdb.h>
#include <pwd.h>
-#include <string.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <strings.h>
#include <syslog.h>
+#include <unistd.h>
#include "application.h"
-#include "snmpd.h"
+#include "log.h"
#include "mib.h"
+#include "snmpd.h"
+#include "snmp.h"
TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files);
static struct file {
-/* $OpenBSD: proc.c,v 1.28 2023/02/15 20:44:01 tobhe Exp $ */
+/* $OpenBSD: proc.c,v 1.29 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
-#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <event.h>
#include <imsg.h>
+#include "log.h"
#include "snmpd.h"
void proc_exec(struct privsep *, struct privsep_proc *, unsigned int, int,
-/* $OpenBSD: smi.c,v 1.38 2023/11/12 20:14:39 martijn Exp $ */
+/* $OpenBSD: smi.c,v 1.39 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/queue.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/un.h>
#include <sys/tree.h>
-#include <sys/sysctl.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_arp.h>
-#include <net/if_media.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
#include <arpa/inet.h>
-#include <stdlib.h>
-#include <stdio.h>
+#include <ber.h>
#include <errno.h>
-#include <event.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
#include <limits.h>
-#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
#include <vis.h>
-#include "snmpd.h"
+#include "log.h"
#include "mib.h"
-#include "application.h"
+#include "smi.h"
+#include "snmp.h"
+#include "snmpd.h"
struct oid {
struct ber_oid o_id;
-/* $OpenBSD: smi.h,v 1.3 2023/11/08 20:02:52 martijn Exp $ */
+/* $OpenBSD: smi.h,v 1.4 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <ber.h>
-#include <stdint.h>
+#include <sys/types.h>
+
+struct ber_element;
+struct ber_oid;
char *smi_oid2string(struct ber_oid *, char *, size_t, size_t);
u_long smi_getticks(void);
-/* $OpenBSD: snmp.h,v 1.19 2022/06/30 09:42:19 martijn Exp $ */
+/* $OpenBSD: snmp.h,v 1.20 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
#define SNMPD_SNMP_H
#include <sys/types.h>
-#include <endian.h>
/*
* SNMP IMSG interface
-/* $OpenBSD: snmpd.c,v 1.48 2022/10/06 14:41:08 martijn Exp $ */
+/* $OpenBSD: snmpd.c,v 1.49 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
*/
#include <sys/types.h>
-#include <sys/queue.h>
-#include <sys/socket.h>
#include <sys/wait.h>
-#include <sys/tree.h>
-
-#include <net/if.h>
#include <dirent.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
#include <err.h>
#include <errno.h>
-#include <event.h>
+#include <pwd.h>
#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <syslog.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <pwd.h>
+#include "log.h"
#include "snmpd.h"
-#include "mib.h"
__dead void usage(void);
-/* $OpenBSD: snmpd.h,v 1.114 2023/11/13 15:05:14 martijn Exp $ */
+/* $OpenBSD: snmpd.h,v 1.115 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
#ifndef SNMPD_H
#define SNMPD_H
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/time.h>
#include <sys/tree.h>
+#include <sys/types.h>
#include <sys/un.h>
-#include <net/if.h>
-#include <net/if_dl.h>
#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/ip.h>
-#include <arpa/inet.h>
-#include <net/pfvar.h>
-#include <net/route.h>
#include <ber.h>
-#include <stdio.h>
+#include <event.h>
+#include <limits.h>
#include <imsg.h>
+#include <stddef.h>
+#include <stdint.h>
-#include "log.h"
-#include "smi.h"
#include "snmp.h"
#ifndef nitems
-/* $OpenBSD: snmpe.c,v 1.92 2023/11/20 10:32:45 martijn Exp $ */
+/* $OpenBSD: snmpe.c,v 1.93 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
*/
#include <sys/queue.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <sys/socket.h>
-#include <sys/un.h>
+#include <sys/time.h>
#include <sys/tree.h>
+#include <sys/types.h>
-#include <net/if.h>
#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
+#include <ber.h>
#include <event.h>
+#include <errno.h>
#include <fcntl.h>
+#include <imsg.h>
#include <locale.h>
+#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
+#include <strings.h>
#include <unistd.h>
-#include <pwd.h>
#include "application.h"
+#include "log.h"
#include "snmpd.h"
#include "snmpe.h"
#include "mib.h"
-/* $OpenBSD: snmpe.h,v 1.2 2022/01/19 10:36:35 martijn Exp $ */
+/* $OpenBSD: snmpe.h,v 1.3 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <stdint.h>
+
#include "snmp.h"
struct snmp_message;
+struct ber_element;
void snmpe_send(struct snmp_message *, enum snmp_pdutype, int32_t,
int32_t, uint32_t, struct ber_element *);
-/* $OpenBSD: trap.c,v 1.40 2023/12/12 20:18:39 martijn Exp $ */
+/* $OpenBSD: trap.c,v 1.41 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org>
*/
#include <sys/queue.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/tree.h>
-
-#include <net/if.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+#include <ber.h>
+#include <stdint.h>
#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <event.h>
-#include <fcntl.h>
#include <string.h>
-#include <unistd.h>
-#include <pwd.h>
-#include "snmpd.h"
+#include "log.h"
#include "mib.h"
+#include "smi.h"
+#include "snmp.h"
+#include "snmpd.h"
void
trap_init(void)
-/* $OpenBSD: traphandler.c,v 1.24 2022/12/28 21:30:19 jmc Exp $ */
+/* $OpenBSD: traphandler.c,v 1.25 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2014 Bret Stephen Lambert <blambert@openbsd.org>
#include <sys/queue.h>
#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/uio.h>
+#include <sys/tree.h>
#include <sys/wait.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
#include <ber.h>
#include <errno.h>
-#include <event.h>
-#include <fcntl.h>
#include <imsg.h>
#include <netdb.h>
+#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <strings.h>
#include <syslog.h>
#include <unistd.h>
-#include <pwd.h>
+#include "log.h"
+#include "smi.h"
+#include "snmp.h"
#include "snmpd.h"
-#include "mib.h"
int traphandler_priv_recvmsg(struct privsep_proc *, struct imsg *);
int traphandler_fork_handler(struct privsep_proc *, struct imsg *);
-/* $OpenBSD: usm.c,v 1.28 2023/11/08 20:09:18 martijn Exp $ */
+/* $OpenBSD: usm.c,v 1.29 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2012 GeNUA mbH
#include <sys/queue.h>
#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/tree.h>
-#include <net/if.h>
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
-#include <errno.h>
-#include <event.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
#ifdef DEBUG
#include <assert.h>
#endif
-
-#include <openssl/evp.h>
-#include <openssl/hmac.h>
+#include <ber.h>
+#include <endian.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
#include "application.h"
-#include "snmpd.h"
+#include "log.h"
#include "mib.h"
+#include "snmp.h"
+#include "snmpd.h"
SLIST_HEAD(, usmuser) usmuserlist;
-/* $OpenBSD: util.c,v 1.13 2022/10/06 14:41:08 martijn Exp $ */
+/* $OpenBSD: util.c,v 1.14 2023/12/21 12:43:31 martijn Exp $ */
/*
* Copyright (c) 2014 Bret Stephen Lambert <blambert@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
-#include <sys/queue.h>
#include <sys/socket.h>
-#include <net/if.h>
+#include <netinet/in.h>
-#include <ber.h>
#include <ctype.h>
-#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
+#include <strings.h>
#include <netdb.h>
-#include <event.h>
-#include "snmp.h"
#include "snmpd.h"
ssize_t