D4-project / d4-core

D4 core software (server and sample sensor client)
https://www.d4-project.org/
GNU Affero General Public License v3.0
43 stars 9 forks source link

Exception when receiving "not accepted" types #48

Open gallypette opened 1 year ago

gallypette commented 1 year ago

Try to send type 3 packets on the default install:

2023-03-02 15:05:16+0000 [D4_Server (TLSMemoryBIOProtocol),3,::ffff:10.106.129.1] Unhandled Error
        Traceback (most recent call last):
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/python/log.py", line 96, in callWithLogger
            return callWithContext({"system": lp}, func, *args, **kw)
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/python/log.py", line 80, in callWithContext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/python/context.py", line 117, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/python/context.py", line 82, in callWithContext
            return func(*args, **kw)
        --- <exception caught here> ---
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/internet/posixbase.py", line 487, in _doReadOrWrite
            why = selectable.doRead()
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/internet/tcp.py", line 248, in doRead
            return self._dataReceived(data)
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/internet/tcp.py", line 253, in _dataReceived
            rval = self.protocol.dataReceived(data)
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/protocols/tls.py", line 329, in dataReceived
            self._flushReceiveBIO()
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/protocols/tls.py", line 295, in _flushReceiveBIO
            ProtocolWrapper.dataReceived(self, bytes)
          File "/root/d4-core/server/D4ENV/lib/python3.10/site-packages/twisted/protocols/policies.py", line 110, in dataReceived
            self.wrappedProtocol.dataReceived(data)
          File "/root/d4-core/server/./server.py", line 217, in dataReceived
            self.process_header(data, self.ip, self.source_port)
          File "/root/d4-core/server/./server.py", line 334, in process_header
            if is_valid_header(data_header['uuid_header'], data_header['type']):
          File "/root/d4-core/server/./server.py", line 129, in is_valid_header
            logger.warning('Invalid type, the server don\'t accept this type: {}, uuid={}, session_uuid={}'.format(type, uuid_to_check, self.session_uuid))
        builtins.NameError: name 'self' is not defined