]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use new API
authorAlan T. DeKok <aland@freeradius.org>
Sun, 27 Sep 2009 16:28:17 +0000 (18:28 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 27 Sep 2009 16:28:17 +0000 (18:28 +0200)
src/main/radclient.c
src/main/stats.c

index 4df0c926aff2f9245eb0e5cbe935341ce4192472..550c8144d09823af768872f94521f4a3183ab18c 100644 (file)
@@ -62,6 +62,7 @@ static int last_used_id = -1;
 #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;
@@ -505,7 +506,8 @@ static int send_one_packet(radclient_t *radclient)
                 */
        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;
 
@@ -521,7 +523,7 @@ static int send_one_packet(radclient_t *radclient)
                                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");
@@ -768,7 +770,7 @@ static int recv_one_packet(int wait_time)
 
        /* 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);
@@ -889,6 +891,8 @@ int main(int argc, char **argv)
                                } else {
                                        usage();
                                }
+                       } else {
+                               ipproto = IPPROTO_TCP;
                        }
                        break;
 
@@ -1106,7 +1110,7 @@ int main(int argc, char **argv)
                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);
index 7e2e57fe02ace1838ca97db48b1bb140f6035b7f..6d5471d510d372fe1a240512532677a93f5024db 100644 (file)
@@ -423,10 +423,8 @@ void request_stats_reply(REQUEST *request)
                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);
                        }