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
Boris Kocherov
re6stnet
Commits
d5d89296
Commit
d5d89296
authored
Jul 25, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port forwarding is now correctly refreshed
parent
a35450fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
registry.py
registry.py
+10
-8
upnpigd.py
upnpigd.py
+5
-4
vifibnet.py
vifibnet.py
+5
-0
No files found.
registry.py
View file @
d5d89296
...
...
@@ -5,14 +5,9 @@ from email.mime.text import MIMEText
from
OpenSSL
import
crypto
import
utils
# To generate server ca and key with serial for 2001:db8:42::/48
# openssl req -nodes -new -x509 -key ca.key -set_serial 0x120010db80042 -days 365 -out ca.crt
IPV6_V6ONLY
=
26
SOL_IPV6
=
41
# Fix for librpcxml to avoid doing reverse dns on each request : it was causing a 5s delay on each request
# Fix for librpcxml to avoid doing reverse dns on each request
# it was causing a 5-10s delay on each request when no reverse DNS was avalaible
# for tis IP
import
BaseHTTPServer
...
...
@@ -24,6 +19,13 @@ BaseHTTPServer.BaseHTTPRequestHandler.address_string = not_insane_address_string
# end of the fix
# To generate server ca and key with serial for 2001:db8:42::/48
# openssl req -nodes -new -x509 -key ca.key -set_serial 0x120010db80042 -days 365 -out ca.crt
IPV6_V6ONLY
=
26
SOL_IPV6
=
41
class
RequestHandler
(
SimpleXMLRPCRequestHandler
):
def
_dispatch
(
self
,
method
,
params
):
...
...
upnpigd.py
View file @
d5d89296
...
...
@@ -48,11 +48,12 @@ class Forwarder:
int
(
local_port
),
'Vifib openvpn server'
,
''
):
utils
.
log
(
'Forwarding %s:%s to %s:%s'
%
(
self
.
_external_ip
,
external_port
,
self
.
_u
.
lanaddr
,
local_port
),
3
)
self
.
_rules
.
append
((
external_port
,
upnp_proto
))
self
.
_rules
.
append
((
external_port
,
int
(
local_port
),
upnp_proto
))
return
(
self
.
_external_ip
,
str
(
external_port
),
proto
)
def
Refresh
(
self
):
for
external_port
,
proto
in
self
.
_rules
:
def
refresh
(
self
):
utils
.
log
(
'Refreshing port forwarding'
,
3
)
for
external_port
,
local_port
,
proto
in
self
.
_rules
:
self
.
_u
.
addportmapping
(
external_port
,
proto
,
self
.
_u
.
lanaddr
,
self
.
_
local_port
,
'Vifib openvpn server'
,
''
)
local_port
,
'Vifib openvpn server'
,
''
)
self
.
next_refresh
=
time
.
time
()
+
3600
vifibnet.py
View file @
d5d89296
...
...
@@ -3,6 +3,7 @@ import argparse, errno, os, select, subprocess, time
from
argparse
import
ArgumentParser
import
db
,
plib
,
upnpigd
,
utils
,
tunnel
class
ArgParser
(
ArgumentParser
):
def
convert_arg_line_to_args
(
self
,
arg_line
):
...
...
@@ -15,6 +16,7 @@ class ArgParser(ArgumentParser):
if
arg
.
strip
():
yield
arg
def
ovpnArgs
(
optional_args
,
ca_path
,
cert_path
):
# Treat openvpn arguments
if
optional_args
[
0
]
==
"--"
:
...
...
@@ -146,6 +148,7 @@ def main():
# main loop
try
:
while
True
:
utils
.
log
(
'Sleeping ...'
,
2
)
nextUpdate
=
min
(
tunnel_manager
.
next_refresh
,
peer_db
.
next_refresh
)
if
forwarder
!=
None
:
nextUpdate
=
min
(
nextUpdate
,
forwarder
.
next_refresh
)
...
...
@@ -158,6 +161,8 @@ def main():
peer_db
.
refresh
()
if
time
.
time
()
>=
tunnel_manager
.
next_refresh
:
tunnel_manager
.
refresh
()
if
forwarder
!=
None
and
time
.
time
()
>
forwarder
.
next_refresh
:
forwarder
.
refresh
()
except
KeyboardInterrupt
:
return
0
...
...
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