Received: by mail.netbsd.org (Postfix, from userid 605) id 9092785048; Mon, 14 May 2018 08:57:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 17A7084DEF for ; Mon, 14 May 2018 08:57:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id xknTYRJW8QXH for ; Mon, 14 May 2018 08:57:57 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 5450B84D3E for ; Mon, 14 May 2018 08:57:57 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 4A548FBEC; Mon, 14 May 2018 08:57:57 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_152628827775230" MIME-Version: 1.0 Date: Mon, 14 May 2018 08:57:57 +0000 From: "Havard Eidnes" Subject: CVS commit: pkgsrc/net/tcl-scotty To: pkgsrc-changes@NetBSD.org Reply-To: he@netbsd.org X-Mailer: log_accum Message-Id: <20180514085757.4A548FBEC@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_152628827775230 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: he Date: Mon May 14 08:57:57 UTC 2018 Modified Files: pkgsrc/net/tcl-scotty: Makefile distinfo pkgsrc/net/tcl-scotty/patches: patch-tnm_snmp_tnmSnmpNet.c Log Message: Provide more diagnostics leading up to abandoning an straps connection. When abandoning a trap connection, check if an straps child's status should be collected. Bump PKGREVISION. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 pkgsrc/net/tcl-scotty/Makefile cvs rdiff -u -r1.26 -r1.27 pkgsrc/net/tcl-scotty/distinfo cvs rdiff -u -r1.2 -r1.3 \ pkgsrc/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_152628827775230 Content-Disposition: inline Content-Length: 7255 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/net/tcl-scotty/Makefile diff -u pkgsrc/net/tcl-scotty/Makefile:1.43 pkgsrc/net/tcl-scotty/Makefile:1.44 --- pkgsrc/net/tcl-scotty/Makefile:1.43 Fri Apr 13 19:10:49 2018 +++ pkgsrc/net/tcl-scotty/Makefile Mon May 14 08:57:57 2018 @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.43 2018/04/13 19:10:49 he Exp $ +# $NetBSD: Makefile,v 1.44 2018/05/14 08:57:57 he Exp $ # DISTNAME= scotty-${DIST_VERS} PKGNAME= tcl-scotty-${DIST_VERS} -PKGREVISION= 16 +PKGREVISION= 17 CATEGORIES= net tcl MASTER_SITES= ftp://ftp.ibr.cs.tu-bs.de/pub/local/tkined/ Index: pkgsrc/net/tcl-scotty/distinfo diff -u pkgsrc/net/tcl-scotty/distinfo:1.26 pkgsrc/net/tcl-scotty/distinfo:1.27 --- pkgsrc/net/tcl-scotty/distinfo:1.26 Sun Apr 15 20:05:46 2018 +++ pkgsrc/net/tcl-scotty/distinfo Mon May 14 08:57:57 2018 @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.26 2018/04/15 20:05:46 hauke Exp $ +$NetBSD: distinfo,v 1.27 2018/05/14 08:57:57 he Exp $ SHA1 (scotty-2.1.11.tar.gz) = 819011f908c57e4591d6f50e51677c01eb55dc13 RMD160 (scotty-2.1.11.tar.gz) = 3b4d45f3db73f05b49a46017bf2ffed6d6464b00 @@ -36,7 +36,7 @@ SHA1 (patch-tnm_snmp_tnmMibTree.c) = fee SHA1 (patch-tnm_snmp_tnmSnmp.h) = 79d12cbbef65e7a2c230b52a47a7c4b059fe6d32 SHA1 (patch-tnm_snmp_tnmSnmpAgent.c) = 04a87727d6644861fdd41e9e10bf3085ff943109 SHA1 (patch-tnm_snmp_tnmSnmpInst.c) = 5d5fc656b59215c5436fc1a6633ba7b626bca442 -SHA1 (patch-tnm_snmp_tnmSnmpNet.c) = 3aa7e1ee5b6b32229804ddf6132e00801be5f55b +SHA1 (patch-tnm_snmp_tnmSnmpNet.c) = 69060921854aac058453a7e0c9d7d962736210a5 SHA1 (patch-tnm_snmp_tnmSnmpRecv.c) = f55abae9975a7832e38e2754fe6e38e025eb6276 SHA1 (patch-tnm_snmp_tnmSnmpSend.c) = 46c2b0f7c3d5f6392df96cba55b831ef763deeb7 SHA1 (patch-tnm_snmp_tnmSnmpTcl.c) = 565d982a4e24e8033c4a16895ff503a3159a1a33 Index: pkgsrc/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c diff -u pkgsrc/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c:1.2 pkgsrc/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c:1.3 --- pkgsrc/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c:1.2 Wed Feb 1 09:29:18 2017 +++ pkgsrc/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c Mon May 14 08:57:57 2018 @@ -1,14 +1,36 @@ -$NetBSD: patch-tnm_snmp_tnmSnmpNet.c,v 1.2 2017/02/01 09:29:18 he Exp $ +$NetBSD: patch-tnm_snmp_tnmSnmpNet.c,v 1.3 2018/05/14 08:57:57 he Exp $ Constify. Avoid use of interp->result. Add code to try to re-sync trap message stream if we get too large trap messages, but don't try more than 10 consecutive attempts and instead abandon trap connection in that case. +Provide more diagnostics leading up to abandoning an straps +connection. When abandoning a trap connection, check if an straps +child's status should be collected. --- tnm/snmp/tnmSnmpNet.c.orig 1997-08-26 18:55:45.000000000 +0000 +++ tnm/snmp/tnmSnmpNet.c -@@ -170,7 +170,7 @@ straps(interp) +@@ -13,6 +13,7 @@ + */ + + #include "tnmSnmp.h" ++#include + + #ifndef __WIN32__ + #include +@@ -140,8 +141,10 @@ xread(fd, buf, len) + { + int rc; + ++ errno = 0; + while ((rc = read(fd, buf, len)) < 0 + && (errno == EINTR || errno == EAGAIN)) { ++ errno = 0; + continue; + } + +@@ -170,7 +173,7 @@ straps(interp) Tcl_Interp *interp; { int *pidArray, argc = 1; @@ -17,16 +39,48 @@ attempts and instead abandon trap connec static Tcl_Channel channel = NULL; static char *straps = NULL; -@@ -843,6 +843,8 @@ TrapRecv(interp, packet, packetlen, from +@@ -841,8 +844,10 @@ TrapRecv(interp, packet, packetlen, from + + return TCL_OK; #else - int len, rlen; +- int len, rlen; ++ int len, rlen, res, pid; char c; + static int resync; +#define RESYNC_MAX 10 /* * Read the message from the straps daemon. We expect the -@@ -868,6 +870,71 @@ TrapRecv(interp, packet, packetlen, from +@@ -854,31 +859,112 @@ TrapRecv(interp, packet, packetlen, from + * n byte - trap message. + */ + +- if (xread(trap_sock, (char *) &from->sin_addr.s_addr, 4) != 4) { ++ if ((res = xread(trap_sock, (char *) &from->sin_addr.s_addr, 4)) != 4) { ++ if (res < 0) ++ fprintf(stderr, "TrapRecv: error: %s\n", strerror(errno)); ++ fprintf(stderr, "TrapRecv: could not read addr: %d\n", res); + goto errorExit; + } +- if (xread(trap_sock, (char *) &from->sin_port, 2) != 2) { ++ if ((res = xread(trap_sock, (char *) &from->sin_port, 2)) != 2) { ++ if (res < 0) ++ fprintf(stderr, "TrapRecv: error: %s\n", strerror(errno)); ++ fprintf(stderr, "TrapRecv: could not read port: %d\n", res); + goto errorExit; + } +- if (xread(trap_sock, (char *) &len, 4) != 4) { ++ if ((res = xread(trap_sock, (char *) &len, 4)) != 4) { ++ if (res < 0) ++ fprintf(stderr, "TrapRecv: error: %s\n", strerror(errno)); ++ fprintf(stderr, "TrapRecf: could not read length: %d\n", res); + goto errorExit; + } + rlen = len < *packetlen ? len : *packetlen; +- if (xread(trap_sock, (char *) packet, rlen) <= 0) { ++ if ((res = xread(trap_sock, (char *) packet, rlen)) <= 0) { ++ fprintf(stderr, "TrapRecv: error: %s\n", strerror(errno)); ++ fprintf(stderr, "TrapRecv: could not read packet: %d\n", res); goto errorExit; } @@ -98,7 +152,15 @@ attempts and instead abandon trap connec /* * Eat up any remaining data-bytes. */ -@@ -879,6 +946,8 @@ TrapRecv(interp, packet, packetlen, from + + while (len > *packetlen) { +- if (xread(trap_sock, &c, 1) != 1) { ++ if ((res = xread(trap_sock, &c, 1)) != 1) { ++ if (res < 0) ++ fprintf(stderr, "TrapRecv: could not read remaining bytes: %s\n", strerror(errno)); ++ fprintf(stderr, "TrapRecv: consume-rest read result: %d\n", res); + goto errorExit; + } len--; } @@ -107,7 +169,23 @@ attempts and instead abandon trap connec *packetlen = rlen; if (hexdump) { -@@ -1060,7 +1129,7 @@ ResponseProc(clientData, mask) +@@ -894,8 +980,15 @@ TrapRecv(interp, packet, packetlen, from + return TCL_OK; + + errorExit: ++ fprintf(stderr, "TrapRecv: errorExit, closing trap receiver\n"); + Tnm_SnmpTrapClose(); + Tcl_SetResult(interp, "lost connection to straps daemon", TCL_STATIC); ++ pid = waitpid(-1, &res, WNOHANG); /* We may have started straps() */ ++ if (pid > 0) { ++ fprintf(stderr, "TrapRecv: collected status for pid %d\n", pid); ++ } else if (pid == -1) { ++ fprintf(stderr, "TrapRecv: wait returned %s\n", strerror(pid)); ++ } + return TCL_ERROR; + #endif + } +@@ -1060,7 +1153,7 @@ ResponseProc(clientData, mask) Tcl_BackgroundError(interp); } if (code == TCL_CONTINUE && hexdump) { @@ -116,7 +194,7 @@ attempts and instead abandon trap connec TnmWriteMessage(interp, "\n"); } } -@@ -1102,7 +1171,7 @@ TrapProc(clientData, mask) +@@ -1102,7 +1195,7 @@ TrapProc(clientData, mask) Tcl_BackgroundError(interp); } if (code == TCL_CONTINUE && hexdump) { @@ -125,7 +203,7 @@ attempts and instead abandon trap connec TnmWriteMessage(interp, "\n"); } } -@@ -1147,7 +1216,7 @@ AgentProc(clientData, mask) +@@ -1147,7 +1240,7 @@ AgentProc(clientData, mask) Tcl_BackgroundError(interp); } if (code == TCL_CONTINUE && hexdump) { --_----------=_152628827775230--