aboutsummaryrefslogtreecommitdiff
path: root/dns/mydns-ng
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2010-01-27 13:03:31 +0000
committerMartin Wilke <miwi@FreeBSD.org>2010-01-27 13:03:31 +0000
commita602da42ebcaeb8628e37731d352cb82e2c53adc (patch)
tree248a97daa675b1e0faa38b9db8a6e7ef03cbbe00 /dns/mydns-ng
parent7bb9c720e36dd3b12b57312087425a5aee6b7829 (diff)
downloadports-a602da42ebcaeb8628e37731d352cb82e2c53adc.tar.gz
ports-a602da42ebcaeb8628e37731d352cb82e2c53adc.zip
child processes must not shutdown() their sockets * Fixes and reports a problem occuring with jumping system time, as reported when running inside some virtual machine. Time jumps are reported to the log with loglevel NOTICE. * Delegation now has precedence over wildcard matching Thanks to Fab for the fix Fixes bugs #0000038, #0000042 PR: 143223 Submitted by: Hung-Yi Chen <gaod@hychen.org> (maintainer)
Notes
Notes: svn path=/head/; revision=248677
Diffstat (limited to 'dns/mydns-ng')
-rw-r--r--dns/mydns-ng/Makefile2
-rw-r--r--dns/mydns-ng/files/patch-src_mydns-1.2.8_main.c100
-rw-r--r--dns/mydns-ng/files/patch-src_mydns-1.2.8_resolve.c76
-rw-r--r--dns/mydns-ng/files/patch-src_mydns-1.2.8_servercomms.c16
4 files changed, 193 insertions, 1 deletions
diff --git a/dns/mydns-ng/Makefile b/dns/mydns-ng/Makefile
index 335260d97ef8..4ab75c3dbc68 100644
--- a/dns/mydns-ng/Makefile
+++ b/dns/mydns-ng/Makefile
@@ -6,8 +6,8 @@
#
PORTNAME= mydns-ng
-PORTREVISION= 1
PORTVERSION= 1.2.8.27
+PORTREVISION= 2
CATEGORIES= dns databases
MASTER_SITES= SF/${PORTNAME}/mydns/${PORTVERSION}
DISTNAME= mydns-${PORTVERSION}
diff --git a/dns/mydns-ng/files/patch-src_mydns-1.2.8_main.c b/dns/mydns-ng/files/patch-src_mydns-1.2.8_main.c
new file mode 100644
index 000000000000..4fb595195526
--- /dev/null
+++ b/dns/mydns-ng/files/patch-src_mydns-1.2.8_main.c
@@ -0,0 +1,100 @@
+--- src/mydns/main.c.orig 2010-01-26 05:17:05.000000000 +0800
++++ src/mydns/main.c 2010-01-26 05:22:38.000000000 +0800
+@@ -513,11 +513,11 @@
+ /* Close any TCP connections and any NOTIFY sockets */
+ for (t = TaskP->head; t; t = TaskP->head) {
+ if (t->protocol == SOCK_STREAM && t->fd >= 0)
+- sockclose(t->fd);
++ close(t->fd);
+ else if (t->protocol == SOCK_DGRAM
+ && (t->status & (ReqTask|TickTask|RunTask))
+ && t->fd >= 0)
+- sockclose(t->fd);
++ close(t->fd);
+ dequeue(t);
+ }
+ }
+@@ -747,7 +747,7 @@
+ if (shutting_down) server->pid = -1;
+ else {
+ if (server->listener) dequeue(server->listener);
+- sockclose(server->serverfd);
++ close(server->serverfd);
+ RELEASE(server);
+ array_store(Servers, n, NULL);
+ if (n == 0) server = spawn_server(primary_initial_tasks);
+@@ -1164,7 +1164,7 @@
+
+ #if HAVE_POLL
+ #if DEBUG_ENABLED
+- DebugX("enabled", 1, _("Selecting for IO numfds = %d, timeout = %s(%d)"), numfds,
++ DebugX("enabled", 1, _("Polling for IO numfds = %d, timeout = %s(%d)"), numfds,
+ (timeoutWanted<0)?"no"
+ :(timeoutWanted==0)?"poll":"yes", timeoutWanted);
+ #endif
+@@ -1175,6 +1175,10 @@
+ if (errno == EAGAIN) { /* Could fail here but will log and retry */
+ Warn(_("server_loop() received EAGAIN - retrying"));
+ continue;
++ } else {
++#if DEBUG_ENABLED
++ DebugX("enabled", 1, _("poll(): error %d: %s"), errno, strerror(errno));
++#endif
+ }
+ RELEASE(items);
+ if (errno == EINVAL) {
+@@ -1213,6 +1217,9 @@
+
+ if (rv < 0) {
+ if (errno == EINTR) continue;
++#if DEBUG_ENABLED
++ DebugX("enabled", 1, _("select(): error %d: %s"), errno, strerror(errno));
++#endif
+ if (errno == EBADF) {
+ /* As we do not get told which FD failed here then purge and try again */
+ purge_bad_tasks();
+@@ -1408,6 +1415,9 @@
+ Warn(_("server_loop() received EAGAIN - retrying"));
+ continue;
+ }
++#if DEBUG_ENABLED
++ DebugX("enabled", 1, _("server_loop(): poll() errro %d: %s"), errno, strerror(errno));
++#endif
+ RELEASE(items);
+ if (errno == EINVAL) {
+ Err(_("server_loop() received EINVAL consistency failure in call to poll/select"));
+@@ -1445,6 +1455,9 @@
+
+ if (rv < 0) {
+ if (errno == EINTR) continue;
++#if DEBUG_ENABLED
++ DebugX("enabled", 1, _("server_loop(): select() errro %d: %s"), errno, strerror(errno));
++#endif
+ if (errno == EBADF) {
+ /* As we do not get told which FD failed here then purge and try again */
+ purge_bad_tasks();
+@@ -1466,9 +1479,6 @@
+ if (FD_ISSET(fd, &efd)) {
+ item->revents |= POLLERR;
+ }
+-#if DEBUG_ENABLED
+- DebugX("enabled", 1, _("Item fd = %d, events = %x, revents = %x"), fd, item->events, item->revents);
+-#endif
+ }
+ }
+
+@@ -1476,6 +1486,14 @@
+ #error You must have either poll (preferred) or select to compile this code
+ #endif
+ #endif
++#if DEBUG_ENABLED
++ /* Debug socket states */
++ for (i = 0; i < numfds; i++) {
++ struct pollfd *item = &items[i];
++ int fd = item->fd;
++ DebugX("enabled", 1, _("Item fd = %d, events = %x, revents = %x"), fd, item->events, item->revents);
++ }
++#endif
+ gettick();
+
+ if (shutting_down) { break; }
diff --git a/dns/mydns-ng/files/patch-src_mydns-1.2.8_resolve.c b/dns/mydns-ng/files/patch-src_mydns-1.2.8_resolve.c
new file mode 100644
index 000000000000..1d09653a5139
--- /dev/null
+++ b/dns/mydns-ng/files/patch-src_mydns-1.2.8_resolve.c
@@ -0,0 +1,76 @@
+--- src/mydns/resolve.c.orig 2010-01-26 05:23:29.000000000 +0800
++++ src/mydns/resolve.c 2010-01-26 05:25:46.000000000 +0800
+@@ -292,6 +292,7 @@
+ register MYDNS_RR *rr = NULL;
+ taskexec_t rv = 0;
+ int recurs = wildcard_recursion;
++ char *savelabel = label;
+
+ #if DEBUG_ENABLED && DEBUG_RESOLVE
+ DebugX("resolve", 1, _("%s: resolve_label(%s, %s, %s, %s, %d)"), desctask(t),
+@@ -312,6 +313,34 @@
+ return (rv);
+ }
+
++ /* No exact match */
++ /* Check for NS delegation */
++ while (*label) {
++ if ((rr = find_rr(t, soa, DNS_QTYPE_NS, label))) {
++ char *newfqdn;
++ if (LASTCHAR(label) == '.') {
++ newfqdn = STRDUP(label);
++ } else {
++ ASPRINTF(&newfqdn, "%s.%s", label, soa->origin);
++ }
++ rv = process_rr(t, AUTHORITY, qtype, newfqdn, soa, label, rr, level);
++ mydns_rr_free(rr);
++ RELEASE(newfqdn);
++ add_authority_ns(t, section, soa, label);
++#if DEBUG_ENABLED && DEBUG_RESOLVE
++ DebugX("resolve", 1, _("%s: resolve_label(%s) returning results %s"), desctask(t),
++ fqdn, task_exec_name(rv));
++#endif
++ return (rv);
++ }
++ label = strchr(label, '.');
++ if (!label) break;
++ label++;
++ }
++ /* No NS delegation. */
++ /* Restore label, it may have been modified above */
++ label = savelabel;
++
+ /*
+ * No exact match.
+ * If `label' isn't empty, replace the first part of the label with `*'
+@@ -420,30 +449,6 @@
+ }
+
+ NOWILDCARDMATCH:
+- /* STILL no match - check for NS records for child delegation */
+- while (*label) {
+- if ((rr = find_rr(t, soa, DNS_QTYPE_NS, label))) {
+- char *newfqdn;
+- if (LASTCHAR(label) == '.') {
+- newfqdn = STRDUP(label);
+- } else {
+- ASPRINTF(&newfqdn, "%s.%s", label, soa->origin);
+- }
+- rv = process_rr(t, AUTHORITY, qtype, newfqdn, soa, label, rr, level);
+- mydns_rr_free(rr);
+- RELEASE(newfqdn);
+- add_authority_ns(t, section, soa, label);
+-#if DEBUG_ENABLED && DEBUG_RESOLVE
+- DebugX("resolve", 1, _("%s: resolve_label(%s) returning results %s"), desctask(t),
+- fqdn, task_exec_name(rv));
+-#endif
+- return (rv);
+- }
+- label = strchr(label, '.');
+- if (!label) break;
+- label++;
+- }
+-
+ return (TASK_EXECUTED);
+ }
+ /*--- resolve_label() ---------------------------------------------------------------------------*/
diff --git a/dns/mydns-ng/files/patch-src_mydns-1.2.8_servercomms.c b/dns/mydns-ng/files/patch-src_mydns-1.2.8_servercomms.c
new file mode 100644
index 000000000000..dc96f34a3edb
--- /dev/null
+++ b/dns/mydns-ng/files/patch-src_mydns-1.2.8_servercomms.c
@@ -0,0 +1,16 @@
+--- src/mydns/servercomms.c.orig 2010-01-26 05:26:08.000000000 +0800
++++ src/mydns/servercomms.c 2010-01-26 05:26:45.000000000 +0800
+@@ -406,7 +406,12 @@
+ DebugX("servercomms", 1, _("%s: Server comms tick - master has not pinged for %d seconds"), desctask(t),
+ lastseen);
+ #endif
+- named_shutdown(0);
++ if (abs(lastseen) > 10*KEEPALIVE) {
++ Notice(_("Possible clock jump: master has not pinged for %d seconds"), lastseen);
++ } else {
++ Notice(_("Client shutdown: %s: master has not pinged for %d seconds"), desctask(t), lastseen);
++ named_shutdown(0);
++ }
+ }
+
+ return TASK_CONTINUE;