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
Joanne Hugé
re6stnet
Commits
866d9caf
Commit
866d9caf
authored
Aug 29, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use ipwin to count ipv6 route after windows vista.
Fix issue: count ipv6 route failed in non-english environments
parent
7df99eeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
22 deletions
+7
-22
re6st/tunnel.py
re6st/tunnel.py
+7
-22
No files found.
re6st/tunnel.py
View file @
866d9caf
...
...
@@ -313,36 +313,21 @@ class TunnelManager(object):
if
sys
.
platform
==
'cygwin'
:
def
_iterRoutes
(
self
):
interface_dict
=
{}
interfaces
=
subprocess
.
check_output
(
(
'netsh'
,
'interface'
,
'ipv6'
,
'show'
,
'interface'
),
stderr
=
subprocess
.
STDOUT
)
for
line
in
interfaces
.
splitlines
():
if
not
line
==
''
:
fs
=
line
.
split
(
None
,
4
)
if
fs
[
0
].
isdigit
():
interface_dict
[
fs
[
0
].
strip
()]
=
fs
[
4
].
strip
()
routing_table
=
subprocess
.
check_output
(
(
'netsh'
,
'interface'
,
'ipv6'
,
'show'
,
'route'
,
'verbose'
),
stderr
=
subprocess
.
STDOUT
)
# Before Vista
if
platform
.
system
()[
10
:
11
]
==
'5'
:
pname
=
'Prefix'
ifname
=
lambda
a
:
a
# From Vista later
args
=
(
'netsh'
,
'interface'
,
'ipv6'
,
'show'
,
'route'
,
'verbose'
)
else
:
pname
=
'Destination Prefix'
ifname
=
interface_dict
.
get
args
=
(
'ipwin'
,
'ipv6'
,
'show'
,
'route'
,
'verbose'
)
routing_table
=
subprocess
.
check_output
(
args
,
stderr
=
subprocess
.
STDOUT
)
for
line
in
routing_table
.
splitlines
():
fs
=
line
.
split
(
':'
,
1
)
test
=
fs
[
0
].
startswith
if
test
(
pname
):
if
test
(
'Prefix'
):
prefix
,
prefix_len
=
fs
[
1
].
split
(
'/'
,
1
)
elif
test
(
'Interface'
):
yield
(
ifname
(
fs
[
1
].
strip
()),
utils
.
binFromIp
(
prefix
.
strip
()),
int
(
prefix_len
))
yield
(
fs
[
1
].
strip
(),
utils
.
binFromIp
(
prefix
.
strip
()),
int
(
prefix_len
))
else
:
def
_iterRoutes
(
self
):
with
open
(
'/proc/net/ipv6_route'
)
as
f
:
...
...
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