[leaf-commits] src/bering-uclibc4/source/openntpd buildtool.cfg, NONE, 1.1 buildtool.mk, NONE, 1.1 ntpd.conf, NONE, 1.1 openntpd-3.9p1.tar.gz, NONE, 1.1 openntpd-user.patch, NONE, 1.1 openntpd.default, NONE, 1.1 openntpd.init, NONE, 1.1 reconnect.patch, NONE, 1.1

Andrew <[email protected]>
Newsgroups gmane.linux.leaf.cvs
Message-ID <[email protected]>
Update of /cvsroot/leaf/src/bering-uclibc4/source/openntpd
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7017/source/openntpd

Added Files:
	buildtool.cfg buildtool.mk ntpd.conf openntpd-3.9p1.tar.gz 
	openntpd-user.patch openntpd.default openntpd.init 
	reconnect.patch 
Log Message:
Fixed opentpd


--- NEW FILE: reconnect.patch ---
diff -urNad openntpd-3.9p1~/client.c openntpd-3.9p1/client.c
--- openntpd-3.9p1~/client.c	2007-03-05 17:50:32.000000000 +0000
+++ openntpd-3.9p1/client.c	2007-03-05 17:51:50.000000000 +0000
@@ -116,6 +116,7 @@
 client_query(struct ntp_peer *p)
 {
 	int	tos = IPTOS_LOWDELAY;
+	int	result;
 
 	if (p->addr == NULL && client_nextaddr(p) == -1) {
 		set_next(p, error_interval());
@@ -163,9 +164,17 @@
 	p->query->msg.xmttime.fractionl = arc4random();
 	p->query->xmttime = gettime();
 
-	if (ntp_sendmsg(p->query->fd, NULL, &p->query->msg,
-	    NTP_MSGSIZE_NOAUTH, 0) == -1) {
+	if ((result = ntp_sendmsg(p->query->fd, NULL, &p->query->msg,
+	    NTP_MSGSIZE_NOAUTH, 0)) < 0) {
 		set_next(p, INTERVAL_QUERY_PATHETIC);
+		if (result == -2) {
+			/*
+			 * got EINVAL in sendto(), probably the local socket
+			 * address got invalidated -> force re-connect()
+			 */
+			close(p->query->fd);
+			p->query->fd = -1;
+		}
 		return (-1);
 	}
 
diff -urNad openntpd-3.9p1~/ntp_msg.c openntpd-3.9p1/ntp_msg.c
--- openntpd-3.9p1~/ntp_msg.c	2007-03-05 17:50:34.000000000 +0000
+++ openntpd-3.9p1/ntp_msg.c	2007-03-05 17:51:50.000000000 +0000
@@ -98,6 +98,8 @@
 			return (-1);
 		}
 		log_warn("sendto");
+		if (errno == EINVAL)
+			return (-2);
 		return (-1);
 	}
 

--- NEW FILE: openntpd.init ---
#! /bin/sh
#
# skeleton	example file to build /etc/init.d/ scripts.
#		This file should be used to construct scripts for /etc/init.d.
#
#		Written by Miquel van Smoorenburg <[email protected]>.
#		Modified for Debian 
#		by Ian Murdock <[email protected]>.
#
# Version:	@(#)skeleton  1.9  26-Feb-2001  [email protected]
#
RCDLINKS="2,S20 3,S20 4,S20 5,S20 0,K20 1,K20 6,K20"

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/openntpd
NAME=openntpd
DESC=openntpd

test -x $DAEMON || exit 0

# Include openntpd defaults if available
if [ -f /etc/default/openntpd ] ; then
	. /etc/default/openntpd
fi

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --oknodo --quiet --exec $DAEMON 2>/dev/null
	echo "$NAME."
	;;
  restart|force-reload)
	echo -n "Restarting $DESC: "
	start-stop-daemon --stop --oknodo --quiet --exec $DAEMON 2>/dev/null
	sleep 1
	start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
	echo "$NAME."
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0

--- NEW FILE: openntpd.default ---
# Uncomment to set the system time when starting in case the offset
# between the local clock and the servers is more than 180 seconds.
# For other options, see man ntpd(8).
DAEMON_OPTS="-s"


--- NEW FILE: openntpd-user.patch ---
diff -urN openntpd-3.9p1.orig/ntpd.h openntpd-3.9p1/ntpd.h
--- openntpd-3.9p1.orig/ntpd.h	2006-05-14 07:29:21.000000000 +0200
+++ openntpd-3.9p1/ntpd.h	2006-09-05 17:19:22.000000000 +0200
@@ -31,7 +31,7 @@
 #include "ntp.h"
 
 #ifndef NTPD_USER
-#define	NTPD_USER	"_ntp"
+#define	NTPD_USER	"root"
 #endif
 #define	CONFFILE	SYSCONFDIR "/ntpd.conf"
 

--- NEW FILE: openntpd-3.9p1.tar.gz ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: buildtool.mk ---
# makefile for openntp
include $(MASTERMAKEFILE)

OPENNTP_DIR:=openntpd-3.9p1
OPENNTP_TARGET_DIR:=$(BT_BUILD_DIR)/openntp

$(OPENNTP_DIR)/.source:
	zcat $(OPENNTP_SOURCE) | tar -xvf -
	cat $(OPENNTP_PATCH1) | patch -d $(OPENNTP_DIR) -p1
	cat $(OPENNTP_PATCH2) | patch -d $(OPENNTP_DIR) -p1

	touch $(OPENNTP_DIR)/.source

