snmp/snmp.patch

Tue, 28 Aug 2012 18:28:20 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:28:20 +0200
changeset 524
241043c7d657
parent 325
6601d28cfe52
child 588
300d43423c2e
permissions
-rw-r--r--

Update version, modernize packaging, and slightly correct build configuration.

michael@325 1 Index: Makefile.in
michael@353 2 diff -Nau Makefile.in.orig Makefile.in
michael@353 3 --- Makefile.in.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 4 +++ Makefile.in 2011-09-15 09:22:50.255341188 +0200
michael@353 5 @@ -19,7 +19,7 @@
michael@325 6 INCLUDESUBDIR=system
michael@325 7 INCLUDESUBDIRHEADERS= aix.h bsd.h bsdi3.h bsdi4.h bsdi.h cygwin.h \
michael@325 8 darwin.h darwin7.h darwin8.h darwin9.h darwin10.h dragonfly.h dynix.h \
michael@325 9 - freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd.h \
michael@325 10 + freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd7.h freebsd8.h freebsd9.h freebsd.h \
michael@325 11 generic.h \
michael@325 12 hpux.h irix.h linux.h mingw32.h mips.h netbsd.h openbsd.h osf5.h \
michael@325 13 solaris2.3.h solaris2.4.h solaris2.5.h solaris2.6.h \
michael@325 14 Index: agent/auto_nlist.c
michael@353 15 diff -Nau agent/auto_nlist.c.orig agent/auto_nlist.c
michael@353 16 --- agent/auto_nlist.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 17 +++ agent/auto_nlist.c 2011-09-15 09:22:50.256627584 +0200
michael@325 18 @@ -53,6 +53,7 @@
michael@325 19 }
michael@325 20 if (*ptr == 0) {
michael@325 21 *ptr = (struct autonlist *) malloc(sizeof(struct autonlist));
michael@325 22 + memset(*ptr, 0, sizeof(struct autonlist));
michael@325 23 it = *ptr;
michael@325 24 it->left = 0;
michael@325 25 it->right = 0;
michael@325 26 Index: agent/mibgroup/mibII/tcp.c
michael@353 27 diff -Nau agent/mibgroup/mibII/tcp.c.orig agent/mibgroup/mibII/tcp.c
michael@353 28 --- agent/mibgroup/mibII/tcp.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 29 +++ agent/mibgroup/mibII/tcp.c 2011-09-15 09:22:50.258135285 +0200
michael@353 30 @@ -88,7 +88,7 @@
michael@325 31 * But only define it under FreeBSD, since it
michael@325 32 * breaks other systems (notable AIX)
michael@325 33 */
michael@325 34 -#ifdef freebsd4
michael@325 35 +#if defined (freebsd4) || defined (__NetBSD__)
michael@325 36 int hz = 1000;
michael@325 37 #endif
michael@325 38
michael@325 39 Index: agent/mibgroup/mibII/tcpTable.c
michael@353 40 diff -Nau agent/mibgroup/mibII/tcpTable.c.orig agent/mibgroup/mibII/tcpTable.c
michael@353 41 --- agent/mibgroup/mibII/tcpTable.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 42 +++ agent/mibgroup/mibII/tcpTable.c 2011-09-15 09:22:50.260414149 +0200
michael@353 43 @@ -110,6 +110,11 @@
michael@325 44 #define TCPTABLE_REMOTEPORT pcb.inp_fport
michael@325 45 #define TCPTABLE_IS_LINKED_LIST
michael@325 46
michael@325 47 +#if defined(__FreeBSD__)
michael@325 48 +#undef INP_NEXT_SYMBOL
michael@325 49 +#define INP_NEXT_SYMBOL inp_next
michael@325 50 +#endif
michael@325 51 +
michael@325 52 #endif /* linux */
michael@325 53 #endif /* WIN32 cygwin */
michael@325 54 #endif /* solaris2 */
michael@353 55 @@ -892,12 +897,17 @@
michael@325 56 nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
michael@325 57 if (!nnew)
michael@325 58 break;
michael@325 59 +#if defined(__FreeBSD__)
michael@325 60 + memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xi_inp),
michael@325 61 + sizeof(struct inpcb));
michael@325 62 +#else
michael@325 63 nnew->state = StateMap[((NS_ELEM *) xig)->xt_tp.t_state];
michael@325 64 if (nnew->state == 5 /* established */ ||
michael@325 65 nnew->state == 8 /* closeWait */ )
michael@325 66 tcp_estab++;
michael@325 67 memcpy(&(nnew->pcb), &(((NS_ELEM *) xig)->xt_inp),
michael@325 68 sizeof(struct inpcb));
michael@325 69 +#endif
michael@325 70
michael@353 71 if (nnew->pcb.inp_vflag & INP_IPV6)
michael@353 72 free(nnew);
michael@325 73 Index: agent/mibgroup/ucd-snmp/diskio.c
michael@353 74 diff -Nau agent/mibgroup/ucd-snmp/diskio.c.orig agent/mibgroup/ucd-snmp/diskio.c
michael@353 75 --- agent/mibgroup/ucd-snmp/diskio.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 76 +++ agent/mibgroup/ucd-snmp/diskio.c 2011-09-15 09:22:50.263188251 +0200
michael@353 77 @@ -800,6 +800,20 @@
michael@325 78 case DISKIO_DEVICE:
michael@325 79 *var_len = strlen(stat->dinfo->devices[indx].device_name);
michael@325 80 return (u_char *) stat->dinfo->devices[indx].device_name;
michael@325 81 +#if defined(freebsd5) && (__FreeBSD_version >= 500107)
michael@325 82 + case DISKIO_NREAD:
michael@325 83 + long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ];
michael@325 84 + return (u_char *) & long_ret;
michael@325 85 + case DISKIO_NWRITTEN:
michael@325 86 + long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_WRITE];
michael@325 87 + return (u_char *) & long_ret;
michael@325 88 + case DISKIO_READS:
michael@325 89 + long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_READ];
michael@325 90 + return (u_char *) & long_ret;
michael@325 91 + case DISKIO_WRITES:
michael@325 92 + long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_WRITE];
michael@325 93 + return (u_char *) & long_ret;
michael@325 94 +#else
michael@325 95 case DISKIO_NREAD:
michael@325 96 #if defined(freebsd5) && __FreeBSD_version >= 500107
michael@325 97 long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ];
michael@353 98 @@ -857,6 +871,7 @@
michael@325 99 case DISKIO_LA15:
michael@325 100 long_ret = devloads[indx].la15;
michael@325 101 return (u_char *) & long_ret;
michael@325 102 +#endif
michael@325 103
michael@325 104 default:
michael@325 105 ERROR_MSG("diskio.c: don't know how to handle this request.");
michael@325 106 Index: agent/mibgroup/ucd-snmp/memory_solaris2.c
michael@353 107 diff -Nau agent/mibgroup/ucd-snmp/memory_solaris2.c.orig agent/mibgroup/ucd-snmp/memory_solaris2.c
michael@353 108 --- agent/mibgroup/ucd-snmp/memory_solaris2.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 109 +++ agent/mibgroup/ucd-snmp/memory_solaris2.c 2011-09-15 09:22:50.264370106 +0200
michael@325 110 @@ -1,3 +1,4 @@
michael@325 111 +#undef _FILE_OFFSET_BITS /* swapctl doesn't support 64bit off_t */
michael@325 112 #include <net-snmp/net-snmp-config.h> /* local SNMP configuration details */
michael@325 113 #if HAVE_STRING_H
michael@325 114 #include <string.h>
michael@325 115 Index: agent/mibgroup/ucd-snmp/proc.c
michael@353 116 diff -Nau agent/mibgroup/ucd-snmp/proc.c.orig agent/mibgroup/ucd-snmp/proc.c
michael@353 117 --- agent/mibgroup/ucd-snmp/proc.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 118 +++ agent/mibgroup/ucd-snmp/proc.c 2011-09-15 09:22:50.265801863 +0200
michael@325 119 @@ -1,3 +1,6 @@
michael@325 120 +#ifdef solaris2
michael@325 121 +#undef _FILE_OFFSET_BITS /* solaris procfs doesn't support 64bit off_t */
michael@325 122 +#endif
michael@325 123 #include <net-snmp/net-snmp-config.h>
michael@353 124 #include <net-snmp/net-snmp-features.h>
michael@325 125
michael@325 126 Index: agent/mibgroup/util_funcs.c
michael@353 127 diff -Nau agent/mibgroup/util_funcs.c.orig agent/mibgroup/util_funcs.c
michael@353 128 --- agent/mibgroup/util_funcs.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 129 +++ agent/mibgroup/util_funcs.c 2011-09-15 09:22:50.267863457 +0200
michael@353 130 @@ -477,6 +477,9 @@
michael@325 131 int fd[2][2], i, cnt;
michael@325 132 char ctmp[STRMAX], *cptr1, *cptr2, argvs[STRMAX], **argv,
michael@325 133 **aptr;
michael@325 134 +
michael@325 135 + *pid = -1; /* open_persist_pipe ignores return code but checks *pid */
michael@325 136 +
michael@325 137 /*
michael@325 138 * Setup our pipes
michael@325 139 */
michael@325 140 Index: agent/snmpd.c
michael@353 141 diff -Nau agent/snmpd.c.orig agent/snmpd.c
michael@353 142 --- agent/snmpd.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 143 +++ agent/snmpd.c 2011-09-15 09:22:41.994430685 +0200
michael@353 144 @@ -440,7 +440,7 @@
michael@353 145 int log_set = 0;
michael@325 146 int uid = 0, gid = 0;
michael@325 147 int agent_mode = -1;
michael@325 148 - char *pid_file = NULL;
michael@325 149 + char *pid_file = "@l_prefix@/var/snmp/snmpd.pid";
michael@325 150 char option_compatability[] = "-Le";
michael@325 151 #if HAVE_GETPID
michael@325 152 int fd;
michael@325 153 Index: apps/snmptrapd.c
michael@353 154 diff -Nau apps/snmptrapd.c.orig apps/snmptrapd.c
michael@353 155 --- apps/snmptrapd.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 156 +++ apps/snmptrapd.c 2011-09-15 09:22:50.270293197 +0200
michael@353 157 @@ -657,6 +657,7 @@
michael@325 158 */
michael@325 159 #if HAVE_GETPID
michael@325 160 strcat(options, "p:");
michael@325 161 + parse_config_pidFile(NULL, "@l_prefix@/var/snmp/snmptrapd.pid");
michael@325 162 #endif
michael@325 163
michael@353 164 #ifndef NETSNMP_FEATURE_REMOVE_LOGGING_SYSLOG
michael@325 165 Index: include/net-snmp/library/system.h
michael@353 166 diff -Nau include/net-snmp/library/system.h.orig include/net-snmp/library/system.h
michael@353 167 --- include/net-snmp/library/system.h.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 168 +++ include/net-snmp/library/system.h 2011-09-15 09:22:50.271350973 +0200
michael@353 169 @@ -155,7 +155,8 @@
michael@325 170 #endif
michael@325 171 #ifndef HAVE_SETENV
michael@325 172 NETSNMP_IMPORT
michael@325 173 - int setenv(const char *, const char *, int);
michael@325 174 + int __netsnmp_setenv(const char *, const char *, int);
michael@325 175 +# define setenv(a,b,c) __netsnmp_setenv(a,b,c)
michael@325 176 #endif
michael@325 177
michael@325 178 NETSNMP_IMPORT
michael@325 179 Index: include/net-snmp/system/freebsd8.h
michael@353 180 diff -Nau include/net-snmp/system/freebsd8.h.orig include/net-snmp/system/freebsd8.h
michael@353 181 --- include/net-snmp/system/freebsd8.h.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 182 +++ include/net-snmp/system/freebsd8.h 2011-09-15 09:22:50.272179012 +0200
michael@325 183 @@ -1,3 +1,6 @@
michael@325 184 +/* freebsd8 is a superset of freebsd7 */
michael@325 185 +#include "freebsd7.h"
michael@325 186 +#define freebsd7 freebsd7
michael@325 187 /* freebsd8 is a superset of freebsd4 */
michael@353 188 #include "freebsd7.h"
michael@353 189 #define freebsd7 freebsd7
michael@325 190 Index: include/net-snmp/system/freebsd9.h
michael@353 191 diff -Nau include/net-snmp/system/freebsd9.h.orig include/net-snmp/system/freebsd9.h
michael@353 192 --- include/net-snmp/system/freebsd9.h.orig 1970-01-01 01:00:00.000000000 +0100
michael@353 193 +++ include/net-snmp/system/freebsd9.h 2011-09-15 09:22:50.272889416 +0200
michael@325 194 @@ -0,0 +1,3 @@
michael@325 195 +/* freebsd9 is a superset of freebsd8 */
michael@325 196 +#include "freebsd8.h"
michael@325 197 +#define freebsd8 freebsd8
michael@325 198 Index: snmplib/system.c
michael@353 199 diff -Nau snmplib/system.c.orig snmplib/system.c
michael@353 200 --- snmplib/system.c.orig 2011-07-02 00:35:46.000000000 +0200
michael@353 201 +++ snmplib/system.c 2011-09-15 09:22:50.274625796 +0200
michael@353 202 @@ -1044,7 +1044,7 @@
michael@325 203
michael@325 204 #ifndef HAVE_SETENV
michael@325 205 int
michael@325 206 -setenv(const char *name, const char *value, int overwrite)
michael@325 207 +__netsnmp_setenv(const char *name, const char *value, int overwrite)
michael@325 208 {
michael@325 209 char *cp;
michael@325 210 int ret;

mercurial