summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--astraceroute.c1
-rw-r--r--astraceroute/Makefile1
-rw-r--r--bpf.c1
-rw-r--r--bpf_parser.y1
-rw-r--r--bpfc.c2
-rw-r--r--bpfc/Makefile2
-rw-r--r--ct_client.c1
-rw-r--r--ct_server.c2
-rw-r--r--ct_servmgmt.c1
-rw-r--r--ct_usermgmt.c1
-rw-r--r--curve.c1
-rw-r--r--curvetun.c1
-rw-r--r--curvetun/Makefile2
-rw-r--r--dev.c1
-rw-r--r--dissector.h2
-rw-r--r--dissector_80211.h1
-rw-r--r--dissector_eth.h1
-rw-r--r--epoll2.c30
-rw-r--r--epoll2.h7
-rw-r--r--flowtop.c1
-rw-r--r--flowtop/Makefile1
-rw-r--r--geoip.c1
-rw-r--r--ifpps.c1
-rw-r--r--ioops.c1
-rw-r--r--irq.c9
-rw-r--r--mac80211.c3
-rw-r--r--mausezahn/Makefile4
-rw-r--r--netsniff-ng.c1
-rw-r--r--netsniff-ng/Makefile1
-rw-r--r--oui.c1
-rw-r--r--pcap_mm.c3
-rw-r--r--pcap_rw.c1
-rw-r--r--pcap_sg.c1
-rw-r--r--proto_lldp.c1
-rw-r--r--ring.h1
-rw-r--r--ring_rx.h2
-rw-r--r--ring_tx.h2
-rw-r--r--stun.c1
-rw-r--r--tprintf.c1
-rw-r--r--trafgen.c3
-rw-r--r--trafgen/Makefile1
-rw-r--r--trafgen_parser.y1
-rw-r--r--tstamping.c1
-rw-r--r--xmalloc.c1
-rw-r--r--xutils.c73
-rw-r--r--xutils.h31
46 files changed, 53 insertions, 154 deletions
diff --git a/astraceroute.c b/astraceroute.c
index a7f04c6..1bcb9a4 100644
--- a/astraceroute.c
+++ b/astraceroute.c
@@ -43,7 +43,6 @@
#include "csum.h"
#include "sock.h"
#include "geoip.h"
-#include "xutils.h"
#include "ring_rx.h"
#include "built_in.h"
diff --git a/astraceroute/Makefile b/astraceroute/Makefile
index b99e310..8f9f518 100644
--- a/astraceroute/Makefile
+++ b/astraceroute/Makefile
@@ -4,7 +4,6 @@ astraceroute-libs = -lGeoIP \
astraceroute-objs = xmalloc.o \
ioops.o \
- xutils.o \
proto_none.o \
tprintf.o \
bpf.o \
diff --git a/bpf.c b/bpf.c
index b64b909..d18eac2 100644
--- a/bpf.c
+++ b/bpf.c
@@ -16,7 +16,6 @@
#include "bpf.h"
#include "xmalloc.h"
-#include "xutils.h"
#include "die.h"
#include "str.h"
diff --git a/bpf_parser.y b/bpf_parser.y
index 307066e..0bbc17d 100644
--- a/bpf_parser.y
+++ b/bpf_parser.y
@@ -24,7 +24,6 @@
#include "bpf_parser.tab.h"
#include "built_in.h"
#include "die.h"
-#include "xutils.h"
#define MAX_INSTRUCTIONS 4096
diff --git a/bpfc.c b/bpfc.c
index f326025..d83bfd7 100644
--- a/bpfc.c
+++ b/bpfc.c
@@ -7,13 +7,13 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <getopt.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/fsuid.h>
#include "xmalloc.h"
-#include "xutils.h"
#include "die.h"
#include "bpf.h"
diff --git a/bpfc/Makefile b/bpfc/Makefile
index 61107bf..fa19d55 100644
--- a/bpfc/Makefile
+++ b/bpfc/Makefile
@@ -1,9 +1,7 @@
bpfc-libs =
bpfc-objs = xmalloc.o \
- xutils.o \
str.o \
- sock.o \
bpf.o \
bpf_lexer.yy.o \
bpf_parser.tab.o \
diff --git a/ct_client.c b/ct_client.c
index 50f5df4..1f4d10e 100644
--- a/ct_client.c
+++ b/ct_client.c
@@ -30,7 +30,6 @@
#include "str.h"
#include "sock.h"
#include "ioops.h"
-#include "xutils.h"
#include "curve.h"
#include "xmalloc.h"
#include "corking.h"
diff --git a/ct_server.c b/ct_server.c
index 89ed815..eb53bd3 100644
--- a/ct_server.c
+++ b/ct_server.c
@@ -29,7 +29,7 @@
#include <linux/if_tun.h>
#include "die.h"
-#include "xutils.h"
+#include "epoll2.h"
#include "ioops.h"
#include "xmalloc.h"
#include "curvetun.h"
diff --git a/ct_servmgmt.c b/ct_servmgmt.c
index 0d7da78..143b03a 100644
--- a/ct_servmgmt.c
+++ b/ct_servmgmt.c
@@ -17,7 +17,6 @@
#include "locking.h"
#include "xmalloc.h"
#include "curvetun.h"
-#include "xutils.h"
#include "curve.h"
#include "ct_servmgmt.h"
#include "crypto_box_curve25519xsalsa20poly1305.h"
diff --git a/ct_usermgmt.c b/ct_usermgmt.c
index 2642986..a4978fc 100644
--- a/ct_usermgmt.c
+++ b/ct_usermgmt.c
@@ -22,7 +22,6 @@
#include "ioops.h"
#include "str.h"
#include "curvetun.h"
-#include "xutils.h"
#include "curve.h"
#include "hash.h"
#include "crypto_verify_32.h"
diff --git a/curve.c b/curve.c
index 243e833..9b32c03 100644
--- a/curve.c
+++ b/curve.c
@@ -19,7 +19,6 @@
#include "built_in.h"
#include "xmalloc.h"
#include "curve.h"
-#include "xutils.h"
#include "ioops.h"
#include "rnd.h"
#include "die.h"
diff --git a/curvetun.c b/curvetun.c
index 38e3f83..eb8bcde 100644
--- a/curvetun.c
+++ b/curvetun.c
@@ -25,7 +25,6 @@
#include <unistd.h>
#include <signal.h>
-#include "xutils.h"
#include "die.h"
#include "str.h"
#include "sig.h"
diff --git a/curvetun/Makefile b/curvetun/Makefile
index f66fd4d..8ae6291 100644
--- a/curvetun/Makefile
+++ b/curvetun/Makefile
@@ -2,7 +2,7 @@ curvetun-libs = -lnacl \
-lpthread
curvetun-objs = xmalloc.o \
- xutils.o \
+ epoll2.o \
str.o \
dev.o \
stun.o \
diff --git a/dev.c b/dev.c
index cd18d9b..210487c 100644
--- a/dev.c
+++ b/dev.c
@@ -9,7 +9,6 @@
#include "sock.h"
#include "die.h"
#include "link.h"
-#include "xutils.h"
int device_ifindex(const char *ifname)
{
diff --git a/dissector.h b/dissector.h
index 2c2c128..60bc429 100644
--- a/dissector.h
+++ b/dissector.h
@@ -9,7 +9,9 @@
#include <stdlib.h>
#include <stdint.h>
+#include <sys/socket.h>
#include <linux/if_packet.h>
+#include <linux/if.h>
#include "ring.h"
#include "tprintf.h"
diff --git a/dissector_80211.h b/dissector_80211.h
index 8c22356..53059e5 100644
--- a/dissector_80211.h
+++ b/dissector_80211.h
@@ -11,7 +11,6 @@
#include "proto.h"
#include "protos.h"
#include "tprintf.h"
-#include "xutils.h"
#include "oui.h"
extern struct hash_table ieee80211_lay2;
diff --git a/dissector_eth.h b/dissector_eth.h
index 4c49f28..85106bc 100644
--- a/dissector_eth.h
+++ b/dissector_eth.h
@@ -11,7 +11,6 @@
#include "proto.h"
#include "protos.h"
#include "tprintf.h"
-#include "xutils.h"
#include "oui.h"
extern struct hash_table eth_lay2;
diff --git a/epoll2.c b/epoll2.c
new file mode 100644
index 0000000..71a7ac6
--- /dev/null
+++ b/epoll2.c
@@ -0,0 +1,30 @@
+#include <sys/epoll.h>
+#include <string.h>
+
+#include "epoll2.h"
+#include "die.h"
+
+void set_epoll_descriptor(int fd_epoll, int action, int fd_toadd, int events)
+{
+ int ret;
+ struct epoll_event ev;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.events = events;
+ ev.data.fd = fd_toadd;
+
+ ret = epoll_ctl(fd_epoll, action, fd_toadd, &ev);
+ if (ret < 0)
+ panic("Cannot add socket for epoll!\n");
+}
+
+int set_epoll_descriptor2(int fd_epoll, int action, int fd_toadd, int events)
+{
+ struct epoll_event ev;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.events = events;
+ ev.data.fd = fd_toadd;
+
+ return epoll_ctl(fd_epoll, action, fd_toadd, &ev);
+}
diff --git a/epoll2.h b/epoll2.h
new file mode 100644
index 0000000..1ecf5f0
--- /dev/null
+++ b/epoll2.h
@@ -0,0 +1,7 @@
+#ifndef __EPOLL_H
+#define __EPOLL_H
+
+extern void set_epoll_descriptor(int fd_epoll, int action, int fd_toadd, int events);
+extern int set_epoll_descriptor2(int fd_epoll, int action, int fd_toadd, int events);
+
+#endif /* __EPOLL_H */
diff --git a/flowtop.c b/flowtop.c
index 0de3cb6..95734df 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -33,7 +33,6 @@
#include "str.h"
#include "sig.h"
#include "geoip.h"
-#include "xutils.h"
#include "built_in.h"
#include "locking.h"
#include "dissector_eth.h"
diff --git a/flowtop/Makefile b/flowtop/Makefile
index 43f221f..7e7797a 100644
--- a/flowtop/Makefile
+++ b/flowtop/Makefile
@@ -7,7 +7,6 @@ flowtop-libs = -lGeoIP \
flowtop-objs = xmalloc.o \
ioops.o \
- xutils.o \
oui.o \
str.o \
sig.o \
diff --git a/geoip.c b/geoip.c
index bef35fb..b403ad1 100644
--- a/geoip.c
+++ b/geoip.c
@@ -18,7 +18,6 @@
#include "built_in.h"
#include "die.h"
-#include "xutils.h"
#include "ioops.h"
#include "str.h"
#include "xmalloc.h"
diff --git a/ifpps.c b/ifpps.c
index 40a3f63..3a83043 100644
--- a/ifpps.c
+++ b/ifpps.c
@@ -22,7 +22,6 @@
#include "sig.h"
#include "link.h"
#include "xmalloc.h"
-#include "xutils.h"
#include "ioops.h"
#include "promisc.h"
#include "cpus.h"
diff --git a/ioops.c b/ioops.c
index 091153b..6e79317 100644
--- a/ioops.c
+++ b/ioops.c
@@ -12,7 +12,6 @@
#include "dev.h"
#include "ioops.h"
#include "str.h"
-#include "xutils.h"
int open_or_die(const char *file, int flags)
{
diff --git a/irq.c b/irq.c
index 1eed0d5..4132d19 100644
--- a/irq.c
+++ b/irq.c
@@ -1,13 +1,7 @@
-/*
- * netsniff-ng - the packet sniffing beast
- * Copyright 2009 - 2013 Daniel Borkmann.
- * Copyright 2009, 2010 Emmanuel Roullit.
- * Subject to the GPL, version 2.
- */
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -16,7 +10,6 @@
#include "irq.h"
#include "str.h"
#include "die.h"
-#include "xutils.h"
int device_irq_number(const char *ifname)
{
diff --git a/mac80211.c b/mac80211.c
index 1572f73..0154416 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -15,6 +15,8 @@
#include <errno.h>
#include <string.h>
#include <limits.h>
+#include <sys/socket.h>
+#include <linux/if.h>
#include <linux/nl80211.h>
#include <libnl3/netlink/genl/genl.h>
#include <libnl3/netlink/genl/family.h>
@@ -25,7 +27,6 @@
#include "die.h"
#include "str.h"
#include "dev.h"
-#include "xutils.h"
#include "mac80211.h"
#include "xmalloc.h"
#include "built_in.h"
diff --git a/mausezahn/Makefile b/mausezahn/Makefile
index 2e9e417..ab892c6 100644
--- a/mausezahn/Makefile
+++ b/mausezahn/Makefile
@@ -5,9 +5,7 @@ mausezahn-libs = -lcli \
-lpthread \
-lm
-mausezahn-objs = xutils.o \
- str.o \
- sock.o \
+mausezahn-objs = str.o \
staging/layer1.o \
staging/layer2.o \
staging/layer3.o \
diff --git a/netsniff-ng.c b/netsniff-ng.c
index ed488aa..23c1d5b 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -26,7 +26,6 @@
#include "ring_rx.h"
#include "ring_tx.h"
#include "mac80211.h"
-#include "xutils.h"
#include "promisc.h"
#include "built_in.h"
#include "pcap_io.h"
diff --git a/netsniff-ng/Makefile b/netsniff-ng/Makefile
index 4621179..356ae2e 100644
--- a/netsniff-ng/Makefile
+++ b/netsniff-ng/Makefile
@@ -43,7 +43,6 @@ netsniff-ng-objs = dissector.o \
iosched.o \
ioops.o \
link.o \
- xutils.o \
xmalloc.o \
hash.o \
bpf.o \
diff --git a/oui.c b/oui.c
index 2fa716a..3354ed4 100644
--- a/oui.c
+++ b/oui.c
@@ -9,7 +9,6 @@
#include "hash.h"
#include "xmalloc.h"
-#include "xutils.h"
#include "oui.h"
#include "str.h"
diff --git a/pcap_mm.c b/pcap_mm.c
index 848f7e0..ea74034 100644
--- a/pcap_mm.c
+++ b/pcap_mm.c
@@ -14,9 +14,8 @@
#include <sys/mman.h>
#include "pcap_io.h"
-#include "ioops.h"
-#include "xutils.h"
#include "built_in.h"
+#include "ioops.h"
#include "iosched.h"
static size_t map_size = 0;
diff --git a/pcap_rw.c b/pcap_rw.c
index 6c9601f..65b45cb 100644
--- a/pcap_rw.c
+++ b/pcap_rw.c
@@ -13,7 +13,6 @@
#include "pcap_io.h"
#include "built_in.h"
-#include "xutils.h"
#include "die.h"
#include "iosched.h"
#include "ioops.h"
diff --git a/pcap_sg.c b/pcap_sg.c
index ea4a709..19bec40 100644
--- a/pcap_sg.c
+++ b/pcap_sg.c
@@ -13,7 +13,6 @@
#include "pcap_io.h"
#include "xmalloc.h"
-#include "xutils.h"
#include "built_in.h"
#include "iosched.h"
#include "ioops.h"
diff --git a/proto_lldp.c b/proto_lldp.c
index 4e33048..205c899 100644
--- a/proto_lldp.c
+++ b/proto_lldp.c
@@ -13,7 +13,6 @@
#include "pkt_buff.h"
#include "proto.h"
#include "protos.h"
-#include "xutils.h"
#define EXTRACT_16BIT(x) ntohs(*((uint16_t *) (x)))
#define EXTRACT_32BIT(x) ntohl(*((uint32_t *) (x)))
diff --git a/ring.h b/ring.h
index 9a2e05b..7ee7735 100644
--- a/ring.h
+++ b/ring.h
@@ -22,7 +22,6 @@
#include <poll.h>
#include <sys/poll.h>
-#include "xutils.h"
#include "built_in.h"
#include "die.h"
#include "dev.h"
diff --git a/ring_rx.h b/ring_rx.h
index 43b4020..6f3cdab 100644
--- a/ring_rx.h
+++ b/ring_rx.h
@@ -7,6 +7,8 @@
#ifndef RX_RING_H
#define RX_RING_H
+#include <stdbool.h>
+
#include "ring.h"
#include "built_in.h"
diff --git a/ring_tx.h b/ring_tx.h
index 23caa35..adfe2a4 100644
--- a/ring_tx.h
+++ b/ring_tx.h
@@ -7,6 +7,8 @@
#ifndef TX_RING_H
#define TX_RING_H
+#include <stdbool.h>
+
#include "ring.h"
#include "built_in.h"
diff --git a/stun.c b/stun.c
index 4b8dd62..2389145 100644
--- a/stun.c
+++ b/stun.c
@@ -19,7 +19,6 @@
#include <sys/select.h>
#include "xmalloc.h"
-#include "xutils.h"
#include "die.h"
#include "sock.h"
diff --git a/tprintf.c b/tprintf.c
index b57d706..82623a9 100644
--- a/tprintf.c
+++ b/tprintf.c
@@ -11,7 +11,6 @@
#include <stdarg.h>
#include <sys/ioctl.h>
-#include "xutils.h"
#include "tprintf.h"
#include "die.h"
#include "locking.h"
diff --git a/trafgen.c b/trafgen.c
index fc15e20..2d99a4b 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -10,6 +10,7 @@
#include <getopt.h>
#include <ctype.h>
#include <stdbool.h>
+#include <sched.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/fsuid.h>
@@ -21,6 +22,7 @@
#include <netinet/in.h>
#include <netinet/ip.h>
#include <linux/icmp.h>
+#include <linux/if.h>
#include <arpa/inet.h>
#include <signal.h>
#include <stdint.h>
@@ -42,7 +44,6 @@
#include "privs.h"
#include "proc.h"
#include "mac80211.h"
-#include "xutils.h"
#include "ioops.h"
#include "irq.h"
#include "built_in.h"
diff --git a/trafgen/Makefile b/trafgen/Makefile
index 9555ca0..3747661 100644
--- a/trafgen/Makefile
+++ b/trafgen/Makefile
@@ -4,7 +4,6 @@ trafgen-libs = $(shell pkg-config --libs libnl-3.0) \
trafgen-objs = xmalloc.o \
ioops.o \
- xutils.o \
privs.o \
proc.o \
dev.o \
diff --git a/trafgen_parser.y b/trafgen_parser.y
index 85d7b01..71f5ddd 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -25,7 +25,6 @@
#include "die.h"
#include "str.h"
#include "csum.h"
-#include "xutils.h"
#define YYERROR_VERBOSE 0
#define YYDEBUG 0
diff --git a/tstamping.c b/tstamping.c
index 9ef1a4a..29dec35 100644
--- a/tstamping.c
+++ b/tstamping.c
@@ -17,7 +17,6 @@ extern int set_sockopt_hwtimestamp(int sock, const char *dev);
#include <linux/if_packet.h>
#include <linux/if.h>
-#include "xutils.h"
#include "str.h"
int set_sockopt_hwtimestamp(int sock, const char *dev)
diff --git a/xmalloc.c b/xmalloc.c
index b40f14c..d5805b8 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -15,7 +15,6 @@
#include <sys/types.h>
#include "xmalloc.h"
-#include "xutils.h"
#include "built_in.h"
#include "die.h"
#include "str.h"
diff --git a/xutils.c b/xutils.c
deleted file mode 100644
index 56b4c59..0000000
--- a/xutils.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * netsniff-ng - the packet sniffing beast
- * Copyright 2009, 2010 Daniel Borkmann.
- * Copyright 2009, 2010 Emmanuel Roullit.
- * Subject to the GPL, version 2.
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <signal.h>
-#include <arpa/inet.h>
-#include <time.h>
-#include <sched.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <netdb.h>
-#include <ifaddrs.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/resource.h>
-#include <sys/epoll.h>
-#include <sys/syscall.h>
-#include <asm/unistd.h>
-#include <linux/if.h>
-#include <linux/socket.h>
-#include <linux/types.h>
-#include <linux/if_ether.h>
-#include <linux/if_packet.h>
-#include <linux/sockios.h>
-#include <netinet/tcp.h>
-#include <netinet/udp.h>
-
-#include "die.h"
-#include "str.h"
-#include "xutils.h"
-#include "ring.h"
-#include "sock.h"
-#include "built_in.h"
-
-void set_epoll_descriptor(int fd_epoll, int action, int fd_toadd, int events)
-{
- int ret;
- struct epoll_event ev;
-
- memset(&ev, 0, sizeof(ev));
- ev.events = events;
- ev.data.fd = fd_toadd;
-
- ret = epoll_ctl(fd_epoll, action, fd_toadd, &ev);
- if (ret < 0)
- panic("Cannot add socket for epoll!\n");
-}
-
-int set_epoll_descriptor2(int fd_epoll, int action, int fd_toadd, int events)
-{
- struct epoll_event ev;
-
- memset(&ev, 0, sizeof(ev));
- ev.events = events;
- ev.data.fd = fd_toadd;
-
- return epoll_ctl(fd_epoll, action, fd_toadd, &ev);
-}
diff --git a/xutils.h b/xutils.h
deleted file mode 100644
index 2e0e251..0000000
--- a/xutils.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * netsniff-ng - the packet sniffing beast
- * Copyright 2009, 2010 Daniel Borkmann.
- * Copyright 2009, 2010 Emmanuel Roullit.
- * Subject to the GPL, version 2.
- */
-
-#ifndef XSYS_H
-#define XSYS_H
-
-#define _GNU_SOURCE
-#include <errno.h>
-#include <stdint.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <linux/ethtool.h>
-#include <linux/if.h>
-#include <linux/wireless.h>
-#include <poll.h>
-#include <sys/poll.h>
-#include <sched.h>
-#include <stdbool.h>
-#include <sys/resource.h>
-#include <sys/time.h>
-
-#include "built_in.h"
-
-extern void set_epoll_descriptor(int fd_epoll, int action, int fd_toadd, int events);
-extern int set_epoll_descriptor2(int fd_epoll, int action, int fd_toadd, int events);
-
-#endif /* XSYS_H */