Lines Matching refs:iph
67 struct iphdr *iph; in DumpPacket() local
99 iph = (struct iphdr *)(ethh + 1); in DumpPacket()
100 udph = (struct udphdr *)((uint32_t *)iph + iph->ihl); in DumpPacket()
101 tcph = (struct tcphdr *)((uint32_t *)iph + iph->ihl); in DumpPacket()
103 t = (uint8_t *)&iph->saddr; in DumpPacket()
105 if (iph->protocol == IPPROTO_TCP || iph->protocol == IPPROTO_UDP) in DumpPacket()
110 t = (uint8_t *)&iph->daddr; in DumpPacket()
112 if (iph->protocol == IPPROTO_TCP || iph->protocol == IPPROTO_UDP) in DumpPacket()
115 thread_printf(mtcp, mtcp->log_fp, " IP_ID=%d", ntohs(iph->id)); in DumpPacket()
116 thread_printf(mtcp, mtcp->log_fp, " TTL=%d ", iph->ttl); in DumpPacket()
118 if (ip_fast_csum(iph, iph->ihl)) { in DumpPacket()
121 org_csum = iph->check; in DumpPacket()
122 iph->check = 0; in DumpPacket()
123 correct_csum = ip_fast_csum(iph, iph->ihl); in DumpPacket()
126 iph->check = org_csum; in DumpPacket()
129 switch (iph->protocol) { in DumpPacket()
151 thread_printf(mtcp, mtcp->log_fp, "protocol %d ", iph->protocol); in DumpPacket()
159 DumpIPPacket(mtcp_manager_t mtcp, const struct iphdr *iph, int len) in DumpIPPacket() argument
165 udph = (struct udphdr *)((uint32_t *)iph + iph->ihl); in DumpIPPacket()
166 tcph = (struct tcphdr *)((uint32_t *)iph + iph->ihl); in DumpIPPacket()
168 t = (uint8_t *)&iph->saddr; in DumpIPPacket()
170 if (iph->protocol == IPPROTO_TCP || iph->protocol == IPPROTO_UDP) in DumpIPPacket()
175 t = (uint8_t *)&iph->daddr; in DumpIPPacket()
177 if (iph->protocol == IPPROTO_TCP || iph->protocol == IPPROTO_UDP) in DumpIPPacket()
180 thread_printf(mtcp, mtcp->log_fp, " IP_ID=%d", ntohs(iph->id)); in DumpIPPacket()
181 thread_printf(mtcp, mtcp->log_fp, " TTL=%d ", iph->ttl); in DumpIPPacket()
183 if (ip_fast_csum(iph, iph->ihl)) { in DumpIPPacket()
187 switch (iph->protocol) { in DumpIPPacket()
209 thread_printf(mtcp, mtcp->log_fp, "protocol %d ", iph->protocol); in DumpIPPacket()
217 DumpIPPacketToFile(FILE *fout, const struct iphdr *iph, int len) in DumpIPPacketToFile() argument
223 udph = (struct udphdr *)((uint32_t *)iph + iph->ihl); in DumpIPPacketToFile()
224 tcph = (struct tcphdr *)((uint32_t *)iph + iph->ihl); in DumpIPPacketToFile()
226 t = (uint8_t *)&iph->saddr; in DumpIPPacketToFile()
228 if (iph->protocol == IPPROTO_TCP || iph->protocol == IPPROTO_UDP) in DumpIPPacketToFile()
233 t = (uint8_t *)&iph->daddr; in DumpIPPacketToFile()
235 if (iph->protocol == IPPROTO_TCP || iph->protocol == IPPROTO_UDP) in DumpIPPacketToFile()
238 fprintf(fout, " IP_ID=%d", ntohs(iph->id)); in DumpIPPacketToFile()
239 fprintf(fout, " TTL=%d ", iph->ttl); in DumpIPPacketToFile()
241 if (ip_fast_csum(iph, iph->ihl)) { in DumpIPPacketToFile()
245 switch (iph->protocol) { in DumpIPPacketToFile()
267 fprintf(fout, "protocol %d ", iph->protocol); in DumpIPPacketToFile()