From 69e7b2e05f5be5ef38b11f1dd50a8738b60d110f Mon Sep 17 00:00:00 2001 From: wiz Date: Thu, 5 Apr 2001 15:18:08 +0000 Subject: Standardize patch file names. --- net/mtr/files/patch-sum | 6 +- net/mtr/patches/patch-01 | 14 - net/mtr/patches/patch-02 | 13 - net/mtr/patches/patch-aa | 14 + net/mtr/patches/patch-ab | 13 + net/ucd-snmp-current/Makefile | 6 +- net/ucd-snmp-current/files/patch-sum | 18 +- net/ucd-snmp-current/patches/patch-012 | 676 --------------------------------- net/ucd-snmp-current/patches/patch-zz | 676 +++++++++++++++++++++++++++++++++ 9 files changed, 717 insertions(+), 719 deletions(-) delete mode 100644 net/mtr/patches/patch-01 delete mode 100644 net/mtr/patches/patch-02 create mode 100644 net/mtr/patches/patch-aa create mode 100644 net/mtr/patches/patch-ab delete mode 100644 net/ucd-snmp-current/patches/patch-012 create mode 100644 net/ucd-snmp-current/patches/patch-zz (limited to 'net') diff --git a/net/mtr/files/patch-sum b/net/mtr/files/patch-sum index 1593d0f3af5..3c59c2a0272 100644 --- a/net/mtr/files/patch-sum +++ b/net/mtr/files/patch-sum @@ -1,4 +1,4 @@ -$NetBSD: patch-sum,v 1.1 1999/12/04 16:50:11 sommerfeld Exp $ +$NetBSD: patch-sum,v 1.2 2001/04/05 15:18:08 wiz Exp $ -MD5 (patch-01) = 9d521132e8f45df887fb35e829cdc492 -MD5 (patch-02) = 739da4139f7a4385318710dadf201403 +SHA1 (patch-aa) = c098f19f68220fa6c37d3e43edc2d6c49cba8118 +SHA1 (patch-ab) = 9ba3ea130f737864e673e60ce656b96556d3c1cc diff --git a/net/mtr/patches/patch-01 b/net/mtr/patches/patch-01 deleted file mode 100644 index c8a9491b005..00000000000 --- a/net/mtr/patches/patch-01 +++ /dev/null @@ -1,14 +0,0 @@ -$NetBSD: patch-01,v 1.2 1999/12/04 16:50:11 sommerfeld Exp $ - ---- net.c.orig Fri Aug 13 18:46:49 1999 -+++ net.c Sat Dec 4 11:44:33 1999 -@@ -213,7 +213,9 @@ - rv = sendto(sendsock, packet, packetsize, 0, - (struct sockaddr *)&remoteaddress, sizeof(remoteaddress)); - if (rv >= 0) { -+#if 0 - fprintf (stderr, "You've got a broken (FreeBSD?) system\n"); -+#endif - BSDfix = 1; - } - } diff --git a/net/mtr/patches/patch-02 b/net/mtr/patches/patch-02 deleted file mode 100644 index 85f0840e8d8..00000000000 --- a/net/mtr/patches/patch-02 +++ /dev/null @@ -1,13 +0,0 @@ -$NetBSD: patch-02,v 1.2 1999/12/04 16:50:11 sommerfeld Exp $ - ---- dns.c.orig Wed Jun 9 11:09:20 1999 -+++ dns.c Tue Aug 10 01:21:12 1999 -@@ -751,7 +751,7 @@ - void dorequest(char *s,int type,word id){ - packetheader *hp; - int r,i; -- int buf[(MaxPacketsize/sizeof (int))+1]; -+ unsigned char buf[MaxPacketsize]; - r = res_mkquery(QUERY,s,C_IN,type,NULL,0,NULL,buf,MaxPacketsize); - if (r == -1){ - restell("Resolver error: Query too large."); diff --git a/net/mtr/patches/patch-aa b/net/mtr/patches/patch-aa new file mode 100644 index 00000000000..3cc012b45db --- /dev/null +++ b/net/mtr/patches/patch-aa @@ -0,0 +1,14 @@ +$NetBSD: patch-aa,v 1.1 2001/04/05 15:18:09 wiz Exp $ + +--- net.c.orig Fri Aug 13 18:46:49 1999 ++++ net.c Sat Dec 4 11:44:33 1999 +@@ -213,7 +213,9 @@ + rv = sendto(sendsock, packet, packetsize, 0, + (struct sockaddr *)&remoteaddress, sizeof(remoteaddress)); + if (rv >= 0) { ++#if 0 + fprintf (stderr, "You've got a broken (FreeBSD?) system\n"); ++#endif + BSDfix = 1; + } + } diff --git a/net/mtr/patches/patch-ab b/net/mtr/patches/patch-ab new file mode 100644 index 00000000000..6fb042958c1 --- /dev/null +++ b/net/mtr/patches/patch-ab @@ -0,0 +1,13 @@ +$NetBSD: patch-ab,v 1.1 2001/04/05 15:18:09 wiz Exp $ + +--- dns.c.orig Wed Jun 9 11:09:20 1999 ++++ dns.c Tue Aug 10 01:21:12 1999 +@@ -751,7 +751,7 @@ + void dorequest(char *s,int type,word id){ + packetheader *hp; + int r,i; +- int buf[(MaxPacketsize/sizeof (int))+1]; ++ unsigned char buf[MaxPacketsize]; + r = res_mkquery(QUERY,s,C_IN,type,NULL,0,NULL,buf,MaxPacketsize); + if (r == -1){ + restell("Resolver error: Query too large."); diff --git a/net/ucd-snmp-current/Makefile b/net/ucd-snmp-current/Makefile index cc7d7c655be..f6720315ca4 100644 --- a/net/ucd-snmp-current/Makefile +++ b/net/ucd-snmp-current/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.8 2001/03/27 03:20:12 hubertf Exp $ +# $NetBSD: Makefile,v 1.9 2001/04/05 15:22:28 wiz Exp $ # DISTNAME= ucd-snmp-4.0.1 @@ -9,12 +9,10 @@ MASTER_SITES= ftp://ucd-snmp.ucdavis.edu/ \ # This patch is malformed (first Index line is missing, other # Index lines are relative to the agent directory), so I've -# put a fixed copy in ${FILESDIR}. (kim 1999-09-21) - +# put a fixed copy in ${PATCHDIR}/patch-zz. (kim 1999-09-21) #PATCH_SITES= http://ucd-snmp.ucdavis.edu/patches/ #PATCHFILES= 012.patch #DIST_SUBDIR= ucd-snmp - MAINTAINER= packages@netbsd.org HOMEPAGE= http://www.ece.ucdavis.edu/ucd-snmp/ COMMENT= Extensible SNMP implementation diff --git a/net/ucd-snmp-current/files/patch-sum b/net/ucd-snmp-current/files/patch-sum index 34d4edb5cc2..e9aef8eee23 100644 --- a/net/ucd-snmp-current/files/patch-sum +++ b/net/ucd-snmp-current/files/patch-sum @@ -1,10 +1,10 @@ -$NetBSD: patch-sum,v 1.1.1.1 1999/09/22 21:11:39 kim Exp $ +$NetBSD: patch-sum,v 1.2 2001/04/05 15:22:28 wiz Exp $ -MD5 (patch-012) = 70b04d9dac52c0cc219b1c3d8b7d82ec -MD5 (patch-aa) = 2a207b08ae1eb7ff69ad3e2127361040 -MD5 (patch-ab) = d77d772f82911e2bbb3efbbe6311ea4a -MD5 (patch-ac) = 69bc75948c5cb2142afc1d94a8c8f4dc -MD5 (patch-ad) = 6a4ab69f5c3f0b98bffcb273c132c837 -MD5 (patch-ae) = 732a0d565d585d53ca5a3f4d8584744c -MD5 (patch-af) = 5f8231f96a5958e72b74c22c4ee65161 -MD5 (patch-ag) = ef99d3a5839cf4491e58eee1c73422b1 +SHA1 (patch-aa) = 76ec43fa8ac83af12e0a2c170494f5e062fbd65e +SHA1 (patch-ab) = 0a36796070fb818e86c9e1a36eb6f337ad3e916d +SHA1 (patch-ac) = 0826c43259883926a76602dcb72ca2724cde713b +SHA1 (patch-ad) = c2fed2e8945fb7fa2dd613268ea78841a2994b76 +SHA1 (patch-ae) = 08532250e7e4226d411d77aeb9943e7d7cd74ef5 +SHA1 (patch-af) = 828998e05e36f85543cce99474fa7d3725a95909 +SHA1 (patch-ag) = aa5e2e12353d96be6865e2094b7c66a4593814c1 +SHA1 (patch-zz) = 30fe7185ab7d704abf887b941f5ae54b00e4c3ee diff --git a/net/ucd-snmp-current/patches/patch-012 b/net/ucd-snmp-current/patches/patch-012 deleted file mode 100644 index f4bc33d2368..00000000000 --- a/net/ucd-snmp-current/patches/patch-012 +++ /dev/null @@ -1,676 +0,0 @@ -$NetBSD: patch-012,v 1.1.1.1 1999/09/22 21:11:39 kim Exp $ - -Index: agent/snmpd.c -=================================================================== -RCS file: /opt/ucd-snmp/ucd-snmp/agent/snmpd.c,v -retrieving revision 1.137 -diff -c -r1.137 snmpd.c -*** snmpd.c 1999/08/23 20:54:32 1.137 ---- snmpd.c 1999/08/27 02:43:49 -*************** -*** 202,213 **** - - #define NUM_SOCKETS 32 - -! #ifdef USING_SD_HANDLERS -! static int sdlist[NUM_SOCKETS], -! sdlen = 0; -! static int portlist[NUM_SOCKETS]; -! int (*sd_handlers[NUM_SOCKETS]) (int); -! #endif - - /* - * Prototypes. ---- 202,211 ---- - - #define NUM_SOCKETS 32 - -! #ifdef USING_SMUX_MODULE -! static int sdlist[NUM_SOCKETS], sdlen = 0; -! int listen_sd; -! #endif /* USING_SMUX_MODULE */ - - /* - * Prototypes. -*************** -*** 909,914 **** ---- 907,915 ---- - struct timeval sched, *svp = &sched, - now, *nvp = &now; - int count, block; -+ #ifdef USING_SMUX_MODULE -+ int i, j, sd; -+ #endif /* USING_SMUX_MODULE */ - - - -*************** -*** 944,949 **** ---- 945,960 ---- - snmp_select_info(&numfds, &fdset, tvp, &block); - if (block == 1) - tvp = NULL; /* block without timeout */ -+ #ifdef USING_SMUX_MODULE -+ if (listen_sd >= 0) { -+ FD_SET(listen_sd, &fdset); -+ numfds = listen_sd >= numfds ? listen_sd + 1 : numfds; -+ for (i = 0; i < sdlen; i++) { -+ FD_SET(sdlist[i], &fdset); -+ numfds = sdlist[i] >= numfds ? sdlist[i] + 1 : numfds; -+ } -+ } -+ #endif /* USING_SMUX_MODULE */ - count = select(numfds, &fdset, 0, 0, tvp); - - if (count > 0){ -*************** -*** 964,969 **** ---- 975,1001 ---- - return -1; - } /* endif -- count>0 */ - -+ #ifdef USING_SMUX_MODULE -+ /* handle the SMUX sd's */ -+ if (listen_sd >= 0) { -+ for (i = 0; i < sdlen; i++) { -+ if (FD_ISSET(sdlist[i], &fdset)) { -+ if (smux_process(sdlist[i]) < 0) { -+ for (; i < (sdlen - 1); i++) { -+ sdlist[i] = sdlist[i+1]; -+ } -+ sdlen--; -+ } -+ } -+ } -+ /* new connection */ -+ if (FD_ISSET(listen_sd, &fdset)) { -+ if ((sd = smux_accept(listen_sd)) >= 0) { -+ sdlist[sdlen++] = sd; -+ } -+ } -+ } -+ #endif /* USING_SMUX_MODULE */ - - /* - * If the time 'now' is greater than the 'sched'uled time, then: -Index: agent/mibgroup/smux/smux.c -=================================================================== -RCS file: /opt/ucd-snmp/ucd-snmp/agent/mibgroup/smux/smux.c,v -retrieving revision 1.29 -diff -c -r1.29 smux.c -*** smux.c 1999/08/24 22:14:18 1.29 ---- smux.c 1999/08/27 02:43:50 -*************** -*** 69,84 **** - oid smux_objid[MAX_OID_LEN]; - u_char smux_str[SMUXMAXSTRLEN]; - -! #ifdef USING_SD_HANDLERS -! extern int sdlist[]; -! extern int sdlen; -! extern int (*sd_handlers[])(int); -! #endif - - static struct timeval smux_rcv_timeout; - static u_long smux_reqid; - -! int init_smux (void); - static u_char *smux_open_process (int, u_char *, size_t *, int *); - static u_char *smux_rreq_process (int, u_char *, size_t *); - static u_char *smux_close_process (int, u_char *, size_t *); ---- 69,80 ---- - oid smux_objid[MAX_OID_LEN]; - u_char smux_str[SMUXMAXSTRLEN]; - -! extern int listen_sd; - - static struct timeval smux_rcv_timeout; - static u_long smux_reqid; - -! void init_smux (void); - static u_char *smux_open_process (int, u_char *, size_t *, int *); - static u_char *smux_rreq_process (int, u_char *, size_t *); - static u_char *smux_close_process (int, u_char *, size_t *); -*************** -*** 161,180 **** - } - } - -! int - init_smux(void) - { - - struct sockaddr_in lo_socket; -- int smux_sd; - int one = 1; - - snmpd_register_config_handler("smuxpeer", smux_parse_peer_auth, - smux_free_peer_auth, - "OID-IDENTITY PASSWORD"); -- - /* Reqid */ - smux_reqid = 0; - - /* Receive timeout */ - smux_rcv_timeout.tv_sec = 0; ---- 157,175 ---- - } - } - -! void - init_smux(void) - { - - struct sockaddr_in lo_socket; - int one = 1; - - snmpd_register_config_handler("smuxpeer", smux_parse_peer_auth, - smux_free_peer_auth, - "OID-IDENTITY PASSWORD"); - /* Reqid */ - smux_reqid = 0; -+ listen_sd = -1; - - /* Receive timeout */ - smux_rcv_timeout.tv_sec = 0; -*************** -*** 185,222 **** - lo_socket.sin_family = AF_INET; - lo_socket.sin_port = htons((u_short) SMUXPORT); - -! if ((smux_sd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { - snmp_log_perror("[init_smux] socket failed"); -! return SMUXNOTOK; - } -! if (bind (smux_sd, (struct sockaddr *) &lo_socket, - sizeof (lo_socket)) < 0) { - snmp_log_perror("[init_smux] bind failed"); -! close(smux_sd); -! return SMUXNOTOK; - } - -! if (setsockopt (smux_sd, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, - sizeof (one)) < 0) { - snmp_log_perror("[init_smux] setsockopt(SO_KEEPALIVE) failed"); -! close(smux_sd); -! return SMUXNOTOK; - } -! if(listen(smux_sd, SOMAXCONN) == -1) { - snmp_log_perror("[init_smux] listen failed"); -! close(smux_sd); -! return SMUXNOTOK; - } -- #ifdef USING_SD_HANDLERS -- sdlist[sdlen] = smux_sd; -- sd_handlers[sdlen++] = smux_accept; -- -- DEBUGMSGTL(("smux_init","sdlen in smux_init: %d\n", sdlen)); -- #endif -- DEBUGMSGTL(("smux_init", "[smux_init] done; smux_sd is %d, smux_port is %d\n", smux_sd, -- ntohs(lo_socket.sin_port))); - -! return SMUXOK; - } - - u_char * ---- 180,216 ---- - lo_socket.sin_family = AF_INET; - lo_socket.sin_port = htons((u_short) SMUXPORT); - -! if ((listen_sd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { - snmp_log_perror("[init_smux] socket failed"); -! return; - } -! -! if (bind (listen_sd, (struct sockaddr *) &lo_socket, - sizeof (lo_socket)) < 0) { - snmp_log_perror("[init_smux] bind failed"); -! close(listen_sd); -! listen_sd = -1; -! return; - } - -! #ifdef SO_KEEPALIVE -! if (setsockopt (listen_sd, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, - sizeof (one)) < 0) { - snmp_log_perror("[init_smux] setsockopt(SO_KEEPALIVE) failed"); -! close(listen_sd); -! listen_sd = -1; -! return; - } -! #endif /* SO_KEEPALIVE */ -! -! if(listen(listen_sd, SOMAXCONN) == -1) { - snmp_log_perror("[init_smux] listen failed"); -! close(listen_sd); -! listen_sd = -1; -! return; - } - -! DEBUGMSGTL(("smux_init", "[smux_init] done; smux listen sd is %d, smux port is %d\n", listen_sd, ntohs(lo_socket.sin_port))); - } - - u_char * -*************** -*** 240,246 **** - } - if (rptr == NULL) - return NULL; -! else if (exact && (*length <= rptr->sr_name_len)) - return NULL; - - *write_method = var_smux_write; ---- 234,240 ---- - } - if (rptr == NULL) - return NULL; -! else if (exact && (*length < rptr->sr_name_len)) - return NULL; - - *write_method = var_smux_write; -*************** -*** 355,373 **** - errno = 0; - if((fd = accept(sd, (struct sockaddr *)&in_socket, &alen)) < 0) { - snmp_log_perror("[smux_accept] accept failed"); -! return SMUXNOTOK; - } else { - snmp_log(LOG_ERR, "[smux_accept] accepted fd %d - errno %d\n", fd, errno); - if (npeers + 1 == SMUXMAXPEERS) { - DEBUGMSGTL (("smux","[smux_accept] denied peer on fd %d, limit reached", fd)); - close(sd); -! return SMUXNOTOK; - } - /* now block for an OpenPDU */ - if ((len = recv(fd, (char *)data, SMUXMAXPKTSIZE, 0)) <= 0) { - DEBUGMSGTL (("smux","[smux_accept] peer on fd %d died or timed out\n", fd)); - close(fd); -! return SMUXNOTOK; - } - /* try to authorize him */ - ptr = data; ---- 349,367 ---- - errno = 0; - if((fd = accept(sd, (struct sockaddr *)&in_socket, &alen)) < 0) { - snmp_log_perror("[smux_accept] accept failed"); -! return -1; - } else { - snmp_log(LOG_ERR, "[smux_accept] accepted fd %d - errno %d\n", fd, errno); - if (npeers + 1 == SMUXMAXPEERS) { - DEBUGMSGTL (("smux","[smux_accept] denied peer on fd %d, limit reached", fd)); - close(sd); -! return -1; - } - /* now block for an OpenPDU */ - if ((len = recv(fd, (char *)data, SMUXMAXPKTSIZE, 0)) <= 0) { - DEBUGMSGTL (("smux","[smux_accept] peer on fd %d died or timed out\n", fd)); - close(fd); -! return -1; - } - /* try to authorize him */ - ptr = data; -*************** -*** 375,393 **** - smux_send_close(fd, SMUXC_PACKETFORMAT); - close(fd); - DEBUGMSGTL (("smux","[smux_accept] peer on %d sent bad open")); -! return SMUXNOTOK; - } else if (type != (u_char)SMUX_OPEN) { - smux_send_close(fd, SMUXC_PROTOCOLERROR); - close(fd); - DEBUGMSGTL (("smux","[smux_accept] peer on %d did not send open: (%d)\n", type)); -! return SMUXNOTOK; - } - ptr = smux_open_process(fd, ptr, &len, &fail); - if (fail) { - smux_send_close(fd, SMUXC_AUTHENTICATIONFAILURE); - close(fd); - DEBUGMSGTL (("smux","[smux_accept] peer on %d failed authentication\n", fd)); -! return SMUXNOTOK; - } - - /* he's OK */ ---- 369,387 ---- - smux_send_close(fd, SMUXC_PACKETFORMAT); - close(fd); - DEBUGMSGTL (("smux","[smux_accept] peer on %d sent bad open")); -! return -1; - } else if (type != (u_char)SMUX_OPEN) { - smux_send_close(fd, SMUXC_PROTOCOLERROR); - close(fd); - DEBUGMSGTL (("smux","[smux_accept] peer on %d did not send open: (%d)\n", type)); -! return -1; - } - ptr = smux_open_process(fd, ptr, &len, &fail); - if (fail) { - smux_send_close(fd, SMUXC_AUTHENTICATIONFAILURE); - close(fd); - DEBUGMSGTL (("smux","[smux_accept] peer on %d failed authentication\n", fd)); -! return -1; - } - - /* he's OK */ -*************** -*** 397,413 **** - snmp_log_perror("smux/setsockopt"); - } - #endif -- - npeers++; -! #ifdef USING_SD_HANDLERS -! sdlist[sdlen] = fd; -! sd_handlers[sdlen++] = smux_process; -! -! DEBUGMSGTL (("smux","[smux_accept] fd %d, sdlen %d\n", fd, sdlen)); -! #endif - } -! -! return SMUXOK; - } - - int ---- 391,400 ---- - snmp_log_perror("smux/setsockopt"); - } - #endif - npeers++; -! DEBUGMSGTL (("smux","[smux_accept] fd %d\n", fd)); - } -! return fd; - } - - int -*************** -*** 424,435 **** - */ - DEBUGMSGTL (("smux","[smux_process] peer on fd %d died or timed out\n", fd)); - smux_peer_cleanup(fd); -! return SMUXNOTOK; /* return value ignored */ - } - - DEBUGMSGTL (("smux","[smux_process] Processing %d bytes\n", length)); - -! error = SMUXOK; - - ptr = data; - len = length; ---- 411,422 ---- - */ - DEBUGMSGTL (("smux","[smux_process] peer on fd %d died or timed out\n", fd)); - smux_peer_cleanup(fd); -! return -1; - } - - DEBUGMSGTL (("smux","[smux_process] Processing %d bytes\n", length)); - -! error = 0; - - ptr = data; - len = length; -*************** -*** 442,474 **** - smux_send_close(fd, SMUXC_PROTOCOLERROR); - DEBUGMSGTL (("smux","[smux_process] peer on fd %d sent duplicate open?\n", fd)); - smux_peer_cleanup(fd); - break; - case SMUX_CLOSE: - ptr = smux_close_process(fd, ptr, &len); - smux_peer_cleanup(fd); - break; - case SMUX_RREQ: - ptr = smux_rreq_process(fd, ptr, &len); - break; - case SMUX_RRSP: -! error = SMUXNOTOK; - ptr = NULL; - smux_send_close(fd, SMUXC_PROTOCOLERROR); - smux_peer_cleanup(fd); - DEBUGMSGTL (("smux","[smux_process] peer on fd %d sent RRSP!\n", fd)); - break; - case SMUX_SOUT: -! error = SMUXNOTOK; - ptr = NULL; - smux_send_close(fd, SMUXC_PROTOCOLERROR); - smux_peer_cleanup(fd); - DEBUGMSGTL (("smux","This shouldn't have happened!\n")); - break; - default: - smux_send_close(fd, SMUXC_PACKETFORMAT); - smux_peer_cleanup(fd); - DEBUGMSGTL (("smux","[smux_process] Wrong type %d\n", (int)type)); -! error = SMUXNOTOK; - break; - } - } ---- 429,468 ---- - smux_send_close(fd, SMUXC_PROTOCOLERROR); - DEBUGMSGTL (("smux","[smux_process] peer on fd %d sent duplicate open?\n", fd)); - smux_peer_cleanup(fd); -+ error = -1; - break; - case SMUX_CLOSE: - ptr = smux_close_process(fd, ptr, &len); - smux_peer_cleanup(fd); -+ error = -1; - break; - case SMUX_RREQ: - ptr = smux_rreq_process(fd, ptr, &len); - break; - case SMUX_RRSP: -! error = -1; - ptr = NULL; - smux_send_close(fd, SMUXC_PROTOCOLERROR); - smux_peer_cleanup(fd); - DEBUGMSGTL (("smux","[smux_process] peer on fd %d sent RRSP!\n", fd)); - break; - case SMUX_SOUT: -! error = -1; - ptr = NULL; - smux_send_close(fd, SMUXC_PROTOCOLERROR); - smux_peer_cleanup(fd); - DEBUGMSGTL (("smux","This shouldn't have happened!\n")); - break; -+ case SMUX_TRAP: -+ /* just log it.. don't handle traps yet */ -+ snmp_log(LOG_INFO, "Got trap from peer on fd %d\n", fd); -+ ptr += len; -+ break; - default: - smux_send_close(fd, SMUXC_PACKETFORMAT); - smux_peer_cleanup(fd); - DEBUGMSGTL (("smux","[smux_process] Wrong type %d\n", (int)type)); -! error = -1; - break; - } - } -*************** -*** 690,698 **** - * belong to him. XXX for now, ignore it. - */ - return ptr; -- } - -! if (operation == SMUX_REGOP_REGISTER) { - if (priority < -1) { - DEBUGMSGTL (("smux","[smux_rreq_process] peer fd %d invalid priority", sd, priority)); - return NULL; ---- 684,692 ---- - * belong to him. XXX for now, ignore it. - */ - return ptr; - -! } else if ((operation == SMUX_REGOP_REGISTER_RO) || -! (operation == SMUX_REGOP_REGISTER_RW)) { - if (priority < -1) { - DEBUGMSGTL (("smux","[smux_rreq_process] peer fd %d invalid priority", sd, priority)); - return NULL; -*************** -*** 763,775 **** - smux_variables, sizeof(struct variable2), - 1, nrptr->sr_name, nrptr->sr_name_len); - done: -! if (smux_send_rrsp(sd, nrptr->sr_priority)) - DEBUGMSGTL (("smux","[smux_rreq_process] send failed\n")); - return ptr; - } -- -- DEBUGMSGTL (("smux","[smux_rreq_process] unknown operation\n")); -- return NULL; - } - - static void ---- 757,769 ---- - smux_variables, sizeof(struct variable2), - 1, nrptr->sr_name, nrptr->sr_name_len); - done: -! if (smux_send_rrsp(sd, nrptr->sr_priority) < 0) - DEBUGMSGTL (("smux","[smux_rreq_process] send failed\n")); - return ptr; -+ } else { -+ DEBUGMSGTL (("smux","[smux_rreq_process] unknown operation\n")); -+ return NULL; - } - } - - static void -*************** -*** 916,922 **** - type = SMUX_GETNEXT; - - if (smux_build(type, smux_reqid, objid, len, 0, NULL, -! *len, packet, &length) != SMUXOK) { - snmp_log(LOG_NOTICE, "[smux_snmp_process]: smux_build failed\n"); - return NULL; - } ---- 910,916 ---- - type = SMUX_GETNEXT; - - if (smux_build(type, smux_reqid, objid, len, 0, NULL, -! *len, packet, &length) < 0) { - snmp_log(LOG_NOTICE, "[smux_snmp_process]: smux_build failed\n"); - return NULL; - } -*************** -*** 1191,1197 **** - - *length = ptr - packet; - -! return SMUXOK; - } - - static void ---- 1185,1191 ---- - - *length = ptr - packet; - -! return 0; - } - - static void -*************** -*** 1231,1248 **** - free(rptr); - } - } -- #ifdef USING_SD_HANDLERS -- /* XXX stop paying attention to his socket */ -- for (i = 0; i < sdlen; i++) { -- if (sdlist[i] == sd) { -- for (; i < (sdlen-1); i++) { -- sdlist[i] = sdlist[i+1]; -- sd_handlers[i] = sd_handlers[i+1]; -- } -- } -- } -- sdlen--; -- #endif - - /* decrement the peer count */ - npeers--; ---- 1225,1230 ---- -*************** -*** 1271,1279 **** - for(i = 0; i < 4; i++, mask >>= 8) - *(++ptr) = (u_char)(pri & mask); - -! if((send(sd, (char *)outdata, 6, 0)) < 0) -! return SMUXNOTOK; -! else -! return SMUXOK; - } -- ---- 1253,1257 ---- - for(i = 0; i < 4; i++, mask >>= 8) - *(++ptr) = (u_char)(pri & mask); - -! return (send(sd, (char *)outdata, 6, 0)); - } -Index: agent/mibgroup/smux/smux.h -=================================================================== -RCS file: /opt/ucd-snmp/ucd-snmp/agent/mibgroup/smux/smux.h,v -retrieving revision 1.6 -diff -c -r1.6 smux.h -*** smux.h 1999/05/03 22:38:37 1.6 ---- smux.h 1999/08/27 02:43:50 -*************** -*** 3,14 **** - * Rewritten by Nick Amato . - */ - -- #define NOTINIT 0 -- #define INIT 1 -- -- #define SMUXOK 0 -- #define SMUXNOTOK -1 -- - #define SMUXPORT 199 - - #define SMUXMAXPKTSIZE 1500 ---- 3,8 ---- -*************** -*** 25,30 **** ---- 19,25 ---- - #define SMUX_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 1) - #define SMUX_GETRSP (ASN_CONTEXT | ASN_CONSTRUCTOR | 2) - #define SMUX_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 3) -+ #define SMUX_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 4) - - #define SMUXC_GOINGDOWN 0 - #define SMUXC_UNSUPPORTEDVERSION 1 -*************** -*** 36,43 **** - #define SMUX_MAX_PEERS 10 - #define SMUX_MAX_PRIORITY 2147483647 - -! #define SMUX_REGOP_DELETE 0 -! #define SMUX_REGOP_REGISTER 1 - - /* - * Authorized peers read from the config file ---- 31,39 ---- - #define SMUX_MAX_PEERS 10 - #define SMUX_MAX_PRIORITY 2147483647 - -! #define SMUX_REGOP_DELETE 0 -! #define SMUX_REGOP_REGISTER_RO 1 -! #define SMUX_REGOP_REGISTER_RW 2 - - /* - * Authorized peers read from the config file -*************** -*** 60,66 **** - struct _smux_reg *sr_next; /* next one */ - } smux_reg; - -! extern int init_smux (void); - extern int smux_accept (int); - extern u_char *smux_snmp_process (int, oid *, size_t *, size_t *, u_char *, int); - extern int smux_process (int); ---- 56,62 ---- - struct _smux_reg *sr_next; /* next one */ - } smux_reg; - -! extern void init_smux (void); - extern int smux_accept (int); - extern u_char *smux_snmp_process (int, oid *, size_t *, size_t *, u_char *, int); - extern int smux_process (int); diff --git a/net/ucd-snmp-current/patches/patch-zz b/net/ucd-snmp-current/patches/patch-zz new file mode 100644 index 00000000000..e0a91ca650f --- /dev/null +++ b/net/ucd-snmp-current/patches/patch-zz @@ -0,0 +1,676 @@ +$NetBSD: patch-zz,v 1.1 2001/04/05 15:22:29 wiz Exp $ + +Index: agent/snmpd.c +=================================================================== +RCS file: /opt/ucd-snmp/ucd-snmp/agent/snmpd.c,v +retrieving revision 1.137 +diff -c -r1.137 snmpd.c +*** snmpd.c 1999/08/23 20:54:32 1.137 +--- snmpd.c 1999/08/27 02:43:49 +*************** +*** 202,213 **** + + #define NUM_SOCKETS 32 + +! #ifdef USING_SD_HANDLERS +! static int sdlist[NUM_SOCKETS], +! sdlen = 0; +! static int portlist[NUM_SOCKETS]; +! int (*sd_handlers[NUM_SOCKETS]) (int); +! #endif + + /* + * Prototypes. +--- 202,211 ---- + + #define NUM_SOCKETS 32 + +! #ifdef USING_SMUX_MODULE +! static int sdlist[NUM_SOCKETS], sdlen = 0; +! int listen_sd; +! #endif /* USING_SMUX_MODULE */ + + /* + * Prototypes. +*************** +*** 909,914 **** +--- 907,915 ---- + struct timeval sched, *svp = &sched, + now, *nvp = &now; + int count, block; ++ #ifdef USING_SMUX_MODULE ++ int i, j, sd; ++ #endif /* USING_SMUX_MODULE */ + + + +*************** +*** 944,949 **** +--- 945,960 ---- + snmp_select_info(&numfds, &fdset, tvp, &block); + if (block == 1) + tvp = NULL; /* block without timeout */ ++ #ifdef USING_SMUX_MODULE ++ if (listen_sd >= 0) { ++ FD_SET(listen_sd, &fdset); ++ numfds = listen_sd >= numfds ? listen_sd + 1 : numfds; ++ for (i = 0; i < sdlen; i++) { ++ FD_SET(sdlist[i], &fdset); ++ numfds = sdlist[i] >= numfds ? sdlist[i] + 1 : numfds; ++ } ++ } ++ #endif /* USING_SMUX_MODULE */ + count = select(numfds, &fdset, 0, 0, tvp); + + if (count > 0){ +*************** +*** 964,969 **** +--- 975,1001 ---- + return -1; + } /* endif -- count>0 */ + ++ #ifdef USING_SMUX_MODULE ++ /* handle the SMUX sd's */ ++ if (listen_sd >= 0) { ++ for (i = 0; i < sdlen; i++) { ++ if (FD_ISSET(sdlist[i], &fdset)) { ++ if (smux_process(sdlist[i]) < 0) { ++ for (; i < (sdlen - 1); i++) { ++ sdlist[i] = sdlist[i+1]; ++ } ++ sdlen--; ++ } ++ } ++ } ++ /* new connection */ ++ if (FD_ISSET(listen_sd, &fdset)) { ++ if ((sd = smux_accept(listen_sd)) >= 0) { ++ sdlist[sdlen++] = sd; ++ } ++ } ++ } ++ #endif /* USING_SMUX_MODULE */ + + /* + * If the time 'now' is greater than the 'sched'uled time, then: +Index: agent/mibgroup/smux/smux.c +=================================================================== +RCS file: /opt/ucd-snmp/ucd-snmp/agent/mibgroup/smux/smux.c,v +retrieving revision 1.29 +diff -c -r1.29 smux.c +*** smux.c 1999/08/24 22:14:18 1.29 +--- smux.c 1999/08/27 02:43:50 +*************** +*** 69,84 **** + oid smux_objid[MAX_OID_LEN]; + u_char smux_str[SMUXMAXSTRLEN]; + +! #ifdef USING_SD_HANDLERS +! extern int sdlist[]; +! extern int sdlen; +! extern int (*sd_handlers[])(int); +! #endif + + static struct timeval smux_rcv_timeout; + static u_long smux_reqid; + +! int init_smux (void); + static u_char *smux_open_process (int, u_char *, size_t *, int *); + static u_char *smux_rreq_process (int, u_char *, size_t *); + static u_char *smux_close_process (int, u_char *, size_t *); +--- 69,80 ---- + oid smux_objid[MAX_OID_LEN]; + u_char smux_str[SMUXMAXSTRLEN]; + +! extern int listen_sd; + + static struct timeval smux_rcv_timeout; + static u_long smux_reqid; + +! void init_smux (void); + static u_char *smux_open_process (int, u_char *, size_t *, int *); + static u_char *smux_rreq_process (int, u_char *, size_t *); + static u_char *smux_close_process (int, u_char *, size_t *); +*************** +*** 161,180 **** + } + } + +! int + init_smux(void) + { + + struct sockaddr_in lo_socket; +- int smux_sd; + int one = 1; + + snmpd_register_config_handler("smuxpeer", smux_parse_peer_auth, + smux_free_peer_auth, + "OID-IDENTITY PASSWORD"); +- + /* Reqid */ + smux_reqid = 0; + + /* Receive timeout */ + smux_rcv_timeout.tv_sec = 0; +--- 157,175 ---- + } + } + +! void + init_smux(void) + { + + struct sockaddr_in lo_socket; + int one = 1; + + snmpd_register_config_handler("smuxpeer", smux_parse_peer_auth, + smux_free_peer_auth, + "OID-IDENTITY PASSWORD"); + /* Reqid */ + smux_reqid = 0; ++ listen_sd = -1; + + /* Receive timeout */ + smux_rcv_timeout.tv_sec = 0; +*************** +*** 185,222 **** + lo_socket.sin_family = AF_INET; + lo_socket.sin_port = htons((u_short) SMUXPORT); + +! if ((smux_sd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { + snmp_log_perror("[init_smux] socket failed"); +! return SMUXNOTOK; + } +! if (bind (smux_sd, (struct sockaddr *) &lo_socket, + sizeof (lo_socket)) < 0) { + snmp_log_perror("[init_smux] bind failed"); +! close(smux_sd); +! return SMUXNOTOK; + } + +! if (setsockopt (smux_sd, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, + sizeof (one)) < 0) { + snmp_log_perror("[init_smux] setsockopt(SO_KEEPALIVE) failed"); +! close(smux_sd); +! return SMUXNOTOK; + } +! if(listen(smux_sd, SOMAXCONN) == -1) { + snmp_log_perror("[init_smux] listen failed"); +! close(smux_sd); +! return SMUXNOTOK; + } +- #ifdef USING_SD_HANDLERS +- sdlist[sdlen] = smux_sd; +- sd_handlers[sdlen++] = smux_accept; +- +- DEBUGMSGTL(("smux_init","sdlen in smux_init: %d\n", sdlen)); +- #endif +- DEBUGMSGTL(("smux_init", "[smux_init] done; smux_sd is %d, smux_port is %d\n", smux_sd, +- ntohs(lo_socket.sin_port))); + +! return SMUXOK; + } + + u_char * +--- 180,216 ---- + lo_socket.sin_family = AF_INET; + lo_socket.sin_port = htons((u_short) SMUXPORT); + +! if ((listen_sd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { + snmp_log_perror("[init_smux] socket failed"); +! return; + } +! +! if (bind (listen_sd, (struct sockaddr *) &lo_socket, + sizeof (lo_socket)) < 0) { + snmp_log_perror("[init_smux] bind failed"); +! close(listen_sd); +! listen_sd = -1; +! return; + } + +! #ifdef SO_KEEPALIVE +! if (setsockopt (listen_sd, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, + sizeof (one)) < 0) { + snmp_log_perror("[init_smux] setsockopt(SO_KEEPALIVE) failed"); +! close(listen_sd); +! listen_sd = -1; +! return; + } +! #endif /* SO_KEEPALIVE */ +! +! if(listen(listen_sd, SOMAXCONN) == -1) { + snmp_log_perror("[init_smux] listen failed"); +! close(listen_sd); +! listen_sd = -1; +! return; + } + +! DEBUGMSGTL(("smux_init", "[smux_init] done; smux listen sd is %d, smux port is %d\n", listen_sd, ntohs(lo_socket.sin_port))); + } + + u_char * +*************** +*** 240,246 **** + } + if (rptr == NULL) + return NULL; +! else if (exact && (*length <= rptr->sr_name_len)) + return NULL; + + *write_method = var_smux_write; +--- 234,240 ---- + } + if (rptr == NULL) + return NULL; +! else if (exact && (*length < rptr->sr_name_len)) + return NULL; + + *write_method = var_smux_write; +*************** +*** 355,373 **** + errno = 0; + if((fd = accept(sd, (struct sockaddr *)&in_socket, &alen)) < 0) { + snmp_log_perror("[smux_accept] accept failed"); +! return SMUXNOTOK; + } else { + snmp_log(LOG_ERR, "[smux_accept] accepted fd %d - errno %d\n", fd, errno); + if (npeers + 1 == SMUXMAXPEERS) { + DEBUGMSGTL (("smux","[smux_accept] denied peer on fd %d, limit reached", fd)); + close(sd); +! return SMUXNOTOK; + } + /* now block for an OpenPDU */ + if ((len = recv(fd, (char *)data, SMUXMAXPKTSIZE, 0)) <= 0) { + DEBUGMSGTL (("smux","[smux_accept] peer on fd %d died or timed out\n", fd)); + close(fd); +! return SMUXNOTOK; + } + /* try to authorize him */ + ptr = data; +--- 349,367 ---- + errno = 0; + if((fd = accept(sd, (struct sockaddr *)&in_socket, &alen)) < 0) { + snmp_log_perror("[smux_accept] accept failed"); +! return -1; + } else { + snmp_log(LOG_ERR, "[smux_accept] accepted fd %d - errno %d\n", fd, errno); + if (npeers + 1 == SMUXMAXPEERS) { + DEBUGMSGTL (("smux","[smux_accept] denied peer on fd %d, limit reached", fd)); + close(sd); +! return -1; + } + /* now block for an OpenPDU */ + if ((len = recv(fd, (char *)data, SMUXMAXPKTSIZE, 0)) <= 0) { + DEBUGMSGTL (("smux","[smux_accept] peer on fd %d died or timed out\n", fd)); + close(fd); +! return -1; + } + /* try to authorize him */ + ptr = data; +*************** +*** 375,393 **** + smux_send_close(fd, SMUXC_PACKETFORMAT); + close(fd); + DEBUGMSGTL (("smux","[smux_accept] peer on %d sent bad open")); +! return SMUXNOTOK; + } else if (type != (u_char)SMUX_OPEN) { + smux_send_close(fd, SMUXC_PROTOCOLERROR); + close(fd); + DEBUGMSGTL (("smux","[smux_accept] peer on %d did not send open: (%d)\n", type)); +! return SMUXNOTOK; + } + ptr = smux_open_process(fd, ptr, &len, &fail); + if (fail) { + smux_send_close(fd, SMUXC_AUTHENTICATIONFAILURE); + close(fd); + DEBUGMSGTL (("smux","[smux_accept] peer on %d failed authentication\n", fd)); +! return SMUXNOTOK; + } + + /* he's OK */ +--- 369,387 ---- + smux_send_close(fd, SMUXC_PACKETFORMAT); + close(fd); + DEBUGMSGTL (("smux","[smux_accept] peer on %d sent bad open")); +! return -1; + } else if (type != (u_char)SMUX_OPEN) { + smux_send_close(fd, SMUXC_PROTOCOLERROR); + close(fd); + DEBUGMSGTL (("smux","[smux_accept] peer on %d did not send open: (%d)\n", type)); +! return -1; + } + ptr = smux_open_process(fd, ptr, &len, &fail); + if (fail) { + smux_send_close(fd, SMUXC_AUTHENTICATIONFAILURE); + close(fd); + DEBUGMSGTL (("smux","[smux_accept] peer on %d failed authentication\n", fd)); +! return -1; + } + + /* he's OK */ +*************** +*** 397,413 **** + snmp_log_perror("smux/setsockopt"); + } + #endif +- + npeers++; +! #ifdef USING_SD_HANDLERS +! sdlist[sdlen] = fd; +! sd_handlers[sdlen++] = smux_process; +! +! DEBUGMSGTL (("smux","[smux_accept] fd %d, sdlen %d\n", fd, sdlen)); +! #endif + } +! +! return SMUXOK; + } + + int +--- 391,400 ---- + snmp_log_perror("smux/setsockopt"); + } + #endif + npeers++; +! DEBUGMSGTL (("smux","[smux_accept] fd %d\n", fd)); + } +! return fd; + } + + int +*************** +*** 424,435 **** + */ + DEBUGMSGTL (("smux","[smux_process] peer on fd %d died or timed out\n", fd)); + smux_peer_cleanup(fd); +! return SMUXNOTOK; /* return value ignored */ + } + + DEBUGMSGTL (("smux","[smux_process] Processing %d bytes\n", length)); + +! error = SMUXOK; + + ptr = data; + len = length; +--- 411,422 ---- + */ + DEBUGMSGTL (("smux","[smux_process] peer on fd %d died or timed out\n", fd)); + smux_peer_cleanup(fd); +! return -1; + } + + DEBUGMSGTL (("smux","[smux_process] Processing %d bytes\n", length)); + +! error = 0; + + ptr = data; + len = length; +*************** +*** 442,474 **** + smux_send_close(fd, SMUXC_PROTOCOLERROR); + DEBUGMSGTL (("smux","[smux_process] peer on fd %d sent duplicate open?\n", fd)); + smux_peer_cleanup(fd); + break; + case SMUX_CLOSE: + ptr = smux_close_process(fd, ptr, &len); + smux_peer_cleanup(fd); + break; + case SMUX_RREQ: + ptr = smux_rreq_process(fd, ptr, &len); + break; + case SMUX_RRSP: +! error = SMUXNOTOK; + ptr = NULL; + smux_send_close(fd, SMUXC_PROTOCOLERROR); + smux_peer_cleanup(fd); + DEBUGMSGTL (("smux","[smux_process] peer on fd %d sent RRSP!\n", fd)); + break; + case SMUX_SOUT: +! error = SMUXNOTOK; + ptr = NULL; + smux_send_close(fd, SMUXC_PROTOCOLERROR); + smux_peer_cleanup(fd); + DEBUGMSGTL (("smux","This shouldn't have happened!\n")); + break; + default: + smux_send_close(fd, SMUXC_PACKETFORMAT); + smux_peer_cleanup(fd); + DEBUGMSGTL (("smux","[smux_process] Wrong type %d\n", (int)type)); +! error = SMUXNOTOK; + break; + } + } +--- 429,468 ---- + smux_send_close(fd, SMUXC_PROTOCOLERROR); + DEBUGMSGTL (("smux","[smux_process] peer on fd %d sent duplicate open?\n", fd)); + smux_peer_cleanup(fd); ++ error = -1; + break; + case SMUX_CLOSE: + ptr = smux_close_process(fd, ptr, &len); + smux_peer_cleanup(fd); ++ error = -1; + break; + case SMUX_RREQ: + ptr = smux_rreq_process(fd, ptr, &len); + break; + case SMUX_RRSP: +! error = -1; + ptr = NULL; + smux_send_close(fd, SMUXC_PROTOCOLERROR); + smux_peer_cleanup(fd); + DEBUGMSGTL (("smux","[smux_process] peer on fd %d sent RRSP!\n", fd)); + break; + case SMUX_SOUT: +! error = -1; + ptr = NULL; + smux_send_close(fd, SMUXC_PROTOCOLERROR); + smux_peer_cleanup(fd); + DEBUGMSGTL (("smux","This shouldn't have happened!\n")); + break; ++ case SMUX_TRAP: ++ /* just log it.. don't handle traps yet */ ++ snmp_log(LOG_INFO, "Got trap from peer on fd %d\n", fd); ++ ptr += len; ++ break; + default: + smux_send_close(fd, SMUXC_PACKETFORMAT); + smux_peer_cleanup(fd); + DEBUGMSGTL (("smux","[smux_process] Wrong type %d\n", (int)type)); +! error = -1; + break; + } + } +*************** +*** 690,698 **** + * belong to him. XXX for now, ignore it. + */ + return ptr; +- } + +! if (operation == SMUX_REGOP_REGISTER) { + if (priority < -1) { + DEBUGMSGTL (("smux","[smux_rreq_process] peer fd %d invalid priority", sd, priority)); + return NULL; +--- 684,692 ---- + * belong to him. XXX for now, ignore it. + */ + return ptr; + +! } else if ((operation == SMUX_REGOP_REGISTER_RO) || +! (operation == SMUX_REGOP_REGISTER_RW)) { + if (priority < -1) { + DEBUGMSGTL (("smux","[smux_rreq_process] peer fd %d invalid priority", sd, priority)); + return NULL; +*************** +*** 763,775 **** + smux_variables, sizeof(struct variable2), + 1, nrptr->sr_name, nrptr->sr_name_len); + done: +! if (smux_send_rrsp(sd, nrptr->sr_priority)) + DEBUGMSGTL (("smux","[smux_rreq_process] send failed\n")); + return ptr; + } +- +- DEBUGMSGTL (("smux","[smux_rreq_process] unknown operation\n")); +- return NULL; + } + + static void +--- 757,769 ---- + smux_variables, sizeof(struct variable2), + 1, nrptr->sr_name, nrptr->sr_name_len); + done: +! if (smux_send_rrsp(sd, nrptr->sr_priority) < 0) + DEBUGMSGTL (("smux","[smux_rreq_process] send failed\n")); + return ptr; ++ } else { ++ DEBUGMSGTL (("smux","[smux_rreq_process] unknown operation\n")); ++ return NULL; + } + } + + static void +*************** +*** 916,922 **** + type = SMUX_GETNEXT; + + if (smux_build(type, smux_reqid, objid, len, 0, NULL, +! *len, packet, &length) != SMUXOK) { + snmp_log(LOG_NOTICE, "[smux_snmp_process]: smux_build failed\n"); + return NULL; + } +--- 910,916 ---- + type = SMUX_GETNEXT; + + if (smux_build(type, smux_reqid, objid, len, 0, NULL, +! *len, packet, &length) < 0) { + snmp_log(LOG_NOTICE, "[smux_snmp_process]: smux_build failed\n"); + return NULL; + } +*************** +*** 1191,1197 **** + + *length = ptr - packet; + +! return SMUXOK; + } + + static void +--- 1185,1191 ---- + + *length = ptr - packet; + +! return 0; + } + + static void +*************** +*** 1231,1248 **** + free(rptr); + } + } +- #ifdef USING_SD_HANDLERS +- /* XXX stop paying attention to his socket */ +- for (i = 0; i < sdlen; i++) { +- if (sdlist[i] == sd) { +- for (; i < (sdlen-1); i++) { +- sdlist[i] = sdlist[i+1]; +- sd_handlers[i] = sd_handlers[i+1]; +- } +- } +- } +- sdlen--; +- #endif + + /* decrement the peer count */ + npeers--; +--- 1225,1230 ---- +*************** +*** 1271,1279 **** + for(i = 0; i < 4; i++, mask >>= 8) + *(++ptr) = (u_char)(pri & mask); + +! if((send(sd, (char *)outdata, 6, 0)) < 0) +! return SMUXNOTOK; +! else +! return SMUXOK; + } +- +--- 1253,1257 ---- + for(i = 0; i < 4; i++, mask >>= 8) + *(++ptr) = (u_char)(pri & mask); + +! return (send(sd, (char *)outdata, 6, 0)); + } +Index: agent/mibgroup/smux/smux.h +=================================================================== +RCS file: /opt/ucd-snmp/ucd-snmp/agent/mibgroup/smux/smux.h,v +retrieving revision 1.6 +diff -c -r1.6 smux.h +*** smux.h 1999/05/03 22:38:37 1.6 +--- smux.h 1999/08/27 02:43:50 +*************** +*** 3,14 **** + * Rewritten by Nick Amato . + */ + +- #define NOTINIT 0 +- #define INIT 1 +- +- #define SMUXOK 0 +- #define SMUXNOTOK -1 +- + #define SMUXPORT 199 + + #define SMUXMAXPKTSIZE 1500 +--- 3,8 ---- +*************** +*** 25,30 **** +--- 19,25 ---- + #define SMUX_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 1) + #define SMUX_GETRSP (ASN_CONTEXT | ASN_CONSTRUCTOR | 2) + #define SMUX_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 3) ++ #define SMUX_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 4) + + #define SMUXC_GOINGDOWN 0 + #define SMUXC_UNSUPPORTEDVERSION 1 +*************** +*** 36,43 **** + #define SMUX_MAX_PEERS 10 + #define SMUX_MAX_PRIORITY 2147483647 + +! #define SMUX_REGOP_DELETE 0 +! #define SMUX_REGOP_REGISTER 1 + + /* + * Authorized peers read from the config file +--- 31,39 ---- + #define SMUX_MAX_PEERS 10 + #define SMUX_MAX_PRIORITY 2147483647 + +! #define SMUX_REGOP_DELETE 0 +! #define SMUX_REGOP_REGISTER_RO 1 +! #define SMUX_REGOP_REGISTER_RW 2 + + /* + * Authorized peers read from the config file +*************** +*** 60,66 **** + struct _smux_reg *sr_next; /* next one */ + } smux_reg; + +! extern int init_smux (void); + extern int smux_accept (int); + extern u_char *smux_snmp_process (int, oid *, size_t *, size_t *, u_char *, int); + extern int smux_process (int); +--- 56,62 ---- + struct _smux_reg *sr_next; /* next one */ + } smux_reg; + +! extern void init_smux (void); + extern int smux_accept (int); + extern u_char *smux_snmp_process (int, oid *, size_t *, size_t *, u_char *, int); + extern int smux_process (int); -- cgit v1.2.3