printer.
Merge commit 'origin/master'
Conflicts:
netdissect.h
extern void pptp_print(netdissect_options *,const u_char *, u_int);
#endif
+extern u_int ipnet_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);
* is the number of bytes actually captured.
*/
u_int
-ipnet_if_print(const struct pcap_pkthdr *h, const u_char *p)
+ipnet_if_print(struct netdissect_options *ndo,
+ const struct pcap_pkthdr *h, const u_char *p)
{
- ipnet_print(gndo, p, h->len, h->caplen);
+ ipnet_print(ndo, p, h->len, h->caplen);
return (sizeof(ipnet_hdr_t));
}
static u_int packets_captured;
typedef u_int (*if_printer)(const struct pcap_pkthdr *, const u_char *);
+typedef u_int (*if_ndo_printer)(struct netdissect_options *ndo,
+ const struct pcap_pkthdr *, const u_char *);
struct printer {
- if_printer f;
+ if_printer f;
int type;
};
+
+struct ndo_printer {
+ if_ndo_printer f;
+ int type;
+};
+
+
static struct printer printers[] = {
{ arcnet_if_print, DLT_ARCNET },
#ifdef DLT_ARCNET_LINUX
#if defined(HAVE_PCAP_USB_H) && defined(DLT_USB_LINUX_MMAPPED)
{ usb_linux_print, DLT_USB_LINUX_MMAPPED},
#endif
+ { NULL, 0 },
+};
+
+static struct ndo_printer ndo_printers[] = {
#ifdef DLT_IPNET
{ ipnet_if_print, DLT_IPNET },
#endif
/* NOTREACHED */
}
+static if_ndo_printer
+lookup_ndo_printer(int type)
+{
+ struct ndo_printer *p;
+
+ for (p = ndo_printers; p->f; ++p)
+ if (type == p->type)
+ return p->f;
+
+ return NULL;
+ /* NOTREACHED */
+}
+
static pcap_t *pd;
static int supports_monitor_mode;
extern char *optarg;
struct print_info {
- if_printer printer;
+ netdissect_options *ndo;
+ union {
+ if_printer printer;
+ if_ndo_printer ndo_printer;
+ } p;
+ int ndo_type;
};
struct dump_info {
/*
* OK, does tcpdump handle that type?
*/
- if (lookup_printer(dlts[n_dlts]) == NULL)
+ if (lookup_printer(dlts[n_dlts]) == NULL
+ && lookup_ndo_printer(dlts[n_dlts]) == NULL)
(void) fprintf(stderr, " (printing not supported)");
putchar('\n');
} else {
}
} else {
type = pcap_datalink(pd);
- printinfo.printer = lookup_printer(type);
- if (printinfo.printer == NULL) {
- gndo->ndo_dltname = pcap_datalink_val_to_name(type);
- if (gndo->ndo_dltname != NULL)
- error("packet printing is not supported for link type %s: use -w",
- gndo->ndo_dltname);
- else
- error("packet printing is not supported for link type %d: use -w", type);
- }
+ printinfo.ndo_type = 1;
+ printinfo.ndo = gndo;
+ printinfo.p.ndo_printer = lookup_ndo_printer(type);
+ if (printinfo.p.ndo_printer == NULL) {
+ printinfo.p.printer = lookup_printer(type);
+ printinfo.ndo_type = 0;
+ if (printinfo.p.printer == NULL) {
+ gndo->ndo_dltname = pcap_datalink_val_to_name(type);
+ if (gndo->ndo_dltname != NULL)
+ error("packet printing is not supported for link type %s: use -w",
+ gndo->ndo_dltname);
+ else
+ error("packet printing is not supported for link type %d: use -w", type);
+ }
+ }
callback = print_packet;
pcap_userdata = (u_char *)&printinfo;
}
*/
snapend = sp + h->caplen;
- hdrlen = (*print_info->printer)(h, sp);
+ if(print_info->ndo_type) {
+ hdrlen = (*print_info->p.ndo_printer)(print_info->ndo, h, sp);
+ } else {
+ hdrlen = (*print_info->p.printer)(h, sp);
+ }
+
if (Xflag) {
/*
* Print the raw packet data in hex and ASCII.
# IETF ROLL RPL packets
dio01 dio.pcap dio.out -t -v
+
+# IPNET encapsulated site
+e1000g e1000g.pcap e1000g.out -t
+
print " ";
exec("../tcpdump -n -r $input $options | tee NEW/$output | diff -w - $output >DIFF/$output.diff");
+@cores = glob("core*");
+exit 10 if (@cores > 0);
+exit 0;
--- /dev/null
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 0, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 0, length 64
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 1, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 1, length 64
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 2, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 2, length 64
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 3, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 3, length 64
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 4, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 4, length 64
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 5, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 5, length 64
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 6, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 6, length 64
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 7, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 7, length 64
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 8, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 8, length 64
+IP 129.146.106.55 > 10.5.233.117: ICMP echo request, id 6901, seq 9, length 64
+IP 10.5.233.117 > 129.146.106.55: ICMP echo reply, id 6901, seq 9, length 64