Lines Matching refs:packet
39 static void maybe_return_agent_options(struct packet *packet,
42 static int reuse_lease (struct packet* packet, struct lease* new_lease,
46 static int do_ping_check(struct packet* packet, struct lease_state* state,
51 static int locate_network6(struct packet *packet);
102 dhcp (struct packet *packet) {
109 if (!locate_network(packet) &&
110 packet->packet_type != DHCPREQUEST &&
111 packet->packet_type != DHCPINFORM &&
112 packet->packet_type != DHCPLEASEQUERY) {
118 if (packet->packet_type > 0 &&
119 packet->packet_type <= dhcp_type_name_max) {
120 s = dhcp_type_names[packet->packet_type - 1];
123 sprintf(typebuf, "type %d", packet->packet_type);
128 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
130 (packet->raw->htype
131 ? print_hw_addr(packet->raw->htype,
132 packet->raw->hlen,
133 packet->raw->chaddr)
135 piaddr(packet->client_addr),
142 (packet->raw->htype
143 ? print_hw_addr(packet->raw->htype,
144 packet->raw->hlen,
145 packet->raw->chaddr)
147 packet->raw->giaddr.s_addr
148 ? inet_ntoa(packet->raw->giaddr)
149 : packet->interface->name, errmsg);
156 * getting the packet from the client to the server. Note
160 * forwarded a packet does not mean that the relay agent in
165 * packet, or there aren't supposed to be. When the giaddr is not
172 * so if they are not in the packet we must "pretend" the last values
175 if (packet->packet_type == DHCPREQUEST &&
176 packet->raw->ciaddr.s_addr && !packet->raw->giaddr.s_addr &&
177 (packet->options->universe_count <= agent_universe.index ||
178 packet->options->universes[agent_universe.index] == NULL))
182 cip.len = sizeof packet -> raw -> ciaddr;
183 memcpy (cip.iabuf, &packet -> raw -> ciaddr,
184 sizeof packet -> raw -> ciaddr);
200 oc = lookup_option (&dhcp_universe, packet -> options,
207 packet, (struct lease *)0,
209 packet -> options,
221 packet -> raw -> htype) ||
223 packet -> raw -> hlen) ||
225 packet -> raw -> chaddr,
226 packet -> raw -> hlen))
231 &(packet -> options -> universes
235 if (packet->options->universe_count <= agent_universe.index)
236 packet->options->universe_count =
239 packet->agent_options_stashed = ISC_TRUE;
246 if ((oc = lookup_option (&dhcp_universe, packet -> options,
253 classify_client (packet);
255 switch (packet -> packet_type) {
257 dhcpdiscover (packet, ms_nulltp);
261 dhcprequest (packet, ms_nulltp, lease);
265 dhcprelease (packet, ms_nulltp);
269 dhcpdecline (packet, ms_nulltp);
273 dhcpinform (packet, ms_nulltp);
277 dhcpleasequery(packet, ms_nulltp);
289 errmsg = "unknown packet type";
297 void dhcpdiscover (packet, ms_nulltp)
298 struct packet *packet;
310 find_lease (&lease, packet, packet -> shared_network,
326 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
329 (packet -> raw -> htype
330 ? print_hw_addr (packet -> raw -> htype,
331 packet -> raw -> hlen,
332 packet -> raw -> chaddr)
337 piaddr(packet->client_addr));
341 (packet -> raw -> htype
342 ? print_hw_addr (packet -> raw -> htype,
343 packet -> raw -> hlen,
344 packet -> raw -> chaddr)
349 packet -> raw -> giaddr.s_addr
350 ? inet_ntoa (packet -> raw -> giaddr)
351 : packet -> interface -> name);
354 if (!packet -> shared_network) {
356 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
357 log_info ("DHCP4o6 packet from unknown subnet: %s",
358 piaddr(packet->client_addr));
361 log_info ("Packet from unknown subnet: %s",
362 inet_ntoa (packet -> raw -> giaddr));
400 if (!allocate_lease (&lease, packet,
401 packet -> shared_network -> pools,
409 packet -> shared_network -> name);
428 !load_balance_mine (packet, peer)) {
450 ack_lease (packet, lease, DHCPOFFER, when, msgbuf, ms_nulltp,
457 void dhcprequest (packet, ms_nulltp, ip_lease)
458 struct packet *packet;
477 oc = lookup_option (&dhcp_universe, packet -> options,
481 evaluate_option_cache (&data, packet, (struct lease *)0,
483 packet -> options, (struct option_state *)0,
492 memcpy (cip.iabuf, &packet -> raw -> ciaddr.s_addr, 4);
501 find_lease (&lease, packet,
513 oc = lookup_option (&dhcp_universe, packet -> options,
517 evaluate_option_cache (&data, packet, (struct lease *)0,
519 packet -> options, (struct option_state *)0,
537 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
541 (packet -> raw -> htype
542 ? print_hw_addr (packet -> raw -> htype,
543 packet -> raw -> hlen,
544 packet -> raw -> chaddr)
549 piaddr(packet->client_addr));
555 (packet -> raw -> htype
556 ? print_hw_addr (packet -> raw -> htype,
557 packet -> raw -> hlen,
558 packet -> raw -> chaddr)
563 packet -> raw -> giaddr.s_addr
564 ? inet_ntoa (packet -> raw -> giaddr)
565 : packet -> interface -> name);
624 nak_lease (packet, &cip, lease->subnet->group);
629 * server source address (sip from incoming packet) is ours.
633 * packet and compare them. If they don't match it we assume
641 eval_network_statements(&eval_options, packet, NULL);
643 NULL, packet);
685 we really only know for sure what network a packet came from
689 If we don't think we know where the packet came from, it
697 raw packet, because it's not available on all platforms.
698 So a packet that was unicast to us through a router from a
699 RENEWING client is going to look exactly like a packet that
703 of packets, if the packet appears to have come in off the
713 the packet will get to us through a BOOTP gateway. We
720 if (!packet -> shared_network ||
721 (packet -> raw -> ciaddr.s_addr &&
722 packet -> raw -> giaddr.s_addr) ||
723 (have_requested_addr && !packet -> raw -> ciaddr.s_addr)) {
728 if (!packet -> shared_network) {
731 nak_lease (packet, &cip, NULL);
745 if (!find_grouped_subnet (&subnet, packet -> shared_network,
747 if (packet -> shared_network -> group -> authoritative)
750 nak_lease (packet, &cip, NULL);
762 nak_lease (packet, &cip, (subnet ? subnet->group : NULL));
768 ack_lease (packet, lease, DHCPACK, 0, msgbuf, ms_nulltp,
781 void dhcprelease (packet, ms_nulltp)
782 struct packet *packet;
796 if ((oc = lookup_option (&dhcp_universe, packet -> options,
799 print_hw_addr (packet -> raw -> htype,
800 packet -> raw -> hlen,
801 packet -> raw -> chaddr));
804 oc = lookup_option (&dhcp_universe, packet -> options,
808 evaluate_option_cache (&data, packet, (struct lease *)0,
810 packet -> options, (struct option_state *)0,
820 if (!memcmp (&packet -> raw -> ciaddr,
839 memcpy (cip.iabuf, &packet -> raw -> ciaddr, 4);
846 (lease -> hardware_addr.hlen != packet -> raw -> hlen + 1 ||
847 lease -> hardware_addr.hbuf [0] != packet -> raw -> htype ||
849 packet -> raw -> chaddr, packet -> raw -> hlen)))
865 strncpy(cstr, inet_ntoa (packet -> raw -> ciaddr), 15);
872 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
877 (packet -> raw -> htype
878 ? print_hw_addr (packet -> raw -> htype,
879 packet -> raw -> hlen,
880 packet -> raw -> chaddr)
885 piaddr(packet->client_addr),
892 (packet -> raw -> htype
893 ? print_hw_addr (packet -> raw -> htype,
894 packet -> raw -> hlen,
895 packet -> raw -> chaddr)
900 packet -> raw -> giaddr.s_addr
901 ? inet_ntoa (packet -> raw -> giaddr)
902 : packet -> interface -> name,
926 release_lease (lease, packet);
936 void dhcpdecline (packet, ms_nulltp)
937 struct packet *packet;
952 if (!(oc = lookup_option (&dhcp_universe, packet -> options,
956 if (!evaluate_option_cache (&data, packet, (struct lease *)0,
958 packet -> options,
981 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
985 (packet -> raw -> htype
986 ? print_hw_addr (packet -> raw -> htype,
987 packet -> raw -> hlen,
988 packet -> raw -> chaddr)
993 piaddr(packet->client_addr));
999 (packet -> raw -> htype
1000 ? print_hw_addr (packet -> raw -> htype,
1001 packet -> raw -> hlen,
1002 packet -> raw -> chaddr)
1007 packet -> raw -> giaddr.s_addr
1008 ? inet_ntoa (packet -> raw -> giaddr)
1009 : packet -> interface -> name);
1015 execute_statements_in_scope(NULL, packet, NULL, NULL,
1016 packet->options, options,
1022 for (i = packet -> class_count; i > 0; i--) {
1024 (NULL, packet, NULL, NULL, packet->options, options,
1025 &global_scope, packet->classes[i - 1]->group,
1032 evaluate_boolean_option_cache (&ignorep, packet, lease,
1034 packet -> options, options,
1078 u_int16_t dhcp_check_relayport(packet)
1079 struct packet *packet;
1082 packet->options,
1084 return (packet->client_port);
1091 void dhcpinform (packet, ms_nulltp)
1092 struct packet *packet;
1100 struct packet outgoing;
1122 if (!packet->raw->ciaddr.s_addr) {
1126 if (packet->client_addr.len == 4) {
1128 memcpy(cip.iabuf, &packet->client_addr.iabuf, 4);
1138 memcpy(cip.iabuf, &packet->raw->ciaddr, 4);
1144 if (packet->raw->giaddr.s_addr) {
1146 memcpy(gip.iabuf, &packet->raw->giaddr, 4);
1158 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
1162 piaddr(packet->client_addr));
1167 packet->raw->giaddr.s_addr ?
1168 inet_ntoa(packet->raw->giaddr) :
1169 packet->interface->name);
1178 relay_port = dhcp_check_relayport(packet);
1187 if ((oc = lookup_option(&agent_universe, packet->options,
1189 oc = lookup_option(&dhcp_universe, packet->options,
1193 if (oc && evaluate_option_cache(&d1, packet, NULL, NULL,
1194 packet->options, NULL,
1267 maybe_return_agent_options(packet, options);
1270 execute_statements_in_scope(NULL, packet, NULL, NULL,
1271 packet->options, options,
1285 NULL, packet, NULL, NULL,
1286 packet->options, options,
1298 for (i = packet->class_count; i > 0; i--) {
1299 execute_statements_in_scope(NULL, packet, NULL, NULL,
1300 packet->options, options,
1302 packet->classes[i - 1]->group,
1320 oc = lookup_option(&dhcp_universe, packet->options,
1324 evaluate_option_cache(&d1, packet, NULL, NULL,
1325 packet->options, NULL,
1385 find_hosts_by_haddr(&hp, packet->raw->htype,
1386 packet->raw->chaddr,
1387 packet->raw->hlen, MDL);
1471 execute_statements_in_scope(NULL, packet, NULL, NULL,
1472 packet->options, options,
1485 evaluate_option_cache (&d1, packet, (struct lease *)0,
1487 packet -> options, (struct option_state *)0,
1491 log_info("file name longer than packet field "
1505 evaluate_option_cache (&d1, packet, (struct lease *)0,
1507 packet -> options, (struct option_state *)0,
1511 log_info("server name longer than packet field "
1525 if ((oc = lookup_option (&dhcp_universe, packet -> options,
1545 get_server_source_address(&from, options, options, packet);
1570 evaluate_option_cache (&d1, packet, (struct lease *)0,
1572 packet -> options, options,
1606 oc = lookup_option (&dhcp_universe, packet -> options,
1610 evaluate_option_cache (&prl, packet, (struct lease *)0,
1612 packet -> options, options,
1616 dump_packet (packet);
1617 dump_raw ((unsigned char *)packet -> raw, packet -> packet_length);
1625 if (evaluate_option_cache (&d1, packet, (struct lease *)0,
1627 packet -> options, options,
1646 cons_options (packet, outgoing.raw, (struct lease *)0,
1648 0, packet -> options, options, &global_scope,
1655 /* Make sure that the packet is at least as big as a BOOTP packet. */
1659 raw.giaddr = packet -> raw -> giaddr;
1660 raw.ciaddr = packet -> raw -> ciaddr;
1661 memcpy (raw.chaddr, packet -> raw -> chaddr, sizeof raw.chaddr);
1662 raw.hlen = packet -> raw -> hlen;
1663 raw.htype = packet -> raw -> htype;
1665 raw.xid = packet -> raw -> xid;
1666 raw.secs = packet -> raw -> secs;
1667 raw.flags = packet -> raw -> flags;
1668 raw.hops = packet -> raw -> hops;
1677 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
1681 (packet->raw->htype && packet->raw->hlen) ?
1682 print_hw_addr(packet->raw->htype, packet->raw->hlen,
1683 packet->raw->chaddr) :
1685 log_info("%s %s", msgbuf, piaddr(packet->client_addr));
1688 packet->dhcp4o6_response->len = outgoing.packet_length;
1689 packet->dhcp4o6_response->buffer = NULL;
1690 if (!buffer_allocate(&packet->dhcp4o6_response->buffer,
1694 packet->dhcp4o6_response->data =
1695 packet->dhcp4o6_response->buffer->data;
1696 memcpy(packet->dhcp4o6_response->buffer->data,
1724 * send the packet).
1729 * If ciaddr is not zero, send the packet there always.
1747 (packet->raw->htype && packet->raw->hlen) ?
1748 print_hw_addr(packet->raw->htype, packet->raw->hlen,
1749 packet->raw->chaddr) :
1752 packet->interface->name);
1756 : packet -> interface);
1760 log_error ("%s:%d: Failed to send %d byte long packet over %s "
1775 * and evaluates options based on the packet's shared-network or the
1776 * network_group in its absence, as well as the packet->clasess (if any).
1778 * \param packet inbound packet received from the client
1782 void nak_lease (packet, cip, network_group)
1783 struct packet *packet;
1792 struct packet outgoing;
1826 relay_port = dhcp_check_relayport(packet);
1852 eval_network_statements(&eval_options, packet, network_group);
1858 get_server_source_address(&from, eval_options, options, packet);
1861 get_server_source_address(&from, NULL, options, packet);
1864 /* If there were agent options in the incoming packet, return
1869 if (packet->options->universe_count > agent_universe.index &&
1870 packet->options->universes [agent_universe.index]) {
1875 packet -> options -> universes [agent_universe.index],
1881 for (i = packet->class_count; i > 0; i--) {
1882 execute_statements_in_scope(NULL, packet, NULL, NULL,
1883 packet->options, eval_options,
1885 packet->classes[i - 1]->group,
1890 echo_client_id(packet, NULL, eval_options, options);
1894 delete_option (&dhcp_universe, packet -> options,
1899 cons_options (packet, outgoing.raw, (struct lease *)0,
1901 0, packet -> options, options, &global_scope,
1906 raw.giaddr = packet -> raw -> giaddr;
1907 memcpy (raw.chaddr, packet -> raw -> chaddr, sizeof raw.chaddr);
1908 raw.hlen = packet -> raw -> hlen;
1909 raw.htype = packet -> raw -> htype;
1911 raw.xid = packet -> raw -> xid;
1912 raw.secs = packet -> raw -> secs;
1913 raw.flags = packet -> raw -> flags | htons (BOOTP_BROADCAST);
1914 raw.hops = packet -> raw -> hops;
1917 /* Make sure that the packet is at least as big as a BOOTP packet. */
1923 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
1926 print_hw_addr (packet -> raw -> htype,
1927 packet -> raw -> hlen,
1928 packet -> raw -> chaddr),
1929 piaddr(packet->client_addr));
1934 print_hw_addr (packet -> raw -> htype,
1935 packet -> raw -> hlen,
1936 packet -> raw -> chaddr),
1937 packet -> raw -> giaddr.s_addr
1938 ? inet_ntoa (packet -> raw -> giaddr)
1939 : packet -> interface -> name);
1942 dump_packet (packet);
1943 dump_raw ((unsigned char *)packet -> raw, packet -> packet_length);
1949 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
1951 packet->dhcp4o6_response->len = outgoing.packet_length;
1952 packet->dhcp4o6_response->buffer = NULL;
1953 if (!buffer_allocate(&packet->dhcp4o6_response->buffer,
1957 packet->dhcp4o6_response->data =
1958 packet->dhcp4o6_response->buffer->data;
1959 memcpy(packet->dhcp4o6_response->buffer->data,
1986 result = send_packet(fallback_interface, packet, &raw,
1991 "packet over %s interface.", MDL,
2004 result = send_packet(packet->interface, packet, &raw,
2007 log_error ("%s:%d: Failed to send %d byte long packet over %s "
2009 packet->interface->name);
2017 * defined and enabled, the given packet is searched for dhcp-client-id. If
2023 * Note the flag packet.sv_echo_client_id is set to reflect the configuration
2027 * \param packet inbound packet received from the client
2032 void echo_client_id(packet, lease, in_options, out_options)
2033 struct packet *packet;
2043 if (oc && evaluate_boolean_option_cache(&ignorep, packet, lease,
2044 NULL, packet->options,
2051 /* Save knowledge that echo is enabled to the packet */
2052 packet->sv_echo_client_id = ISC_TRUE;
2054 /* Now see if inbound packet contains client-id */
2055 oc = lookup_option(&dhcp_universe, packet->options, opcode);
2058 packet, NULL, NULL,
2059 packet->options, NULL,
2062 /* Packet contained client-id, add it to out_options. */
2083 static void check_pool_threshold (struct packet *packet, struct lease *lease,
2127 if (get_option_int(&poolhigh, &server_universe, packet, lease, NULL,
2128 packet->options, state->options, state->options,
2155 if ((get_option_int(&poollow, &server_universe, packet, lease, NULL,
2156 packet->options, state->options, state->options,
2173 void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
2174 struct packet *packet;
2226 state -> got_requested_address = packet -> got_requested_address;
2228 packet -> interface -> shared_network, MDL);
2232 packet -> options, DHO_DHCP_SERVER_IDENTIFIER))
2235 maybe_return_agent_options(packet, state->options);
2258 execute_statements_in_scope (NULL, packet, lease,
2259 NULL, packet->options,
2265 (execute_statements_in_scope(NULL, packet, lease, NULL,
2266 packet->options, state->options,
2273 for (i = packet -> class_count; i > 0; i--) {
2274 execute_statements_in_scope(NULL, packet, lease, NULL,
2275 packet->options, state->options,
2277 packet->classes[i - 1]->group,
2292 if (packet -> packet_type == DHCPREQUEST &&
2296 packet, lease,
2298 packet -> options,
2337 release_lease (seek, packet);
2348 !evaluate_boolean_option_cache (&ignorep, packet, lease,
2350 packet -> options,
2385 release_lease (seek, packet);
2394 /* Make sure this packet satisfies the configured minimum
2400 if (evaluate_option_cache (&d1, packet, lease,
2402 packet -> options, state -> options,
2405 ntohs (packet -> raw -> secs) < d1.data [0]) {
2409 ntohs(packet->raw->secs));
2427 identifier or hardware address on the packet, and
2431 oc = lookup_option (&dhcp_universe, packet -> options,
2434 evaluate_option_cache (&d1, packet, lease,
2436 packet -> options, state -> options,
2451 packet -> raw -> htype,
2452 packet -> raw -> chaddr,
2453 packet -> raw -> hlen,
2465 find_hosts_by_option(&hp, packet,
2466 packet->options, MDL);
2481 execute_statements_in_scope (NULL, packet, lease, NULL,
2482 packet->options, state->options,
2495 packet, lease,
2497 packet -> options,
2513 packet, lease,
2515 packet -> options,
2531 packet, lease,
2533 packet -> options,
2550 for (i = 0; i < packet -> class_count; i++)
2551 if (packet -> classes [i] ==
2554 if (i == packet -> class_count) {
2569 for (i = 0; i < packet->class_count; i++) {
2572 billclass = packet->classes[i];
2585 if (bill != 0 && i == packet->class_count) {
2619 evaluate_option_cache (&state -> filename, packet, lease,
2621 packet -> options, state -> options,
2628 packet, lease,
2630 packet -> options, state -> options,
2662 if (evaluate_option_cache (&d1, packet, lease,
2664 packet -> options,
2674 if ((oc = lookup_option (&dhcp_universe, packet -> options,
2676 s1 = evaluate_option_cache (&d1, packet, lease,
2678 packet -> options,
2715 evaluate_boolean_option_cache(&ignorep, packet,
2716 lease, NULL, packet->options,
2737 if (evaluate_option_cache (&d1, packet, lease,
2739 packet -> options,
2760 if (evaluate_option_cache (&d1, packet, lease,
2762 packet -> options,
2779 evaluate_option_cache(&d1, packet, lease, NULL,
2780 packet->options, state->options,
2833 check_pool_threshold(packet, lease, state);
2841 nak_lease(packet, &cip, lease->subnet->group);
2871 nak_lease(packet, &cip, lease->subnet->group);
2982 if (evaluate_option_cache (&d1, packet, lease,
2984 packet -> options,
2995 if (evaluate_option_cache (&d1, packet, lease,
2997 packet -> options,
3018 !evaluate_boolean_option_cache(&ignorep, packet, lease, NULL,
3019 packet->options, state->options,
3023 oc = lookup_option (&dhcp_universe, packet -> options,
3026 evaluate_option_cache(&d1, packet, lease, NULL,
3027 packet->options, state->options,
3077 oc = lookup_option(&dhcp_universe, packet->options,
3080 evaluate_option_cache(&d1, packet, NULL, NULL, packet->options,
3090 /* If we got relay agent information options from the packet, then
3096 if (!packet->agent_options_stashed &&
3097 (packet->options != NULL) &&
3098 packet->options->universe_count > agent_universe.index &&
3099 packet->options->universes[agent_universe.index] != NULL) {
3103 evaluate_boolean_option_cache (&ignorep, packet, lease,
3105 packet -> options,
3113 packet -> options -> universes [agent_universe.index],
3119 oc = lookup_option (&dhcp_universe, packet -> options, DHO_HOST_NAME);
3121 s1 = evaluate_option_cache (&d1, packet, (struct lease *)0,
3123 packet -> options,
3151 lt -> hardware_addr.hlen = packet -> raw -> hlen + 1;
3152 lt -> hardware_addr.hbuf [0] = packet -> raw -> htype;
3153 memcpy (< -> hardware_addr.hbuf [1], packet -> raw -> chaddr,
3154 sizeof packet -> raw -> chaddr);
3171 execute_statements (NULL, packet, lt, NULL, packet->options,
3184 evaluate_boolean_option_cache (&ignorep, packet, lt,
3186 packet -> options,
3189 ddns_updates(packet, lt, lease, NULL, NULL, state->options);
3197 lease -> hardware_addr.hlen = packet -> raw -> hlen + 1;
3198 lease -> hardware_addr.hbuf [0] = packet -> raw -> htype;
3200 packet -> raw -> chaddr,
3201 sizeof packet -> raw -> chaddr); /* XXX */
3207 use_old_lease = reuse_lease(packet, lt, lease, state, offer,
3254 /* Remember the interface on which the packet arrived. */
3255 state -> ip = packet -> interface;
3258 state -> giaddr = packet -> raw -> giaddr;
3259 state -> ciaddr = packet -> raw -> ciaddr;
3260 state -> xid = packet -> raw -> xid;
3261 state -> secs = packet -> raw -> secs;
3262 state -> bootp_flags = packet -> raw -> flags;
3263 state -> hops = packet -> raw -> hops;
3270 evaluate_boolean_option_cache (&ignorep, packet, lease,
3272 packet -> options, state -> options,
3276 /* Get the Maximum Message Size option from the packet, if one
3278 oc = lookup_option (&dhcp_universe, packet -> options,
3281 evaluate_option_cache (&d1, packet, lease,
3283 packet -> options, state -> options,
3292 evaluate_option_cache (&d1, packet, lease,
3294 packet -> options, state -> options,
3303 /* Get the Subnet Selection option from the packet, if one
3305 if ((oc = lookup_option (&dhcp_universe, packet -> options,
3344 state->options, packet);
3373 evaluate_option_cache(&d1, packet, lease, NULL,
3374 packet->options, state->options,
3390 evaluate_option_cache(&d1, packet, lease, NULL,
3391 packet->options, state->options,
3415 if (evaluate_option_cache (&d1, packet, lease,
3417 packet -> options, state -> options,
3450 use_host_decl_name(packet, lease, state->options);
3453 echo_client_id(packet, lease, state->options, state->options);
3461 (&ignorep, packet, lease, NULL,
3462 packet->options, state->options, &lease->scope,
3496 (&ignorep, packet, lease, (struct client_state *)0,
3497 packet -> options, state -> options, &lease -> scope,
3524 evaluate_option_cache (&d1, packet, lease,
3526 packet -> options, state -> options,
3555 oc = lookup_option (&dhcp_universe, packet -> options,
3559 packet, lease, (struct client_state *)0,
3560 packet -> options, state -> options,
3564 dump_packet (packet);
3565 dump_raw ((unsigned char *)packet -> raw, packet -> packet_length);
3572 /* Hang the packet off the lease state. */
3573 packet_reference (&lease -> state -> packet, packet, MDL);
3578 do_ping_check(packet, state, lease, original_cltt, same_client)) {
3606 * \param packet inbound packet received from the client
3614 int do_ping_check(struct packet* packet, struct lease_state* state,
3634 !(evaluate_boolean_option_cache (&ignorep, packet, lease,
3635 0, packet->options, state->options,
3649 (evaluate_option_cache (&ds, packet, lease, 0,
3650 packet->options, state->options,
3673 (evaluate_option_cache (&ds, packet, lease, 0,
3674 packet->options, state->options,
3685 (evaluate_option_cache (&ds, packet, lease, 0,
3686 packet->options, state->options,
3836 /* process from bottom to retain packet order */
3926 log_info("file name longer than packet field "
3945 log_info("server name longer than packet field "
3973 packet_length = cons_options (state -> packet, &raw, lease,
3976 state -> packet -> options,
4003 as a BOOTP packet. */
4008 if (dhcpv4_over_dhcpv6 && (state->packet->dhcp4o6_response != NULL)) {
4022 piaddr(state->packet->client_addr));
4025 state->packet->dhcp4o6_response->len = packet_length;
4026 state->packet->dhcp4o6_response->buffer = NULL;
4027 if (!buffer_allocate(&state->packet->dhcp4o6_response->buffer,
4031 state->packet->dhcp4o6_response->data =
4032 state->packet->dhcp4o6_response->buffer->data;
4033 memcpy(state->packet->dhcp4o6_response->buffer->data,
4075 relay_port = dhcp_check_relayport(state->packet);
4096 "packet over %s interface.", MDL,
4134 " packet over %s interface.", MDL,
4167 "packet over %s interface.", MDL,
4180 struct packet *packet, struct shared_network *share, int *ours,
4217 if (packet -> raw -> ciaddr.s_addr) {
4219 memcpy (cip.iabuf, &packet -> raw -> ciaddr, 4);
4222 oc = lookup_option (&dhcp_universe, packet -> options,
4226 evaluate_option_cache (&d1, packet, (struct lease *)0,
4228 packet -> options,
4231 packet
4241 oc = lookup_option (&dhcp_universe, packet -> options,
4246 packet, (struct lease *)0,
4248 packet -> options, (struct option_state *)0,
4258 packet -> known = 1;
4259 mockup_lease (&fixed_lease, packet, share, hp);
4281 if (find_hosts_by_haddr (&hp, packet -> raw -> htype,
4282 packet -> raw -> chaddr,
4283 packet -> raw -> hlen, MDL)) {
4285 packet -> known = 1;
4290 mockup_lease (&fixed_lease, packet, share, host);
4303 if (find_hosts_by_option(&hp, packet,
4304 packet->options, MDL) == 1) {
4305 packet->known = 1;
4310 mockup_lease (&fixed_lease, packet, share, host);
4322 if (packet -> packet_type == DHCPREQUEST && fixed_lease &&
4341 * packet -> known, which may be set by either the uid host
4348 isc_boolean_t do_release = !packet->raw->ciaddr.s_addr;
4386 permitted (packet, uid_lease -> pool -> prohibit_list)) ||
4388 !permitted (packet, uid_lease -> pool -> permit_list))) {
4398 release_lease (uid_lease, packet);
4421 h.hlen = packet -> raw -> hlen + 1;
4422 h.hbuf [0] = packet -> raw -> htype;
4423 memcpy (&h.hbuf [1], packet -> raw -> chaddr, packet -> raw -> hlen);
4478 permitted (packet, hw_lease -> pool -> prohibit_list)) ||
4480 !permitted (packet, hw_lease -> pool -> permit_list))) {
4485 if (!packet -> raw -> ciaddr.s_addr)
4486 release_lease (hw_lease, packet);
4524 /* If the requested IP address isn't on the network the packet
4556 (ip_lease -> hardware_addr.hbuf [0] != packet -> raw -> htype ||
4557 ip_lease -> hardware_addr.hlen != packet -> raw -> hlen + 1 ||
4559 packet -> raw -> chaddr,
4592 packet->packet_type == DHCPDISCOVER) {
4612 (packet -> raw -> htype,
4613 packet -> raw -> hlen,
4614 packet -> raw -> chaddr)),
4624 !packet -> raw -> ciaddr.s_addr &&
4627 packet -> packet_type == DHCPREQUEST)
4628 release_lease (uid_lease, packet);
4638 if (packet -> packet_type == DHCPREQUEST && fixed_lease) {
4669 if (packet -> packet_type == DHCPREQUEST && fixed_lease && ip_lease)
4695 permitted (packet, ip_lease -> pool -> prohibit_list)) ||
4697 !permitted (packet, ip_lease -> pool -> permit_list)))) {
4698 if (!packet->raw->ciaddr.s_addr &&
4700 release_lease (ip_lease, packet);
4707 permitted (packet, uid_lease -> pool -> prohibit_list)) ||
4709 !permitted (packet, uid_lease -> pool -> permit_list)))) {
4710 if (!packet -> raw -> ciaddr.s_addr)
4711 release_lease (uid_lease, packet);
4717 permitted (packet, hw_lease -> pool -> prohibit_list)) ||
4719 !permitted (packet, hw_lease -> pool -> permit_list)))) {
4720 if (!packet -> raw -> ciaddr.s_addr)
4721 release_lease (hw_lease, packet);
4735 if (packet -> packet_type == DHCPREQUEST &&
4757 if (!packet -> raw -> ciaddr.s_addr)
4758 release_lease (ip_lease, packet);
4781 print_hw_addr(packet->raw->htype,
4782 packet->raw->hlen,
4783 packet->raw->chaddr),
4786 if (!packet -> raw -> ciaddr.s_addr &&
4787 packet -> packet_type == DHCPREQUEST &&
4789 release_lease(uid_lease, packet);
4822 : packet -> packet_type == 0)) {
4890 packet -> packet_type == DHCPREQUEST) {
4937 int mockup_lease (struct lease **lp, struct packet *packet,
4987 int allocate_lease (struct lease **lp, struct packet *packet,
4995 permitted (packet, pool -> prohibit_list)) ||
4997 !permitted (packet, pool -> permit_list)))
5143 that matches the specified packet, returning nonzero if so, zero if
5146 int permitted (packet, permit_list)
5147 struct packet *packet;
5156 if (!packet -> known)
5161 if (packet -> known)
5166 if (packet -> authenticated)
5171 if (!packet -> authenticated)
5179 if (!packet -> options_valid ||
5180 !packet -> packet_type)
5185 for (i = 0; i < packet -> class_count; i++) {
5186 if (p -> class == packet -> classes [i])
5188 if (packet -> classes [i] &&
5189 packet -> classes [i] -> superclass &&
5190 (packet -> classes [i] -> superclass ==
5206 static int locate_network6 (packet)
5207 struct packet *packet;
5209 const struct packet *chk_packet;
5225 if ((oc = lookup_option(&agent_universe, packet->options,
5227 oc = lookup_option(&dhcp_universe, packet->options,
5236 if (!evaluate_option_cache(&data, packet, NULL, NULL,
5237 packet->options, NULL,
5253 shared_network_reference(&packet->shared_network,
5264 if (packet->raw->giaddr.s_addr) {
5266 memcpy(ia.iabuf, &packet->raw->giaddr, 4);
5269 shared_network_reference(&packet->shared_network,
5279 /* First, find the link address where the packet from the client
5280 * first appeared (if this packet was relayed).
5283 chk_packet = packet->dhcpv6_container_packet;
5301 shared_network_reference(&packet->shared_network,
5310 * that this packet came in on to pick the shared_network.
5312 if (packet->interface != NULL) {
5313 if (packet->interface->shared_network == NULL)
5315 shared_network_reference(&packet->shared_network,
5316 packet->interface->shared_network,
5331 int locate_network (packet)
5332 struct packet *packet;
5340 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
5341 return (locate_network6 (packet));
5350 if ((oc = lookup_option(&agent_universe, packet->options,
5352 oc = lookup_option(&dhcp_universe, packet->options,
5357 if (!oc && !packet -> raw -> giaddr.s_addr) {
5358 if (packet -> interface -> shared_network) {
5360 (&packet -> shared_network,
5361 packet -> interface -> shared_network, MDL);
5372 if (!evaluate_option_cache (&data, packet, (struct lease *)0,
5374 packet -> options,
5390 memcpy (ia.iabuf, &packet -> raw -> giaddr, 4);
5395 shared_network_reference (&packet -> shared_network,
5412 * options from the incoming packet and configuration information.
5420 * packet is the state structure for the incoming packet
5439 struct packet *packet) {
5453 if (evaluate_option_cache(&d, packet, NULL, NULL,
5454 packet->options, options,
5476 (packet->interface->address_count > 0)) {
5477 *from = packet->interface->addresses[0];
5480 a = &packet->interface->addresses[0];
5518 * \param packet inbound packet
5519 * \param network_group scope group to use if packet->shared_network is null.
5523 struct packet *packet,
5530 /* Use the packet's shared_network if it has one. If not use
5532 if (packet->shared_network != NULL) {
5538 if ((packet->shared_network->subnets != NULL) &&
5539 (packet->shared_network->subnets->group != NULL)) {
5540 execute_statements_in_scope(NULL, packet, NULL, NULL,
5541 packet->options, *network_options,
5543 packet->shared_network->subnets->group,
5546 execute_statements_in_scope(NULL, packet, NULL, NULL,
5547 packet->options, *network_options,
5549 packet->shared_network->group,
5554 if (packet->shared_network->pools != NULL) {
5555 execute_statements_in_scope(NULL, packet, NULL, NULL,
5556 packet->options, *network_options,
5558 packet->shared_network->pools->group,
5559 packet->shared_network->group,
5563 execute_statements_in_scope(NULL, packet, NULL, NULL,
5564 packet->options, *network_options,
5568 execute_statements_in_scope(NULL, packet, NULL, NULL,
5569 packet->options, *network_options,
5638 maybe_return_agent_options(struct packet *packet, struct option_state *options)
5640 /* If there were agent options in the incoming packet, return
5652 if (!packet->agent_options_stashed &&
5653 (packet->options != NULL) &&
5654 packet->options->universe_count > agent_universe.index &&
5655 packet->options->universes[agent_universe.index] != NULL &&
5662 packet->options->universes[agent_universe.index], MDL);
5677 * \param packet inbound packet received from the client
5681 void use_host_decl_name(struct packet* packet,
5687 (evaluate_boolean_option_cache(NULL, packet, lease, NULL,
5688 packet->options, options,
5738 * \param packet inbound packet received from the client
5749 reuse_lease (struct packet* packet,
5786 (evaluate_option_cache(&d1, packet, new_lease, NULL,
5787 packet->options, state->options,