ports/143223: [MAINTAINER] dns/mydns-ng: Fix some bugs
Hung-Yi Chen
gaod at hychen.org
Mon Jan 25 22:00:14 UTC 2010
>Number: 143223
>Category: ports
>Synopsis: [MAINTAINER] dns/mydns-ng: Fix some bugs
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: maintainer-update
>Submitter-Id: current-users
>Arrival-Date: Mon Jan 25 22:00:13 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Hung-Yi Chen
>Release: FreeBSD 8.0-RELEASE-p2 i386
>Organization:
>Environment:
System: FreeBSD gaod.tfcis.org 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #3: Tue Jan 12 17:56:41 CST 2010 gaod at gaod.tfcis.org:/usr/obj/usr/src/sys/GENERIC i386
>Description:
* Fix for Bug #0000040 http://bugs.mydns-ng.com/view.php?id=40
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
>How-To-Repeat:
>Fix:
--- mydns-ng begins here ---
===> Generating patch
===> Viewing diff with more
diff -ruN --exclude=CVS /usr/ports/dns/mydns-ng.orig/Makefile /usr/ports/dns/mydns-ng/Makefile
--- /usr/ports/dns/mydns-ng.orig/Makefile 2009-08-24 01:31:35.000000000 +0800
+++ /usr/ports/dns/mydns-ng/Makefile 2010-01-26 05:30:27.000000000 +0800
@@ -6,7 +6,7 @@
#
PORTNAME= mydns-ng
-PORTREVISION= 1
+PORTREVISION= 2
PORTVERSION= 1.2.8.27
CATEGORIES= dns databases
MASTER_SITES= SF/${PORTNAME}/mydns/${PORTVERSION}
diff -ruN --exclude=CVS /usr/ports/dns/mydns-ng.orig/files/patch-src_mydns-1.2.8_main.c /usr/ports/dns/mydns-ng/files/patch-src_mydns-1.2.8_main.c
--- /usr/ports/dns/mydns-ng.orig/files/patch-src_mydns-1.2.8_main.c 1970-01-01 08:00:00.000000000 +0800
+++ /usr/ports/dns/mydns-ng/files/patch-src_mydns-1.2.8_main.c 2010-01-26 05:28:06.000000000 +0800
@@ -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 -ruN --exclude=CVS /usr/ports/dns/mydns-ng.orig/files/patch-src_mydns-1.2.8_resolve.c /usr/ports/dns/mydns-ng/files/patch-src_mydns-1.2.8_resolve.c
--- /usr/ports/dns/mydns-ng.orig/files/patch-src_mydns-1.2.8_resolve.c 1970-01-01 08:00:00.000000000 +0800
+++ /usr/ports/dns/mydns-ng/files/patch-src_mydns-1.2.8_resolve.c 2010-01-26 05:28:31.000000000 +0800
@@ -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 -ruN --exclude=CVS /usr/ports/dns/mydns-ng.orig/files/patch-src_mydns-1.2.8_servercomms.c /usr/ports/dns/mydns-ng/files/patch-src_mydns-1.2.8_servercomms.c
--- /usr/ports/dns/mydns-ng.orig/files/patch-src_mydns-1.2.8_servercomms.c 1970-01-01 08:00:00.000000000 +0800
+++ /usr/ports/dns/mydns-ng/files/patch-src_mydns-1.2.8_servercomms.c 2010-01-26 05:28:52.000000000 +0800
@@ -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;
===> Done
--- mydns-ng ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list