snmp/snmp.patch

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 589
6db023bc5512
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

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

mercurial