Lines Matching refs:icmph

18 DumpICMPPacket(struct icmphdr *icmph, uint32_t saddr, uint32_t daddr);
35 ICMPChecksum(uint16_t *icmph, int len) in ICMPChecksum() argument
44 sum += *icmph++; in ICMPChecksum()
49 *(uint8_t*)(&odd_byte) = * (uint8_t*)icmph; in ICMPChecksum()
68 struct icmphdr *icmph; in ICMPOutput() local
118 icmph = (struct icmphdr *) IP_NEXT_PTR(iph); in ICMPOutput()
121 icmph->icmp_type = icmp_type; in ICMPOutput()
122 icmph->icmp_code = icmp_code; in ICMPOutput()
123 icmph->icmp_checksum = 0; in ICMPOutput()
124 ICMP_ECHO_SET_ID(icmph, htons(icmp_id)); in ICMPOutput()
125 ICMP_ECHO_SET_SEQ(icmph, htons(icmp_seq)); in ICMPOutput()
129 memcpy((void *) (icmph + 1), icmpd, len); in ICMPOutput()
132 icmph->icmp_checksum = in ICMPOutput()
133 ICMPChecksum((uint16_t *)icmph, sizeof(struct icmphdr) + len); in ICMPOutput()
136 DumpICMPPacket(icmph, saddr, daddr); in ICMPOutput()
152 ProcessICMPECHORequest(mtcp_manager_t mtcp, struct pkt_ctx *pctx, struct icmphdr *icmph) in ProcessICMPECHORequest() argument
157 if (ICMPChecksum((uint16_t *) icmph, pctx->p.ip_len - (pctx->p.iph->ihl << 2) )) in ProcessICMPECHORequest()
161 … ntohs(ICMP_ECHO_GET_ID(icmph)), ntohs(ICMP_ECHO_GET_SEQ(icmph)), (uint8_t *) (icmph + 1), in ProcessICMPECHORequest()
168 ProcessICMPECHOReply(mtcp_manager_t mtcp, struct pkt_ctx *pctx, struct icmphdr *icmph) in ProcessICMPECHOReply() argument
178 type = icmph->icmp_type; in ProcessICMPECHOReply()
179 code = icmph->icmp_code; in ProcessICMPECHOReply()
180 seq = ntohs(ICMP_ECHO_GET_SEQ(icmph)); in ProcessICMPECHOReply()
181 id = ntohs(ICMP_ECHO_GET_ID(icmph)); in ProcessICMPECHOReply()
189 struct icmphdr *icmph = (struct icmphdr *) IP_NEXT_PTR(pctx->p.iph); in ProcessICMPPacket() local
203 switch (icmph->icmp_type) in ProcessICMPPacket()
206 ProcessICMPECHORequest(mtcp, pctx, icmph); in ProcessICMPPacket()
210 ProcessICMPECHOReply(mtcp, pctx, icmph); in ProcessICMPPacket()
223 icmph->icmp_type); in ProcessICMPPacket()
231 DumpICMPPacket(struct icmphdr *icmph, uint32_t saddr, uint32_t daddr) in DumpICMPPacket() argument
238 icmph->icmp_type, icmph->icmp_code, in DumpICMPPacket()
239 ICMP_ECHO_GET_ID(icmph), ICMP_ECHO_GET_SEQ(icmph)); in DumpICMPPacket()