- if ((off & 0x1fff) == 0) {
- cp = (const u_char *)ip + hlen;
- nh = ip->ip_p;
-
- if (nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
- nh != IPPROTO_SCTP) {
- (void)printf("%s > %s: ", ipaddr_string(&ip->ip_src),
- ipaddr_string(&ip->ip_dst));
- }
-again:
- switch (nh) {
-
- case IPPROTO_AH:
- nh = *cp;
- advance = ah_print(cp);
- if (advance <= 0)
- break;
- cp += advance;
- len -= advance;
- goto again;
-
- case IPPROTO_ESP:
- {
- int enh, padlen;
- advance = esp_print(gndo, cp, (const u_char *)ip, &enh, &padlen);
- if (advance <= 0)
- break;
- cp += advance;
- len -= advance + padlen;
- nh = enh & 0xff;
- goto again;
- }
-
- case IPPROTO_IPCOMP:
- {
- int enh;
- advance = ipcomp_print(cp, &enh);
- if (advance <= 0)
- break;
- cp += advance;
- len -= advance;
- nh = enh & 0xff;
- goto again;
- }
-
- case IPPROTO_SCTP:
- sctp_print(cp, (const u_char *)ip, len);
- break;
-
- case IPPROTO_TCP:
- tcp_print(cp, len, (const u_char *)ip, (off &~ 0x6000));
- break;
-
- case IPPROTO_UDP:
- udp_print(cp, len, (const u_char *)ip, (off &~ 0x6000));
- break;
-
- case IPPROTO_ICMP:
- /* pass on the MF bit plus the offset to detect fragments */
- icmp_print(cp, len, (const u_char *)ip, (off & 0x3fff));
- break;
-
- case IPPROTO_PIGP:
- /*
- * XXX - the current IANA protocol number assignments
- * page lists 9 as "any private interior gateway
- * (used by Cisco for their IGRP)" and 88 as
- * "EIGRP" from Cisco.
- *
- * Recent BSD <netinet/in.h> headers define
- * IP_PROTO_PIGP as 9 and IP_PROTO_IGRP as 88.
- * We define IP_PROTO_PIGP as 9 and
- * IP_PROTO_EIGRP as 88; those names better
- * match was the current protocol number
- * assignments say.
- */
- igrp_print(cp, len, (const u_char *)ip);
- break;
-
- case IPPROTO_EIGRP:
- eigrp_print(cp, len);
- break;
-
- case IPPROTO_ND:
- (void)printf(" nd %d", len);
- break;
-
- case IPPROTO_EGP:
- egp_print(cp);
- break;
-
- case IPPROTO_OSPF:
- ospf_print(cp, len, (const u_char *)ip);
- break;
-
- case IPPROTO_IGMP:
- igmp_print(cp, len);
- break;
-
- case IPPROTO_IPV4:
- /* DVMRP multicast tunnel (ip-in-ip encapsulation) */
- ip_print(cp, len);
- if (! vflag) {
- printf(" (ipip-proto-4)");
- return;
- }
- break;
-
-#ifdef INET6
- case IPPROTO_IPV6:
- /* ip6-in-ip encapsulation */
- ip6_print(cp, len);
- break;
-#endif /*INET6*/
-
- case IPPROTO_RSVP:
- rsvp_print(cp, len);
- break;
-
- case IPPROTO_GRE:
- /* do it */
- gre_print(cp, len);
- break;
-
- case IPPROTO_MOBILE:
- mobile_print(cp, len);
- break;
-
- case IPPROTO_PIM:
- pim_print(cp, len);
- break;
-
- case IPPROTO_VRRP:
- vrrp_print(cp, len, ip->ip_ttl);
- break;
-
- default:
- if ((proto = getprotobynumber(nh)) != NULL)
- (void)printf(" %s", proto->p_name);
- else
- (void)printf(" ip-proto-%d", nh);
- printf(" %d", len);
- break;
+ if ((ipds->off & 0x1fff) == 0) {
+ ipds->cp = (const u_char *)ipds->ip + hlen;
+ ipds->nh = ipds->ip->ip_p;
+
+ if (ipds->nh != IPPROTO_TCP && ipds->nh != IPPROTO_UDP &&
+ ipds->nh != IPPROTO_SCTP && ipds->nh != IPPROTO_DCCP) {
+ (void)printf("%s > %s: ",
+ ipaddr_string(&ipds->ip->ip_src),
+ ipaddr_string(&ipds->ip->ip_dst));