summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-10-13 11:19:28 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-10-13 11:19:28 +0200
commit146f9b6e5b90380db3407a88518193ef78bbe72e (patch)
tree1af48589e1ff88be3685cd4d483662ff9cc0b86e /net
parent1d73a42006b0ae3d81a901778b0fb12d85406bbd (diff)
downloadbarebox-146f9b6e5b90380db3407a88518193ef78bbe72e.tar.gz
barebox-146f9b6e5b90380db3407a88518193ef78bbe72e.tar.xz
remove sntp support. Has been broken for long enough
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r--net/Kconfig4
-rw-r--r--net/Makefile1
-rw-r--r--net/dhcp.c11
-rw-r--r--net/net.c24
-rw-r--r--net/sntp.c131
5 files changed, 1 insertions, 170 deletions
diff --git a/net/Kconfig b/net/Kconfig
index 841fe518d5..cca2b00387 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -11,10 +11,6 @@ config NET_RARP
bool
prompt "rarp protocol support"
-config NET_SNTP
- bool
- prompt "sntp support"
-
config NET_NFS
bool
prompt "nfs support"
diff --git a/net/Makefile b/net/Makefile
index df775be9ca..0ffc8959c1 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -3,6 +3,5 @@ obj-$(CONFIG_NET) += eth.o
obj-$(CONFIG_NET) += net.o
obj-$(CONFIG_NET_NFS) += nfs.o
obj-$(CONFIG_NET_RARP) += rarp.o
-obj-$(CONFIG_NET_SNTP) += sntp.o
obj-$(CONFIG_NET_TFTP) += tftp.o
obj-$(CONFIG_NET_PING) += ping.o
diff --git a/net/dhcp.c b/net/dhcp.c
index 311e3a9dde..cc2b78fba2 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -375,12 +375,6 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
case 1:
NetCopyIP (&NetOurSubnetMask, (popt + 2));
break;
-#if defined CONFIG_NET_SNTP && defined CONFIG_BOOTP_TIMEOFFSET
- case 2: /* Time offset */
- NetCopyLong (&NetTimeOffset, (ulong *) (popt + 2));
- NetTimeOffset = ntohl (NetTimeOffset);
- break;
-#endif
case 3:
NetCopyIP (&NetOurGatewayIP, (popt + 2));
break;
@@ -404,11 +398,6 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
memcpy (&NetOurRootPath, popt + 2, size);
NetOurRootPath[size] = 0;
break;
-#if defined CONFIG_NET_SNTP && defined CONFIG_BOOTP_NTPSERVER
- case 42: /* NTP server IP */
- NetCopyIP (&NetNtpServerIP, (popt + 2));
- break;
-#endif
case 51:
NetCopyLong (&dhcp_leasetime, (ulong *) (popt + 2));
break;
diff --git a/net/net.c b/net/net.c
index db6d575992..94b4a40276 100644
--- a/net/net.c
+++ b/net/net.c
@@ -65,12 +65,6 @@
* We want: - load the boot file
* Next step: none
*
- * SNTP:
- *
- * Prerequisites: - own ethernet address
- * - own IP address
- * We want: - network time
- * Next step: none
*/
@@ -87,9 +81,6 @@
#include "tftp.h"
#include "rarp.h"
#include "nfs.h"
-#ifdef CONFIG_NET_SNTP
-#include "sntp.h"
-#endif
#define ARP_TIMEOUT (5 * SECOND) /* Seconds before trying ARP again */
#ifndef CONFIG_NET_RETRY_COUNT
@@ -135,11 +126,6 @@ ushort NetOurNativeVLAN = 0xFFFF; /* ditto */
char BootFile[128]; /* Boot File name */
-#ifdef CONFIG_NET_SNTP
-IPaddr_t NetNtpServerIP; /* NTP server IP address */
-int NetTimeOffset=0; /* offset time from UTC */
-#endif
-
uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
uchar *NetRxPackets[PKTBUFSRX]; /* Receive packets */
@@ -779,14 +765,6 @@ static int net_check_prereq (proto_t protocol)
switch (protocol) {
/* Fall through */
-#ifdef CONFIG_NET_SNTP
- case SNTP:
- if (NetNtpServerIP == 0) {
- puts ("*** ERROR: NTP server address not given\n");
- return -1;
- }
- goto common;
-#endif
#ifdef CONFIG_NET_NFS
case NFS:
#endif
@@ -796,7 +774,7 @@ static int net_check_prereq (proto_t protocol)
printf("*** ERROR: `%s.serverip' not set\n", dev_id(&edev->dev));
return -1;
}
-common:
+
if (NetOurIP == 0) {
printf("*** ERROR: `%s.ipaddr' not set\n", dev_id(&edev->dev));
return -1;
diff --git a/net/sntp.c b/net/sntp.c
deleted file mode 100644
index 8d913dd51e..0000000000
--- a/net/sntp.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * SNTP support driver
- *
- * Masami Komiya <mkomiya@sonare.it> 2005
- *
- */
-
-#include <common.h>
-#include <command.h>
-#include <clock.h>
-#include <net.h>
-#include <rtc.h>
-
-#include "sntp.h"
-
-#define SNTP_TIMEOUT 10
-
-static int SntpOurPort;
-
-static void
-SntpSend (void)
-{
- struct sntp_pkt_t pkt;
- int pktlen = SNTP_PACKET_LEN;
- int sport;
-
- debug ("%s\n", __FUNCTION__);
-
- memset (&pkt, 0, sizeof(pkt));
-
- pkt.li = NTP_LI_NOLEAP;
- pkt.vn = NTP_VERSION;
- pkt.mode = NTP_MODE_CLIENT;
-
- memcpy ((char *)NetTxPacket + NetEthHdrSize() + IP_HDR_SIZE, (char *)&pkt, pktlen);
-
- SntpOurPort = 10000 + ((uint32_t)get_time_ns() % 4096);
- sport = NTP_SERVICE_PORT;
-
- NetSendUDPPacket (NetServerEther, NetNtpServerIP, sport, SntpOurPort, pktlen);
-}
-
-static void
-SntpTimeout (void)
-{
- puts ("Timeout\n");
- NetState = NETLOOP_FAIL;
- return;
-}
-
-static void
-SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
-{
- struct sntp_pkt_t *rpktp = (struct sntp_pkt_t *)pkt;
- struct rtc_time tm;
- ulong seconds;
-
- debug ("%s\n", __FUNCTION__);
-
- if (dest != SntpOurPort) return;
-
- /*
- * As the RTC's used in U-Boot sepport second resolution only
- * we simply ignore the sub-second field.
- */
- memcpy (&seconds, &rpktp->transmit_timestamp, sizeof(ulong));
-
- to_tm(ntohl(seconds) - 2208988800UL + NetTimeOffset, &tm);
-#if (CONFIG_COMMANDS & CFG_CMD_DATE)
- rtc_set (&tm);
-#endif
- printf ("Date: %4d-%02d-%02d Time: %2d:%02d:%02d\n",
- tm.tm_year, tm.tm_mon, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec);
-
- NetState = NETLOOP_SUCCESS;
-}
-
-void
-SntpStart (void)
-{
- debug ("%s\n", __FUNCTION__);
-
- NetSetTimeout (SNTP_TIMEOUT * SECOND, SntpTimeout);
- NetSetHandler(SntpHandler);
- memset (NetServerEther, 0, 6);
-
- SntpSend ();
-}
-
-int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- char *toff;
-
- if (argc < 2) {
- NetNtpServerIP = getenv_IPaddr ("ntpserverip");
- if (NetNtpServerIP == 0) {
- printf ("ntpserverip not set\n");
- return (1);
- }
- } else {
- NetNtpServerIP = string_to_ip(argv[1]);
- if (NetNtpServerIP == 0) {
- printf ("Bad NTP server IP address\n");
- return (1);
- }
- }
-
- toff = getenv ("timeoffset");
- if (toff == NULL) NetTimeOffset = 0;
- else NetTimeOffset = simple_strtol (toff, NULL, 10);
-
- if (NetLoopInit(SNTP) < 0)
- return 1;
-
- SntpStart();
-
- if (NetLoop() < 0) {
- printf("SNTP failed: host %s not responding\n", argv[1]);
- return 1;
- }
-
- return 0;
-}
-
-U_BOOT_CMD(
- sntp, 2, 1, do_sntp,
- "sntp\t- synchronize RTC via network\n",
- "[NTP server IP]\n"
-);
-