From d6d9374b66ccfc861d5ed1bfcd30ac949f2fe4ce Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Thu, 26 Jul 2018 21:52:47 +0200 Subject: [PATCH] configctl, ignore end of stream marker, the normal exit when no data for python should be enough, closes https://github.com/opnsense/core/issues/2568 Initially we had issues with datablocks containing \0, for which we added an end of stream marker. in python this doesn't seem necessary, so better to remove to prevent cpu overload when the connection is lost. --- src/opnsense/service/configd_ctl.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/opnsense/service/configd_ctl.py b/src/opnsense/service/configd_ctl.py index fbbb53df3..ae9778804 100755 --- a/src/opnsense/service/configd_ctl.py +++ b/src/opnsense/service/configd_ctl.py @@ -65,11 +65,7 @@ def exec_config_cmd(exec_command): line = sock.recv(65536) if line: data.append(line) - - # end of stream marker found, exit - if line.find("%c%c%c"%(chr(0), chr(0), chr(0))) > -1 or ( - len(line) < 3 and len(data) > 1 and (''.join(data[-2:])).find("%c%c%c"%(chr(0), chr(0), chr(0))) > -1 - ): + else: break return ''.join(data)[:-3]