Lines Matching defs:ip
24 "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149.2.9 2007/09/14 01:30:02 guy Exp $ (LBL)";
41 #include "ip.h"
58 * print the recorded route in an IP RR, LSRR or SSRR option.
85 * Otherwise, return IP destination.
91 ip_finddst(const struct ip *ip)
98 cp = (const u_char *)(ip + 1);
99 length = (IP_HL(ip) << 2) - sizeof(struct ip);
128 memcpy(&retval, &ip->ip_dst.s_addr, sizeof(u_int32_t));
195 * print IP options.
268 printf("[|ip]");
272 * compute an IP header checksum.
367 const struct ip *ip;
396 (const u_char *)ipds->ip,
419 sctp_print(ipds->cp, (const u_char *)ipds->ip, ipds->len);
423 dccp_print(ipds->cp, (const u_char *)ipds->ip, ipds->len);
428 tcp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
434 udp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
440 icmp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
458 igrp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip);
474 ospf_print(ipds->cp, ipds->len, (const u_char *)ipds->ip);
482 /* DVMRP multicast tunnel (ip-in-ip encapsulation) */
492 /* ip6-in-ip encapsulation */
515 vrrp_print(ipds->cp, ipds->len, ipds->ip->ip_ttl);
519 pgm_print(ipds->cp, ipds->len, (const u_char *)ipds->ip);
526 ND_PRINT((ndo, " ip-proto-%d", ipds->nh));
540 ipd.ip = (const struct ip *)bp2;
552 * print an IP datagram.
566 ipds->ip = (const struct ip *)bp;
567 if (IP_V(ipds->ip) != 4) { /* print version if != 4 */
568 printf("IP%u ", IP_V(ipds->ip));
569 if (IP_V(ipds->ip) == 6)
573 printf("IP ");
575 if ((u_char *)(ipds->ip + 1) > snapend) {
576 printf("[|ip]");
579 if (length < sizeof (struct ip)) {
580 (void)printf("truncated-ip %u", length);
583 hlen = IP_HL(ipds->ip) * 4;
584 if (hlen < sizeof (struct ip)) {
589 ipds->len = EXTRACT_16BITS(&ipds->ip->ip_len);
591 (void)printf("truncated-ip - %u bytes missing! ",
610 * Cut off the snapshot length to the end of the IP payload.
618 ipds->off = EXTRACT_16BITS(&ipds->ip->ip_off);
621 (void)printf("(tos 0x%x", (int)ipds->ip->ip_tos);
623 if (ipds->ip->ip_tos & 0x03) {
624 switch (ipds->ip->ip_tos & 0x03) {
636 if (ipds->ip->ip_ttl >= 1)
637 (void)printf(", ttl %u", ipds->ip->ip_ttl);
646 EXTRACT_16BITS(&ipds->ip->ip_id),
649 tok2str(ipproto_values,"unknown",ipds->ip->ip_p),
650 ipds->ip->ip_p);
652 (void)printf(", length %u", EXTRACT_16BITS(&ipds->ip->ip_len));
654 if ((hlen - sizeof(struct ip)) > 0) {
656 ip_optprint((u_char *)(ipds->ip + 1), hlen - sizeof(struct ip));
660 if ((u_char *)ipds->ip + hlen <= snapend) {
661 ip, hlen, 0);
663 ip_sum = EXTRACT_16BITS(&ipds->ip->ip_sum);
677 ipds->cp = (const u_char *)ipds->ip + hlen;
678 ipds->nh = ipds->ip->ip_p;
683 ipaddr_string(&ipds->ip->ip_src),
684 ipaddr_string(&ipds->ip->ip_dst));
693 * next level protocol header. print the ip addr
697 (void)printf("%s > %s:", ipaddr_string(&ipds->ip->ip_src),
698 ipaddr_string(&ipds->ip->ip_dst));
699 if ((proto = getprotobynumber(ipds->ip->ip_p)) != NULL)
702 (void)printf(" ip-proto-%d", ipds->ip->ip_p);
710 struct ip *ip, hdr;
712 ip = (struct ip *)bp;
714 (void)printf("truncated-ip %d", length);
717 memcpy (&hdr, (char *)ip, 4);
728 (void)printf("unknown ip %d", IP_V(&hdr));