Lines Matching refs:ip
714 } ip;
746 if (sizeof(p.ip.hdr) != SWRAP_PACKET__IP_HDR_SIZE) {
749 if (sizeof(p.ip.p.tcp) != SWRAP_PACKET__IP_P_TCP_SIZE) {
752 if (sizeof(p.ip.p.udp) != SWRAP_PACKET__IP_P_UDP_SIZE) {
755 if (sizeof(p.ip.p.icmp) != SWRAP_PACKET__IP_P_ICMP_SIZE) {
797 wire_hdr_len = sizeof(packet->ip.hdr) + sizeof(packet->ip.p.tcp);
803 wire_hdr_len = sizeof(packet->ip.hdr) + sizeof(packet->ip.p.udp);
814 icmp_hdr_len = sizeof(packet->ip.hdr) + sizeof(packet->ip.p.icmp);
834 packet->ip.hdr.ver_hdrlen = 0x45; /* version 4 and 5 * 32 bit words */
835 packet->ip.hdr.tos = 0x00;
836 packet->ip.hdr.packet_length = htons(wire_len - icmp_truncate_len);
837 packet->ip.hdr.identification = htons(0xFFFF);
838 packet->ip.hdr.flags = 0x40; /* BIT 1 set - means don't fraqment */
839 packet->ip.hdr.fragment = htons(0x0000);
840 packet->ip.hdr.ttl = 0xFF;
841 packet->ip.hdr.protocol = protocol;
842 packet->ip.hdr.hdr_checksum = htons(0x0000);
843 packet->ip.hdr.src_addr = src_addr->sin_addr.s_addr;
844 packet->ip.hdr.dest_addr = dest_addr->sin_addr.s_addr;
847 packet->ip.p.icmp.type = 0x03; /* destination unreachable */
848 packet->ip.p.icmp.code = 0x01; /* host unreachable */
849 packet->ip.p.icmp.checksum = htons(0x0000);
850 packet->ip.p.icmp.unused = htonl(0x00000000);
852 /* set the ip header in the ICMP payload */
854 packet->ip.hdr.ver_hdrlen = 0x45; /* version 4 and 5 * 32 bit words */
855 packet->ip.hdr.tos = 0x00;
856 packet->ip.hdr.packet_length = htons(wire_len - icmp_hdr_len);
857 packet->ip.hdr.identification = htons(0xFFFF);
858 packet->ip.hdr.flags = 0x40; /* BIT 1 set - means don't fraqment */
859 packet->ip.hdr.fragment = htons(0x0000);
860 packet->ip.hdr.ttl = 0xFF;
861 packet->ip.hdr.protocol = icmp_protocol;
862 packet->ip.hdr.hdr_checksum = htons(0x0000);
863 packet->ip.hdr.src_addr = dest_addr->sin_addr.s_addr;
864 packet->ip.hdr.dest_addr = src_addr->sin_addr.s_addr;
872 packet->ip.p.tcp.source_port = src_port;
873 packet->ip.p.tcp.dest_port = dest_port;
874 packet->ip.p.tcp.seq_num = htonl(tcp_seq);
875 packet->ip.p.tcp.ack_num = htonl(tcp_ack);
876 packet->ip.p.tcp.hdr_length = 0x50; /* 5 * 32 bit words */
877 packet->ip.p.tcp.control = tcp_ctl;
878 packet->ip.p.tcp.window = htons(0x7FFF);
879 packet->ip.p.tcp.checksum = htons(0x0000);
880 packet->ip.p.tcp.urg = htons(0x0000);
885 packet->ip.p.udp.source_port = src_addr->sin_port;
886 packet->ip.p.udp.dest_port = dest_addr->sin_port;
887 packet->ip.p.udp.length = htons(8 + payload_len);
888 packet->ip.p.udp.checksum = htons(0x0000);