summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface.h1
-rw-r--r--netdissect.h1
-rw-r--r--print-802_15_4.c27
-rw-r--r--tcpdump.c6
4 files changed, 18 insertions, 17 deletions
diff --git a/interface.h b/interface.h
index c301e37d..6e04b058 100644
--- a/interface.h
+++ b/interface.h
@@ -273,7 +273,6 @@ extern u_int juniper_ppp_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_frelay_print(const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_chdlc_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
-extern u_int ieee802_15_4_if_print(const struct pcap_pkthdr *, const u_char *);
extern void snmp_print(const u_char *, u_int);
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
extern u_int symantec_if_print(const struct pcap_pkthdr *, const u_char *);
diff --git a/netdissect.h b/netdissect.h
index e87941da..757cd7bf 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -433,6 +433,7 @@ 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 *);
+extern u_int ieee802_15_4_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
#if 0
#ifdef INET6
diff --git a/print-802_15_4.c b/print-802_15_4.c
index a5364124..6fe00d88 100644
--- a/print-802_15_4.c
+++ b/print-802_15_4.c
@@ -87,7 +87,8 @@ extract_header_length(u_int16_t fc)
u_int
-ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
+ieee802_15_4_if_print(struct netdissect_options *ndo,
+ const struct pcap_pkthdr *h, const u_char *p)
{
u_int caplen = h->caplen;
u_int hdrlen;
@@ -95,7 +96,7 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
u_int8_t seq;
if (caplen < 3) {
- printf("[|802.15.4] %x", caplen);
+ ND_PRINT((ndo, "[|802.15.4] %x", caplen));
return caplen;
}
@@ -107,11 +108,11 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
p += 3;
caplen -= 3;
- printf("IEEE 802.15.4 %s packet ", ftypes[fc & 0x7]);
+ ND_PRINT((ndo,"IEEE 802.15.4 %s packet ", ftypes[fc & 0x7]));
if (vflag)
- printf("seq %02x ", seq);
+ ND_PRINT((ndo,"seq %02x ", seq));
if (hdrlen == -1) {
- printf("malformed! ");
+ ND_PRINT((ndo,"malformed! "));
return caplen;
}
@@ -124,33 +125,33 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
switch ((fc >> 10) & 0x3) {
case 0x00:
- printf("none ");
+ ND_PRINT((ndo,"none "));
break;
case 0x02:
panid = EXTRACT_LE_16BITS(p);
p += 2;
- printf("%04x:%04x ", panid, EXTRACT_LE_16BITS(p));
+ ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p)));
p += 2;
break;
case 0x03:
panid = EXTRACT_LE_16BITS(p);
p += 2;
- printf("%04x:%s ", panid, le64addr_string(p));
+ ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(p)));
p += 8;
break;
}
- printf("< ");
+ ND_PRINT((ndo,"< ");
switch ((fc >> 14) & 0x3) {
case 0x00:
- printf("none ");
+ ND_PRINT((ndo,"none "));
break;
case 0x02:
if (!(fc & (1 << 6))) {
panid = EXTRACT_LE_16BITS(p);
p += 2;
}
- printf("%04x:%04x ", panid, EXTRACT_LE_16BITS(p));
+ ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p)));
p += 2;
break;
case 0x03:
@@ -158,7 +159,7 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
panid = EXTRACT_LE_16BITS(p);
p += 2;
}
- printf("%04x:%s ", panid, le64addr_string(p));
+ ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(p))));
p += 8;
break;
}
@@ -167,7 +168,7 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
}
if (!suppress_default_print)
- default_print(p, caplen);
+ (ndo->ndo_default_print)(ndo, p, caplen);
return 0;
}
diff --git a/tcpdump.c b/tcpdump.c
index c5f4bbeb..da88d383 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -293,9 +293,6 @@ static struct printer printers[] = {
{ usb_linux_64_byte_print, DLT_USB_LINUX_MMAPPED},
#endif /* DLT_USB_LINUX_MMAPPED */
#endif /* HAVE_PCAP_USB_H */
-#ifdef DLT_IEEE802_15_4
- { ieee802_15_4_if_print, DLT_IEEE802_15_4 },
-#endif
#ifdef DLT_IPV4
{ raw_if_print, DLT_IPV4 },
#endif
@@ -309,6 +306,9 @@ static struct ndo_printer ndo_printers[] = {
#ifdef DLT_IPNET
{ ipnet_if_print, DLT_IPNET },
#endif
+#ifdef DLT_IEEE802_15_4
+ { ieee802_15_4_if_print, DLT_IEEE802_15_4 },
+#endif
{ NULL, 0 },
};