aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-01-19 09:14:03 +0000
committerChristian Grothoff <christian@grothoff.org>2011-01-19 09:14:03 +0000
commit60a1041f916d83c51800da45895eee029de31da6 (patch)
tree494d2bcd6c9888c5a101a51c5362dd36b597a6b7 /src/vpn
parentbfa3121cb08cab4930d85681b1c59fb3b36dc769 (diff)
downloadgnunet-60a1041f916d83c51800da45895eee029de31da6.tar.gz
gnunet-60a1041f916d83c51800da45895eee029de31da6.zip
byebye
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/gnunet-helper-vpn.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c
index 6dc858f97..92e7d423e 100644
--- a/src/vpn/gnunet-helper-vpn.c
+++ b/src/vpn/gnunet-helper-vpn.c
@@ -56,13 +56,6 @@ struct in6_ifreq
56#endif 56#endif
57 57
58 58
59struct suid_packet
60{
61 struct GNUNET_MessageHeader hdr;
62 unsigned char data[1];
63}
64
65
66/** 59/**
67 * Creates a tun-interface called dev; 60 * Creates a tun-interface called dev;
68 * @param dev is asumed to point to a char[IFNAMSIZ] 61 * @param dev is asumed to point to a char[IFNAMSIZ]
@@ -305,7 +298,7 @@ outer:
305 if (FD_ISSET (0, &fds_r) && write_fd_possible) 298 if (FD_ISSET (0, &fds_r) && write_fd_possible)
306 { 299 {
307 write_fd_possible = 0; 300 write_fd_possible = 0;
308 struct suid_packet *pkt = (struct suid_packet *) buf; 301 struct GNUNET_MessageHeader *pkt = ( struct GNUNET_MessageHeader *) buf;
309 tin = read (0, buf, sizeof (struct GNUNET_MessageHeader)); 302 tin = read (0, buf, sizeof (struct GNUNET_MessageHeader));
310 if (tin <= 0) 303 if (tin <= 0)
311 { 304 {
@@ -315,11 +308,11 @@ outer:
315 wri = 0; 308 wri = 0;
316 goto outer; 309 goto outer;
317 } 310 }
318 if (pkt->hdr.type != ntohs (GNUNET_MESSAGE_TYPE_VPN_HELPER)) 311 if (pkt->type != ntohs (GNUNET_MESSAGE_TYPE_VPN_HELPER))
319 abort (); 312 abort ();
320 while (tin < ntohs (pkt->hdr.size)) 313 while (tin < ntohs (pkt->size))
321 { 314 {
322 ssize_t t = read (0, buf + tin, ntohs (pkt->hdr.size) - tin); 315 ssize_t t = read (0, buf + tin, ntohs (pkt->size) - tin);
323 if (t <= 0) 316 if (t <= 0)
324 { 317 {
325 fprintf (stderr, "read-error: %s\n", strerror (errno)); 318 fprintf (stderr, "read-error: %s\n", strerror (errno));
@@ -332,11 +325,11 @@ outer:
332 } 325 }
333 tin = 0; 326 tin = 0;
334 while (tin < 327 while (tin <
335 ntohs (pkt->hdr.size) - 328 ntohs (pkt->size) -
336 sizeof (struct GNUNET_MessageHeader)) 329 sizeof (struct GNUNET_MessageHeader))
337 { 330 {
338 ssize_t t = write (fd_tun, pkt->data, 331 ssize_t t = write (fd_tun, &pkt[1],
339 ntohs (pkt->hdr.size) - 332 ntohs (pkt->size) -
340 sizeof (struct GNUNET_MessageHeader) - tin); 333 sizeof (struct GNUNET_MessageHeader) - tin);
341 if (t <= 0) 334 if (t <= 0)
342 { 335 {