Lines Matching refs:packet
141 static void add_reject(struct packet *packet);
254 static void forw_dhcpv4_response(struct packet *packet);
1194 int check_collection (packet, lease, collection) in check_collection() argument
1195 struct packet *packet; in check_collection()
1202 void classify (packet, class) in classify() argument
1203 struct packet *packet; in classify()
1314 client -> xid = client -> packet.xid;
1329 uint32_t check_v6only(packet, client) in check_v6only() argument
1330 struct packet *packet; in check_v6only()
1358 oc = lookup_option(&dhcp_universe, packet->options,
1365 if (evaluate_option_cache(&data, packet, (struct lease *)0, client,
1366 packet->options, (struct option_state *)0,
1502 client -> xid = client -> packet.xid;
1512 compare_hw_address(const char *name, struct packet *packet) { in compare_hw_address() argument
1513 if (packet->interface->hw_address.hlen - 1 != packet->raw->hlen || in compare_hw_address()
1514 memcmp(&packet->interface->hw_address.hbuf[1], in compare_hw_address()
1515 packet->raw->chaddr, packet->raw->hlen)) { in compare_hw_address()
1516 unsigned char *c = packet->raw ->chaddr; in compare_hw_address()
1518 name, packet->raw->hlen, in compare_hw_address()
1520 c = &packet -> interface -> hw_address.hbuf [1]; in compare_hw_address()
1522 name, packet->interface->hw_address.hlen - 1, in compare_hw_address()
1534 void dhcpack (packet) in dhcpack() argument
1535 struct packet *packet; in dhcpack()
1537 struct interface_info *ip = packet -> interface;
1547 if (client -> xid == packet -> raw -> xid)
1550 if (!client || compare_hw_address("DHCPACK", packet) == ISC_TRUE)
1564 inet_ntoa(packet->raw->yiaddr),
1565 piaddr (packet->client_addr));
1568 v6only_wait = check_v6only(packet, client);
1577 lease = packet_to_lease (packet, client);
1593 evaluate_option_cache (&ds, packet, (struct lease *)0, client,
1594 packet -> options, client -> new -> options,
1610 add_reject(packet);
1636 evaluate_option_cache (&ds, packet, (struct lease *)0, client,
1637 packet -> options, client -> new -> options,
1663 evaluate_option_cache (&ds, packet, (struct lease *)0, client,
1664 packet -> options, client -> new -> options,
1815 client -> xid = client -> packet.xid;
1821 evaluate_option_cache (&ds, (struct packet *)0, (struct lease *)0,
1893 void bootp (packet) in bootp() argument
1894 struct packet *packet; in bootp()
1900 if (packet -> raw -> op != BOOTREPLY)
1905 for (ap = packet -> interface -> client -> config -> reject_list;
1907 if (addr_match(&packet->client_addr, &ap->match)) {
1916 "mask %s.", piaddr(packet->client_addr),
1922 dhcpoffer (packet);
1926 void dhcp (packet) in dhcp() argument
1927 struct packet *packet; in dhcp()
1930 void (*handler) (struct packet *);
1935 switch (packet -> packet_type) {
1957 for (ap = packet -> interface -> client -> config -> reject_list;
1959 if (addr_match(&packet->client_addr, &ap->match)) {
1968 type, piaddr(packet->client_addr),
1973 (*handler) (packet);
1978 dhcpv6(struct packet *packet) { in dhcpv6() argument
1984 if (packet->dhcpv6_msg_type >= dhcpv6_type_name_max) in dhcpv6()
1988 for (ap = packet->interface->client->config->reject_list ; in dhcpv6()
1990 if (addr_match(&packet->client_addr, &ap->match)) { in dhcpv6()
1991 strcpy(addrbuf, piaddr(packet->client_addr)); in dhcpv6()
1993 dhcpv6_type_names[packet->dhcpv6_msg_type], in dhcpv6()
2001 switch(packet->dhcpv6_msg_type) { in dhcpv6()
2006 dhcpv6_type_names[packet->dhcpv6_msg_type], in dhcpv6()
2007 packet->interface->name, in dhcpv6()
2008 piaddr(packet->client_addr)); in dhcpv6()
2009 forw_dhcpv4_response(packet); in dhcpv6()
2020 dhcpv6_type_names[packet->dhcpv6_msg_type], in dhcpv6()
2021 packet->interface->name, piaddr(packet->client_addr)); in dhcpv6()
2029 for (client = packet->interface->client ; client ; in dhcpv6()
2032 packet->dhcpv6_transaction_id, 3) == 0) { in dhcpv6()
2033 client->v6_handler(packet, client); in dhcpv6()
2055 static void forw_dhcpv4_response(struct packet *packet) in forw_dhcpv4_response() argument
2070 if (packet->client_addr.len != 16) { in forw_dhcpv4_response()
2078 oc = lookup_option(&dhcpv6_universe, packet->options, D6O_DHCPV4_MSG); in forw_dhcpv4_response()
2082 piaddr(packet->client_addr)); in forw_dhcpv4_response()
2115 packet->client_addr.iabuf, 16); in forw_dhcpv4_response()
2139 struct packet *packet; in recv_dhcpv4_response() local
2153 packet = NULL; in recv_dhcpv4_response()
2154 if (!packet_allocate(&packet, MDL)) { in recv_dhcpv4_response()
2159 packet->raw = (struct dhcp_packet *) raw->data; in recv_dhcpv4_response()
2160 packet->packet_length = raw->len - 16; in recv_dhcpv4_response()
2161 packet->client_port = remote_port; in recv_dhcpv4_response()
2162 packet->client_addr = from; in recv_dhcpv4_response()
2163 interface_reference(&packet->interface, interfaces, MDL); in recv_dhcpv4_response()
2166 if (!option_state_allocate (&packet->options, MDL)) { in recv_dhcpv4_response()
2168 packet_dereference (&packet, MDL); in recv_dhcpv4_response()
2173 if (packet->packet_length >= DHCP_FIXED_NON_UDP + 4) { in recv_dhcpv4_response()
2175 if (!parse_options(packet)) { in recv_dhcpv4_response()
2176 if (packet->options) in recv_dhcpv4_response()
2178 (&packet->options, MDL); in recv_dhcpv4_response()
2179 packet_dereference (&packet, MDL); in recv_dhcpv4_response()
2183 if (packet->options_valid && in recv_dhcpv4_response()
2185 packet->options, in recv_dhcpv4_response()
2189 evaluate_option_cache(&dp, packet, NULL, NULL, in recv_dhcpv4_response()
2190 packet->options, NULL, in recv_dhcpv4_response()
2193 packet->packet_type = dp.data[0]; in recv_dhcpv4_response()
2195 packet->packet_type = 0; in recv_dhcpv4_response()
2200 if (validate_packet(packet) != 0) { in recv_dhcpv4_response()
2201 if (packet->packet_type) in recv_dhcpv4_response()
2202 dhcp(packet); in recv_dhcpv4_response()
2204 bootp(packet); in recv_dhcpv4_response()
2208 packet_dereference(&packet, MDL); in recv_dhcpv4_response()
2213 void dhcpoffer (packet) in dhcpoffer() argument
2214 struct packet *packet; in dhcpoffer()
2216 struct interface_info *ip = packet -> interface;
2223 const char *name = packet -> packet_type ? "DHCPOFFER" : "BOOTREPLY";
2228 dump_packet (packet);
2233 if (client -> xid == packet -> raw -> xid)
2239 compare_hw_address(name, packet) == ISC_TRUE)
2243 inet_ntoa(packet->raw->yiaddr),
2244 piaddr(packet->client_addr));
2247 v6only_wait = check_v6only(packet, client);
2263 !lookup_option(&dhcp_universe, packet->options,
2288 if (lease -> address.len == sizeof packet -> raw -> yiaddr &&
2290 &packet -> raw -> yiaddr, lease -> address.len)) {
2296 lease = packet_to_lease (packet, client);
2307 if (!packet -> options_valid || !packet -> packet_type)
2354 struct client_lease *packet_to_lease (packet, client) in packet_to_lease() argument
2355 struct packet *packet; in packet_to_lease()
2374 option_state_reference(&lease->options, packet->options, MDL);
2376 lease->address.len = sizeof(packet->raw->yiaddr);
2377 memcpy(lease->address.iabuf, &packet->raw->yiaddr,
2380 lease->next_srv_addr.len = sizeof(packet->raw->siaddr);
2381 memcpy(lease->next_srv_addr.iabuf, &packet->raw->siaddr,
2393 evaluate_option_cache (&data, packet,
2395 packet -> options, lease -> options,
2404 (packet -> options, option,
2420 evaluate_option_cache (&data, packet, (struct lease *)0, client,
2421 packet -> options, lease -> options,
2432 if (!(i & 2) && packet -> raw -> sname [0]) {
2436 if (!packet -> raw -> sname [len])
2445 packet -> raw -> sname, len);
2451 if (!(i & 1) && packet -> raw -> file [0]) {
2455 if (!packet -> raw -> file [len])
2464 packet -> raw -> file, len);
2469 execute_statements_in_scope(NULL, (struct packet *)packet, NULL,
2477 void dhcpnak (packet) in dhcpnak() argument
2478 struct packet *packet; in dhcpnak()
2480 struct interface_info *ip = packet -> interface;
2485 if (client -> xid == packet -> raw -> xid)
2490 if (!client || compare_hw_address("DHCPNAK", packet) == ISC_TRUE)
2503 log_info ("DHCPNAK from %s", piaddr (packet -> client_addr));
2625 client -> packet.secs = htons (interval);
2627 client -> packet.secs = htons (65535);
2628 client -> secs = client -> packet.secs;
2647 result = send_packet(client->interface, NULL, &client->packet,
3013 client -> packet.secs = client -> secs;
3016 client -> packet.secs = htons (interval);
3018 client -> packet.secs = htons (65535);
3029 rip_str = inet_ntoa(client->packet.ciaddr);
3054 result = send_packet(fallback_interface, NULL, &client->packet,
3066 result = send_packet(client->interface, NULL, &client->packet,
3107 result = send_packet(client->interface, NULL, &client->packet,
3177 result = send_packet(fallback_interface, NULL, &client->packet,
3188 result = send_packet(client->interface, NULL, &client->packet,
3254 memcpy(ds.buffer->data + ofs, &client->packet, client->packet_length); in send_dhcpv4_query()
3504 memset (&client -> packet, 0, sizeof (client -> packet));
3514 cons_options ((struct packet *)0, &client -> packet,
3530 client -> packet.op = BOOTREQUEST;
3531 client -> packet.htype = client -> interface -> hw_address.hbuf [0];
3533 client -> packet.hlen = client -> interface -> hw_address.hlen - 1;
3534 client -> packet.hops = 0;
3535 client -> packet.xid = random ();
3536 client -> packet.secs = 0; /* filled in by send_discover. */
3539 client -> packet.flags = 0;
3541 client -> packet.flags = htons (BOOTP_BROADCAST);
3543 memset (&(client -> packet.ciaddr),
3544 0, sizeof client -> packet.ciaddr);
3545 memset (&(client -> packet.yiaddr),
3546 0, sizeof client -> packet.yiaddr);
3547 memset (&(client -> packet.siaddr),
3548 0, sizeof client -> packet.siaddr);
3549 client -> packet.giaddr = giaddr;
3551 memcpy (client -> packet.chaddr,
3556 dump_raw ((unsigned char *)&client -> packet, client -> packet_length);
3568 memset (&client -> packet, 0, sizeof (client -> packet));
3589 cons_options ((struct packet *)0, &client -> packet,
3604 client -> packet.op = BOOTREQUEST;
3605 client -> packet.htype = client -> interface -> hw_address.hbuf [0];
3607 client -> packet.hlen = client -> interface -> hw_address.hlen - 1;
3608 client -> packet.hops = 0;
3609 client -> packet.xid = client -> xid;
3610 client -> packet.secs = 0; /* Filled in by send_request. */
3617 memcpy (&client -> packet.ciaddr,
3619 client -> packet.flags = 0;
3621 memset (&client -> packet.ciaddr, 0,
3622 sizeof client -> packet.ciaddr);
3624 client -> packet.flags = 0;
3626 client -> packet.flags = htons (BOOTP_BROADCAST);
3629 memset (&client -> packet.yiaddr, 0,
3630 sizeof client -> packet.yiaddr);
3631 memset (&client -> packet.siaddr, 0,
3632 sizeof client -> packet.siaddr);
3635 client -> packet.giaddr = giaddr;
3637 memset (&client -> packet.giaddr, 0,
3638 sizeof client -> packet.giaddr);
3640 memcpy (client -> packet.chaddr,
3645 dump_raw ((unsigned char *)&client -> packet, client -> packet_length);
3665 memset (&client -> packet, 0, sizeof (client -> packet));
3667 cons_options ((struct packet *)0, &client -> packet,
3679 client -> packet.op = BOOTREQUEST;
3680 client -> packet.htype = client -> interface -> hw_address.hbuf [0];
3682 client -> packet.hlen = client -> interface -> hw_address.hlen - 1;
3683 client -> packet.hops = 0;
3684 client -> packet.xid = client -> xid;
3685 client -> packet.secs = 0; /* Filled in by send_request. */
3687 client -> packet.flags = 0;
3689 client -> packet.flags = htons (BOOTP_BROADCAST);
3692 memset (&client -> packet.ciaddr, 0,
3693 sizeof client -> packet.ciaddr);
3694 memset (&client -> packet.yiaddr, 0,
3695 sizeof client -> packet.yiaddr);
3696 memset (&client -> packet.siaddr, 0,
3697 sizeof client -> packet.siaddr);
3698 client -> packet.giaddr = giaddr;
3699 memcpy (client -> packet.chaddr,
3704 dump_raw ((unsigned char *)&client -> packet, client -> packet_length);
3717 memset (&client -> packet, 0, sizeof (client -> packet));
3725 cons_options ((struct packet *)0, &client -> packet,
3741 client -> packet.op = BOOTREQUEST;
3742 client -> packet.htype = client -> interface -> hw_address.hbuf [0];
3744 client -> packet.hlen = client -> interface -> hw_address.hlen - 1;
3745 client -> packet.hops = 0;
3746 client -> packet.xid = random ();
3747 client -> packet.secs = 0;
3748 client -> packet.flags = 0;
3749 memcpy (&client -> packet.ciaddr,
3751 memset (&client -> packet.yiaddr, 0,
3752 sizeof client -> packet.yiaddr);
3753 memset (&client -> packet.siaddr, 0,
3754 sizeof client -> packet.siaddr);
3755 client -> packet.giaddr = giaddr;
3756 memcpy (client -> packet.chaddr,
3761 dump_raw ((unsigned char *)&client -> packet, client -> packet_length);
3842 struct packet *packet, struct lease *lease, in write_lease_option() argument
3862 if (evaluate_option_cache (&ds, packet, lease, client_state, in write_lease_option()
4352 struct packet *packet, struct lease *lease, in client_option_envadd() argument
4363 if (evaluate_option_cache (&data, packet, lease, client_state, in client_option_envadd()
4442 if (oc && evaluate_option_cache (&data, (struct packet *)0, in script_write_params()
4471 (&data, (struct packet *)0, in script_write_params()
4515 option_space_foreach ((struct packet *)0, (struct lease *)0, in script_write_params()
4873 evaluate_option_cache (&ds, (struct packet *)0,
5025 int parse_agent_information_option (packet, len, data) in parse_agent_information_option() argument
5026 struct packet *packet; in parse_agent_information_option()
5332 evaluate_boolean_option_cache (&ignorep, (struct packet *)0, in client_dns_update()
5343 evaluate_boolean_option_cache (&ignorep, (struct packet *)0, in client_dns_update()
5353 !evaluate_option_cache (&ddns_cb->fwd_name, (struct packet *)0, in client_dns_update()
5678 add_reject(struct packet *packet) { in add_reject() argument
5689 list->match.addr = packet->client_addr; in add_reject()
5695 list->next = packet->interface->client->config->reject_list; in add_reject()
5696 packet->interface->client->config->reject_list = list; in add_reject()