Thread View: mod.computers.masscomp
1 messages
1 total messages
Started by guy
Wed, 10 Dec 1986 18:09
Re: ICMP network utility
Author: guy
Date: Wed, 10 Dec 1986 18:09
Date: Wed, 10 Dec 1986 18:09
57 lines
2157 bytes
2157 bytes
> It should run on VAX, Masscomp and Sun for sure. If you find otherwise...
I found otherwise - or, more correctly, Doug Kingston found otherwise. This
"ping" is based on a version prior to the one that came out in 4.3, but it
that version has the same bug Doug found in the 4.3 one; it doesn't work
with odd packet sizes on big-endian machines (like Suns and Masscomps).
Here's a "diff -c" listing of the changes needed to make it work with odd
packet sizes; however, if somebody has the 4.3 source they might want to
look at that version (and apply this fix, the 4.3 version still has that
bug).
[thanks! -- sob]
*** ping.c.BAK Tue Dec 9 09:24:42 1986
--- ping.c Tue Dec 9 09:28:46 1986
***************
*** 309,314 ****
--- 309,315 ----
register int nleft = len;
register u_short *w = addr;
register u_short answer;
+ u_short odd_byte = 0;
register int sum = 0;
/*
***************
*** 323,335 ****
}
/* mop up an odd byte, if necessary */
! if( nleft == 1 )
! sum += *(u_char *)w;
/*
* add back carry outs from top 16 bits to low 16 bits
*/
! sum += (sum >> 16); /* add hi 16 to low 16 */
answer = ~sum; /* truncate to 16 bits */
return (answer);
}
--- 324,339 ----
}
/* mop up an odd byte, if necessary */
! if( nleft == 1 ) {
! *(u_char *)(&odd_byte) = *(u_char *)w;
! sum += odd_byte;
! }
/*
* add back carry outs from top 16 bits to low 16 bits
*/
! sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
! sum += (sum >> 16); /* add carry */
answer = ~sum; /* truncate to 16 bits */
return (answer);
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads