[BusyBox-cvs] Re: busybox-cvs Digest, Vol 28, Issue 15

Vladimir N. Oleynik dzo at simtreas.ru
Wed Jul 20 08:35:06 UTC 2005


Hi.

> applying fix for:
>  0000045: traceroute causes an alignment trap due to unaligned buffer on arm
> Modified:
>    trunk/busybox/networking/traceroute.c
> 
> 
> Changeset:
> Modified: trunk/busybox/networking/traceroute.c
> ===================================================================
> --- trunk/busybox/networking/traceroute.c	2005-07-19 02:18:44 UTC (rev 10859)
> +++ trunk/busybox/networking/traceroute.c	2005-07-19 20:37:15 UTC (rev 10860)
> @@ -77,6 +77,7 @@
>  
>  
>  #define MAXPACKET       65535   /* max ip packet size */
> +#define MAXPACKET_ICMP  512
>  #ifndef MAXHOSTNAMELEN
>  #define MAXHOSTNAMELEN  64
>  #endif
> @@ -101,7 +102,6 @@
>  
>  #include "busybox.h"
>  
> -static u_char  packet[512];            /* last inbound (icmp) packet */
>  static struct opacket  *outpacket;     /* last output (udp) packet */
>  
>  static int s;                          /* receive (icmp) socket file descriptor */
> @@ -185,7 +185,7 @@
>  }
>  
>  static inline int
> -wait_for_reply(int sock, struct sockaddr_in *from, int reset_timer)
> +wait_for_reply(int sock, struct sockaddr_in *from, int reset_timer, u_char *packet, int size)
>  {
>  	fd_set fds;
>  	static struct timeval wait;
> @@ -212,7 +212,7 @@
>  	}
>  
>  	if (select(sock+1, &fds, (fd_set *)0, (fd_set *)0, &wait) > 0)
> -		cc=recvfrom(s, (char *)packet, sizeof(packet), 0,
> +		cc=recvfrom(s, (char *)packet, size, 0,
>  			    (struct sockaddr *)from, &fromlen);
>  
>  	return(cc);
> @@ -339,10 +339,12 @@
>  	struct hostent *hp;
>  	struct sockaddr_in from, *to;
>  	int ch, i, on, probe, seq, tos, ttl;
> +	u_char *packet;
>  
>  	int options = 0;                /* socket options */
>  	char *source = 0;
>  	int nprobes = 3;
> +	packet = xmalloc (MAXPACKET_ICMP);
>  
>  	on = 1;
>  	seq = tos = 0;
> @@ -494,7 +496,7 @@
>  			(void) gettimeofday(&t1, &tz);
>  			send_probe(++seq, ttl);
>  			reset_timer = 1;
> -			while ((cc = wait_for_reply(s, &from, reset_timer)) != 0) {
> +			while ((cc = wait_for_reply(s, &from, reset_timer, packet, MAXPACKET_ICMP)) != 0) {
>  				(void) gettimeofday(&t2, &tz);
>  				if ((i = packet_ok(packet, cc, &from, seq))) {
>  					reset_timer = 1;

O my God.
Please restore previous version with change:

-static u_char  packet[512];            /* last inbound (icmp) packet */
+/* last inbound (icmp) packet */
+static u_char  packet[512] __attribute__ ((aligned (16)));


--w
vodz



More information about the busybox-cvs mailing list