]> The Tcpdump Group git mirrors - tcpdump/commitdiff
remove buffer move in LBL_ALIGN case, which does more bad things than good things.
authoritojun <itojun>
Fri, 18 Oct 2002 04:40:02 +0000 (04:40 +0000)
committeritojun <itojun>
Fri, 18 Oct 2002 04:40:02 +0000 (04:40 +0000)
(if there's unaligned access, they must be converted to EXTRACT_xx)

print-atalk.c
print-ip.c
print-ip6.c

index 8a5dbef5410767e7b84ae63fc6c1e2cb42c6d1e1..a67b6c601dfba4a6744275ca43c8db40c22e51d6 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.74 2002-09-05 21:25:37 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.75 2002-10-18 04:40:02 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -189,21 +189,6 @@ atalk_print(register const u_char *bp, u_int length)
               ddpskt_string(dp->dstSkt));
        bp += ddpSize;
        length -= ddpSize;
-#ifdef LBL_ALIGN
-       if ((long)bp & 3) {
-               static u_char *abuf = NULL;
-
-               if (abuf == NULL) {
-                       abuf = (u_char *)malloc(snaplen);
-                       if (abuf == NULL)
-                               error("atalk_print: malloc");
-               }
-               memcpy((char *)abuf, (char *)bp, min(length, snaplen));
-               snapend += abuf - (u_char *)bp;
-               packetp = abuf;
-               bp = abuf;
-       }
-#endif
        ddp_print(bp, length, dp->type, snet, dp->srcNode, dp->srcSkt);
 }
 
index 3e999f707fda7c7986fd93abc5a9f641a8103fb7..621abccd6c9986e2b8fb4bd89fb16e7e35afc1bc 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.115 2002-10-04 08:30:18 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.116 2002-10-18 04:40:03 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -353,30 +353,6 @@ ip_print(register const u_char *bp, register u_int length)
        struct protoent *proto;
 
        ip = (const struct ip *)bp;
-#ifdef LBL_ALIGN
-       /*
-        * If the IP header is not aligned, copy into abuf.
-        */
-       if ((long)ip & 3) {
-               static u_char *abuf = NULL;
-               static int didwarn = 0;
-
-               if (abuf == NULL) {
-                       abuf = (u_char *)malloc(snaplen);
-                       if (abuf == NULL)
-                               error("ip_print: malloc");
-               }
-               memcpy((char *)abuf, (char *)ip, min(length, snaplen));
-               snapend += abuf - (u_char *)ip;
-               packetp = abuf;
-               ip = (struct ip *)abuf;
-               /* We really want libpcap to give us aligned packets */
-               if (!didwarn) {
-                       warning("compensating for unaligned libpcap packets");
-                       ++didwarn;
-               }
-       }
-#endif
        if ((u_char *)(ip + 1) > snapend) {
                printf("[|ip]");
                return;
index d30b5b28366586fe0845ddc3d2b9f0309953f901..ac6f95f87000a96ed6493e1d71cf5c754240ee86 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.26 2002-09-05 21:25:42 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.27 2002-10-18 04:40:03 itojun Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -57,25 +57,6 @@ ip6_print(register const u_char *bp, register u_int length)
 
        ip6 = (const struct ip6_hdr *)bp;
 
-#ifdef LBL_ALIGN
-       /*
-        * The IP6 header is not 16-byte aligned, so copy into abuf.
-        */
-       if ((u_long)ip6 & 15) {
-               static u_char *abuf;
-
-               if (abuf == NULL) {
-                       abuf = malloc(snaplen);
-                       if (abuf == NULL)
-                               error("ip6_print: malloc");
-               }
-               memcpy(abuf, ip6, min(length, snaplen));
-               snapend += abuf - (u_char *)ip6;
-               packetp = abuf;
-               ip6 = (struct ip6_hdr *)abuf;
-               bp = abuf;
-       }
-#endif
        TCHECK(*ip6);
        if (length < sizeof (struct ip6_hdr)) {
                (void)printf("truncated-ip6 %d", length);