Révision | 9a05ad81f81bdbb8e40a3f4e19934efd48b98fa0 (tree) |
---|---|
l'heure | 2015-12-04 12:30:03 |
Auteur | Ruben Agin <phabrics@phab...> |
Commiter | Ruben Agin |
Fix for TAP windows ethernet. Updated docs for OpenVPN. New version.
@@ -34,7 +34,7 @@ dnl POSSIBILITY OF SUCH DAMAGE. | ||
34 | 34 | dnl Checks that we are given a good source directory. |
35 | 35 | AC_PREREQ([2.68]) |
36 | 36 | m4_include(version.m4) |
37 | -AC_INIT([tme], [0.12beta12]) | |
37 | +AC_INIT([tme], [0.12beta14]) | |
38 | 38 | AC_CONFIG_SRCDIR([ic/m68k/m68k-impl.h]) |
39 | 39 | AC_CONFIG_MACRO_DIR([m4]) |
40 | 40 | AC_CANONICAL_TARGET |
@@ -286,6 +286,8 @@ _tme_eth_th_reader(struct tme_ethernet *eth) | ||
286 | 286 | } |
287 | 287 | |
288 | 288 | #elif defined(OPENVPN_ETH) |
289 | + event_reset(eth->tme_eth_event_set); | |
290 | + | |
289 | 291 | flags = EVENT_READ; |
290 | 292 | |
291 | 293 | can_write = eth->tme_eth_can_write; |
@@ -321,20 +323,27 @@ _tme_eth_th_reader(struct tme_ethernet *eth) | ||
321 | 323 | eth->tme_eth_buffer, |
322 | 324 | eth->tme_eth_buffer_size); |
323 | 325 | #endif |
326 | + tme_mutex_lock(ð->tme_eth_mutex); | |
327 | + | |
328 | +#ifdef OPENVPN_ETH | |
329 | + if(can_write && !eth->tme_eth_can_write) { | |
330 | + /* signal transition that we can write */ | |
331 | + eth->tme_eth_can_write = TRUE; | |
332 | + //_tme_eth_callout(eth, TME_ETH_CALLOUT_CTRL); | |
333 | + } | |
334 | +#endif | |
335 | + | |
324 | 336 | /* if the read failed: */ |
325 | - if (buffer_end <= 0 | |
337 | + if(buffer_end <= 0) { | |
326 | 338 | #ifdef OPENVPN_ETH |
327 | - && !can_write | |
339 | + if(!can_write) | |
328 | 340 | #endif |
329 | - ) { | |
330 | - tme_log(ð->tme_eth_element->tme_element_log_handle, 1, errno, | |
331 | - (ð->tme_eth_element->tme_element_log_handle, | |
332 | - _("failed to read/write packets"))); | |
333 | - tme_mutex_lock(ð->tme_eth_mutex); | |
341 | + tme_log(ð->tme_eth_element->tme_element_log_handle, 1, errno, | |
342 | + (ð->tme_eth_element->tme_element_log_handle, | |
343 | + _("failed to read/write packets"))); | |
334 | 344 | continue; |
335 | 345 | } |
336 | 346 | |
337 | - | |
338 | 347 | /* Filter out multicast packets we sent or unicast packets not destined for us. |
339 | 348 | This should remove all duplicate packets on, i.e., tap interfaces... |
340 | 349 | */ |
@@ -352,19 +361,9 @@ _tme_eth_th_reader(struct tme_ethernet *eth) | ||
352 | 361 | tme_log(ð->tme_eth_element->tme_element_log_handle, 1, TME_OK, |
353 | 362 | (ð->tme_eth_element->tme_element_log_handle, |
354 | 363 | _("read %ld bytes of packets"), (long) buffer_end)); |
355 | - tme_mutex_lock(ð->tme_eth_mutex); | |
356 | 364 | eth->tme_eth_buffer_offset = 0; |
357 | 365 | eth->tme_eth_buffer_end = buffer_end; |
358 | 366 | _tme_eth_callout(eth, TME_ETH_CALLOUT_CTRL); |
359 | - } else { | |
360 | - tme_mutex_lock(ð->tme_eth_mutex); | |
361 | -#ifdef OPENVPN_ETH | |
362 | - if(can_write && !eth->tme_eth_can_write) { | |
363 | - /* signal transition that we can write */ | |
364 | - eth->tme_eth_can_write = TRUE; | |
365 | - //_tme_eth_callout(eth, TME_ETH_CALLOUT_CTRL); | |
366 | - } | |
367 | -#endif | |
368 | 367 | } |
369 | 368 | } |
370 | 369 | /* NOTREACHED */ |
@@ -59,6 +59,9 @@ _TME_RCSID("$Id: posix-disk.c,v 1.6 2010/06/05 14:28:57 fredette Exp $"); | ||
59 | 59 | #else |
60 | 60 | #include "mman.h" |
61 | 61 | #endif |
62 | +#ifdef WIN32 | |
63 | +#include <windows.h> | |
64 | +#endif | |
62 | 65 | #ifdef HAVE_STDARG_H |
63 | 66 | #include <stdarg.h> |
64 | 67 | #else /* HAVE_STDARG_H */ |
@@ -716,6 +719,10 @@ _tme_posix_disk_open(struct tme_posix_disk *posix_disk, | ||
716 | 719 | page_size = sysconf(_SC_PAGESIZE); |
717 | 720 | #elif defined(_SC_PAGE_SIZE) |
718 | 721 | page_size = sysconf(_SC_PAGE_SIZE); |
722 | +#elif defined(WIN32) | |
723 | + SYSTEM_INFO si; | |
724 | + GetSystemInfo(&si); | |
725 | + page_size = si.dwPageSize; | |
719 | 726 | #else |
720 | 727 | page_size = 4096; |
721 | 728 | #endif |
@@ -49,6 +49,9 @@ _TME_RCSID("$Id: recode-mmap.c,v 1.2 2008/07/01 02:00:53 fredette Exp $"); | ||
49 | 49 | #else |
50 | 50 | #include "mman.h" |
51 | 51 | #endif |
52 | +#ifdef WIN32 | |
53 | +#include <windows.h> | |
54 | +#endif | |
52 | 55 | |
53 | 56 | /* this host function allocates memory for building and running thunks: */ |
54 | 57 | void |
@@ -64,6 +67,10 @@ tme_recode_host_thunks_alloc(struct tme_recode_ic *ic, | ||
64 | 67 | size_page = sysconf(_SC_PAGESIZE); |
65 | 68 | #elif defined(_SC_PAGE_SIZE) |
66 | 69 | size_page = sysconf(_SC_PAGE_SIZE); |
70 | +#elif defined(WIN32) | |
71 | + SYSTEM_INFO si; | |
72 | + GetSystemInfo(&si); | |
73 | + size_page = si.dwPageSize; | |
67 | 74 | #else |
68 | 75 | size_page = 4096; |
69 | 76 | #endif |
@@ -54,9 +54,22 @@ scsibus0 at sc0: tme/scsi/bus | ||
54 | 54 | #mie0 memory 0xa0000 at mbmem0 addr 0xa0000 |
55 | 55 | #ie0 at mie0: tme/ic/i82586 |
56 | 56 | #bpf1 at ie0: tme/host/bsd/bpf delay 10000 |
57 | + | |
57 | 58 | # OR enable tap ethernet device, an alternative method for network access |
58 | -# if you have read/write permission on tap device or have cap_net_admin+ep capability (on Linux) | |
59 | +# 2 ways to access a tap device: native or openvpn (respectively below) | |
60 | +# both require setuid or equivalent permissions, which should be set up at build time | |
59 | 61 | #tap1 at ie0: tme/host/tun/tap inet 10.0.77.1 netmask 255.255.255.0 bcast 10.0.77.255 |
62 | +#tap1 at ie0: tme/host/openvpn/tap --dev tap --ifconfig 10.0.77.1 255.255.255.0 --tun-ipv6 --ifconfig-ipv6 "2001:db8::1/64" "2001:db8::2" | |
63 | + | |
64 | +# You can enable "networking" multiple machines using the following line, | |
65 | +# while removing the " at ie0" from the one of the previous 2 lines that is used | |
66 | +# to set up the tap device. | |
67 | +#tap1 at tap1 | |
68 | + | |
69 | +# This creates a master configuration that can be used with different slave | |
70 | +# configurations that only need the second line below to connect to the tap network | |
71 | +# via bpf. Note that the master requires this line, too... | |
72 | +#bpf1 at ie0: tme/host/bsd/bpf interface tap0 | |
60 | 73 | |
61 | 74 | ## the Sun bwtwo Multibus board, Sun type-2 keyboard and mouse, and |
62 | 75 | ## the GTK-based display to drive them all: |
@@ -33,8 +33,20 @@ mainbus0 intreg at obio0 addr 0x0A0000 | ||
33 | 33 | #ie0 at obie0: tme/ic/i82586 |
34 | 34 | #bpf1 at ie0: tme/host/bsd/bpf |
35 | 35 | # OR enable tap ethernet device, an alternative method for network access |
36 | -# if you have read/write permission on tap device or have cap_net_admin+ep capability (on Linux) | |
36 | +# 2 ways to access a tap device: native or openvpn (respectively below) | |
37 | +# both require setuid or equivalent permissions, which should be set up at build time | |
37 | 38 | #tap1 at ie0: tme/host/tun/tap inet 10.0.77.1 netmask 255.255.255.0 bcast 10.0.77.255 |
39 | +#tap1 at ie0: tme/host/openvpn/tap --dev tap --ifconfig 10.0.77.1 255.255.255.0 --tun-ipv6 --ifconfig-ipv6 "2001:db8::1/64" "2001:db8::2" | |
40 | + | |
41 | +# You can enable "networking" multiple machines using the following line, | |
42 | +# while removing the " at ie0" from the one of the previous 2 lines that is used | |
43 | +# to set up the tap device. | |
44 | +#tap1 at tap1 | |
45 | + | |
46 | +# This creates a master configuration that can be used with different slave | |
47 | +# configurations that only need the second line below to connect to the tap network | |
48 | +# via bpf. Note that the master requires this line, too... | |
49 | +#bpf1 at ie0: tme/host/bsd/bpf interface tap0 | |
38 | 50 | |
39 | 51 | ## the Sun type-3 keyboard and mouse: |
40 | 52 | ## |
@@ -74,8 +74,20 @@ scsibus0 at ncr0: tme/scsi/bus | ||
74 | 74 | le0 at sbus0 slot 0 offset 0xc00000 ipl 5 dma-offset 0xff000000: tme/ic/am7990 |
75 | 75 | #bpf0 at le0: tme/host/bsd/bpf |
76 | 76 | # OR enable tap ethernet device, an alternative method for network access |
77 | -# if you have read/write permission on tap device or have cap_net_admin+ep capability (on Linux) | |
77 | +# 2 ways to access a tap device: native or openvpn (respectively below) | |
78 | +# both require setuid or equivalent permissions, which should be set up at build time | |
78 | 79 | #tap0 at le0: tme/host/tun/tap inet 10.0.77.1 netmask 255.255.255.0 bcast 10.0.77.255 |
80 | +#tap0 at le0: tme/host/openvpn/tap --dev tap --ifconfig 10.0.77.1 255.255.255.0 --tun-ipv6 --ifconfig-ipv6 "2001:db8::1/64" "2001:db8::2" | |
81 | + | |
82 | +# You can enable "networking" multiple machines using the following line, | |
83 | +# while removing the " at le0" from the one of the previous 2 lines that is used | |
84 | +# to set up the tap device. | |
85 | +#tap0 at tap0 | |
86 | + | |
87 | +# This creates a master configuration that can be used with different slave | |
88 | +# configurations that only need the second line below to connect to the tap network | |
89 | +# via bpf. Note that the master requires this line, too... | |
90 | +#bpf0 at le0: tme/host/bsd/bpf interface tap0 | |
79 | 91 | |
80 | 92 | ## an SBus cgthree: |
81 | 93 | ## |
@@ -77,8 +77,20 @@ ledma0 at sbus0 slot 14 offset 0x8c00000 | ||
77 | 77 | le0 at ledma0 master: tme/ic/am7990 |
78 | 78 | #bpf0 at le0: tme/host/bsd/bpf |
79 | 79 | # OR enable tap ethernet device, an alternative method for network access |
80 | -# if you have read/write permission on tap device or have cap_net_admin+ep capability (on Linux) | |
80 | +# 2 ways to access a tap device: native or openvpn (respectively below) | |
81 | +# both require setuid or equivalent permissions, which should be set up at build time | |
81 | 82 | #tap0 at le0: tme/host/tun/tap inet 10.0.77.1 netmask 255.255.255.0 bcast 10.0.77.255 |
83 | +#tap0 at le0: tme/host/openvpn/tap --dev tap --ifconfig 10.0.77.1 255.255.255.0 --tun-ipv6 --ifconfig-ipv6 "2001:db8::1/64" "2001:db8::2" | |
84 | + | |
85 | +# You can enable "networking" multiple machines using the following line, | |
86 | +# while removing the " at le0" from the one of the previous 2 lines that is used | |
87 | +# to set up the tap device. | |
88 | +#tap0 at tap0 | |
89 | + | |
90 | +# This creates a master configuration that can be used with different slave | |
91 | +# configurations that only need the second line below to connect to the tap network | |
92 | +# via bpf. Note that the master requires this line, too... | |
93 | +#bpf0 at le0: tme/host/bsd/bpf interface tap0 | |
82 | 94 | |
83 | 95 | ## the SBus parallel port: |
84 | 96 | ## |
@@ -97,6 +97,7 @@ Networking | ||
97 | 97 | * PPP:: |
98 | 98 | * IPv4 Network Address Translation:: |
99 | 99 | * Proxy ARP/NDP:: |
100 | +* OpenVPN:: | |
100 | 101 | * Network Descriptions:: |
101 | 102 | * Network Services:: |
102 | 103 |
@@ -233,8 +234,8 @@ Windows - Preliminary support for building/running on Windows | ||
233 | 234 | platforms is provided through Cygwin. It should work out of the |
234 | 235 | box. See below for details. It should also build (natively or cross) |
235 | 236 | on MinGW, and run under the Wine emulator (use --without-x |
236 | ---enable-threads=glib configure options). No Ethernet support is | |
237 | -available for Windows, yet. | |
237 | +--enable-threads=glib configure options). Preliminary Ethernet support is | |
238 | +available for Windows, using OpenVPN. | |
238 | 239 | |
239 | 240 | @item |
240 | 241 | Other - It should work on any POSIX platforms, sans whatever features |
@@ -519,6 +520,7 @@ is the topic of the next section. | ||
519 | 520 | * PPP:: |
520 | 521 | * IPv4 Network Address Translation:: |
521 | 522 | * Proxy ARP/NDP:: |
523 | +* OpenVPN:: | |
522 | 524 | * Network Descriptions:: |
523 | 525 | * Network Services:: |
524 | 526 | @end menu |
@@ -880,6 +882,24 @@ apply, with commands used for IPv6 instead (ip -6). If your router | ||
880 | 882 | doesn't have a route to your host, this may be needed to use IPv6 |
881 | 883 | networking. |
882 | 884 | |
885 | +@node OpenVPN | |
886 | +@subsection OpenVPN | |
887 | + | |
888 | +Preliminary support for OpenVPN is now provided for the purposes of | |
889 | +creating and using TAP devices on multiple platforms. OpenVPN is | |
890 | +compiled in as another host module, with a special tap leaf interface, | |
891 | +that uses the same options as OpenVPN itself. See the OpenVPN docs | |
892 | +for further information. | |
893 | + | |
894 | +In particular, it can be used to configure tap interfaces with IP | |
895 | +or IPv6 addresses. Here is a sample line that can be used to accomplish | |
896 | +this: | |
897 | + | |
898 | +@code{tap0 at le0: tme/host/openvpn/tap --dev tap --ifconfig 10.0.77.1 255.255.255.0 --ifconfig-ipv6 "2001:db8::1/64" "2001:db8::2" --tun-ipv6} | |
899 | + | |
900 | +Note that this is currently the only way to get networking support | |
901 | +under Windows. | |
902 | + | |
883 | 903 | @node Network Descriptions |
884 | 904 | @subsection Network Descriptions |
885 | 905 |