Update of /cvsroot/leaf/src/bering-uclibc/apps/openntpd
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18526
Modified Files:
buildtool.cfg buildtool.mk
Added Files:
reconnect.patch
Log Message:
Reconnect after an EINVAL to make it work with dynamic IP addresses.
see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=392250
--- 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);
}
Index: buildtool.cfg
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/apps/openntpd/buildtool.cfg,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** buildtool.cfg 12 Dec 2006 21:27:12 -0000 1.2
--- buildtool.cfg 27 Jun 2007 17:47:26 -0000 1.3
***************
*** 19,22 ****
--- 19,29 ----
</File>
+ <File reconnect.patch>
+ Server = cvs-sourceforge
+ Revision = HEAD
+ Directory = openntpd
+ Envname = OPENNTP_PATCH2
+ </File>
+
<File openntpd.default>
Server = cvs-sourceforge
***************
*** 40,44 ****
<openntpd>
Version = 3.9p1
! Revision = 2
Help <<EOF
--- 47,51 ----
<openntpd>
Version = 3.9p1
! Revision = 3
Help <<EOF
Index: buildtool.mk
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/apps/openntpd/buildtool.mk,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** buildtool.mk 5 Sep 2006 20:07:52 -0000 1.1
--- buildtool.mk 27 Jun 2007 17:47:26 -0000 1.2
***************
*** 8,11 ****
--- 8,13 ----
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
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
leaf-cvs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits