Lines Matching full:options
172 if (((packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len != 0) && in dhcpdiscover()
174 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].data, in dhcpdiscover()
175 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len)) != in dhcpdiscover()
214 if (packet->options[DHO_DHCP_REQUESTED_ADDRESS].len == 4) in dhcprequest()
216 packet->options[DHO_DHCP_REQUESTED_ADDRESS].data, 4); in dhcprequest()
278 (packet->options[DHO_DHCP_REQUESTED_ADDRESS].len == 4 && in dhcprequest()
355 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len && in dhcprequest()
356 !memcmp(packet->options[DHO_DHCP_CLIENT_IDENTIFIER].data, in dhcprequest()
395 if (packet->options[DHO_DHCP_REQUESTED_ADDRESS].len) { in dhcprelease()
402 if (packet->options[i].len) { in dhcprelease()
403 lease = find_lease_by_uid(packet->options[i].data, in dhcprelease()
404 packet->options[i].len); in dhcprelease()
492 if (packet->options[DHO_DHCP_REQUESTED_ADDRESS].len != 4) in dhcpdecline()
497 packet->options[DHO_DHCP_REQUESTED_ADDRESS].data, 4); in dhcpdecline()
562 if (packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len) in dhcpinform()
564 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].data, in dhcpinform()
565 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len); in dhcpinform()
584 struct tree_cache *options[256]; in nak_lease() local
588 memset(options, 0, sizeof options); in nak_lease()
595 options[i] = &dhcpnak_tree; in nak_lease()
596 options[i]->value = &nak; in nak_lease()
597 options[i]->len = sizeof nak; in nak_lease()
598 options[i]->buf_size = sizeof nak; in nak_lease()
599 options[i]->timeout = -1; in nak_lease()
600 options[i]->tree = NULL; in nak_lease()
601 options[i]->flags = 0; in nak_lease()
605 options[i] = &dhcpmsg_tree; in nak_lease()
606 options[i]->value = (unsigned char *)dhcp_message; in nak_lease()
607 options[i]->len = strlen(dhcp_message); in nak_lease()
608 options[i]->buf_size = strlen(dhcp_message); in nak_lease()
609 options[i]->timeout = -1; in nak_lease()
610 options[i]->tree = NULL; in nak_lease()
611 options[i]->flags = 0; in nak_lease()
617 if (packet->options[i].len) { in nak_lease()
618 options[i] = &server_tree; in nak_lease()
619 options[i]->value = packet->options[i].data, in nak_lease()
620 options[i]->len = packet->options[i].len; in nak_lease()
621 options[i]->buf_size = packet->options[i].len; in nak_lease()
622 options[i]->timeout = -1; in nak_lease()
623 options[i]->tree = NULL; in nak_lease()
624 options[i]->flags = 0; in nak_lease()
629 if (packet->options[i].len) { in nak_lease()
630 options[i] = &client_tree; in nak_lease()
631 options[i]->value = packet->options[i].data, in nak_lease()
632 options[i]->len = packet->options[i].len; in nak_lease()
633 options[i]->buf_size = packet->options[i].len; in nak_lease()
634 options[i]->timeout = -1; in nak_lease()
635 options[i]->tree = NULL; in nak_lease()
636 options[i]->flags = 0; in nak_lease()
641 if (packet->options[i].data) { in nak_lease()
642 packet->options[i].len = 0; in nak_lease()
643 free(packet->options[i].data); in nak_lease()
644 packet->options[i].data = NULL; in nak_lease()
649 0, options, 0, 0, 0, NULL, 0); in nak_lease()
726 if (packet->options[i].len) { in ack_lease()
727 vendor_class = find_class(0, packet->options[i].data, in ack_lease()
728 packet->options[i].len); in ack_lease()
733 if (packet->options[i].len) { in ack_lease()
734 user_class = find_class(1, packet->options[i].data, in ack_lease()
735 packet->options[i].len); in ack_lease()
766 if (packet->options[i].len) in ack_lease()
771 if (packet->options[i].len && lease->client_hostname && in ack_lease()
772 (strlen(lease->client_hostname) == packet->options[i].len) && in ack_lease()
773 !memcmp(lease->client_hostname, packet->options[i].data, in ack_lease()
774 packet->options[i].len)) { in ack_lease()
775 } else if (packet->options[i].len) { in ack_lease()
777 lease->client_hostname = malloc( packet->options[i].len + 1); in ack_lease()
780 memcpy(lease->client_hostname, packet->options[i].data, in ack_lease()
781 packet->options[i].len); in ack_lease()
782 lease->client_hostname[packet->options[i].len] = 0; in ack_lease()
790 if (packet->options[i].len && lease->client_identifier && in ack_lease()
791 lease->client_identifier_len == packet->options[i].len && in ack_lease()
792 !memcmp(lease->client_identifier, packet->options[i].data, in ack_lease()
793 packet->options[i].len)) { in ack_lease()
795 } else if (packet->options[i].len) { in ack_lease()
797 lease->client_identifier = malloc(packet->options[i].len); in ack_lease()
800 lease->client_identifier_len = packet->options[i].len; in ack_lease()
801 memcpy(lease->client_identifier, packet->options[i].data, in ack_lease()
802 packet->options[i].len); in ack_lease()
876 if (packet->options[i].len == 4) { in ack_lease()
877 lease_time = getULong( packet->options[i].data); in ack_lease()
916 if (packet->options[i].len) { in ack_lease()
917 if (packet->options[i].len <= sizeof lt.uid_buf) { in ack_lease()
918 memcpy(lt.uid_buf, packet->options[i].data, in ack_lease()
919 packet->options[i].len); in ack_lease()
922 lt.uid_len = packet->options[i].len; in ack_lease()
924 lt.uid_max = lt.uid_len = packet->options[i].len; in ack_lease()
928 memcpy(lt.uid, packet->options[i].data, lt.uid_len); in ack_lease()
967 terminates string options and expects us to do likewise. */ in ack_lease()
969 if (packet->options[i].len && in ack_lease()
970 packet->options[i].data[packet->options[i].len - 1] == '\0') in ack_lease()
985 /* Figure out what options to send to the client: */ in ack_lease()
987 /* Start out with the subnet options... */ in ack_lease()
988 memcpy(state->options, lease->subnet->group->options, in ack_lease()
989 sizeof state->options); in ack_lease()
993 /* If we have a vendor class, install those options, in ack_lease()
994 superseding any subnet options. */ in ack_lease()
997 if (vendor_class->group->options[i]) in ack_lease()
998 state->options[i] = in ack_lease()
999 vendor_class->group->options[i]; in ack_lease()
1002 /* If we have a user class, install those options, in ack_lease()
1003 superseding any subnet and vendor class options. */ in ack_lease()
1006 if (user_class->group->options[i]) in ack_lease()
1007 state->options[i] = in ack_lease()
1008 user_class->group->options[i]; in ack_lease()
1014 options, superseding anything that's in the way. */ in ack_lease()
1017 if (lease->host->group->options[i]) in ack_lease()
1018 state->options[i] = in ack_lease()
1019 lease->host->group->options[i]; in ack_lease()
1025 if (packet->options[i].data && in ack_lease()
1026 packet->options[i].len == sizeof(u_int16_t)) in ack_lease()
1027 state->max_message_size = getUShort(packet->options[i].data); in ack_lease()
1029 else if (state->options[i] && state->options[i]->value) in ack_lease()
1030 state->max_message_size = getUShort(state->options[i]->value); in ack_lease()
1034 if (packet->options[i].data) { in ack_lease()
1035 state->prl = calloc(1, packet->options[i].len); in ack_lease()
1039 memcpy(state->prl, packet->options[i].data, in ack_lease()
1040 packet->options[i].len); in ack_lease()
1041 state->prl_len = packet->options[i].len; in ack_lease()
1048 if (!state->options[i] && lease->hostname) { in ack_lease()
1049 state->options[i] = new_tree_cache("hostname"); in ack_lease()
1050 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1051 state->options[i]->value = (unsigned char *)lease->hostname; in ack_lease()
1052 state->options[i]->len = strlen(lease->hostname); in ack_lease()
1053 state->options[i]->buf_size = state->options[i]->len; in ack_lease()
1054 state->options[i]->timeout = -1; in ack_lease()
1055 state->options[i]->tree = NULL; in ack_lease()
1059 * Now, if appropriate, put in DHCP-specific options that in ack_lease()
1064 state->options[i] = new_tree_cache("message-type"); in ack_lease()
1065 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1066 state->options[i]->value = &state->offer; in ack_lease()
1067 state->options[i]->len = sizeof state->offer; in ack_lease()
1068 state->options[i]->buf_size = sizeof state->offer; in ack_lease()
1069 state->options[i]->timeout = -1; in ack_lease()
1070 state->options[i]->tree = NULL; in ack_lease()
1073 if (!state->options[i]) { in ack_lease()
1075 state->options[i] = new_tree_cache("server-id"); in ack_lease()
1076 state->options[i]->value = in ack_lease()
1078 state->options[i]->len = in ack_lease()
1080 state->options[i]->buf_size = state->options[i]->len; in ack_lease()
1081 state->options[i]->timeout = -1; in ack_lease()
1082 state->options[i]->tree = NULL; in ack_lease()
1088 if (!tree_evaluate(state->options[i])) in ack_lease()
1090 if (!state->options[i]->value || in ack_lease()
1091 (state->options[i]->len > in ack_lease()
1095 state->from.len = state->options[i]->len; in ack_lease()
1096 memcpy(state->from.iabuf, state->options[i]->value, in ack_lease()
1102 if (packet->options[i].len == 4) { in ack_lease()
1103 if (state->options[i]->len != 4 || in ack_lease()
1104 memcmp(packet->options[i].data, in ack_lease()
1105 state->options[i]->value, 4) != 0) { in ack_lease()
1116 state->options[i] = new_tree_cache("class-identifier"); in ack_lease()
1117 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1118 state->options[i]->value = in ack_lease()
1120 state->options[i]->len = strlen(vendor_class->name); in ack_lease()
1121 state->options[i]->buf_size = state->options[i]->len; in ack_lease()
1122 state->options[i]->timeout = -1; in ack_lease()
1123 state->options[i]->tree = NULL; in ack_lease()
1130 state->options[i] = new_tree_cache("user-class"); in ack_lease()
1131 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1132 state->options[i]->value = in ack_lease()
1134 state->options[i]->len = strlen(user_class->name); in ack_lease()
1135 state->options[i]->buf_size = state->options[i]->len; in ack_lease()
1136 state->options[i]->timeout = -1; in ack_lease()
1137 state->options[i]->tree = NULL; in ack_lease()
1155 state->options[i] = new_tree_cache("lease-expiry"); in ack_lease()
1156 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1157 state->options[i]->value = (unsigned char *)&state->expiry; in ack_lease()
1158 state->options[i]->len = sizeof state->expiry; in ack_lease()
1159 state->options[i]->buf_size = sizeof state->expiry; in ack_lease()
1160 state->options[i]->timeout = -1; in ack_lease()
1161 state->options[i]->tree = NULL; in ack_lease()
1167 state->options[i] = new_tree_cache("renewal-time"); in ack_lease()
1168 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1169 state->options[i]->value = in ack_lease()
1171 state->options[i]->len = sizeof state->renewal; in ack_lease()
1172 state->options[i]->buf_size = sizeof state->renewal; in ack_lease()
1173 state->options[i]->timeout = -1; in ack_lease()
1174 state->options[i]->tree = NULL; in ack_lease()
1182 state->options[i] = new_tree_cache("rebind-time"); in ack_lease()
1183 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1184 state->options[i]->value = (unsigned char *)&state->rebind; in ack_lease()
1185 state->options[i]->len = sizeof state->rebind; in ack_lease()
1186 state->options[i]->buf_size = sizeof state->rebind; in ack_lease()
1187 state->options[i]->timeout = -1; in ack_lease()
1188 state->options[i]->tree = NULL; in ack_lease()
1194 if (!state->options[i]) { in ack_lease()
1195 state->options[i] = new_tree_cache("subnet-mask"); in ack_lease()
1196 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1197 state->options[i]->value = lease->subnet->netmask.iabuf; in ack_lease()
1198 state->options[i]->len = lease->subnet->netmask.len; in ack_lease()
1199 state->options[i]->buf_size = lease->subnet->netmask.len; in ack_lease()
1200 state->options[i]->timeout = -1; in ack_lease()
1201 state->options[i]->tree = NULL; in ack_lease()
1224 if (ulafdr && !state->options[i]) { in ack_lease()
1225 state->options[i] = new_tree_cache("routers"); in ack_lease()
1226 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1227 state->options[i]->value = lease->ip_addr.iabuf; in ack_lease()
1228 state->options[i]->len = lease->ip_addr.len; in ack_lease()
1229 state->options[i]->buf_size = lease->ip_addr.len; in ack_lease()
1230 state->options[i]->timeout = -1; in ack_lease()
1231 state->options[i]->tree = NULL; in ack_lease()
1239 memset(&state->options[i], 0, sizeof(state->options[i])); in ack_lease()
1252 state->options[i] = new_tree_cache("dhcp-client-identifier"); in ack_lease()
1253 state->options[i]->flags = TC_TEMPORARY; in ack_lease()
1254 state->options[i]->value = lease->client_identifier; in ack_lease()
1255 state->options[i]->len = lease->client_identifier_len; in ack_lease()
1256 state->options[i]->buf_size = lease->client_identifier_len; in ack_lease()
1257 state->options[i]->timeout = -1; in ack_lease()
1258 state->options[i]->tree = NULL; in ack_lease()
1260 memset(&state->options[i], 0, sizeof(state->options[i])); in ack_lease()
1298 buffer as available for options. */ in dhcp_reply()
1305 server_name buffer as available for options. */ in dhcp_reply()
1328 if (state->options[DHO_DHCP_PARAMETER_REQUEST_LIST] && in dhcp_reply()
1329 state->options[DHO_DHCP_PARAMETER_REQUEST_LIST]->value) { in dhcp_reply()
1330 prl = state->options[DHO_DHCP_PARAMETER_REQUEST_LIST]->value; in dhcp_reply()
1331 prl_len = state->options[DHO_DHCP_PARAMETER_REQUEST_LIST]->len; in dhcp_reply()
1340 /* Insert such options as will fit into the buffer. */ in dhcp_reply()
1342 state->options, bufs, nulltp, bootpp, prl, prl_len); in dhcp_reply()
1347 if (state->options[i] && in dhcp_reply()
1348 state->options[i]->flags & TC_TEMPORARY) in dhcp_reply()
1349 free_tree_cache(state->options[i]); in dhcp_reply()
1476 if (packet->options[DHO_DHCP_REQUESTED_ADDRESS].len == 4) { in find_lease()
1480 packet->options[DHO_DHCP_REQUESTED_ADDRESS].data, in find_lease()
1490 if (packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len) { in find_lease()
1494 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].data, in find_lease()
1495 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len); in find_lease()
1502 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].data, in find_lease()
1503 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len); in find_lease()
1593 if ((ip_lease->uid_len && packet->options[i].data && in find_lease()
1594 ip_lease->uid_len == packet->options[i].len && in find_lease()
1595 !memcmp(packet->options[i].data, ip_lease->uid, in find_lease()
1655 packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len && in find_lease()
1742 options. */ in find_lease()
1784 if (hp->group->options[DHO_DHCP_CLIENT_IDENTIFIER]) { in mockup_lease()
1786 hp->group->options[DHO_DHCP_CLIENT_IDENTIFIER]->value; in mockup_lease()
1788 hp->group->options[DHO_DHCP_CLIENT_IDENTIFIER]->len; in mockup_lease()