summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2016-02-06 19:30:52 +0000
committerkrw <krw@openbsd.org>2016-02-06 19:30:52 +0000
commit711cae1e3c63d7830510355cfe2a04ad008fb43e (patch)
tree83f9b044d463bc4b3a1a1e5e55a63bb5234145af
parentConvert to uiomove. From Martin Natano. (diff)
downloadwireguard-openbsd-711cae1e3c63d7830510355cfe2a04ad008fb43e.tar.xz
wireguard-openbsd-711cae1e3c63d7830510355cfe2a04ad008fb43e.zip
Eliminate #include inside *.h files and include only needed headers in
each *.c file. Inspired by mention of header silliness by Edgar Pettijohn and mmcc@ on tech@.
-rw-r--r--sbin/dhclient/bpf.c22
-rw-r--r--sbin/dhclient/clparse.c18
-rw-r--r--sbin/dhclient/conflex.c22
-rw-r--r--sbin/dhclient/dhclient.c28
-rw-r--r--sbin/dhclient/dhcpd.h35
-rw-r--r--sbin/dhclient/dispatch.c28
-rw-r--r--sbin/dhclient/errwarn.c22
-rw-r--r--sbin/dhclient/kroute.c25
-rw-r--r--sbin/dhclient/options.c20
-rw-r--r--sbin/dhclient/packet.c17
-rw-r--r--sbin/dhclient/parse.c17
-rw-r--r--sbin/dhclient/privsep.c20
-rw-r--r--sbin/dhclient/privsep.h6
-rw-r--r--sbin/dhclient/tables.c14
14 files changed, 222 insertions, 72 deletions
diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c
index a6e956d7f25..c10931ac922 100644
--- a/sbin/dhclient/bpf.c
+++ b/sbin/dhclient/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.37 2014/12/03 18:47:03 krw Exp $ */
+/* $OpenBSD: bpf.c,v 1.38 2016/02/06 19:30:52 krw Exp $ */
/* BPF socket interface code, originally contributed by Archie Cobbs. */
@@ -40,13 +40,29 @@
* Enterprises, see ``http://www.vix.com''.
*/
-#include "dhcpd.h"
#include <sys/ioctl.h>
-#include <sys/uio.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/types.h>
#include <net/bpf.h>
+#include <net/if.h>
+
+#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
+#include <netinet/if_ether.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "dhcp.h"
+#include "dhcpd.h"
#define BPF_FORMAT "/dev/bpf%d"
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index 99a895d926b..edf52f0b7fb 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clparse.c,v 1.93 2015/10/26 16:32:33 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.94 2016/02/06 19:30:52 krw Exp $ */
/* Parser for dhclient config and lease files. */
@@ -40,6 +40,22 @@
* Enterprises, see ``http://www.vix.com''.
*/
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+
+#include <net/if.h>
+#include <net/if_arp.h>
+
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "dhcp.h"
#include "dhcpd.h"
#include "dhctoken.h"
diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c
index 427b4a8c7e5..92622b13d5c 100644
--- a/sbin/dhclient/conflex.c
+++ b/sbin/dhclient/conflex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conflex.c,v 1.32 2015/05/18 17:51:21 krw Exp $ */
+/* $OpenBSD: conflex.c,v 1.33 2016/02/06 19:30:52 krw Exp $ */
/* Lexical scanner for dhclient config file. */
@@ -40,11 +40,27 @@
* Enterprises, see ``http://www.vix.com''.
*/
-#include "dhcpd.h"
-#include "dhctoken.h"
+#include <sys/queue.h>
+#include <sys/socket.h>
+
+#include <arpa/inet.h>
+
+#include <net/if.h>
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
+#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <vis.h>
+#include "dhcp.h"
+#include "dhcpd.h"
+#include "dhctoken.h"
+
int lexline;
int lexchar;
char *token_line;
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 70554488677..b1cdaac6ba2 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.371 2016/01/26 18:26:19 mmcc Exp $ */
+/* $OpenBSD: dhclient.c,v 1.372 2016/02/06 19:30:52 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -53,21 +53,41 @@
* purpose.
*/
-#include "dhcpd.h"
-#include "privsep.h"
-
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
+#include <sys/queue.h>
+
+#include <net/if.h>
+#include <net/route.h>
+
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
#include <ifaddrs.h>
+#include <imsg.h>
#include <limits.h>
+#include <paths.h>
#include <poll.h>
#include <pwd.h>
#include <resolv.h>
+#include <signal.h>
#include <stdint.h>
+#include <stdlib.h>
#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+
+#include "dhcp.h"
+#include "dhcpd.h"
+#include "privsep.h"
char *path_dhclient_conf = _PATH_DHCLIENT_CONF;
char *path_dhclient_db = NULL;
diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h
index ee0d97cf65d..d47674254a7 100644
--- a/sbin/dhclient/dhcpd.h
+++ b/sbin/dhclient/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.153 2015/12/12 14:48:17 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.154 2016/02/06 19:30:52 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -39,39 +39,6 @@
* Enterprises, see ``http://www.vix.com''.
*/
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <sys/queue.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <arpa/inet.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <netdb.h>
-#include <paths.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <syslog.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "dhcp.h"
-
#define LOCAL_PORT 68
#define REMOTE_PORT 67
#define INTERNALSIG INT_MAX
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index 6def048ebb0..d396eb2b228 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.104 2015/12/19 01:16:33 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.105 2016/02/06 19:30:52 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -39,15 +39,35 @@
* Enterprises, see ``http://www.vix.com''.
*/
-#include "dhcpd.h"
-#include "privsep.h"
-
#include <sys/ioctl.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_types.h>
+
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
+#include <errno.h>
#include <ifaddrs.h>
+#include <imsg.h>
+#include <limits.h>
#include <poll.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "dhcp.h"
+#include "dhcpd.h"
+#include "privsep.h"
+
struct dhcp_timeout timeout;
diff --git a/sbin/dhclient/errwarn.c b/sbin/dhclient/errwarn.c
index 3a14fba38a7..093d26e2c73 100644
--- a/sbin/dhclient/errwarn.c
+++ b/sbin/dhclient/errwarn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: errwarn.c,v 1.22 2014/01/20 10:17:20 krw Exp $ */
+/* $OpenBSD: errwarn.c,v 1.23 2016/02/06 19:30:52 krw Exp $ */
/* Errors and warnings. */
@@ -40,10 +40,26 @@
* with Vixie Laboratories.
*/
-#include "dhcpd.h"
+#include <sys/queue.h>
+#include <sys/socket.h>
+
+#include <arpa/inet.h>
+
+#include <net/if.h>
-#include <sys/uio.h>
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+
+#include "dhcp.h"
+#include "dhcpd.h"
static char mbuf[1024];
diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c
index 97f69657c1f..c0eea23aeb5 100644
--- a/sbin/dhclient/kroute.c
+++ b/sbin/dhclient/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.78 2015/12/19 14:56:22 krw Exp $ */
+/* $OpenBSD: kroute.c,v 1.79 2016/02/06 19:30:52 krw Exp $ */
/*
* Copyright 2012 Kenneth R Westerback <krw@openbsd.org>
@@ -16,17 +16,32 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "dhcpd.h"
-#include "privsep.h"
-
#include <sys/ioctl.h>
+#include <sys/socket.h>
#include <sys/sysctl.h>
-#include <sys/uio.h>
+#include <arpa/inet.h>
+
+#include <net/if.h>
#include <net/if_types.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
+#include <errno.h>
#include <ifaddrs.h>
+#include <imsg.h>
+#include <limits.h>
#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "dhcp.h"
+#include "dhcpd.h"
+#include "privsep.h"
struct in_addr active_addr;
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c
index 389d99feaa7..06b01561b67 100644
--- a/sbin/dhclient/options.c
+++ b/sbin/dhclient/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.74 2015/10/26 16:32:33 krw Exp $ */
+/* $OpenBSD: options.c,v 1.75 2016/02/06 19:30:52 krw Exp $ */
/* DHCP options parsing and reassembly. */
@@ -40,10 +40,26 @@
* Enterprises, see ``http://www.vix.com''.
*/
-#include "dhcpd.h"
+#include <sys/queue.h>
+#include <sys/socket.h>
+
+#include <arpa/inet.h>
+
+#include <net/if.h>
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
+#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <vis.h>
+#include "dhcp.h"
+#include "dhcpd.h"
+
int parse_option_buffer(struct option_data *, unsigned char *, int);
int expand_search_domain_name(unsigned char *, size_t, int *, unsigned char *);
diff --git a/sbin/dhclient/packet.c b/sbin/dhclient/packet.c
index 64704d05d7a..79febbd44eb 100644
--- a/sbin/dhclient/packet.c
+++ b/sbin/dhclient/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.29 2016/02/03 14:48:36 krw Exp $ */
+/* $OpenBSD: packet.c,v 1.30 2016/02/06 19:30:52 krw Exp $ */
/* Packet assembly code, originally contributed by Archie Cobbs. */
@@ -40,10 +40,23 @@
* Enterprises, see ``http://www.vix.com''.
*/
-#include "dhcpd.h"
+#include <sys/queue.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
+#include <netinet/if_ether.h>
+
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "dhcp.h"
+#include "dhcpd.h"
u_int32_t
checksum(unsigned char *buf, unsigned nbytes, u_int32_t sum)
diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c
index f53e62f1e39..8fed24971f3 100644
--- a/sbin/dhclient/parse.c
+++ b/sbin/dhclient/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.39 2015/05/18 17:51:21 krw Exp $ */
+/* $OpenBSD: parse.c,v 1.40 2016/02/06 19:30:52 krw Exp $ */
/* Common parser code for dhcpd and dhclient. */
@@ -40,8 +40,23 @@
* Enterprises, see ``http://www.vix.com''.
*/
+#include <sys/queue.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <stdint.h>
+#include <string.h>
+#include "dhcp.h"
#include "dhcpd.h"
#include "dhctoken.h"
diff --git a/sbin/dhclient/privsep.c b/sbin/dhclient/privsep.c
index 3c0b5203b9f..47f876d76da 100644
--- a/sbin/dhclient/privsep.c
+++ b/sbin/dhclient/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.39 2015/02/07 10:08:06 krw Exp $ */
+/* $OpenBSD: privsep.c,v 1.40 2016/02/06 19:30:52 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -16,12 +16,24 @@
* OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/queue.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
+#include <errno.h>
+#include <imsg.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "dhcp.h"
#include "dhcpd.h"
#include "privsep.h"
-#include <sys/queue.h>
-#include <sys/uio.h>
-
void
dispatch_imsg(struct imsgbuf *ibuf)
{
diff --git a/sbin/dhclient/privsep.h b/sbin/dhclient/privsep.h
index d9215dc6867..e985b1d29ea 100644
--- a/sbin/dhclient/privsep.h
+++ b/sbin/dhclient/privsep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.h,v 1.28 2015/02/10 04:20:26 krw Exp $ */
+/* $OpenBSD: privsep.h,v 1.29 2016/02/06 19:30:52 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -16,10 +16,6 @@
* OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <arpa/inet.h>
-
-#include <imsg.h>
-
enum imsg_code {
IMSG_NONE,
IMSG_DELETE_ADDRESS,
diff --git a/sbin/dhclient/tables.c b/sbin/dhclient/tables.c
index ff6c4dfd847..1d82123c2d4 100644
--- a/sbin/dhclient/tables.c
+++ b/sbin/dhclient/tables.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tables.c,v 1.19 2015/10/26 16:32:33 krw Exp $ */
+/* $OpenBSD: tables.c,v 1.20 2016/02/06 19:30:52 krw Exp $ */
/* Tables of information. */
@@ -40,6 +40,18 @@
* Enterprises, see ``http://www.vix.com''.
*/
+#include <sys/queue.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
+#include <signal.h>
+#include <stdio.h>
+
+#include "dhcp.h"
#include "dhcpd.h"
/*