summaryrefslogtreecommitdiff
path: root/net/tcl-scotty
diff options
context:
space:
mode:
authorhe <he@pkgsrc.org>2018-05-14 08:57:57 +0000
committerhe <he@pkgsrc.org>2018-05-14 08:57:57 +0000
commit20b8648b5de855b39ec3879bb9d914602a809559 (patch)
treec0552e37a2770a0466b019fa818c1cc6e4392c77 /net/tcl-scotty
parent36236652ca1345274f291416ab128840e968d335 (diff)
downloadpkgsrc-20b8648b5de855b39ec3879bb9d914602a809559.tar.gz
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.
Diffstat (limited to 'net/tcl-scotty')
-rw-r--r--net/tcl-scotty/Makefile4
-rw-r--r--net/tcl-scotty/distinfo4
-rw-r--r--net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c96
3 files changed, 91 insertions, 13 deletions
diff --git a/net/tcl-scotty/Makefile b/net/tcl-scotty/Makefile
index 855a6964e00..1da82256220 100644
--- a/net/tcl-scotty/Makefile
+++ b/net/tcl-scotty/Makefile
@@ -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/
diff --git a/net/tcl-scotty/distinfo b/net/tcl-scotty/distinfo
index a1a87df416b..82bfec077c9 100644
--- a/net/tcl-scotty/distinfo
+++ b/net/tcl-scotty/distinfo
@@ -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) = fee6c4c681c3930ec4df624166d3a32091b2159b
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
diff --git a/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c b/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c
index 71962015676..6d02b45640a 100644
--- a/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c
+++ b/net/tcl-scotty/patches/patch-tnm_snmp_tnmSnmpNet.c
@@ -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 <sys/wait.h>
+
+ #ifndef __WIN32__
+ #include <sys/un.h>
+@@ -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 connection in that case.
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 connection in that case.
/*
* 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 connection in that case.
*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 connection in that case.
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 connection in that case.
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) {