Lines Matching refs:iph
169 struct iphdr iph; member
659 if (bytes < (int) (sizeof(packet.iph) + sizeof(packet.udph))) { in read_raw()
663 if (bytes < ntohs(packet.iph.tot_len)) { in read_raw()
668 bytes = ntohs(packet.iph.tot_len); in read_raw()
670 if (packet.iph.protocol != IPPROTO_UDP || packet.iph.version != IPVERSION in read_raw()
671 || packet.iph.ihl != (sizeof(packet.iph) >> 2) in read_raw()
673 || ntohs(packet.udph.len) != (uint16_t)(bytes - sizeof(packet.iph))) { in read_raw()
678 check = packet.iph.check; in read_raw()
679 packet.iph.check = 0; in read_raw()
680 if (check != dhcp_checksum(&packet.iph, sizeof(packet.iph))) { in read_raw()
684 memset(&packet.iph, 0, ((size_t) &((struct iphdr *)0)->protocol)); in read_raw()
685 packet.iph.tot_len = packet.udph.len; in read_raw()
692 memcpy(&state->pdhcp, &packet.dhcp, bytes - (sizeof(packet.iph) + sizeof(packet.udph))); in read_raw()
697 return bytes - sizeof(packet.iph) - sizeof(packet.udph); in read_raw()
744 packet.iph.protocol = IPPROTO_UDP; in send_raw()
745 packet.iph.saddr = INADDR_ANY; in send_raw()
746 packet.iph.daddr = INADDR_BROADCAST; in send_raw()
750 packet.iph.tot_len = packet.udph.len; in send_raw()
752 packet.iph.tot_len = htons(sizeof(dhcp_raw_t) - padding); in send_raw()
753 packet.iph.ihl = sizeof(packet.iph) >> 2; in send_raw()
754 packet.iph.version = IPVERSION; in send_raw()
755 packet.iph.ttl = IPDEFTTL; in send_raw()
756 packet.iph.check = dhcp_checksum(&packet.iph, sizeof(packet.iph)); in send_raw()