mirror of
https://github.com/Ysurac/openmptcprouter-vps-admin.git
synced 2025-02-12 10:31:52 +00:00
Use subprocess for ss -M command
This commit is contained in:
parent
1e36d2aa4b
commit
21d071ebec
2 changed files with 12 additions and 2 deletions
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -1,3 +1,9 @@
|
|||
omr-vps-admin (0.11+20240704) unstable; urgency=medium
|
||||
|
||||
* Use subprocess for ss -M command
|
||||
|
||||
-- OpenMPTCProuter <contact@openmptcprouter.com> Wed, 04 Jul 2024 11:40:03 +0200
|
||||
|
||||
omr-vps-admin (0.11+20240629) unstable; urgency=medium
|
||||
|
||||
* Add a timeout on ss -M command
|
||||
|
|
|
@ -1336,8 +1336,12 @@ async def mptcpsupport(request: Request):
|
|||
with open('/proc/net/mptcp_net/mptcp') as f:
|
||||
if iptohex in f.read():
|
||||
return {"mptcp": "working"}
|
||||
elif not os.popen("timeout 2 ss -M | grep " + ip) == '':
|
||||
else:
|
||||
mptcpcheck = subprocess.Popen("timeout 2 ss -M | grep -q " + ip, shell=True, stdout=subprocess.PIPE)
|
||||
mptcpcheck.communicate()
|
||||
if mptcpcheck.returncode == 0:
|
||||
return {"mptcp": "working"}
|
||||
mptcpcheck.kill()
|
||||
return {"mptcp": "not working"}
|
||||
|
||||
# Get VPS status
|
||||
|
|
Loading…
Reference in a new issue