/*
* Non-blocking sockets must handle this.
*/
+#ifdef EWOULDBLOCK
if (errno == EWOULDBLOCK) {
return 0;
}
+#endif
DEBUG2(" ... failed to accept connection.");
return -1;
sock->other_ipaddr = src_ipaddr;
sock->other_port = src_port;
sock->client = client;
+ sock->opened = sock->last_packet = time(NULL);
this->fd = newfd;
this->status = RAD_LISTEN_STATUS_INIT;
snprintf(buffer, bufsize, "%d", sock->my_port);
FORWARD;
+#ifdef WITH_TLS
if (this->tls) {
ADDSTRING(" (TLS)");
FORWARD;
}
+#endif
if (this->server) {
ADDSTRING(" as server ");
/*
* Try IPv4 first
*/
+ memset(&ipaddr, 0, sizeof(ipaddr));
ipaddr.ipaddr.ip4addr.s_addr = htonl(INADDR_NONE);
rcode = cf_item_parse(cs, "ipaddr", PW_TYPE_IPADDR,
&ipaddr.ipaddr.ip4addr, NULL);
rad_assert(request->proxy_listener == listener);
rad_assert(listener->send == proxy_socket_send);
- if (rad_send(request->proxy, request->packet,
+ if (rad_send(request->proxy, NULL,
request->home_server->secret) < 0) {
radlog_request(L_ERR, 0, request, "Failed sending proxied request: %s",
fr_strerror());
return 0;
}
- FR_STATS_TYPE_INC(client->auth->total_requests);
+ FR_STATS_TYPE_INC(client->auth.total_requests);
/*
* We only understand Status-Server on this socket.
return 0;
}
- FR_STATS_TYPE_INC(client->auth->total_requests);
+ FR_STATS_TYPE_INC(client->auth.total_requests);
/*
* Some sanity checks, based on the packet code.
return 0;
}
- FR_STATS_TYPE_INC(client->acct->total_requests);
+ FR_STATS_TYPE_INC(client->acct.total_requests);
/*
* Some sanity checks, based on the packet code.
}
/*
+ * Don't open sockets if we're checking the config.
+ */
+ if (check_config) {
+ this->fd = -1;
+ return 0;
+ }
+
+ /*
* Copy fr_socket() here, as we may need to bind to a device.
*/
this->fd = socket(sock->my_ipaddr.af, sock_type, 0);
if (sock->interface) {
#ifdef SO_BINDTODEVICE
struct ifreq ifreq;
- strcpy(ifreq.ifr_name, sock->interface);
+
+ memset(&ifreq, 0, sizeof(ifreq));
+ strlcpy(ifreq.ifr_name, sock->interface, sizeof(ifreq.ifr_name));
fr_suid_up();
rcode = setsockopt(this->fd, SOL_SOCKET, SO_BINDTODEVICE,
#ifdef WITH_PROXY
int defined_proxy = 0;
#endif
+#ifndef WITH_TLS
+ spawn_flag = spawn_flag; /* -Wunused */
+#endif
/*
* We shouldn't be called with a pre-existing list.
if (cs) this->server = mainconfig.name;
}
-#ifdef WITH_TLS
- if (!spawn_flag && this->tls) {
- tls_error:
- cf_log_err(cf_sectiontoitem(cs), "Threading must be enabled for TLS sockets to function properly.");
- listen_free(&this);
- return -1;
- }
-#endif
-
*last = this;
last = &(this->next);
return -1;
}
-#ifdef WITH_TLS
- if (!spawn_flag && this->tls) goto tls_error;
-#endif
-
*last = this;
last = &(this->next);
} /* loop over "listen" directives in server <foo> */
}
#endif
- event_new_fd(this);
+
+#ifdef WITH_TLS
+ if (!spawn_flag && this->tls) {
+ cf_log_err(cf_sectiontoitem(this->cs), "Threading must be enabled for TLS sockets to function properly.");
+ cf_log_err(cf_sectiontoitem(this->cs), "You probably need to do 'radiusd -fxx -l stdout' for debugging");
+ return -1;
+ }
+#endif
+ if (!check_config) event_new_fd(this);
}
/*
*/
#ifdef WITH_PROXY
if ((mainconfig.proxy_requests == TRUE) &&
+ !check_config &&
(*head != NULL) && !defined_proxy) {
listen_socket_t *sock = NULL;
int port = 0;