Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Yohann D'Anello
re6stnet
Commits
cf991b97
Commit
cf991b97
authored
Apr 16, 2013
by
Jondy Zhao
Committed by
Julien Muchembled
Apr 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use --dev-node other than --dev when run openvpn in the Cygwin;
Add function TunnelManager._get_win32_ipv6_route_table.
parent
620b9e98
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
14 deletions
+30
-14
re6st/plib.py
re6st/plib.py
+2
-2
re6st/tunnel.py
re6st/tunnel.py
+28
-12
No files found.
re6st/plib.py
View file @
cf991b97
import
logging
,
errno
,
os
import
logging
,
errno
,
os
,
sys
from
.
import
utils
here
=
os
.
path
.
realpath
(
os
.
path
.
dirname
(
__file__
))
...
...
@@ -9,7 +9,7 @@ ovpn_log = None
def
openvpn
(
iface
,
encrypt
,
*
args
,
**
kw
):
args
=
[
'openvpn'
,
'--dev-type'
,
'tap'
,
'--dev'
,
iface
,
'--dev
-node'
if
sys
.
platform
==
'cygwin'
else
'--dev
'
,
iface
,
'--persist-tun'
,
'--persist-key'
,
'--script-security'
,
'2'
,
...
...
re6st/tunnel.py
View file @
cf991b97
import
logging
,
random
,
socket
,
subprocess
,
time
import
logging
,
random
,
socket
,
subprocess
,
sys
,
time
from
collections
import
deque
from
itertools
import
chain
from
.
import
plib
,
utils
...
...
@@ -303,6 +303,31 @@ class TunnelManager(object):
if
self
.
_makeTunnel
(
*
peer
):
break
if
sys
.
platform
==
'cygwin'
:
def
_iterRoutes
(
self
):
routing_table
=
subprocess
.
check_output
(
(
'netsh'
,
'interface'
,
'ipv6'
,
'show'
,
'route'
,
'verbose'
),
stderr
=
subprocess
.
OUTPUT
)
for
line
in
routing_table
.
splitlines
():
fs
=
line
.
split
(
':'
,
1
)
test
=
fs
[
0
].
startswith
if
test
(
'Prefix'
):
prefix
,
prefix_len
=
fs
[
1
].
split
(
'/'
,
1
)
elif
test
(
'Interface'
):
yield
(
fs
[
1
].
strip
(),
utils
.
binFromIp
(
prefix
),
int
(
prefix_len
))
else
:
def
_iterRoutes
(
self
):
with
open
(
'/proc/net/ipv6_route'
)
as
f
:
routing_table
=
f
.
read
()
for
line
in
routing_table
.
splitlines
():
line
=
line
.
split
()
iface
=
line
[
-
1
]
if
iface
!=
'lo'
and
not
(
int
(
line
[
-
2
],
16
)
&
RTF_CACHE
):
yield
(
iface
,
bin
(
int
(
line
[
0
],
16
))[
2
:].
rjust
(
128
,
'0'
),
int
(
line
[
1
],
16
))
def
_countRoutes
(
self
):
logging
.
debug
(
'Starting to count the routes on each interface...'
)
del
self
.
_distant_peers
[:]
...
...
@@ -311,17 +336,8 @@ class TunnelManager(object):
a
=
len
(
self
.
_network
)
b
=
a
+
len
(
self
.
_prefix
)
other
=
[]
with
open
(
'/proc/net/ipv6_route'
)
as
f
:
self
.
_last_routing_table
=
f
.
read
()
for
line
in
self
.
_last_routing_table
.
splitlines
():
line
=
line
.
split
()
iface
=
line
[
-
1
]
if
iface
==
'lo'
or
int
(
line
[
-
2
],
16
)
&
RTF_CACHE
:
continue
ip
=
bin
(
int
(
line
[
0
],
16
))[
2
:].
rjust
(
128
,
'0'
)
if
ip
[:
a
]
!=
self
.
_network
or
ip
[
a
:
b
]
==
self
.
_prefix
:
continue
prefix_len
=
int
(
line
[
1
],
16
)
for
iface
,
ip
,
prefix_len
in
self
.
_iterRoutes
():
if
ip
[:
a
]
==
self
.
_network
and
ip
[
a
:
b
]
!=
self
.
_prefix
:
prefix
=
ip
[
a
:
prefix_len
]
logging
.
trace
(
'Route on iface %s detected to %s/%u'
,
iface
,
utils
.
ipFromBin
(
ip
),
prefix_len
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment