]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-mobile.c
More UNALIGNED_MEM{CPY,CMP} on IP addresses.
[tcpdump] / print-mobile.c
index b9f7e7a12a60065b2d8b05439aa556118d677815..530f26efeb41a07ef182e314306eb5ddb50e519f 100644 (file)
 #include "config.h"
 #endif
 
 #include "config.h"
 #endif
 
-#ifndef lint
-static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.12 2002-12-11 07:14:05 guy Exp $";
-#endif
-
 #include <tcpdump-stdinc.h>
 
 #include <stdio.h>
 #include <tcpdump-stdinc.h>
 
 #include <stdio.h>
@@ -72,12 +67,13 @@ mobile_print(const u_char *bp, u_int length)
 {
        const u_char *cp = bp +8 ;
        const struct mobile_ip *mob;
 {
        const u_char *cp = bp +8 ;
        const struct mobile_ip *mob;
+       struct cksum_vec vec[1];
        u_short proto,crc;
        u_char osp =0;                  /* old source address present */
 
        mob = (const struct mobile_ip *)bp;
 
        u_short proto,crc;
        u_char osp =0;                  /* old source address present */
 
        mob = (const struct mobile_ip *)bp;
 
-       if (length < MOBILE_SIZE) {
+       if (length < MOBILE_SIZE || !TTEST(*mob)) {
                fputs("[|mobile]", stdout);
                return;
        }
                fputs("[|mobile]", stdout);
                return;
        }
@@ -101,7 +97,9 @@ mobile_print(const u_char *bp, u_int length)
                (void)printf("> %s ",ipaddr_string(&mob->odst));
                (void)printf("(oproto=%d)",proto>>8);
        }
                (void)printf("> %s ",ipaddr_string(&mob->odst));
                (void)printf("(oproto=%d)",proto>>8);
        }
-       if (in_cksum((u_short *)mob, osp ? 12 : 8, 0)!=0) {
+       vec[0].ptr = (const u_int8_t *)(void *)mob;
+       vec[0].len = osp ? 12 : 8;
+       if (in_cksum(vec, 1)!=0) {
                (void)printf(" (bad checksum %d)",crc);
        }
 
                (void)printf(" (bad checksum %d)",crc);
        }