summaryrefslogtreecommitdiffstats
path: root/src/target/fake_trx/ctrl_if.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/fake_trx/ctrl_if.py')
-rw-r--r--src/target/fake_trx/ctrl_if.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/target/fake_trx/ctrl_if.py b/src/target/fake_trx/ctrl_if.py
index 64f08bfd..d4840cde 100644
--- a/src/target/fake_trx/ctrl_if.py
+++ b/src/target/fake_trx/ctrl_if.py
@@ -26,16 +26,18 @@ from udp_link import UDPLink
class CTRLInterface(UDPLink):
def handle_rx(self, data, remote):
- if self.verify_req(data):
- request = self.prepare_req(data)
- rc = self.parse_cmd(request)
+ if not self.verify_req(data):
+ print("[!] Wrong data on CTRL interface")
+ return
+
+ # Attempt to parse a command
+ request = self.prepare_req(data)
+ rc = self.parse_cmd(request)
- if type(rc) is tuple:
- self.send_response(request, remote, rc[0], rc[1])
- else:
- self.send_response(request, remote, rc)
+ if type(rc) is tuple:
+ self.send_response(request, remote, rc[0], rc[1])
else:
- print("[!] Wrong data on CTRL interface")
+ self.send_response(request, remote, rc)
def verify_req(self, data):
# Verify command signature