source: $(OPENNTP_DIR)/.source
                        
$(OPENNTP_DIR)/.configured: $(OPENNTP_DIR)/.source
	(cd $(OPENNTP_DIR) ; CC=$(TARGET_CC) LD=$(TARGET_LD) CFLAGS="$(BT_COPT_FLAGS)" \
	./configure \
	--prefix=/usr \
	--host=$(GNU_ARCH)-linux \
	--build=$(GNU_ARCH)-linux \
	--without-ssl-dir \
	--with-builtin-arc4random \
	--sysconfdir=/etc/openntpd);
	touch $(OPENNTP_DIR)/.configured

	#--with-ssl-dir=PATH
	#--without-privsep-user \

                                                                 
$(OPENNTP_DIR)/.build: $(OPENNTP_DIR)/.configured
	mkdir -p $(OPENNTP_TARGET_DIR)
	mkdir -p $(OPENNTP_TARGET_DIR)/etc/default	
	mkdir -p $(OPENNTP_TARGET_DIR)/etc/init.d	
	mkdir -p $(OPENNTP_TARGET_DIR)/etc/openntpd
	mkdir -p $(OPENNTP_TARGET_DIR)/usr/sbin		
	make -C $(OPENNTP_DIR) all  
	-$(BT_STRIP) $(BT_STRIP_BINOPTS) $(OPENNTP_DIR)/ntpd	
	cp -a $(OPENNTP_DIR)/ntpd $(OPENNTP_TARGET_DIR)/usr/sbin/openntpd
	cp -a openntpd.default $(OPENNTP_TARGET_DIR)/etc/default/openntpd
	cp -a openntpd.init $(OPENNTP_TARGET_DIR)/etc/init.d/openntpd
	cp -a ntpd.conf $(OPENNTP_TARGET_DIR)/etc/openntpd/
	cp -a $(OPENNTP_TARGET_DIR)/* $(BT_STAGING_DIR)/
	touch $(OPENNTP_DIR)/.build

build: $(OPENNTP_DIR)/.build
                                                                                         
clean:
	make -C $(OPENNTP_DIR) clean
	rm -rf $(OPENNTP_TARGET_DIR)
	-rm $(OPENNTP_DIR)/.build
	-rm $(OPENNTP_DIR)/.configured
                                                                                                                 
srcclean: clean
	rm -rf $(OPENNTP_DIR) 

--- NEW FILE: ntpd.conf ---
# $OpenBSD: ntpd.conf,v 1.7 2004/07/20 17:38:35 henning Exp $
# sample ntpd configuration file, see ntpd.conf(5)

# Addresses to listen on (ntpd does not listen by default)
#listen on *
#listen on 127.0.0.1
#listen on ::1

# sync to a single server
#server ntp.example.org

# use a random selection of 8 public stratum 2 servers
# see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers
servers pool.ntp.org

--- NEW FILE: buildtool.cfg ---
<File buildtool.mk>
  Server = cvs4-sourceforge
  Revision = HEAD
  Directory = openntpd
</File>

<File openntpd-3.9p1.tar.gz>
  Server = cvs4-sourceforge
  Revision = HEAD
  Directory = openntpd
  Envname = OPENNTP_SOURCE
</File>

<File openntpd-user.patch>
  Server = cvs4-sourceforge
  Revision = HEAD
  Directory = openntpd
  Envname = OPENNTP_PATCH1
</File>

<File reconnect.patch>
  Server = cvs4-sourceforge
  Revision = HEAD
  Directory = openntpd
  Envname = OPENNTP_PATCH2
</File>

<File openntpd.default>
  Server = cvs4-sourceforge
  Revision = HEAD
  Directory = openntpd
</File>

<File openntpd.init>
  Server = cvs4-sourceforge
  Revision = HEAD
  Directory = openntpd
</File>

<File ntpd.conf>
  Server = cvs4-sourceforge
  Revision = HEAD
  Directory = openntpd
</File>

<Package>
	<openntpd>
		Version = 3.9p1
		Revision = 3
		
		Help <<EOF
		Easy to use implementation of the Network Time Protocol.
		It provides the ability to sync the local clock to remote NTP 
		servers and can act as NTP server itself, redistributing the 
		local clock.		
		Homepage: http://www.openntpd.org/
		LEAF package by __PACKAGER__, __BUILDDATE__
		EOF
		
		<Permissions>
		Files = 644
		Directories = 755
		</Permissions>
                                                       
		<Owner>
		Files = root:root
		Directories = root:root
		</Owner>
		
		<Contents>
			<File>
				Filename        = etc/default/openntpd
				Source          = etc/default/openntpd
				Description     = openntpd daemon configuration
				Type            = conf
				Type		= local
				Type            = binary
			</File>
			<File>
				Filename    = etc/init.d/openntpd
				Source      = etc/init.d/openntpd
				Description = openntpd init file
				Type        = binary
				Permissions = 755
			</File>
			<File>
				Filename    = usr/sbin/openntpd
				Source      = usr/sbin/openntpd
				Type        = binary
				Permissions = 755
			</File>
			<File>
				Filename        = etc/openntpd/ntpd.conf
				Source          = etc/openntpd/ntpd.conf
				Description     = openntpd configuration
				Type            = conf
				Type		= local
				Type            = binary
			</File>
		</Contents>
	</openntpd>
</Package>


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.