5 #include <tcpdump-stdinc.h>
9 typedef struct ipnet_hdr
{
15 uint32_t iph_grifindex
;
20 #define IPH_AF_INET 2 /* Matches Solaris's AF_INET */
21 #define IPH_AF_INET6 26 /* Matches Solaris's AF_INET6 */
25 static const struct tok ipnet_values
[] = {
26 { IPH_AF_INET
, "IPv4" },
27 { IPH_AF_INET6
, "IPv6" },
32 ipnet_hdr_print(netdissect_options
*ndo
, const u_char
*bp
, u_int length
)
34 const ipnet_hdr_t
*hdr
;
35 hdr
= (const ipnet_hdr_t
*)bp
;
37 ND_PRINT((ndo
, "%d > %d", hdr
->iph_zsrc
, hdr
->iph_zdst
));
39 if (!ndo
->ndo_qflag
) {
40 ND_PRINT((ndo
,", family %s (%d)",
41 tok2str(ipnet_values
, "Unknown",
47 "Unknown Ethertype (0x%04x)",
51 ND_PRINT((ndo
, ", length %u: ", length
));
55 ipnet_print(netdissect_options
*ndo
, const u_char
*p
, u_int length
, u_int caplen
)
57 const ipnet_hdr_t
*hdr
;
59 if (caplen
< sizeof(ipnet_hdr_t
)) {
60 ND_PRINT((ndo
, "[|ipnet]"));
65 ipnet_hdr_print(ndo
, p
, length
);
67 length
-= sizeof(ipnet_hdr_t
);
68 caplen
-= sizeof(ipnet_hdr_t
);
69 hdr
= (const ipnet_hdr_t
*)p
;
70 p
+= sizeof(ipnet_hdr_t
);
72 switch (hdr
->iph_family
) {
75 ip_print(ndo
, p
, length
);
79 ip6_print(ndo
, p
, length
);
84 ipnet_hdr_print(ndo
, (const u_char
*)hdr
,
85 length
+ sizeof(ipnet_hdr_t
));
87 if (!ndo
->ndo_suppress_default_print
)
88 ND_DEFAULTPRINT(p
, caplen
);
94 * This is the top level routine of the printer. 'p' points
95 * to the ether header of the packet, 'h->ts' is the timestamp,
96 * 'h->len' is the length of the packet off the wire, and 'h->caplen'
97 * is the number of bytes actually captured.
100 ipnet_if_print(netdissect_options
*ndo
,
101 const struct pcap_pkthdr
*h
, const u_char
*p
)
103 ipnet_print(ndo
, p
, h
->len
, h
->caplen
);
105 return (sizeof(ipnet_hdr_t
));
110 * c-style: whitesmith
115 #endif /* DLT_IPNET */