newvector should be a bool
[freeradius.git] / src / modules / proto_dhcp / dhcpclient.c
index 93cf6b3..dad87a7 100644 (file)
@@ -43,12 +43,12 @@ static int success = 0;
 static int retries = 3;
 static float timeout = 5;
 
-static int server_port = 0;
+static uint16_t server_port = 0;
 static int packet_code = 0;
 static fr_ipaddr_t server_ipaddr;
 
 static fr_ipaddr_t client_ipaddr;
-static int client_port = 0;
+static uint16_t client_port = 0;
 
 static int sockfd;
 
@@ -107,13 +107,13 @@ static int request_init(char const *filename)
                fp = stdin;
        }
 
-       request = rad_alloc(NULL, 0);
+       request = rad_alloc(NULL, false);
 
        /*
         *      Read the VP's.
         */
-       request->vps = readvp2(NULL, fp, &filedone, "dhcpclient:");
-       if (!request->vps) {
+       if (readvp2(&request->vps, NULL, fp, &filedone) < 0) {
+               fr_perror("dhcpclient");
                rad_free(&request);
                if (fp != stdin) fclose(fp);
                return 1;
@@ -122,7 +122,7 @@ static int request_init(char const *filename)
        /*
         *      Fix / set various options
         */
-       for (vp = paircursor(&cursor, &request->vps); vp; vp = pairnext(&cursor)) {
+       for (vp = fr_cursor_init(&cursor, &request->vps); vp; vp = fr_cursor_next(&cursor)) {
                switch (vp->da->attr) {
                default:
                        break;
@@ -340,7 +340,7 @@ int main(int argc, char **argv)
                        portname = NULL;
                }
 
-               if (ip_hton(hostname, AF_INET, &server_ipaddr) < 0) {
+               if (ip_hton(&server_ipaddr, AF_INET, hostname, false) < 0) {
                        fprintf(stderr, "dhcpclient: Failed to find IP address for host %s: %s\n", hostname, fr_syserror(errno));
                        exit(1);
                }