aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-01-31 07:26:12 +0100
committerMartin Braun <martin.braun@ettus.com>2018-02-07 13:46:53 -0800
commit0d73d8ab817ed0e0e1578d26fff98201b2cff961 (patch)
treeb4dbd04fcd8e636c07c490ac8f4b39df8e2cd00f
parent0e285428dfadebebb27b0ee6a7851d6622b7f341 (diff)
downloaduhd-0d73d8ab817ed0e0e1578d26fff98201b2cff961.tar.gz
uhd-0d73d8ab817ed0e0e1578d26fff98201b2cff961.tar.bz2
uhd-0d73d8ab817ed0e0e1578d26fff98201b2cff961.zip
mpm: rpc_server: Declare local connection for *all* local IPs
Before, it was possible to trick the RPC server in believing a connection was remote when the incoming connection was from a local IP address that was not 127.0.0.1.
-rw-r--r--mpm/python/usrp_mpm/rpc_server.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py
index 4eed6b79b..062396082 100644
--- a/mpm/python/usrp_mpm/rpc_server.py
+++ b/mpm/python/usrp_mpm/rpc_server.py
@@ -26,6 +26,7 @@ from mprpc import RPCServer
from usrp_mpm.mpmlog import get_main_logger
from usrp_mpm.mpmutils import to_binary_str
from usrp_mpm.sys_utils import watchdog
+from usrp_mpm.sys_utils import net
TIMEOUT_INTERVAL = 3.0 # Seconds before claim expires (default value)
TOKEN_LEN = 16 # Length of the token string
@@ -289,7 +290,7 @@ class MPMServer(RPCServer):
self._state.claim_token.value,
self.client_host
)
- if self.client_host in ["127.0.0.1", "::1"]:
+ if self.client_host in net.get_local_ip_addrs():
self.periph_manager.set_connection_type("local")
else:
self.periph_manager.set_connection_type("remote")
@@ -384,7 +385,7 @@ class MPMServer(RPCServer):
This is as safe method which can be called without a claim on the device
"""
info = self.periph_manager.get_device_info()
- if self.client_host in ["127.0.0.1", "::1"]:
+ if self.client_host in net.get_local_ip_addrs():
info["connection"] = "local"
else:
info["connection"] = "remote"