summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-ipnet.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-01-07 19:55:18 +0000
committerdelphij <delphij@FreeBSD.org>2015-01-07 19:55:18 +0000
commitf49c5d523af9076a4a59e8dd664f9a897108432e (patch)
treee268839e08c106e178b33bd461d8d0a9c6fb5ad9 /contrib/tcpdump/print-ipnet.c
parentc371846049d370ab78d943e60e789cdffe0aad3d (diff)
parent08263d19579d35a7a65e0c8bcb768504ce76d04e (diff)
downloadFreeBSD-src-f49c5d523af9076a4a59e8dd664f9a897108432e.zip
FreeBSD-src-f49c5d523af9076a4a59e8dd664f9a897108432e.tar.gz
MFV r276761: tcpdump 4.6.2.
MFC after: 1 month
Diffstat (limited to 'contrib/tcpdump/print-ipnet.c')
-rw-r--r--contrib/tcpdump/print-ipnet.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/contrib/tcpdump/print-ipnet.c b/contrib/tcpdump/print-ipnet.c
index 187f939..e1cd59e 100644
--- a/contrib/tcpdump/print-ipnet.c
+++ b/contrib/tcpdump/print-ipnet.c
@@ -1,27 +1,36 @@
+#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-#include <pcap.h>
-
-#include "netdissect.h"
#include "interface.h"
-#include "addrtoname.h"
-#include "ipnet.h"
+
+typedef struct ipnet_hdr {
+ uint8_t iph_version;
+ uint8_t iph_family;
+ uint16_t iph_htype;
+ uint32_t iph_pktlen;
+ uint32_t iph_ifindex;
+ uint32_t iph_grifindex;
+ uint32_t iph_zsrc;
+ uint32_t iph_zdst;
+} ipnet_hdr_t;
+
+#define IPH_AF_INET 2 /* Matches Solaris's AF_INET */
+#define IPH_AF_INET6 26 /* Matches Solaris's AF_INET6 */
#ifdef DLT_IPNET
-const struct tok ipnet_values[] = {
+static const struct tok ipnet_values[] = {
{ IPH_AF_INET, "IPv4" },
{ IPH_AF_INET6, "IPv6" },
{ 0, NULL }
};
static inline void
-ipnet_hdr_print(struct netdissect_options *ndo, const u_char *bp, u_int length)
+ipnet_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
{
const ipnet_hdr_t *hdr;
hdr = (const ipnet_hdr_t *)bp;
@@ -44,7 +53,7 @@ ipnet_hdr_print(struct netdissect_options *ndo, const u_char *bp, u_int length)
}
static void
-ipnet_print(struct netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
+ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
{
ipnet_hdr_t *hdr;
@@ -79,7 +88,7 @@ ipnet_print(struct netdissect_options *ndo, const u_char *p, u_int length, u_int
length + sizeof(ipnet_hdr_t));
if (!ndo->ndo_suppress_default_print)
- ndo->ndo_default_print(ndo, p, caplen);
+ ND_DEFAULTPRINT(p, caplen);
break;
}
}
@@ -91,7 +100,7 @@ ipnet_print(struct netdissect_options *ndo, const u_char *p, u_int length, u_int
* is the number of bytes actually captured.
*/
u_int
-ipnet_if_print(struct netdissect_options *ndo,
+ipnet_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
ipnet_print(ndo, p, h->len, h->caplen);
OpenPOWER on IntegriCloud