+ nh = ip->ip_p;
+
+#ifndef IPPROTO_SCTP
+#define IPPROTO_SCTP 132
+#endif
+ 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) {
+
+#ifndef IPPROTO_AH
+#define IPPROTO_AH 51
+#endif
+ case IPPROTO_AH:
+ nh = *cp;
+ advance = ah_print(cp, (const u_char *)ip);
+ cp += advance;
+ len -= advance;
+ goto again;
+
+#ifndef IPPROTO_ESP
+#define IPPROTO_ESP 50
+#endif
+ case IPPROTO_ESP:
+ {
+ int enh, padlen;
+ advance = esp_print(cp, (const u_char *)ip, &enh, &padlen);
+ cp += advance;
+ len -= advance + padlen;
+ if (enh < 0)
+ break;
+ nh = enh & 0xff;
+ goto again;
+ }
+
+#ifndef IPPROTO_IPCOMP
+#define IPPROTO_IPCOMP 108
+#endif
+ case IPPROTO_IPCOMP:
+ {
+ int enh;
+ advance = ipcomp_print(cp, (const u_char *)ip, &enh);
+ cp += advance;
+ len -= advance;
+ if (enh < 0)
+ break;
+ 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:
+ icmp_print(cp, len, (const u_char *)ip);
+ break;
+
+#ifndef IPPROTO_IGRP
+#define IPPROTO_IGRP 9
+#endif
+ case IPPROTO_IGRP:
+ igrp_print(cp, len, (const u_char *)ip);
+ break;
+
+ case IPPROTO_ND:
+ (void)printf(" nd %d", len);
+ break;
+
+ case IPPROTO_EGP:
+ egp_print(cp, len, (const u_char *)ip);
+ break;
+
+#ifndef IPPROTO_OSPF
+#define IPPROTO_OSPF 89
+#endif
+ case IPPROTO_OSPF:
+ ospf_print(cp, len, (const u_char *)ip);
+ break;
+
+#ifndef IPPROTO_IGMP
+#define IPPROTO_IGMP 2
+#endif
+ case IPPROTO_IGMP:
+ igmp_print(cp, len);
+ break;
+
+ case 4:
+ /* DVMRP multicast tunnel (ip-in-ip encapsulation) */
+ ip_print(cp, len);
+ if (! vflag) {
+ printf(" (ipip-proto-4)");
+ return;
+ }
+ break;
+
+#ifdef INET6
+#ifndef IP6PROTO_ENCAP
+#define IP6PROTO_ENCAP 41
+#endif
+ case IP6PROTO_ENCAP:
+ /* ip6-in-ip encapsulation */
+ ip6_print(cp, len);
+ break;
+#endif /*INET6*/
+
+
+#ifndef IPPROTO_GRE
+#define IPPROTO_GRE 47
+#endif
+ case IPPROTO_GRE:
+ /* do it */
+ gre_print(cp, len);
+ break;
+
+#ifndef IPPROTO_MOBILE
+#define IPPROTO_MOBILE 55
+#endif
+ case IPPROTO_MOBILE:
+ mobile_print(cp, len);
+ break;
+
+#ifndef IPPROTO_PIM
+#define IPPROTO_PIM 103
+#endif
+ case IPPROTO_PIM:
+ pim_print(cp, len);
+ break;
+
+#ifndef IPPROTO_VRRP
+#define IPPROTO_VRRP 112
+#endif
+ 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;
+ }