extern u_int usb_linux_64_byte_print(const struct pcap_pkthdr *, const u_char *);
#ifdef INET6
-extern void ip6_print(const u_char *, u_int);
extern void ip6_opt_print(const u_char *, int);
extern int hbhopt_print(const u_char *);
extern int dstopt_print(const u_char *);
extern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
extern u_int ieee802_15_4_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
-#if 0
#ifdef INET6
extern void ip6_print(netdissect_options *,const u_char *, u_int);
+#if 0
extern void ip6_opt_print(netdissect_options *,const u_char *, int);
extern int nextproto6_cksum(const struct ip6_hdr *, const u_short *, u_int, u_int);
extern int hbhopt_print(netdissect_options *,const u_char *);
extern void zephyr_print(netdissect_options * ndo,
const u_char *cp, int length);
+#endif /* 0 */
#endif /*INET6*/
+
+#if 0
extern u_short in_cksum(const u_short *,
register u_int, int);
-
#endif
extern void esp_print_decodesecret(netdissect_options *ndo);
#ifdef INET6
case ARCTYPE_INET6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
return (1);
#endif /*INET6*/
case ARCTYPE_ARP_OLD:
case ARCTYPE_ARP:
case ARCTYPE_REVARP:
- arp_print(gndo, p, length, caplen);
+ arp_print(gndo, p, length, caplen);
return (1);
case ARCTYPE_ATALK: /* XXX was this ever used? */
break;
#ifdef INET6
case ETHERTYPE_IPV6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case CHDLC_TYPE_SLARP:
break;
#ifdef INET6
case AF_INET6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif /*INET6*/
}
#ifdef INET6
case ETHERTYPE_IPV6:
- ip6_print(/*ndo,*/ p, length);
+ ip6_print(ndo, p, length);
return (1);
#endif /*INET6*/
#ifdef INET6
case NLPID_IP6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case NLPID_CLNP:
break;
#ifdef INET6
case ETHERTYPE_IPV6:
- ip6_print(bp, len);
+ ip6_print(gndo, bp, len);
break;
#endif
case ETHERTYPE_MPLS:
case IPPROTO_IPV4:
/* DVMRP multicast tunnel (ip-in-ip encapsulation) */
- ip_print(gndo, ipds->cp, ipds->len);
+ ip_print(ndo, ipds->cp, ipds->len);
if (! vflag) {
ND_PRINT((ndo, " (ipip-proto-4)"));
return;
#ifdef INET6
case IPPROTO_IPV6:
/* ip6-in-ip encapsulation */
- ip6_print(ipds->cp, ipds->len);
+ ip6_print(ndo, ipds->cp, ipds->len);
break;
#endif /*INET6*/
return;
#ifdef INET6
case 6:
- ip6_print (bp, length);
+ ip6_print (gndo, bp, length);
return;
#endif
default:
* print an IP6 datagram.
*/
void
-ip6_print(register const u_char *bp, register u_int length)
+ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
{
register const struct ip6_hdr *ip6;
register int advance;
TCHECK(*ip6);
if (length < sizeof (struct ip6_hdr)) {
- (void)printf("truncated-ip6 %u", length);
+ (void)ND_PRINT((ndo, "truncated-ip6 %u", length));
return;
}
- if (!eflag)
- printf("IP6 ");
+ if (!ndo->ndo_eflag)
+ ND_PRINT((ndo, "IP6 "));
payload_len = EXTRACT_16BITS(&ip6->ip6_plen);
len = payload_len + sizeof(struct ip6_hdr);
if (length < len)
- (void)printf("truncated-ip6 - %u bytes missing!",
- len - length);
+ (void)ND_PRINT((ndo, "truncated-ip6 - %u bytes missing!",
+ len - length));
- if (vflag) {
+ if (ndo->ndo_vflag) {
flow = EXTRACT_32BITS(&ip6->ip6_flow);
- printf("(");
+ ND_PRINT((ndo, "("));
#if 0
/* rfc1883 */
if (flow & 0x0f000000)
- (void)printf("pri 0x%02x, ", (flow & 0x0f000000) >> 24);
+ (void)ND_PRINT((ndo, "pri 0x%02x, ", (flow & 0x0f000000) >> 24));
if (flow & 0x00ffffff)
- (void)printf("flowlabel 0x%06x, ", flow & 0x00ffffff);
+ (void)ND_PRINT((ndo, "flowlabel 0x%06x, ", flow & 0x00ffffff));
#else
/* RFC 2460 */
if (flow & 0x0ff00000)
- (void)printf("class 0x%02x, ", (flow & 0x0ff00000) >> 20);
+ (void)ND_PRINT((ndo, "class 0x%02x, ", (flow & 0x0ff00000) >> 20));
if (flow & 0x000fffff)
- (void)printf("flowlabel 0x%05x, ", flow & 0x000fffff);
+ (void)ND_PRINT((ndo, "flowlabel 0x%05x, ", flow & 0x000fffff));
#endif
- (void)printf("hlim %u, next-header %s (%u) payload length: %u) ",
+ (void)ND_PRINT((ndo, "hlim %u, next-header %s (%u) payload length: %u) ",
ip6->ip6_hlim,
tok2str(ipproto_values,"unknown",ip6->ip6_nxt),
ip6->ip6_nxt,
- payload_len);
+ payload_len));
}
/*
* Cut off the snapshot length to the end of the IP payload.
*/
ipend = bp + len;
- if (ipend < snapend)
- snapend = ipend;
+ if (ipend < ndo->ndo_snapend)
+ ndo->ndo_snapend = ipend;
cp = (const u_char *)ip6;
advance = sizeof(struct ip6_hdr);
nh = ip6->ip6_nxt;
- while (cp < snapend && advance > 0) {
+ while (cp < ndo->ndo_snapend && advance > 0) {
cp += advance;
len -= advance;
if (cp == (const u_char *)(ip6 + 1) &&
nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
nh != IPPROTO_DCCP && nh != IPPROTO_SCTP) {
- (void)printf("%s > %s: ", ip6addr_string(&ip6->ip6_src),
- ip6addr_string(&ip6->ip6_dst));
+ (void)ND_PRINT((ndo, "%s > %s: ", ip6addr_string(&ip6->ip6_src),
+ ip6addr_string(&ip6->ip6_dst)));
}
switch (nh) {
break;
case IPPROTO_FRAGMENT:
advance = frag6_print(cp, (const u_char *)ip6);
- if (snapend <= cp + advance)
+ if (ndo->ndo_snapend <= cp + advance)
return;
nh = *cp;
fragmented = 1;
udp_print(cp, len, (const u_char *)ip6, fragmented);
return;
case IPPROTO_ICMPV6:
- icmp6_print(gndo, cp, len, (const u_char *)ip6, fragmented);
+ icmp6_print(ndo, cp, len, (const u_char *)ip6, fragmented);
return;
case IPPROTO_AH:
advance = ah_print(cp);
case IPPROTO_ESP:
{
int enh, padlen;
- advance = esp_print(gndo, cp, len, (const u_char *)ip6, &enh, &padlen);
+ advance = esp_print(ndo, cp, len, (const u_char *)ip6, &enh, &padlen);
nh = enh & 0xff;
len -= padlen;
break;
return;
case IPPROTO_IPV6:
- ip6_print(cp, len);
+ ip6_print(ndo, cp, len);
return;
case IPPROTO_IPV4:
- ip_print(gndo, cp, len);
+ ip_print(ndo, cp, len);
return;
case IPPROTO_PGM:
return;
case IPPROTO_NONE:
- (void)printf("no next header");
+ (void)ND_PRINT((ndo, "no next header"));
return;
default:
- (void)printf("ip-proto-%d %d", nh, len);
+ (void)ND_PRINT((ndo, "ip-proto-%d %d", nh, len));
return;
}
}
return;
trunc:
- (void)printf("[|ip6]");
+ (void)ND_PRINT((ndo, "[|ip6]"));
}
#endif /* INET6 */
#ifdef INET6
case IPH_AF_INET6:
- ip6_print(p, length);
+ ip6_print(ndo, p, length);
break;
#endif /*INET6*/
#ifdef INET6
case NLPID_IP6:
- ip6_print(p+1, length-1);
+ ip6_print(gndo, p+1, length-1);
break;
#endif
break;
#ifdef INET6
case JUNIPER_PROTO_IPV6:
- ip6_print(p, l2info.length);
+ ip6_print(gndo, p, l2info.length);
break;
#endif /* INET6 */
default:
return l2info.header_len;
#ifdef INET6
case JUNIPER_LSQ_L3_PROTO_IPV6:
- ip6_print(p,l2info.length);
+ ip6_print(gndo, p,l2info.length);
return l2info.header_len;
#endif
case JUNIPER_LSQ_L3_PROTO_MPLS:
return l2info.header_len;
#ifdef INET6
case JUNIPER_LSQ_L3_PROTO_IPV6:
- ip6_print(p,l2info.length);
+ ip6_print(gndo, p,l2info.length);
return l2info.header_len;
#endif
case JUNIPER_LSQ_L3_PROTO_MPLS:
case 0x6d:
case 0x6e:
case 0x6f:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
default:
case PT_IPV6:
#ifdef INET6
- ip6_print(p, length - (p - bp));
+ ip6_print(gndo, p, length - (p - bp));
#else
printf("IPv6, length: %u", length);
#endif
case BSD_AFNUM_INET6_BSD:
case BSD_AFNUM_INET6_FREEBSD:
case BSD_AFNUM_INET6_DARWIN:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
break;
#ifdef INET6
case 6: /* IPv6 */
- ip6_print(bp, len);
+ ip6_print(gndo, bp, len);
break;
#endif
default:
goto cleanup;
#ifdef INET6
case PPP_IPV6:
- ip6_print(b+1, t - b - 1);
- goto cleanup;
+ ip6_print(gndo, b+1, t - b - 1);
+ goto cleanup;
#endif
default: /* no luck - try next guess */
- break;
+ break;
}
proto = EXTRACT_16BITS(b); /* next guess - load two octets */
#ifdef INET6
case ETHERTYPE_IPV6: /*XXX*/
case PPP_IPV6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case ETHERTYPE_IPX: /*XXX*/
p += hdrlength;
switch (ptype) {
case PPP_IP:
- ip_print(p, length);
+ ip_print(gndo, p, length);
break;
#ifdef INET6
case PPP_IPV6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case PPP_MPLS_UCAST:
p += hdrlength;
switch (ptype) {
case PPP_IP:
- ip_print(p, length);
+ ip_print(gndo, p, length);
break;
#ifdef INET6
case PPP_IPV6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case PPP_MPLS_UCAST:
break;
#ifdef INET6
case PPP_IPV6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case PPP_MPLS_UCAST:
case PPP_MPLS_MCAST:
- mpls_print(p, length);
+ mpls_print(gndo, p, length);
break;
default:
printf("%s ", tok2str(ppptype2str, "unknown PPP protocol (0x%04x)", ptype));
break;
#ifdef INET6
case 6:
- ip6_print((u_char *)ip, length);
+ ip6_print(gndo, (u_char *)ip, length);
break;
#endif
default: