Lines Matching defs:ip
45 #include "ip.h"
62 static int tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
114 static int tcp_cksum(register const struct ip *ip,
134 memcpy(&phu.ph.src, &ip->ip_src.s_addr, sizeof(u_int32_t));
135 if (IP_HL(ip) == 5)
136 memcpy(&phu.ph.dst, &ip->ip_dst.s_addr, sizeof(u_int32_t));
138 phu.ph.dst = ip_finddst(ip);
195 register const struct ip *ip;
207 ip = (struct ip *)bp2;
209 if (IP_V(ip) == 6)
217 ipaddr_string(&ip->ip_src),
218 ipaddr_string(&ip->ip_dst));
237 (u_char *)ip);
243 (u_char *)ip);
262 if (ip->ip_p == IPPROTO_TCP) {
264 ipaddr_string(&ip->ip_src),
266 ipaddr_string(&ip->ip_dst),
345 src = &ip->ip_src;
346 dst = &ip->ip_dst;
350 if (memcmp(src, dst, sizeof ip->ip_dst) > 0)
354 memcpy(&tha.src, dst, sizeof ip->ip_dst);
355 memcpy(&tha.dst, src, sizeof ip->ip_src);
358 memcpy(&tha.dst, dst, sizeof ip->ip_dst);
359 memcpy(&tha.src, src, sizeof ip->ip_src);
365 src = &ip->ip_src;
366 dst = &ip->ip_dst;
370 if (memcmp(src, dst, sizeof ip->ip_dst) > 0)
374 memcpy(&tha.src, dst, sizeof ip->ip_dst);
375 memcpy(&tha.dst, src, sizeof ip->ip_src);
378 memcpy(&tha.dst, dst, sizeof ip->ip_dst);
379 memcpy(&tha.src, src, sizeof ip->ip_src);
423 if (IP_V(ip) == 4 && vflag && !fragmented) {
426 sum = tcp_cksum(ip, tp, length);
437 if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !fragmented) {
596 switch (tcp_verify_signature(ip, tp,
735 tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
756 * Step 1: Update MD5 hash with IP pseudo-header.
758 if (IP_V(ip) == 4) {
759 MD5_Update(&ctx, (char *)&ip->ip_src, sizeof(ip->ip_src));
760 MD5_Update(&ctx, (char *)&ip->ip_dst, sizeof(ip->ip_dst));
762 MD5_Update(&ctx, (char *)&ip->ip_p, sizeof(ip->ip_p));
763 tlen = EXTRACT_16BITS(&ip->ip_len) - IP_HL(ip) * 4;
767 } else if (IP_V(ip) == 6) {
768 ip6 = (struct ip6_hdr *)ip;