Lines Matching defs:packet

52 /* Parse all available options out of the specified packet. */
53 /* Note, the caller is responsible for allocating packet->options. */
54 int parse_options (packet)
55 struct packet *packet;
60 if (memcmp (packet -> raw -> options, DHCP_OPTIONS_COOKIE, 4)) {
61 packet -> options_valid = 0;
65 /* Go through the options field, up to the end of the packet
67 if (!parse_option_buffer (packet -> options,
68 &packet -> raw -> options [4],
69 (packet -> packet_length -
75 the packet is junk. Microsoft clients accept this,
85 if ((op = lookup_option (&dhcp_universe, packet -> options,
98 if ((op = lookup_option (&dhcp_universe, packet -> options,
102 (packet -> options,
103 (unsigned char *)packet -> raw -> file,
104 sizeof packet -> raw -> file,
110 (packet -> options,
111 (unsigned char *)packet -> raw -> sname,
112 sizeof packet -> raw -> sname,
117 packet -> options_valid = 1;
122 * values in packet->options.
362 decoded the packet and executed the scopes that it matches). */
546 * separate fields in the dhcp packet (options, file, and sname) where
549 * returns 0 on error, length of packet on success
552 cons_options(struct packet *inpacket, struct dhcp_packet *outpacket,
578 * If there's a Maximum Message Size option in the incoming packet
580 * if the one specified in the packet is shorter than the
581 * alternative, take the one in the packet.
609 /* Enforce minimum packet size, per RFC 2132 */
615 * changes to the way the packet is allocated. For
721 * in the packet if there is space. Note that the option
748 * packet.
869 "in reply packet.");
872 /* Tack a DHO_END option onto the packet if we need to. */
876 /* Copy main buffer into the options buffer of the packet */
901 struct packet *packet,
914 if (evaluate_option_cache(&ds, packet, NULL,
1009 * \param packet structure containing what we know about the packet
1017 struct option_state *opt_state, struct packet *packet,
1043 if (option_space_encapsulate(&ds, packet, NULL, NULL, NULL, opt_state,
1060 struct packet *packet,
1108 if (evaluate_option_cache(&ds, packet, NULL,
1167 if (evaluate_option_cache(&ds, packet, NULL,
1192 packet, encap_opt, code);
1210 option_space_foreach(packet, NULL,
1248 struct packet *packet, struct lease *lease,
1404 (void) evaluate_option_cache (&name, packet, lease,
1423 (&encapsulation, packet, lease, client_state,
1448 (void) evaluate_option_cache (&od, packet,
2290 int get_option (result, universe, packet, lease, client_state,
2294 struct packet *packet;
2312 if (!evaluate_option_cache (result, packet, lease, client_state,
2325 int get_option_int (result, universe, packet, lease, client_state,
2329 struct packet *packet;
2355 if (!evaluate_option_cache(&d1, packet, lease, client_state,
2686 struct packet *dummy_packet,
2701 struct packet *dummy_packet,
3059 struct packet *packet, struct lease *lease,
3071 if (evaluate_option_cache(&tmp, packet, lease, client_state,
3112 subu->encapsulate(&tmp, packet, lease,
3128 int option_space_encapsulate (result, packet, lease, client_state,
3131 struct packet *packet;
3152 if (u->encapsulate(result, packet, lease, client_state,
3178 search_subencapsulation(struct data_string *result, struct packet *packet,
3202 subu->encapsulate(&sub, packet, lease, client_state,
3216 int hashed_option_space_encapsulate (result, packet, lease, client_state,
3219 struct packet *packet;
3245 if (store_option(result, universe, packet, lease,
3252 if (search_subencapsulation(result, packet, lease, client_state,
3259 int nwip_option_space_encapsulate (result, packet, lease, client_state,
3262 struct packet *packet;
3285 if (store_option (result, universe, packet,
3311 if (store_option (result, universe, packet, lease,
3384 int fqdn_option_space_encapsulate (result, packet, lease, client_state,
3387 struct packet *packet;
3419 packet, lease, client_state,
3536 fqdn6_option_space_foreach(struct packet *packet, struct lease *lease,
3543 struct packet *,
3559 struct packet *packet, struct lease *lease,
3586 (void) evaluate_option_cache(&results[oc->option->code], packet,
3670 * one-byte values we record from the packet. The input is
3756 void option_space_foreach (struct packet *packet, struct lease *lease,
3763 struct packet *,
3771 (*u -> foreach) (packet, lease, client_state, in_options,
3775 void suboption_foreach (struct packet *packet, struct lease *lease,
3782 struct packet *,
3794 (*universe -> foreach) (packet, lease, client_state,
3799 void hashed_option_space_foreach (struct packet *packet, struct lease *lease,
3806 struct packet *,
3829 (*func) (oc, packet, lease, client_state,
3880 int linked_option_space_encapsulate (result, packet, lease, client_state,
3883 struct packet *packet;
3903 if (store_option (result, universe, packet,
3909 if (search_subencapsulation(result, packet, lease, client_state,
3981 void linked_option_space_foreach (struct packet *packet, struct lease *lease,
3988 struct packet *,
4007 packet, lease, client_state,
4012 void do_packet (interface, packet, len, from_port, from, hfrom)
4014 struct dhcp_packet *packet;
4021 struct packet *decoded_packet;
4027 trace_inpacket_stash(interface, packet, len, from_port, from, hfrom);
4032 log_error("do_packet: no memory for incoming packet!");
4035 decoded_packet->raw = packet;
4042 if (packet->hlen > sizeof packet->chaddr) {
4044 log_info("Discarding packet with bogus hlen.");
4048 /* Allocate packet->options now so it is non-null for all packets */
4086 /* If the caller kept the packet, they'll have upped the refcnt. */
4102 packet6_len_okay(const char *packet, int len) {
4106 if ((packet[0] == DHCPV6_RELAY_FORW) ||
4107 (packet[0] == DHCPV6_RELAY_REPL)) {
4124 do_packet6(struct interface_info *interface, const char *packet,
4133 struct packet *decoded_packet;
4138 if (!packet6_len_okay(packet, len)) {
4140 "short packet from %s port %d, len %d, dropped",
4147 log_error("do_packet6: no memory for incoming packet.");
4164 decoded_packet->raw = (struct dhcp_packet *)packet;
4172 msg_type = packet[0];
4176 relay = (const struct dhcpv6_relay_packet *)packet;
4199 msg46 = (struct dhcpv4_over_dhcpv6_packet *)packet;
4218 msg = (const struct dhcpv6_packet *)packet;
4499 * Checks if received BOOTP/DHCPv4 packet is sane
4501 * @param packet received, decoded packet
4503 * @return 1 if packet is sane, 0 if it is not
4505 int validate_packet(struct packet *packet)
4509 oc = lookup_option (&dhcp_universe, packet->options,
4514 log_debug("Dropped DHCPv4 packet with zero-length client-id");
4524 log_debug("Accepted DHCPv4 packet with one-character client-id - "
4530 * but continue processing the packet as we can.
4532 if (packet->raw->hlen == 0) {
4533 log_debug("Received DHCPv4 packet without client-id"
4557 * \param packet - structure to hold information about the packet being
4565 * \param out_options - The options we have added as we process the packet.
4572 void parse_vendor_option(packet, lease, client_state, in_options,
4574 struct packet *packet;
4586 /* check if we are processing a packet, if not we can return */
4587 if ((packet == NULL) || (in_options == NULL) || (out_options == NULL))
4601 (void) evaluate_option_cache(&name, packet, lease, client_state,