From a0af97d2bfba67f952a59dfb549397d8e110dc2c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 9 Nov 1999 03:43:47 +0000 Subject: Patch from Eric Norum to add NTP BOOTP support because EPICS needs a synchronized time-of-day clock. This patch is the changes needed to get NTP server information from a BOOTP server. This patch also adds NTP server information to the network configuration structure, too. --- cpukit/libnetworking/nfs/bootp_subr.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'cpukit/libnetworking/nfs/bootp_subr.c') diff --git a/cpukit/libnetworking/nfs/bootp_subr.c b/cpukit/libnetworking/nfs/bootp_subr.c index b39c9e4714..36907cda1d 100644 --- a/cpukit/libnetworking/nfs/bootp_subr.c +++ b/cpukit/libnetworking/nfs/bootp_subr.c @@ -730,7 +730,12 @@ processOptions (unsigned char *optbuf, int optbufSize) dhcp_gotnetmask = 1; break; - case 2: /* Time offset, unused */ + case 2: /* Time offset */ + /* Time offset */ + if (len!=4) + panic("bootpc: time offset len is %d",len); + bcopy (p, &rtems_bsdnet_timeoffset, 4); + rtems_bsdnet_timeoffset = ntohl (rtems_bsdnet_timeoffset); break; case 3: @@ -743,6 +748,32 @@ processOptions (unsigned char *optbuf, int optbufSize) } break; + /* + * Some old BOOTP daemons don't support the NTP server (42) tag, + * but do support the RFC 868 time server (4) tag. Cheat here + * and assume they mean the same thing. + */ + case 4: + case 42: + /* Time servers */ + if (len % 4) + panic ("bootpc: time server Len is %d", len); + { + int tlen = 0; + while ((tlen < len) && + (rtems_bsdnet_ntpserver_count < sizeof rtems_bsdnet_config.ntp_server / + sizeof rtems_bsdnet_config.ntp_server[0])) { + bcopy (p+tlen, + &rtems_bsdnet_ntpserver[rtems_bsdnet_ntpserver_count], + 4); + printip("Time Server", + rtems_bsdnet_ntpserver[rtems_bsdnet_ntpserver_count]); + rtems_bsdnet_ntpserver_count++; + tlen += 4; + } + } + break; + case 6: /* Domain Name servers */ if (len % 4) -- cgit v1.2.3