[comp.unix.wizards] Sun 3.4 ICMP Timestamp

budd@bu-cs.BU.EDU (Philip Budne) (10/20/87)

I brought up a copy of 4.3 timed on Sun 3.4 but was seeing bad results
(confederations of machines with different times), so I decided to
modify 4.3 ping to send timestamp messages and see what the deal was.

On 4.3 I get back well formed messages pinging both the Vax itself and
Suns, However on the Sun I get nothing but trash back.

I could find no Sun code that differentiates between ECHO REPLY and
TIMESTAMP REPLY.  Has anyone seen this problem?

	Phil Budne, Boston University

steve@mimsy.UUCP (Steve D. Miller) (10/21/87)

From the fiddling I did on a SunOS 3.4 machine, it seems that 3.4 is still
returning only the ICMP header on raw ICMP sockets.  This was a 4.2-ism;
4.3BSD returns both the IP and ICMP headers for such sockets.  The patch
for 4.2BSD is as follows:

*** /usr/src/etc/timed/measure.c	Wed May 28 23:10:26 1986
--- /usr/src/etc/timed/measure.c.42	Wed Oct 21 09:45:49 1987
***************
*** 47,53 ****
  	u_char packet[PACKET_IN], opacket[64];
  	register struct icmp *icp = (struct icmp *) packet;
  	register struct icmp *oicp = (struct icmp *) opacket;
- 	struct ip *ip = (struct ip *) packet;
  
  	min1 = min2 = 0x7fffffff;
  	status = HOSTDOWN;
--- 47,52 ----
***************
*** 113,119 ****
  			(void)gettimeofday(&tv1, (struct timezone *)0);
  			if (cc < 0)
  				return(-1);
- 			icp = (struct icmp *)(packet + (ip->ip_hl << 2));
  			if((icp->icmp_type == ICMP_TSTAMPREPLY) &&
  			    icp->icmp_id == id && icp->icmp_seq == seqno)
  				break;
--- 112,117 ----

This patch is clearly necessary in this case, but it's unclear to me
what else might need to be done to get the 4.3 timed up under SunOS 3.4.
It does seem from other things I've looked at that 3.4 is capable of
handling Timestamp Request and Timestamp Reply messages more-or-less
properly, whatever that means.

	-Steve

-- 
Spoken: Steve Miller    Domain: steve@mimsy.umd.edu    UUCP: uunet!mimsy!steve
Phone: +1-301-454-1516  USPS: UMIACS, Univ. of Maryland, College Park, MD 20742