int inaddr_any;
fr_ipaddr_t ipaddr;
int port;
+#ifdef WITH_TCP
+ int type;
+#endif
} fr_packet_socket_t;
{
int i, start;
struct sockaddr_storage src;
- socklen_t sizeof_src = sizeof(src);
+ socklen_t sizeof_src;
fr_packet_socket_t *ps;
if (!pl) return 0;
memset(ps, 0, sizeof(*ps));
ps->sockfd = sockfd;
ps->offset = start;
+#ifdef WITH_TCP
+ sizeof_src = sizeof(ps->type);
+
+ if (getsockopt(sockfd, SOL_SOCKET, SO_TYPE, &ps->type, &sizeof_src) < 0) {
+ return 0;
+ }
+#endif
/*
* Get address family, etc. first, so we know if we
* FIXME: udpfromto also does this, but it's not
* a critical problem.
*/
+ sizeof_src = sizeof(src);
memset(&src, 0, sizeof_src);
if (getsockname(sockfd, (struct sockaddr *) &src,
&sizeof_src) < 0) {
if (!FD_ISSET(pl->sockets[start].sockfd, set)) continue;
+#ifdef WITH_TCP
+ if (pl->sockets[start].type == SOCK_STREAM) {
+ packet = fr_tcp_recv(pl->sockets[start].sockfd, 0);
+ } else
+#endif
packet = rad_recv(pl->sockets[start].sockfd, 0);
if (!packet) continue;