[PATCH] Cleanup include redundancy
donkeysnore
donkeysnore at gmail.com
Wed Jan 23 06:04:25 CET 2019
Signed-off-by: donkeysnore <donkeysnore at gmail.com>
---
src/allowedips.c | 1 -
src/cookie.c | 6 ------
src/crypto/zinc/blake2s/blake2s.c | 3 ---
src/crypto/zinc/chacha20/chacha20.c | 1 -
src/crypto/zinc/poly1305/poly1305.c | 1 -
src/device.c | 3 ---
src/device.h | 3 ---
src/hashtables.c | 2 --
src/main.c | 2 --
src/messages.h | 1 -
src/netlink.c | 2 --
src/noise.c | 5 -----
src/noise.h | 3 ---
src/peer.c | 5 -----
src/peer.h | 5 -----
src/queueing.h | 4 ----
src/receive.c | 7 -------
src/send.c | 4 ----
src/socket.c | 5 -----
src/timers.c | 2 --
src/tools/config.c | 3 ---
src/tools/curve25519.c | 1 -
src/tools/encoding.h | 1 -
src/tools/genkey.c | 1 -
src/tools/ipc.c | 10 ----------
src/tools/set.c | 1 -
src/tools/setconf.c | 1 -
src/tools/show.c | 8 --------
src/tools/showconf.c | 5 -----
29 files changed, 96 deletions(-)
diff --git a/src/allowedips.c b/src/allowedips.c
index 30b66f4..ace5ac7 100644
--- a/src/allowedips.c
+++ b/src/allowedips.c
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason at zx2c4.com>. All Rights Reserved.
*/
-#include "allowedips.h"
#include "peer.h"
struct allowedips_node {
diff --git a/src/cookie.c b/src/cookie.c
index 97ab28a..f4095dc 100644
--- a/src/cookie.c
+++ b/src/cookie.c
@@ -3,16 +3,10 @@
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason at zx2c4.com>. All Rights Reserved.
*/
-#include "cookie.h"
#include "peer.h"
-#include "device.h"
-#include "messages.h"
#include "ratelimiter.h"
#include "timers.h"
-#include <zinc/blake2s.h>
-#include <zinc/chacha20poly1305.h>
-
#include <net/ipv6.h>
#include <crypto/algapi.h>
diff --git a/src/crypto/zinc/blake2s/blake2s.c b/src/crypto/zinc/blake2s/blake2s.c
index b881db0..c0c88ee 100644
--- a/src/crypto/zinc/blake2s/blake2s.c
+++ b/src/crypto/zinc/blake2s/blake2s.c
@@ -12,12 +12,9 @@
#include <zinc/blake2s.h>
#include "../selftest/run.h"
-#include <linux/types.h>
#include <linux/string.h>
-#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
-#include <linux/bug.h>
#include <asm/unaligned.h>
typedef union {
diff --git a/src/crypto/zinc/chacha20/chacha20.c b/src/crypto/zinc/chacha20/chacha20.c
index b4763c8..6859c83 100644
--- a/src/crypto/zinc/chacha20/chacha20.c
+++ b/src/crypto/zinc/chacha20/chacha20.c
@@ -10,7 +10,6 @@
#include <zinc/chacha20.h>
#include "../selftest/run.h"
-#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/vmalloc.h>
diff --git a/src/crypto/zinc/poly1305/poly1305.c b/src/crypto/zinc/poly1305/poly1305.c
index 7d373b9..c476719 100644
--- a/src/crypto/zinc/poly1305/poly1305.c
+++ b/src/crypto/zinc/poly1305/poly1305.c
@@ -11,7 +11,6 @@
#include "../selftest/run.h"
#include <asm/unaligned.h>
-#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/module.h>
#include <linux/init.h>
diff --git a/src/device.c b/src/device.c
index 98c05bc..e1f6bb0 100644
--- a/src/device.c
+++ b/src/device.c
@@ -6,15 +6,12 @@
#include "queueing.h"
#include "socket.h"
#include "timers.h"
-#include "device.h"
#include "ratelimiter.h"
-#include "peer.h"
#include "messages.h"
#include <linux/module.h>
#include <linux/rtnetlink.h>
#include <linux/inet.h>
-#include <linux/netdevice.h>
#include <linux/inetdevice.h>
#include <linux/if_arp.h>
#include <linux/icmp.h>
diff --git a/src/device.h b/src/device.h
index b85638c..c53c463 100644
--- a/src/device.h
+++ b/src/device.h
@@ -8,13 +8,10 @@
#include "noise.h"
#include "allowedips.h"
-#include "hashtables.h"
#include "cookie.h"
-#include <linux/types.h>
#include <linux/netdevice.h>
#include <linux/workqueue.h>
-#include <linux/mutex.h>
#include <linux/net.h>
#include <linux/ptr_ring.h>
diff --git a/src/hashtables.c b/src/hashtables.c
index 18cac91..242f27d 100644
--- a/src/hashtables.c
+++ b/src/hashtables.c
@@ -3,9 +3,7 @@
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason at zx2c4.com>. All Rights Reserved.
*/
-#include "hashtables.h"
#include "peer.h"
-#include "noise.h"
static struct hlist_head *pubkey_bucket(struct pubkey_hashtable *table,
const u8 pubkey[NOISE_PUBLIC_KEY_LEN])
diff --git a/src/main.c b/src/main.c
index 4b5b58e..7aa3e97 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,8 +4,6 @@
*/
#include "version.h"
-#include "device.h"
-#include "noise.h"
#include "queueing.h"
#include "ratelimiter.h"
#include "netlink.h"
diff --git a/src/messages.h b/src/messages.h
index 3cfd1c5..c8d6d76 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -10,7 +10,6 @@
#include <zinc/chacha20poly1305.h>
#include <zinc/blake2s.h>
-#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/skbuff.h>
diff --git a/src/netlink.c b/src/netlink.c
index bdd3150..0bac1d0 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -4,11 +4,9 @@
*/
#include "netlink.h"
-#include "device.h"
#include "peer.h"
#include "socket.h"
#include "queueing.h"
-#include "messages.h"
#include "uapi/wireguard.h"
#include <linux/if.h>
#include <net/genetlink.h>
diff --git a/src/noise.c b/src/noise.c
index e629307..1efddd8 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -3,12 +3,7 @@
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason at zx2c4.com>. All Rights Reserved.
*/
-#include "noise.h"
-#include "device.h"
-#include "peer.h"
-#include "messages.h"
#include "queueing.h"
-#include "hashtables.h"
#include <linux/rcupdate.h>
#include <linux/slab.h>
diff --git a/src/noise.h b/src/noise.h
index 8e5cc0a..7ad0cfc 100644
--- a/src/noise.h
+++ b/src/noise.h
@@ -5,14 +5,11 @@
#ifndef _WG_NOISE_H
#define _WG_NOISE_H
-#include "messages.h"
#include "hashtables.h"
-#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/atomic.h>
#include <linux/rwsem.h>
-#include <linux/mutex.h>
#include <linux/ktime.h>
#include <linux/kref.h>
diff --git a/src/peer.c b/src/peer.c
index 020a97b..778c4fc 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -3,14 +3,9 @@
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason at zx2c4.com>. All Rights Reserved.
*/
-#include "peer.h"
-#include "device.h"
#include "queueing.h"
#include "timers.h"
-#include "hashtables.h"
-#include "noise.h"
-#include <linux/kref.h>
#include <linux/lockdep.h>
#include <linux/rcupdate.h>
#include <linux/list.h>
diff --git a/src/peer.h b/src/peer.h
index f3cf255..996afe6 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -7,13 +7,8 @@
#define _WG_PEER_H
#include "device.h"
-#include "noise.h"
-#include "cookie.h"
-#include <linux/types.h>
#include <linux/netfilter.h>
-#include <linux/spinlock.h>
-#include <linux/kref.h>
#include <net/dst_cache.h>
struct wg_device;
diff --git a/src/queueing.h b/src/queueing.h
index d2866aa..ae35660 100644
--- a/src/queueing.h
+++ b/src/queueing.h
@@ -7,10 +7,6 @@
#define _WG_QUEUEING_H
#include "peer.h"
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/ip.h>
-#include <linux/ipv6.h>
struct wg_device;
struct wg_peer;
diff --git a/src/receive.c b/src/receive.c
index 693ec57..a7db35e 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -4,17 +4,10 @@
*/
#include "queueing.h"
-#include "device.h"
-#include "peer.h"
#include "timers.h"
-#include "messages.h"
-#include "cookie.h"
#include "socket.h"
#include <linux/simd.h>
-#include <linux/ip.h>
-#include <linux/ipv6.h>
-#include <linux/udp.h>
#include <net/ip_tunnels.h>
/* Must be called with bh disabled. */
diff --git a/src/send.c b/src/send.c
index b0df5c7..c928367 100644
--- a/src/send.c
+++ b/src/send.c
@@ -5,11 +5,7 @@
#include "queueing.h"
#include "timers.h"
-#include "device.h"
-#include "peer.h"
#include "socket.h"
-#include "messages.h"
-#include "cookie.h"
#include <linux/simd.h>
#include <linux/uio.h>
diff --git a/src/socket.c b/src/socket.c
index 652d798..d93df29 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -3,16 +3,11 @@
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason at zx2c4.com>. All Rights Reserved.
*/
-#include "device.h"
#include "peer.h"
#include "socket.h"
#include "queueing.h"
-#include "messages.h"
#include <linux/ctype.h>
-#include <linux/net.h>
-#include <linux/if_vlan.h>
-#include <linux/if_ether.h>
#include <linux/inetdevice.h>
#include <net/udp_tunnel.h>
#include <net/ipv6.h>
diff --git a/src/timers.c b/src/timers.c
index ee16c56..f2ad4f6 100644
--- a/src/timers.c
+++ b/src/timers.c
@@ -4,8 +4,6 @@
*/
#include "timers.h"
-#include "device.h"
-#include "peer.h"
#include "queueing.h"
#include "socket.h"
diff --git a/src/tools/config.c b/src/tools/config.c
index 5d15356..360721b 100644
--- a/src/tools/config.c
+++ b/src/tools/config.c
@@ -8,15 +8,12 @@
#include <ctype.h>
#include <netdb.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sys/socket.h>
#include <sys/stat.h>
#include <errno.h>
#include "config.h"
-#include "containers.h"
#include "ipc.h"
#include "encoding.h"
diff --git a/src/tools/curve25519.c b/src/tools/curve25519.c
index 7949933..609ff6e 100644
--- a/src/tools/curve25519.c
+++ b/src/tools/curve25519.c
@@ -5,7 +5,6 @@
#include "curve25519.h"
-#include <stdint.h>
#include <string.h>
#ifndef __BYTE_ORDER__
diff --git a/src/tools/encoding.h b/src/tools/encoding.h
index f977ee9..41a2fb2 100644
--- a/src/tools/encoding.h
+++ b/src/tools/encoding.h
@@ -7,7 +7,6 @@
#define ENCODING_H
#include <stdbool.h>
-#include <stdint.h>
#include "containers.h"
#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1)
diff --git a/src/tools/genkey.c b/src/tools/genkey.c
index 65711e1..c3d2642 100644
--- a/src/tools/genkey.c
+++ b/src/tools/genkey.c
@@ -6,7 +6,6 @@
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
diff --git a/src/tools/ipc.c b/src/tools/ipc.c
index da31eff..e22a9a5 100644
--- a/src/tools/ipc.c
+++ b/src/tools/ipc.c
@@ -11,34 +11,24 @@
#include <linux/genetlink.h>
#include "mnlg.h"
#endif
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <net/if.h>
#include <errno.h>
-#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
-#include <time.h>
#include <dirent.h>
#include <signal.h>
#include <netdb.h>
#include <limits.h>
-#include <sys/types.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <arpa/inet.h>
#include "ipc.h"
-#include "containers.h"
#include "encoding.h"
#include "curve25519.h"
-#include "../uapi/wireguard.h"
#define SOCK_PATH RUNSTATEDIR "/wireguard/"
#define SOCK_SUFFIX ".sock"
diff --git a/src/tools/set.c b/src/tools/set.c
index 19f4b92..f50f368 100644
--- a/src/tools/set.c
+++ b/src/tools/set.c
@@ -4,7 +4,6 @@
*/
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include "containers.h"
diff --git a/src/tools/setconf.c b/src/tools/setconf.c
index 8211ebd..7a0295a 100644
--- a/src/tools/setconf.c
+++ b/src/tools/setconf.c
@@ -5,7 +5,6 @@
#include <stddef.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include "containers.h"
diff --git a/src/tools/show.c b/src/tools/show.c
index ba6f115..870860d 100644
--- a/src/tools/show.c
+++ b/src/tools/show.c
@@ -5,20 +5,12 @@
#include <arpa/inet.h>
#include <inttypes.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <stdbool.h>
#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <time.h>
#include <netdb.h>
-#include "containers.h"
#include "ipc.h"
#include "terminal.h"
#include "encoding.h"
diff --git a/src/tools/showconf.c b/src/tools/showconf.c
index ad76b7f..a57985f 100644
--- a/src/tools/showconf.c
+++ b/src/tools/showconf.c
@@ -4,16 +4,11 @@
*/
#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <net/if.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
-#include <stdlib.h>
#include <netdb.h>
-#include "containers.h"
#include "encoding.h"
#include "ipc.h"
#include "subcommands.h"
--
2.17.1
More information about the WireGuard
mailing list