Set larger receive buffer size for bulk requests

When using SNMP BULK GET requests (from Zabbix in our case), the default value of 1024 truncates the request, resulting in malformed requests reaching the agent. Using an 8K buffer fixes this. A better approach perhaps would be to process the buffer using a loop.
This commit is contained in:
amartin-git
2021-12-06 12:26:22 -05:00
committed by GitHub
parent 89abebb26b
commit c19df5a77a

View File

@ -97,7 +97,7 @@ class Network():
self.socket.send(pdu.encode()) self.socket.send(pdu.encode())
def recv_pdu(self): def recv_pdu(self):
buf = self.socket.recv(1024) buf = self.socket.recv(8192)
if not buf: return None if not buf: return None
pdu = PDU() pdu = PDU()
pdu.decode(buf) pdu.decode(buf)