Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@666 | 1 | Index: tun.c |
michael@668 | 2 | diff -Nau tun.c.orig tun.c |
michael@666 | 3 | --- tun.c.orig 2011-04-06 18:05:52.000000000 +0200 |
michael@666 | 4 | +++ tun.c 2011-04-30 10:22:38.000000000 +0200 |
michael@668 | 5 | @@ -1391,7 +1391,8 @@ |
michael@666 | 6 | #elif defined(TARGET_SOLARIS) |
michael@666 | 7 | |
michael@666 | 8 | #ifndef TUNNEWPPA |
michael@666 | 9 | -#error I need the symbol TUNNEWPPA from net/if_tun.h |
michael@666 | 10 | +#warning I usually need the symbol TUNNEWPPA from net/if_tun.h -- using a shameless local copy taken from TUN 1.1 |
michael@666 | 11 | +#define TUNNEWPPA (('T'<<16) | 0x0001) |
michael@666 | 12 | #endif |
michael@666 | 13 | |
michael@666 | 14 | void |
michael@668 | 15 | |
michael@668 | 16 | ----------------------------------------------------------------------- |
michael@668 | 17 | |
michael@668 | 18 | It's a hack since unnumbered device drivers could contain digits in |
michael@668 | 19 | their name, but at least this corrects OpenVPN's false assumption that |
michael@668 | 20 | all TUN drivers in the world are named 'tun' by module and device node. |
michael@668 | 21 | In the worst case, this change attempts to attach to a unnumbered device |
michael@668 | 22 | node without appending a number which should fail. |
michael@668 | 23 | |
michael@668 | 24 | - MSvB 2012 |
michael@668 | 25 | |
michael@668 | 26 | Index: tun.c |
michael@668 | 27 | diff -Nau tun.c.orig tun.c |
michael@668 | 28 | --- tun.c.orig Fri Mar 2 19:28:20 2012 |
michael@668 | 29 | +++ tun.c Fri Mar 2 21:08:22 2012 |
michael@668 | 30 | @@ -1480,7 +1480,10 @@ |
michael@668 | 31 | tt->actual_name = (char *) malloc (32); |
michael@668 | 32 | check_malloc_return (tt->actual_name); |
michael@668 | 33 | |
michael@668 | 34 | - openvpn_snprintf (tt->actual_name, 32, "%s%d", dev_tuntap_type, ppa); |
michael@668 | 35 | + if (has_digit((unsigned char *)dev)) |
michael@668 | 36 | + openvpn_snprintf (tt->actual_name, 32, "%s", dev); |
michael@668 | 37 | + else |
michael@668 | 38 | + openvpn_snprintf (tt->actual_name, 32, "%s%d", dev, ppa); |
michael@668 | 39 | |
michael@668 | 40 | if (tt->type == DEV_TYPE_TAP) |
michael@668 | 41 | { |
michael@668 | 42 | Index: error.c |
michael@668 | 43 | diff -Nau error.c.orig error.c |
michael@668 | 44 | --- error.c.orig 2011-12-13 17:58:56.000000000 +0100 |
michael@668 | 45 | +++ error.c 2012-03-06 18:52:39.236992377 +0100 |
michael@668 | 46 | @@ -656,6 +656,13 @@ |
michael@668 | 47 | void plugin_abort (void); |
michael@668 | 48 | #endif |
michael@668 | 49 | |
michael@668 | 50 | + /* Ignored BUG https://community.openvpn.net/openvpn/ticket/53 |
michael@668 | 51 | + * This solves the problem of flawed release of important resources |
michael@668 | 52 | + * when OpenVPN daemonizes. Otherwise we see immediately after startup: |
michael@668 | 53 | + * Tue Mar 6 18:33:22 2012 Initialization Sequence Completed |
michael@668 | 54 | + * Tue Mar 6 18:33:36 2012 event_wait : Interrupted system call |
michael@668 | 55 | + * Tue Mar 6 18:33:36 2012 TCP/UDP: Closing socket */ |
michael@668 | 56 | + if (status == OPENVPN_EXIT_STATUS_ERROR) |
michael@668 | 57 | tun_abort(); |
michael@668 | 58 | |
michael@668 | 59 | #ifdef WIN32 |
michael@668 | 60 | @@ -665,6 +672,7 @@ |
michael@668 | 61 | close_syslog (); |
michael@668 | 62 | |
michael@668 | 63 | #ifdef ENABLE_PLUGIN |
michael@668 | 64 | + if (status == OPENVPN_EXIT_STATUS_ERROR) |
michael@668 | 65 | plugin_abort (); |
michael@668 | 66 | #endif |
michael@668 | 67 |