summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-mobile.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2002-06-21 00:43:23 +0000
committerfenner <fenner@FreeBSD.org>2002-06-21 00:43:23 +0000
commit91fc581e384bca8ae8831d23b70ab73ab0dc1a21 (patch)
tree89431945035dbd4a9ce74e63c4a1f65ed4166a1a /contrib/tcpdump/print-mobile.c
parentf815ae37f4671c581fdc1c6f99a8490a6dfbb4f6 (diff)
downloadFreeBSD-src-91fc581e384bca8ae8831d23b70ab73ab0dc1a21.zip
FreeBSD-src-91fc581e384bca8ae8831d23b70ab73ab0dc1a21.tar.gz
Import tcpdump 3.7.1, from
http://www.tcpdump.org/release/tcpdump-3.7.1.tar.gz
Diffstat (limited to 'contrib/tcpdump/print-mobile.c')
-rw-r--r--contrib/tcpdump/print-mobile.c32
1 files changed, 3 insertions, 29 deletions
diff --git a/contrib/tcpdump/print-mobile.c b/contrib/tcpdump/print-mobile.c
index a6116f6..bc4f3cb 100644
--- a/contrib/tcpdump/print-mobile.c
+++ b/contrib/tcpdump/print-mobile.c
@@ -42,7 +42,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.5 2000/09/29 04:58:43 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.7 2001/08/20 17:53:54 fenner Exp $";
#endif
#include <sys/param.h>
@@ -70,8 +70,6 @@ struct mobile_ip {
#define OSRC_PRES 0x0080 /* old source is present */
-static u_int16_t mob_in_cksum(u_short *p, int len);
-
/*
* Deencapsulate and print a mobile-tunneled IP datagram
*/
@@ -89,6 +87,7 @@ mobile_print(const u_char *bp, u_int length)
fputs("[|mobile]", stdout);
return;
}
+ fputs("mobile: ", stdout);
proto = EXTRACT_16BITS(&mob->proto);
crc = EXTRACT_16BITS(&mob->hcheck);
@@ -108,34 +107,9 @@ mobile_print(const u_char *bp, u_int length)
(void)printf("> %s ",ipaddr_string(&mob->odst));
(void)printf("(oproto=%d)",proto>>8);
}
- if (mob_in_cksum((u_short *)mob, osp ? 12 : 8)!=0) {
+ if (in_cksum((u_short *)mob, osp ? 12 : 8, 0)!=0) {
(void)printf(" (bad checksum %d)",crc);
}
return;
}
-
-static u_int16_t mob_in_cksum(u_short *p, int len)
-{
- u_int32_t sum = 0;
- int nwords = len >> 1;
-
- while (nwords-- != 0)
- sum += *p++;
-
- if (len & 1) {
- union {
- u_int16_t w;
- u_int8_t c[2];
- } u;
- u.c[0] = *(u_char *)p;
- u.c[1] = 0;
- sum += u.w;
- }
-
- /* end-around-carry */
- sum = (sum >> 16) + (sum & 0xffff);
- sum += (sum >> 16);
- return (~sum);
-}
-
OpenPOWER on IntegriCloud