summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/nonetwork.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/nonetwork.c b/tools/nonetwork.c
new file mode 100644
index 0000000..d203fb2
--- /dev/null
+++ b/tools/nonetwork.c
@@ -0,0 +1,36 @@
+// nonetwork, break standard network functions using LD_PRELOAD
+// Source: https://github.com/starius/nonetwork
+// Copyright (C) 2015 Boris Nagaev
+// License: MIT
+
+#include <errno.h>
+
+int connect(int sock, const void *addr, unsigned int len) {
+ errno = 13; // EACCES, Permission denied
+ return -1;
+}
+
+void *gethostbyname(const char *name) {
+ return 0;
+}
+
+int getaddrinfo(const char *node, const char *service,
+ const void *hints,
+ void **res) {
+ return -4; // EAI_FAIL
+}
+
+void freeaddrinfo(void *res) {
+}
+
+int getnameinfo(const void * sa,
+ unsigned int salen, char * host,
+ unsigned int hostlen, char * serv,
+ unsigned int servlen, int flags) {
+ return -4; // EAI_FAIL
+}
+
+struct hostent *gethostbyaddr(const void *addr, unsigned int len,
+ int type) {
+ return 0;
+}