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;
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;
/*
* 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;
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);
}