summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/addrtoname.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>1997-05-27 02:17:42 +0000
committerfenner <fenner@FreeBSD.org>1997-05-27 02:17:42 +0000
commita45d5a033f69ab70d6de3ead1e8c6fd59f87352b (patch)
treebe1f1538067d8b764f3c8883470f914b73adcec2 /contrib/tcpdump/addrtoname.c
parent3ff0e744409afb9167d172e5c627942dd28ad80f (diff)
downloadFreeBSD-src-a45d5a033f69ab70d6de3ead1e8c6fd59f87352b.zip
FreeBSD-src-a45d5a033f69ab70d6de3ead1e8c6fd59f87352b.tar.gz
Merge tcpdump 3.3.
The print_nfs.c changes are pretty extensive; this is partially because LBL did a lot of cleanup and partially because I removed lots of pointless changes away from the LBL style. PR: 3371 mostly-Submitted by: Chris Timmons <skynyrd@opus.cts.cwu.edu>
Diffstat (limited to 'contrib/tcpdump/addrtoname.c')
-rw-r--r--contrib/tcpdump/addrtoname.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c
index 11d150f..e6b3e41 100644
--- a/contrib/tcpdump/addrtoname.c
+++ b/contrib/tcpdump/addrtoname.c
@@ -22,8 +22,8 @@
* and address to string conversion routines
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: addrtoname.c,v 1.49 96/07/02 00:19:35 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: addrtoname.c,v 1.54 96/12/05 22:10:19 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@@ -164,7 +164,7 @@ getname(const u_char *ap)
addr = *(const u_int32_t *)ap;
#else
/*
- * Deal with alignment.
+ * Extract 32 bits in network order, dealing with alignment.
*/
switch ((long)ap & 3) {
@@ -173,26 +173,26 @@ getname(const u_char *ap)
break;
case 2:
-#if BYTE_ORDER == LITTLE_ENDIAN
- addr = ((u_int32_t)*(u_short *)(ap + 2) << 16) |
- (u_int32_t)*(u_short *)ap;
-#else
+#ifdef WORDS_BIGENDIAN
addr = ((u_int32_t)*(u_short *)ap << 16) |
(u_int32_t)*(u_short *)(ap + 2);
+#else
+ addr = ((u_int32_t)*(u_short *)(ap + 2) << 16) |
+ (u_int32_t)*(u_short *)ap;
#endif
break;
default:
-#if BYTE_ORDER == LITTLE_ENDIAN
- addr = ((u_int32_t)ap[3] << 24) |
- ((u_int32_t)ap[2] << 16) |
- ((u_int32_t)ap[1] << 8) |
- (u_int32_t)ap[0];
-#else
+#ifdef WORDS_BIGENDIAN
addr = ((u_int32_t)ap[0] << 24) |
((u_int32_t)ap[1] << 16) |
((u_int32_t)ap[2] << 8) |
(u_int32_t)ap[3];
+#else
+ addr = ((u_int32_t)ap[3] << 24) |
+ ((u_int32_t)ap[2] << 16) |
+ ((u_int32_t)ap[1] << 8) |
+ (u_int32_t)ap[0];
#endif
break;
}
@@ -739,7 +739,7 @@ dnaddr_string(u_short dnaddr)
/* Return a zero'ed hnamemem struct and cuts down on calloc() overhead */
struct hnamemem *
-newhnamemem()
+newhnamemem(void)
{
register struct hnamemem *p;
static struct hnamemem *ptr = NULL;
OpenPOWER on IntegriCloud