#ifdef WITH_TCP
const char *proto = NULL;
#endif
+static int ipproto = IPPROTO_UDP;
static rbtree_t *filename_tree = NULL;
static fr_packet_list_t *pl = NULL;
*/
retry:
radclient->request->src_ipaddr.af = server_ipaddr.af;
- rcode = fr_packet_list_id_alloc(pl, radclient->request, NULL);
+ rcode = fr_packet_list_id_alloc(pl, ipproto,
+ radclient->request, NULL);
if (rcode < 0) {
int mysockfd;
fprintf(stderr, "radclient: Can't open new socket\n");
exit(1);
}
- if (!fr_packet_list_socket_add(pl, mysockfd,
+ if (!fr_packet_list_socket_add(pl, mysockfd, ipproto,
&server_ipaddr,
server_port, NULL)) {
fprintf(stderr, "radclient: Can't add new socket\n");
/* libradius debug already prints out the value pairs for us */
if (!fr_debug_flag && do_output) {
- printf("Received response ID %d, code %d, length = %d\n",
+ printf("Received response ID %d, code %d, length = %ld\n",
radclient->reply->id, radclient->reply->code,
radclient->reply->data_len);
vp_printlist(stdout, radclient->reply->vps);
} else {
usage();
}
+ } else {
+ ipproto = IPPROTO_TCP;
}
break;
exit(1);
}
- if (!fr_packet_list_socket_add(pl, sockfd, &server_ipaddr,
+ if (!fr_packet_list_socket_add(pl, sockfd, ipproto, &server_ipaddr,
server_port, NULL)) {
fprintf(stderr, "radclient: Out of memory\n");
exit(1);
if (vp) {
ipaddr.af = AF_INET;
ipaddr.ipaddr.ip4addr.s_addr = vp->vp_ipaddr;
-#ifndef WITH_TCP
- client = client_find(cl, &ipaddr);
-#else
client = client_find(cl, &ipaddr, IPPROTO_UDP);
+#ifdef WITH_TCP
if (!client) {
client = client_find(cl, &ipaddr, IPPROTO_TCP);
}