aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/monitor.py7
-rwxr-xr-xsrc/net_monitor2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/monitor.py b/src/monitor.py
index e7a3c12..3198b78 100644
--- a/src/monitor.py
+++ b/src/monitor.py
@@ -328,6 +328,13 @@ class Monitor:
pass
return routes, default_routes
+ def protocols_list(self):
+ protos = []
+ for proto in ["tcp", "tcp6", "udp", "udp6"]:
+ if os.path.exists("/proc/net/%s" % proto):
+ protos.append(proto)
+ return protos
+
def get_connections(self, proto="tcp"):
"""Reads active connections"""
connections=[]
diff --git a/src/net_monitor b/src/net_monitor
index cdd5c6d..4a8ddf9 100755
--- a/src/net_monitor
+++ b/src/net_monitor
@@ -559,7 +559,7 @@ class MonitorGui:
"""Updates connections"""
lstore = self.connections
lstore.clear()
- for proto in ["tcp", "tcp6", "udp", "udp6"]:
+ for proto in self.monitor.protocols_list():
connections = self.monitor.get_connections(proto=proto)
for loc_addr, loc_port, rem_addr, rem_port, status in connections:
iter = lstore.append()