snmp/snmp.patch

Fri, 10 Aug 2012 14:26:56 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 10 Aug 2012 14:26:56 +0200
changeset 507
b38213c8f8c3
parent 325
6601d28cfe52
child 588
300d43423c2e
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

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

mercurial