snmp/snmp.patch

changeset 325
6601d28cfe52
child 353
198005e4aad2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/snmp/snmp.patch	Fri Mar 25 20:06:11 2011 +0100
     1.3 @@ -0,0 +1,196 @@
     1.4 +Index: Makefile.in
     1.5 +--- Makefile.in.orig	2010-09-10 06:23:07.000000000 +0200
     1.6 ++++ Makefile.in	2010-10-09 09:56:09.000000000 +0200
     1.7 +@@ -18,7 +18,7 @@
     1.8 + INCLUDESUBDIR=system
     1.9 + INCLUDESUBDIRHEADERS= aix.h bsd.h bsdi3.h bsdi4.h bsdi.h cygwin.h \
    1.10 + 	darwin.h darwin7.h darwin8.h darwin9.h darwin10.h dragonfly.h dynix.h \
    1.11 +-	freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd.h \
    1.12 ++	freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd7.h freebsd8.h freebsd9.h freebsd.h \
    1.13 + 	generic.h \
    1.14 + 	hpux.h irix.h linux.h mingw32.h mips.h netbsd.h openbsd.h osf5.h \
    1.15 + 	solaris2.3.h solaris2.4.h solaris2.5.h solaris2.6.h \
    1.16 +Index: agent/auto_nlist.c
    1.17 +--- agent/auto_nlist.c.orig	2010-07-29 16:58:47.000000000 +0200
    1.18 ++++ agent/auto_nlist.c	2010-10-09 09:08:23.000000000 +0200
    1.19 +@@ -53,6 +53,7 @@
    1.20 +     }
    1.21 +     if (*ptr == 0) {
    1.22 +         *ptr = (struct autonlist *) malloc(sizeof(struct autonlist));
    1.23 ++	memset(*ptr, 0, sizeof(struct autonlist));
    1.24 +         it = *ptr;
    1.25 +         it->left = 0;
    1.26 +         it->right = 0;
    1.27 +Index: agent/mibgroup/mibII/tcp.c
    1.28 +--- agent/mibgroup/mibII/tcp.c.orig	2010-08-13 17:04:33.000000000 +0200
    1.29 ++++ agent/mibgroup/mibII/tcp.c	2010-10-09 09:08:23.000000000 +0200
    1.30 +@@ -87,7 +87,7 @@
    1.31 +                  * But only define it under FreeBSD, since it
    1.32 +                  *   breaks other systems (notable AIX)
    1.33 +                  */
    1.34 +-#ifdef freebsd4
    1.35 ++#if defined (freebsd4) || defined (__NetBSD__)
    1.36 + int  hz = 1000;
    1.37 + #endif
    1.38 + 
    1.39 +Index: agent/mibgroup/mibII/tcpTable.c
    1.40 +--- agent/mibgroup/mibII/tcpTable.c.orig	2010-06-16 15:13:25.000000000 +0200
    1.41 ++++ agent/mibgroup/mibII/tcpTable.c	2010-10-09 09:08:23.000000000 +0200
    1.42 +@@ -104,6 +104,11 @@
    1.43 + #define	TCPTABLE_REMOTEPORT	pcb.inp_fport
    1.44 + #define	TCPTABLE_IS_LINKED_LIST
    1.45 + 
    1.46 ++#if defined(__FreeBSD__)
    1.47 ++#undef  INP_NEXT_SYMBOL
    1.48 ++#define INP_NEXT_SYMBOL inp_next
    1.49 ++#endif
    1.50 ++
    1.51 + #endif                          /* linux */
    1.52 + #endif                          /* WIN32 cygwin */
    1.53 + #endif                          /* solaris2 */
    1.54 +@@ -867,12 +872,17 @@
    1.55 +         nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
    1.56 +         if (!nnew)
    1.57 +             break;
    1.58 ++#if defined(__FreeBSD__)
    1.59 ++        memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xi_inp),
    1.60 ++                           sizeof(struct inpcb));
    1.61 ++#else
    1.62 +         nnew->state = StateMap[((NS_ELEM *) xig)->xt_tp.t_state];
    1.63 +         if (nnew->state == 5 /* established */ ||
    1.64 +             nnew->state == 8 /*  closeWait  */ )
    1.65 +             tcp_estab++;
    1.66 +         memcpy(&(nnew->pcb), &(((NS_ELEM *) xig)->xt_inp),
    1.67 +                            sizeof(struct inpcb));
    1.68 ++#endif
    1.69 + 
    1.70 + 	nnew->inp_next = tcp_head;
    1.71 + 	tcp_head   = nnew;
    1.72 +Index: agent/mibgroup/ucd-snmp/diskio.c
    1.73 +--- agent/mibgroup/ucd-snmp/diskio.c.orig	2010-08-13 17:04:33.000000000 +0200
    1.74 ++++ agent/mibgroup/ucd-snmp/diskio.c	2010-10-09 09:08:23.000000000 +0200
    1.75 +@@ -618,6 +618,20 @@
    1.76 +     case DISKIO_DEVICE:
    1.77 +         *var_len = strlen(stat->dinfo->devices[indx].device_name);
    1.78 +         return (u_char *) stat->dinfo->devices[indx].device_name;
    1.79 ++#if defined(freebsd5) && (__FreeBSD_version >= 500107)
    1.80 ++    case DISKIO_NREAD:
    1.81 ++        long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ];
    1.82 ++        return (u_char *) & long_ret;
    1.83 ++    case DISKIO_NWRITTEN:
    1.84 ++        long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_WRITE];
    1.85 ++        return (u_char *) & long_ret;
    1.86 ++    case DISKIO_READS:
    1.87 ++        long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_READ];
    1.88 ++        return (u_char *) & long_ret;
    1.89 ++    case DISKIO_WRITES:
    1.90 ++        long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_WRITE];
    1.91 ++        return (u_char *) & long_ret;
    1.92 ++#else
    1.93 +     case DISKIO_NREAD:
    1.94 + #if defined(freebsd5) && __FreeBSD_version >= 500107
    1.95 +         long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ];
    1.96 +@@ -675,6 +689,7 @@
    1.97 +     case DISKIO_LA15:
    1.98 +         long_ret = devloads[indx].la15;
    1.99 +         return (u_char *) & long_ret;
   1.100 ++#endif
   1.101 + 
   1.102 +     default:
   1.103 +         ERROR_MSG("diskio.c: don't know how to handle this request.");
   1.104 +Index: agent/mibgroup/ucd-snmp/memory_solaris2.c
   1.105 +--- agent/mibgroup/ucd-snmp/memory_solaris2.c.orig	2008-10-21 23:10:43.000000000 +0200
   1.106 ++++ agent/mibgroup/ucd-snmp/memory_solaris2.c	2010-10-09 09:08:23.000000000 +0200
   1.107 +@@ -1,3 +1,4 @@
   1.108 ++#undef _FILE_OFFSET_BITS /* swapctl doesn't support 64bit off_t */
   1.109 + #include <net-snmp/net-snmp-config.h>   /* local SNMP configuration details */
   1.110 + #if HAVE_STRING_H
   1.111 + #include <string.h>
   1.112 +Index: agent/mibgroup/ucd-snmp/proc.c
   1.113 +--- agent/mibgroup/ucd-snmp/proc.c.orig	2010-07-29 16:58:47.000000000 +0200
   1.114 ++++ agent/mibgroup/ucd-snmp/proc.c	2010-10-09 09:08:23.000000000 +0200
   1.115 +@@ -1,3 +1,6 @@
   1.116 ++#ifdef solaris2
   1.117 ++#undef _FILE_OFFSET_BITS /* solaris procfs doesn't support 64bit off_t */
   1.118 ++#endif
   1.119 + #include <net-snmp/net-snmp-config.h>
   1.120 + 
   1.121 + #ifdef solaris2
   1.122 +Index: agent/mibgroup/util_funcs.c
   1.123 +--- agent/mibgroup/util_funcs.c.orig	2010-05-16 20:12:40.000000000 +0200
   1.124 ++++ agent/mibgroup/util_funcs.c	2010-10-09 09:08:23.000000000 +0200
   1.125 +@@ -457,6 +457,9 @@
   1.126 +     int             fd[2][2], i, cnt;
   1.127 +     char            ctmp[STRMAX], *cptr1, *cptr2, argvs[STRMAX], **argv,
   1.128 +         **aptr;
   1.129 ++
   1.130 ++    *pid = -1;  /* open_persist_pipe ignores return code but checks *pid */
   1.131 ++
   1.132 +     /*
   1.133 +      * Setup our pipes 
   1.134 +      */
   1.135 +Index: agent/snmpd.c
   1.136 +--- agent/snmpd.c.orig	2010-08-17 20:31:31.000000000 +0200
   1.137 ++++ agent/snmpd.c	2010-10-09 09:08:23.000000000 +0200
   1.138 +@@ -429,7 +429,7 @@
   1.139 +     int             uid = 0, gid = 0;
   1.140 +     int             agent_mode = -1;
   1.141 +     char           *cptr, **argvptr;
   1.142 +-    char           *pid_file = NULL;
   1.143 ++    char           *pid_file = "@l_prefix@/var/snmp/snmpd.pid";
   1.144 +     char            option_compatability[] = "-Le";
   1.145 + #if HAVE_GETPID
   1.146 +     int fd;
   1.147 +Index: apps/snmptrapd.c
   1.148 +--- apps/snmptrapd.c.orig	2010-08-13 20:50:07.000000000 +0200
   1.149 ++++ apps/snmptrapd.c	2010-10-09 09:08:23.000000000 +0200
   1.150 +@@ -652,6 +652,7 @@
   1.151 +      */
   1.152 + #if HAVE_GETPID
   1.153 +     strcat(options, "p:");
   1.154 ++    parse_config_pidFile(NULL, "@l_prefix@/var/snmp/snmptrapd.pid");
   1.155 + #endif
   1.156 + 
   1.157 + #ifdef WIN32
   1.158 +Index: include/net-snmp/library/system.h
   1.159 +--- include/net-snmp/library/system.h.orig	2010-03-25 16:06:26.000000000 +0100
   1.160 ++++ include/net-snmp/library/system.h	2010-10-09 09:56:40.000000000 +0200
   1.161 +@@ -141,7 +141,8 @@
   1.162 + #endif
   1.163 + #ifndef HAVE_SETENV
   1.164 +     NETSNMP_IMPORT
   1.165 +-    int             setenv(const char *, const char *, int);
   1.166 ++    int             __netsnmp_setenv(const char *, const char *, int);
   1.167 ++#   define          setenv(a,b,c) __netsnmp_setenv(a,b,c)
   1.168 + #endif
   1.169 + 
   1.170 +     NETSNMP_IMPORT
   1.171 +Index: include/net-snmp/system/freebsd8.h
   1.172 +--- include/net-snmp/system/freebsd8.h.orig	2010-02-14 20:29:08.000000000 +0100
   1.173 ++++ include/net-snmp/system/freebsd8.h	2010-10-09 09:08:23.000000000 +0200
   1.174 +@@ -1,3 +1,6 @@
   1.175 ++/* freebsd8 is a superset of freebsd7 */
   1.176 ++#include "freebsd7.h"
   1.177 ++#define freebsd7 freebsd7
   1.178 + /* freebsd8 is a superset of freebsd4 */
   1.179 + #include "freebsd4.h"
   1.180 + #define freebsd4 freebsd4
   1.181 +Index: include/net-snmp/system/freebsd9.h
   1.182 +--- include/net-snmp/system/freebsd9.h.orig	2010-10-09 09:08:23.000000000 +0200
   1.183 ++++ include/net-snmp/system/freebsd9.h	2010-10-09 09:08:23.000000000 +0200
   1.184 +@@ -0,0 +1,3 @@
   1.185 ++/* freebsd9 is a superset of freebsd8 */
   1.186 ++#include "freebsd8.h"
   1.187 ++#define freebsd8 freebsd8
   1.188 +Index: snmplib/system.c
   1.189 +--- snmplib/system.c.orig	2010-07-29 16:58:47.000000000 +0200
   1.190 ++++ snmplib/system.c	2010-10-09 09:08:23.000000000 +0200
   1.191 +@@ -837,7 +837,7 @@
   1.192 + 
   1.193 + #ifndef HAVE_SETENV
   1.194 + int
   1.195 +-setenv(const char *name, const char *value, int overwrite)
   1.196 ++__netsnmp_setenv(const char *name, const char *value, int overwrite)
   1.197 + {
   1.198 +     char           *cp;
   1.199 +     int             ret;

mercurial