Home | History | Annotate | Download | only in dhcpcd

Lines Matching refs:ip

43 #include <netinet/ip.h>
641 struct ip ip;
675 struct ip *ip;
679 ip = &udpp->ip;
684 * ip structure and an invalid ip_len (basically udp length).
687 * Finally we complete the ip structure and ip checksum.
693 ip->ip_p = IPPROTO_UDP;
694 ip->ip_src.s_addr = source.s_addr;
696 ip->ip_dst.s_addr = INADDR_BROADCAST;
698 ip->ip_dst.s_addr = dest.s_addr;
703 ip->ip_len = udp->uh_ulen;
706 ip->ip_v = IPVERSION;
707 ip->ip_hl = sizeof(*ip) >> 2;
708 ip->ip_id = arc4random() & UINT16_MAX;
709 ip->ip_ttl = IPDEFTTL;
710 ip->ip_len = htons(sizeof(*ip) + sizeof(*udp) + length);
711 ip->ip_sum = checksum(ip, sizeof(*ip));
714 return sizeof(*ip) + sizeof(*udp) + length;
724 return ntohs(packet.ip.ip_len) -
725 sizeof(packet.ip) -
735 if (data_len < sizeof(packet.ip)) {
743 from->s_addr = packet.ip.ip_src.s_addr;
748 if (checksum(&packet.ip, sizeof(packet.ip)) != 0) {
753 bytes = ntohs(packet.ip.ip_len);
760 packet.ip.ip_hl = 0;
761 packet.ip.ip_v = 0;
762 packet.ip.ip_tos = 0;
763 packet.ip.ip_len = packet.udp.uh_ulen;
764 packet.ip.ip_id = 0;
765 packet.ip.ip_off = 0;
766 packet.ip.ip_ttl = 0;
767 packet.ip.ip_sum = 0;