Skip to content

Commit

Permalink
Merge pull request #4 from rtitmuss/check_remote_address
Browse files Browse the repository at this point in the history
Drop udp packets from unknown hosts
  • Loading branch information
yozik04 committed May 31, 2022
2 parents e110209 + e45d007 commit 566e793
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nibe/connection/nibegw.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ def connection_made(self, transport):
self._transport = transport

def datagram_received(self, data, addr):
if addr[0] != self._remote_ip:
logger.warning(
f"Ignoring packet from unknown host: {addr}"
)
return

logger.debug(f"Received {hexlify(data)} from {addr}")
try:
msg = Response.parse(data)
Expand Down

0 comments on commit 566e793

Please sign in to comment.