From 568a3850715f43bbb65dabbf398a7c8bf07c485e Mon Sep 17 00:00:00 2001 From: Mike Wang Date: Wed, 8 Oct 2025 17:32:27 +0800 Subject: [PATCH] fix: Infinite EADDRNOTAVAIL loop when local IP changes --- natter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/natter.py b/natter.py index fe3aef1..923258c 100755 --- a/natter.py +++ b/natter.py @@ -1874,6 +1874,13 @@ def natter_main(show_title = True): try: keep_alive.keep_alive() except (OSError, socket.error) as ex: + if hasattr(errno, "EADDRNOTAVAIL") and \ + ex.errno == errno.EADDRNOTAVAIL: + if exit_when_changed: + Logger.info("Natter is exiting because local IP address " + "has changed") + raise NatterExitException("Local IP address has changed") + raise NatterRetryException("Local IP address has changed") if udp_mode: Logger.debug("keep-alive: UDP response not received: %s" % ex) else: