mirror of
https://github.com/sileht/bird-lg.git
synced 2024-11-25 08:14:42 +01:00
Use traceroute{,6} on BSD instead of traceroute -{4,6}
This commit is contained in:
parent
5cb45d5785
commit
fe9a7f8fe4
13
lg-proxy.py
13
lg-proxy.py
|
@ -57,14 +57,21 @@ def check_accesslist():
|
|||
def traceroute():
|
||||
check_accesslist()
|
||||
|
||||
if sys.platform.startswith('freebsd') or sys.platform.startswith('netbsd') or sys.platform.startswith('openbsd'):
|
||||
traceroute4 = [ 'traceroute' ]
|
||||
traceroute6 = [ 'traceroute6' ]
|
||||
else: # For Linux
|
||||
traceroute4 = [ 'traceroute', '-4' ]
|
||||
traceroute6 = [ 'traceroute', '-6' ]
|
||||
|
||||
src = []
|
||||
if request.path == '/traceroute6':
|
||||
o = "-6"
|
||||
traceroute = traceroute6
|
||||
if app.config.get("IPV6_SOURCE",""):
|
||||
src = [ "-s", app.config.get("IPV6_SOURCE") ]
|
||||
|
||||
else:
|
||||
o = "-4"
|
||||
traceroute = traceroute4
|
||||
if app.config.get("IPV4_SOURCE",""):
|
||||
src = [ "-s", app.config.get("IPV4_SOURCE") ]
|
||||
|
||||
|
@ -77,7 +84,7 @@ def traceroute():
|
|||
options = [ '-A', '-q1', '-w1', '-m15' ]
|
||||
else: # For Linux
|
||||
options = [ '-A', '-q1', '-N32', '-w1', '-m15' ]
|
||||
command = [ 'traceroute' , o ] + src + options + [ query ]
|
||||
command = traceroute + src + options + [ query ]
|
||||
result = subprocess.Popen( command , stdout=subprocess.PIPE).communicate()[0].decode('utf-8', 'ignore').replace("\n","<br>")
|
||||
|
||||
return result
|
||||
|
|
Loading…
Reference in a new issue