Print error message if we're not configured to listen on any ports
[freeradius.git] / src / main / listen.c
index 4928b74..6effff6 100644 (file)
@@ -881,12 +881,12 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
        sock->my_port = listen_port;
 
        if (check_config) {
-               if (home_server_find(&sock->ipaddr, sock->port)) {
+               if (home_server_find(&sock->my_ipaddr, sock->my_port, sock->proto)) {
                                char buffer[128];
                                
                                DEBUG("ERROR: We have been asked to listen on %s port %d, which is also listed as a home server.  This can create a proxy loop.",
-                                     ip_ntoh(&sock->ipaddr, buffer, sizeof(buffer)),
-                                     sock->port);
+                                     ip_ntoh(&sock->my_ipaddr, buffer, sizeof(buffer)),
+                                     sock->my_port);
                                return -1;
                }
 
@@ -1929,7 +1929,7 @@ static int listen_bind(rad_listen_t *this)
 #endif
 
                default:
-                       radlog(L_ERR, "ERROR: Non-fatal internal sanity check failed in bind.");
+                       DEBUG("WARNING: Internal sanity check failed in binding to socket.  Ignoring problem.");
                        return -1;
                }
        }
@@ -2667,6 +2667,15 @@ int listen_init(CONF_SECTION *config, rad_listen_t **head)
 
 add_sockets:
        /*
+        *      No sockets to receive packets, this is an error.
+        *      proxying is pointless.
+        */
+       if (!*head) {
+               radlog(L_ERR, "The server is not configured to listen on any ports.  Cannot start.");
+               return -1;
+       }
+
+       /*
         *      Print out which sockets we're listening on, and
         *      add them to the event list.
         */