diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-12-13 10:25:29 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-12-13 10:25:29 +0000 |
commit | af69da485fd33e58fb827c0686e77f63cf5702c2 (patch) | |
tree | 7d51f733da5fc8afffac70b16fb7251d33cc5a79 /src/vpn | |
parent | 23bbdf1b43cc34d3d52f6b342a6122198bb3d938 (diff) | |
download | gnunet-af69da485fd33e58fb827c0686e77f63cf5702c2.tar.gz gnunet-af69da485fd33e58fb827c0686e77f63cf5702c2.zip |
-comments
Diffstat (limited to 'src/vpn')
-rw-r--r-- | src/vpn/gnunet-helper-vpn-windows.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/vpn/gnunet-helper-vpn-windows.c b/src/vpn/gnunet-helper-vpn-windows.c index a4c020186..73b0eec2b 100644 --- a/src/vpn/gnunet-helper-vpn-windows.c +++ b/src/vpn/gnunet-helper-vpn-windows.c | |||
@@ -86,13 +86,13 @@ | |||
86 | #define _tpopen _popen | 86 | #define _tpopen _popen |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | /* | 89 | /** |
90 | * Our local process' PID. Used for creating a sufficiently unique additional | 90 | * Our local process' PID. Used for creating a sufficiently unique additional |
91 | * hardware ID for our device. | 91 | * hardware ID for our device. |
92 | */ | 92 | */ |
93 | static TCHAR secondary_hwid[LINE_LEN / 2]; | 93 | static TCHAR secondary_hwid[LINE_LEN / 2]; |
94 | 94 | ||
95 | /* | 95 | /** |
96 | * Device's visible Name, used to identify a network device in netsh. | 96 | * Device's visible Name, used to identify a network device in netsh. |
97 | * eg: "Local Area Connection 9" | 97 | * eg: "Local Area Connection 9" |
98 | */ | 98 | */ |
@@ -188,7 +188,7 @@ set_address6 (const TCHAR *address, unsigned long prefix_len) | |||
188 | if (0 != ret) | 188 | if (0 != ret) |
189 | { | 189 | { |
190 | _ftprintf (stderr, _T ("Setting IPv6 address failed: %s\n"), strerror (ret)); | 190 | _ftprintf (stderr, _T ("Setting IPv6 address failed: %s\n"), strerror (ret)); |
191 | exit (1); | 191 | exit (1); // FIXME: return error code, shut down interface / unload driver |
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
@@ -222,7 +222,7 @@ set_address4 (const char *address, const char *mask) | |||
222 | if (0 != ret) | 222 | if (0 != ret) |
223 | { | 223 | { |
224 | _ftprintf (stderr, _T ("Setting IPv4 address failed: %s\n"), strerror (ret)); | 224 | _ftprintf (stderr, _T ("Setting IPv4 address failed: %s\n"), strerror (ret)); |
225 | exit (1); | 225 | exit (1); // FIXME: return error code, shut down interface / unload driver |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
@@ -396,7 +396,7 @@ resolve_interface_name () | |||
396 | /* Of course there is a multitude of entries here, with arbitrary names, | 396 | /* Of course there is a multitude of entries here, with arbitrary names, |
397 | * thus we need to iterate through there. | 397 | * thus we need to iterate through there. |
398 | */ | 398 | */ |
399 | while (FALSE == retval) | 399 | while (! retval) |
400 | { | 400 | { |
401 | TCHAR instance_key[256]; | 401 | TCHAR instance_key[256]; |
402 | TCHAR query_key [256]; | 402 | TCHAR query_key [256]; |
@@ -486,21 +486,13 @@ cleanup: | |||
486 | /** | 486 | /** |
487 | * Creates a tun-interface called dev; | 487 | * Creates a tun-interface called dev; |
488 | * | 488 | * |
489 | * @param hwid is asumed to point to a TCHAR[LINE_LEN] | ||
490 | * if *dev == '\\0', uses the name supplied by the kernel; | ||
491 | * @return the fd to the tun or -1 on error | 489 | * @return the fd to the tun or -1 on error |
492 | */ | 490 | */ |
493 | static int | 491 | static int |
494 | init_tun (TCHAR *hwid) | 492 | init_tun () |
495 | { | 493 | { |
496 | int fd=-1; | 494 | int fd=-1; |
497 | 495 | ||
498 | if (NULL == hwid) | ||
499 | { | ||
500 | errno = EINVAL; | ||
501 | return -1; | ||
502 | } | ||
503 | |||
504 | if (!setup_interface ()) | 496 | if (!setup_interface ()) |
505 | { | 497 | { |
506 | errno = ENODEV; | 498 | errno = ENODEV; |
@@ -578,9 +570,9 @@ main (int argc, char **argv) | |||
578 | */ | 570 | */ |
579 | _itot (_getpid (), pid_as_string, 10); | 571 | _itot (_getpid (), pid_as_string, 10); |
580 | strncpy (secondary_hwid, hwid, LINE_LEN); | 572 | strncpy (secondary_hwid, hwid, LINE_LEN); |
581 | strncat (secondary_hwid, pid_as_string, LINE_LEN); | 573 | strncat (secondary_hwid, pid_as_string, LINE_LEN); // BUFFER OVERFLOW! |
582 | 574 | ||
583 | if (-1 == (fd_tun = init_tun (hwid))) | 575 | if (-1 == (fd_tun = init_tun ())) |
584 | { | 576 | { |
585 | fprintf (stderr, "Fatal: could not initialize virtual-interface %s with IPv6 %s/%s and IPv4 %s/%s\n", | 577 | fprintf (stderr, "Fatal: could not initialize virtual-interface %s with IPv6 %s/%s and IPv4 %s/%s\n", |
586 | hwid, | 578 | hwid, |