aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vpn/gnunet-helper-hijack-dns.c4
-rw-r--r--src/vpn/gnunet-helper-vpn.c8
-rw-r--r--src/vpn/gnunet-vpn-tun.c2
3 files changed, 9 insertions, 5 deletions
diff --git a/src/vpn/gnunet-helper-hijack-dns.c b/src/vpn/gnunet-helper-hijack-dns.c
index 671223851..cc002a8cb 100644
--- a/src/vpn/gnunet-helper-hijack-dns.c
+++ b/src/vpn/gnunet-helper-hijack-dns.c
@@ -30,7 +30,7 @@
30int fork_and_exec(char* file, char* cmd[]) { 30int fork_and_exec(char* file, char* cmd[]) {
31 pid_t pid = fork(); 31 pid_t pid = fork();
32 if (pid < 0) { 32 if (pid < 0) {
33 fprintf(stderr, "could not fork: %m\n"); 33 fprintf(stderr, "could not fork: %s\n", strerror(errno));
34 return GNUNET_SYSERR; 34 return GNUNET_SYSERR;
35 } 35 }
36 36
@@ -61,7 +61,7 @@ int main(int argc, char** argv) {
61 61
62 struct stat s; 62 struct stat s;
63 if (stat("/sbin/iptables", &s) < 0) { 63 if (stat("/sbin/iptables", &s) < 0) {
64 fprintf(stderr, "stat on /sbin/iptables failed: %m\n"); 64 fprintf(stderr, "stat on /sbin/iptables failed: %s\n", strerror(errno));
65 return GNUNET_SYSERR; 65 return GNUNET_SYSERR;
66 } 66 }
67 67
diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c
index 00ac1b0ec..3f9bcb3d4 100644
--- a/src/vpn/gnunet-helper-vpn.c
+++ b/src/vpn/gnunet-helper-vpn.c
@@ -82,6 +82,7 @@ static void set_address6(char* dev, char* address, unsigned long prefix_len) { /
82 /* FIXME */ ioctl(fd, SIOCGIFFLAGS, &ifr); 82 /* FIXME */ ioctl(fd, SIOCGIFFLAGS, &ifr);
83 ifr.ifr_flags |= IFF_UP | IFF_RUNNING; 83 ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
84 /* FIXME */ ioctl(fd, SIOCSIFFLAGS, &ifr); 84 /* FIXME */ ioctl(fd, SIOCSIFFLAGS, &ifr);
85 close(fd);
85} /* }}} */ 86} /* }}} */
86 87
87static void set_address4(char* dev, char* address, char* mask) { /* {{{ */ 88static void set_address4(char* dev, char* address, char* mask) { /* {{{ */
@@ -123,6 +124,7 @@ static void set_address4(char* dev, char* address, char* mask) { /* {{{ */
123 /* FIXME */ ioctl(fd, SIOCGIFFLAGS, &ifr); 124 /* FIXME */ ioctl(fd, SIOCGIFFLAGS, &ifr);
124 ifr.ifr_flags |= IFF_UP | IFF_RUNNING; 125 ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
125 /* FIXME */ ioctl(fd, SIOCSIFFLAGS, &ifr); 126 /* FIXME */ ioctl(fd, SIOCSIFFLAGS, &ifr);
127 close(fd);
126} /* }}} */ 128} /* }}} */
127 129
128void setnonblocking(int fd) {/*{{{*/ 130void setnonblocking(int fd) {/*{{{*/
@@ -150,7 +152,7 @@ int main(int argc, char** argv) {
150 int fd_tun = init_tun(dev); 152 int fd_tun = init_tun(dev);
151 153
152 if (fd_tun < 0) { 154 if (fd_tun < 0) {
153 fprintf(stderr, "Could not initialize tun-interface: %m\n"); 155 fprintf(stderr, "Could not initialize tun-interface: %s\n", strerror(errno));
154 exit(1); 156 exit(1);
155 } 157 }
156 158
@@ -270,7 +272,7 @@ outer:
270 while(r < ntohs(hdr.size)) { 272 while(r < ntohs(hdr.size)) {
271 int t = write(1, buf, ntohs(hdr.size) - r); 273 int t = write(1, buf, ntohs(hdr.size) - r);
272 if (t < 0) { 274 if (t < 0) {
273 fprintf(stderr, "write-error 1: %m, written %d/%d\n", r, ntohs(hdr.size)); 275 fprintf(stderr, "write-error 1: %s, written %d/%d\n", strerror(errno), r, ntohs(hdr.size));
274 shutdown(fd_tun, SHUT_RD); 276 shutdown(fd_tun, SHUT_RD);
275 shutdown(1, SHUT_WR); 277 shutdown(1, SHUT_WR);
276 rea = 0; 278 rea = 0;
@@ -283,5 +285,7 @@ outer:
283 } 285 }
284 fprintf(stderr, "Quitting!\n"); 286 fprintf(stderr, "Quitting!\n");
285 287
288 close(fd_tun);
289
286 return 0; 290 return 0;
287} 291}
diff --git a/src/vpn/gnunet-vpn-tun.c b/src/vpn/gnunet-vpn-tun.c
index e3854495f..ec8632f1c 100644
--- a/src/vpn/gnunet-vpn-tun.c
+++ b/src/vpn/gnunet-vpn-tun.c
@@ -29,7 +29,7 @@ int init_tun(char *dev) {{{
29 int fd, err; 29 int fd, err;
30 30
31 if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) { 31 if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) {
32 fprintf(stderr, "opening /dev/net/tun: %m\n"); 32 fprintf(stderr, "opening /dev/net/tun: %s\n", strerror(errno));
33 return -1; 33 return -1;
34 } 34 }
35 35