Problem listening on external IP

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
dew
Newbie
Newbie
Posts: 1
Joined: July 20th, 2008, 12:05 am

Problem listening on external IP

Post by dew »

Since upgrading to 0.4.2 from 0.3.4 I've had trouble getting SABnzbd to listen on my server's external IP, it seemed to ignore config settings and reset the listen host to 0.0.0.0. This wasn't a problem in 0.3.4, but it seems something's changed in CherryPy and 0.0.0.0 no longer means 'listen on every IP' (at least, I think that's the problem. I couldn't find much in the way of documentation for that behaviour, and I'm no Python programmer).

After some cackhanded fiddling around I tracked it down to Sab looking up my server's hostname, which was returning its FQDN, and due to laziness/'security reasons' (mainly the former, I'll admit ;)) my server's FQDN doesn't actually resolve to anything. So Sab is detecting the error and resetting the IP to 0.0.0.0. Which isn't doing what it used to do.

Anyway, here's a simple patch which solves the problem (at least for me):

Code: Select all

--- SABnzbd.py  2008-07-20 04:52:31.000000000 +0100
+++ SABnzbd.py  2008-07-20 05:58:59.000000000 +0100
 -615,5 +615,5 @@
     localhost = hostip = 'localhost'
     try:
-        info = socket.getaddrinfo(socket.gethostname(), None)
+        info = socket.getaddrinfo(cherryhost, None)
     except:
         # Hostname does not resolve, use 0.0.0.0
I really am no good at Python, so that might be entirely wrong, but it seems more logical to look up the IP in the config rather than guessing based on the server's hostname.
Post Reply