summaryrefslogtreecommitdiffstats
path: root/main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-23 18:24:11 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-23 18:24:11 +0000
commit2d2ddf507bf1ae2f4cc595b23b8e018398cbe8dd (patch)
treea63d3b3b1c89018b5419358eed5c2bb0acf1cd92 /main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
parente374901731eb35599bd6735de4dd38560e3a79b8 (diff)
downloadaports-2d2ddf507bf1ae2f4cc595b23b8e018398cbe8dd.tar.bz2
aports-2d2ddf507bf1ae2f4cc595b23b8e018398cbe8dd.tar.xz
move core/* to main/
added maintainer to several packages as well
Diffstat (limited to 'main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff')
-rw-r--r--main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff43
1 files changed, 43 insertions, 0 deletions
diff --git a/main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff b/main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
new file mode 100644
index 000000000..adca55614
--- /dev/null
+++ b/main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
@@ -0,0 +1,43 @@
+diff -Naur openntpd-3.9p1/client.c openntpd-3.9p1-fixed/client.c
+--- openntpd-3.9p1/client.c 2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1-fixed/client.c 2006-10-11 02:41:44.000000000 +0200
+@@ -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 -Naur openntpd-3.9p1/ntp_msg.c openntpd-3.9p1-fixed/ntp_msg.c
+--- openntpd-3.9p1/ntp_msg.c 2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1-fixed/ntp_msg.c 2006-10-11 02:41:49.000000000 +0200
+@@ -98,6 +98,8 @@
+ return (-1);
+ }
+ log_warn("sendto");
++ if (errno == EINVAL)
++ return (-2);
+ return (-1);
+ }
+