Update version, adapt patch, correct PID writing, correct build on newer

Wed, 08 Feb 2012 20:07:00 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 08 Feb 2012 20:07:00 +0200
changeset 588
300d43423c2e
parent 587
d0df67c21897
child 589
6db023bc5512

Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.

snmp/rc.snmp file | annotate | diff | comparison | revisions
snmp/snmp.patch file | annotate | diff | comparison | revisions
snmp/snmp.spec file | annotate | diff | comparison | revisions
snmp/snmp_iface.patch file | annotate | diff | comparison | revisions
     1.1 --- a/snmp/rc.snmp	Tue Aug 28 18:42:20 2012 +0200
     1.2 +++ b/snmp/rc.snmp	Wed Feb 08 20:07:00 2012 +0200
     1.3 @@ -43,8 +43,8 @@
     1.4      rcService snmp active yes && exit 0
     1.5      for daemon in $snmp_daemons; do
     1.6          case "$daemon" in
     1.7 -            snmpd     ) @l_prefix@/sbin/snmpd     -Lsd $snmp_listen ;;
     1.8 -            snmptrapd ) @l_prefix@/sbin/snmptrapd -Lsd $snmp_listentrap ;;
     1.9 +            snmpd     ) @l_prefix@/sbin/snmpd     -p $snmp_pidfile_snmpd -Lsd $snmp_listen ;;
    1.10 +            snmptrapd ) @l_prefix@/sbin/snmptrapd -p $snmp_pidfile_snmptrapd -Lsd $snmp_listentrap ;;
    1.11          esac
    1.12      done
    1.13  
     2.1 --- a/snmp/snmp.patch	Tue Aug 28 18:42:20 2012 +0200
     2.2 +++ b/snmp/snmp.patch	Wed Feb 08 20:07:00 2012 +0200
     2.3 @@ -1,16 +1,3 @@
     2.4 -Index: Makefile.in
     2.5 -diff -Nau Makefile.in.orig Makefile.in
     2.6 ---- Makefile.in.orig	2011-07-02 00:35:46.000000000 +0200
     2.7 -+++ Makefile.in	2011-09-15 09:22:50.255341188 +0200
     2.8 -@@ -19,7 +19,7 @@
     2.9 - INCLUDESUBDIR=system
    2.10 - INCLUDESUBDIRHEADERS= aix.h bsd.h bsdi3.h bsdi4.h bsdi.h cygwin.h \
    2.11 - 	darwin.h darwin7.h darwin8.h darwin9.h darwin10.h dragonfly.h dynix.h \
    2.12 --	freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd.h \
    2.13 -+	freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd7.h freebsd8.h freebsd9.h freebsd.h \
    2.14 - 	generic.h \
    2.15 - 	hpux.h irix.h linux.h mingw32.h mips.h netbsd.h openbsd.h osf5.h \
    2.16 - 	solaris2.3.h solaris2.4.h solaris2.5.h solaris2.6.h \
    2.17  Index: agent/auto_nlist.c
    2.18  diff -Nau agent/auto_nlist.c.orig agent/auto_nlist.c
    2.19  --- agent/auto_nlist.c.orig	2011-07-02 00:35:46.000000000 +0200
    2.20 @@ -154,7 +141,7 @@
    2.21  diff -Nau apps/snmptrapd.c.orig apps/snmptrapd.c
    2.22  --- apps/snmptrapd.c.orig	2011-07-02 00:35:46.000000000 +0200
    2.23  +++ apps/snmptrapd.c	2011-09-15 09:22:50.270293197 +0200
    2.24 -@@ -657,6 +657,7 @@
    2.25 +@@ -653,6 +653,7 @@
    2.26        */
    2.27   #if HAVE_GETPID
    2.28       strcat(options, "p:");
    2.29 @@ -176,30 +163,11 @@
    2.30   #endif
    2.31   
    2.32       NETSNMP_IMPORT
    2.33 -Index: include/net-snmp/system/freebsd8.h
    2.34 -diff -Nau include/net-snmp/system/freebsd8.h.orig include/net-snmp/system/freebsd8.h
    2.35 ---- include/net-snmp/system/freebsd8.h.orig	2011-07-02 00:35:46.000000000 +0200
    2.36 -+++ include/net-snmp/system/freebsd8.h	2011-09-15 09:22:50.272179012 +0200
    2.37 -@@ -1,3 +1,6 @@
    2.38 -+/* freebsd8 is a superset of freebsd7 */
    2.39 -+#include "freebsd7.h"
    2.40 -+#define freebsd7 freebsd7
    2.41 - /* freebsd8 is a superset of freebsd4 */
    2.42 - #include "freebsd7.h"
    2.43 - #define freebsd7 freebsd7
    2.44 -Index: include/net-snmp/system/freebsd9.h
    2.45 -diff -Nau include/net-snmp/system/freebsd9.h.orig include/net-snmp/system/freebsd9.h
    2.46 ---- include/net-snmp/system/freebsd9.h.orig	1970-01-01 01:00:00.000000000 +0100
    2.47 -+++ include/net-snmp/system/freebsd9.h	2011-09-15 09:22:50.272889416 +0200
    2.48 -@@ -0,0 +1,3 @@
    2.49 -+/* freebsd9 is a superset of freebsd8 */
    2.50 -+#include "freebsd8.h"
    2.51 -+#define freebsd8 freebsd8
    2.52  Index: snmplib/system.c
    2.53  diff -Nau snmplib/system.c.orig snmplib/system.c
    2.54  --- snmplib/system.c.orig	2011-07-02 00:35:46.000000000 +0200
    2.55  +++ snmplib/system.c	2011-09-15 09:22:50.274625796 +0200
    2.56 -@@ -1044,7 +1044,7 @@
    2.57 +@@ -1048,7 +1048,7 @@
    2.58   
    2.59   #ifndef HAVE_SETENV
    2.60   int
     3.1 --- a/snmp/snmp.spec	Tue Aug 28 18:42:20 2012 +0200
     3.2 +++ b/snmp/snmp.spec	Wed Feb 08 20:07:00 2012 +0200
     3.3 @@ -31,8 +31,8 @@
     3.4  Class:        BASE
     3.5  Group:        Network
     3.6  License:      BSD
     3.7 -Version:      5.7
     3.8 -Release:      20110915
     3.9 +Version:      5.7.1
    3.10 +Release:      20120208
    3.11  
    3.12  #   package options
    3.13  %option       with_fsl          yes
    3.14 @@ -51,6 +51,7 @@
    3.15  Source4:      snmptrapd.conf
    3.16  Patch0:       snmp.patch
    3.17  Patch1:       snmp_agentx.patch
    3.18 +Patch2:       snmp_iface.patch
    3.19  
    3.20  #   build information
    3.21  Prefix:       %{l_prefix}
    3.22 @@ -89,6 +90,7 @@
    3.23      %setup -q -n net-snmp-%{version}
    3.24      %patch -p0
    3.25      %patch -p0 -P 1
    3.26 +    %patch -p0 -P 2
    3.27  
    3.28      #   provide a default PID file location
    3.29      %{l_shtool} subst %{l_value -s -a} \
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/snmp/snmp_iface.patch	Wed Feb 08 20:07:00 2012 +0200
     4.3 @@ -0,0 +1,149 @@
     4.4 +Index: agent/mibgroup/ip-mib/data_access/ipaddress_common.c
     4.5 +--- agent/mibgroup/ip-mib/data_access/ipaddress_common.c.orig	2011-09-28 06:53:47.000000000 +0200
     4.6 ++++ agent/mibgroup/ip-mib/data_access/ipaddress_common.c	2012-02-18 21:20:51.943118452 +0100
     4.7 +@@ -452,6 +452,7 @@
     4.8 + {
     4.9 +     const netsnmp_ipaddress_entry *lh = (const netsnmp_ipaddress_entry *)lhs;
    4.10 +     const netsnmp_ipaddress_entry *rh = (const netsnmp_ipaddress_entry *)rhs;
    4.11 ++    int   rc;
    4.12 + 
    4.13 +     netsnmp_assert(NULL != lhs);
    4.14 +     netsnmp_assert(NULL != rhs);
    4.15 +@@ -467,7 +468,19 @@
    4.16 +     /*
    4.17 +      * length equal, compare address
    4.18 +      */
    4.19 +-    return memcmp(lh->ia_address, rh->ia_address, lh->ia_address_len);
    4.20 ++    rc = memcmp(lh->ia_address, rh->ia_address, lh->ia_address_len);
    4.21 ++    if (rc)
    4.22 ++        return rc;
    4.23 ++
    4.24 ++    /*
    4.25 ++     * address same, compare ifIndex
    4.26 ++     */
    4.27 ++    if (lh->if_index < rh->if_index)
    4.28 ++        return -1;
    4.29 ++    else if (lh->if_index > rh->if_index)
    4.30 ++        return 1;
    4.31 ++
    4.32 ++    return 0;
    4.33 + }
    4.34 + 
    4.35 + #ifndef NETSNMP_FEATURE_REMOVE_IPADDRESS_COMMON_COPY_UTILITIES
    4.36 +Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h
    4.37 +--- agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h.orig	2011-09-28 06:53:47.000000000 +0200
    4.38 ++++ agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h	2012-02-18 21:20:51.939850024 +0100
    4.39 +@@ -106,7 +106,9 @@
    4.40 +      * simplistic map of address length to type
    4.41 +      */
    4.42 + #define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4  4
    4.43 ++#define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4Z 5
    4.44 + #define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6  16
    4.45 ++#define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6Z 17
    4.46 + 
    4.47 + 
    4.48 + /*************************************************************
    4.49 +Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c
    4.50 +--- agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c.orig	2012-02-18 21:02:55.315118127 +0100
    4.51 ++++ agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c	2012-02-18 21:20:51.933373869 +0100
    4.52 +@@ -262,9 +262,10 @@
    4.53 +     if ((NULL != rowreq_ctx) &&
    4.54 +         (MFD_SUCCESS ==
    4.55 +          ipAddressTable_indexes_set(rowreq_ctx,
    4.56 +-                                    ipaddress_entry->ia_address_len,
    4.57 ++                                    ipaddress_entry->ia_address_len + 1,
    4.58 +                                     ipaddress_entry->ia_address,
    4.59 +-                                    ipaddress_entry->ia_address_len))) {
    4.60 ++                                    ipaddress_entry->ia_address_len,
    4.61 ++                                    ipaddress_entry->if_index))) {
    4.62 +         if (CONTAINER_INSERT(container, rowreq_ctx) < 0) {
    4.63 +             DEBUGMSGTL (("ipAddressTable:access","container insert failed for new entry\n"));
    4.64 +             ipAddressTable_release_rowreq_ctx(rowreq_ctx);
    4.65 +Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c
    4.66 +--- agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c.orig	2011-09-28 06:53:47.000000000 +0200
    4.67 ++++ agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c	2012-02-18 21:24:03.877503380 +0100
    4.68 +@@ -355,10 +355,18 @@
    4.69 +         *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV4;
    4.70 +         break;
    4.71 + 
    4.72 ++    case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4Z:
    4.73 ++        *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV4Z;
    4.74 ++        break;
    4.75 ++
    4.76 +     case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6:
    4.77 +         *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV6;
    4.78 +         break;
    4.79 + 
    4.80 ++    case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6Z:
    4.81 ++        *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV6Z;
    4.82 ++        break;
    4.83 ++
    4.84 +     default:
    4.85 +         snmp_log(LOG_ERR, "couldn't map value %ld for ipAddressAddrType\n",
    4.86 +                  raw_ipAddressAddrType_val);
    4.87 +@@ -389,8 +397,10 @@
    4.88 + ipAddressTable_indexes_set_tbl_idx(ipAddressTable_mib_index * tbl_idx,
    4.89 +                                    long ipAddressAddrType_val,
    4.90 +                                    u_char *ipAddressAddr_val_ptr,
    4.91 +-                                   size_t ipAddressAddr_val_ptr_len)
    4.92 ++                                   size_t ipAddressAddr_val_ptr_len,
    4.93 ++                                   long ipAddressAddr_ifIndex)
    4.94 + {
    4.95 ++    uint32_t zone = htonl(ipAddressAddr_ifIndex);
    4.96 +     DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_indexes_set_tbl_idx", "called\n"));
    4.97 + 
    4.98 +     /*
    4.99 +@@ -416,6 +426,11 @@
   4.100 +     memcpy(tbl_idx->ipAddressAddr, ipAddressAddr_val_ptr,
   4.101 +            ipAddressAddr_val_ptr_len * sizeof(ipAddressAddr_val_ptr[0]));
   4.102 + 
   4.103 ++    /** zone */
   4.104 ++    tbl_idx->ipAddressAddr_len += sizeof(zone);
   4.105 ++    memcpy(&tbl_idx->ipAddressAddr[ipAddressAddr_val_ptr_len *
   4.106 ++                                   sizeof(ipAddressAddr_val_ptr[0])],
   4.107 ++           &zone, sizeof(zone));
   4.108 + 
   4.109 +     return MFD_SUCCESS;
   4.110 + }                               /* ipAddressTable_indexes_set_tbl_idx */
   4.111 +@@ -437,7 +452,8 @@
   4.112 + ipAddressTable_indexes_set(ipAddressTable_rowreq_ctx * rowreq_ctx,
   4.113 +                            u_long ipAddressAddrType_val,
   4.114 +                            u_char *ipAddressAddr_val_ptr,
   4.115 +-                           size_t ipAddressAddr_val_ptr_len)
   4.116 ++                           size_t ipAddressAddr_val_ptr_len,
   4.117 ++                           long ipAddressAddr_ifIndex)
   4.118 + {
   4.119 +     DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_indexes_set",
   4.120 +                 "called\n"));
   4.121 +@@ -446,7 +462,8 @@
   4.122 +         ipAddressTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
   4.123 +                                            ipAddressAddrType_val,
   4.124 +                                            ipAddressAddr_val_ptr,
   4.125 +-                                           ipAddressAddr_val_ptr_len))
   4.126 ++                                           ipAddressAddr_val_ptr_len,
   4.127 ++                                           ipAddressAddr_ifIndex))
   4.128 +         return MFD_ERROR;
   4.129 + 
   4.130 +     /*
   4.131 +Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h
   4.132 +--- agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h.orig	2011-09-28 06:53:47.000000000 +0200
   4.133 ++++ agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h	2012-02-18 21:25:15.751422674 +0100
   4.134 +@@ -273,14 +273,16 @@
   4.135 +                                            long ipAddressAddrType_val,
   4.136 +                                            u_char *ipAddressAddr_val_ptr,
   4.137 +                                            size_t
   4.138 +-                                           ipAddressAddr_val_ptr_len);
   4.139 ++                                           ipAddressAddr_val_ptr_len,
   4.140 ++                                           long ipAddressAddr_ifIndex);
   4.141 +     int             ipAddressTable_indexes_set(ipAddressTable_rowreq_ctx *
   4.142 +                                                rowreq_ctx,
   4.143 +                                                u_long
   4.144 +                                                ipAddressAddrType_val,
   4.145 +                                                u_char *ipAddressAddr_val_ptr,
   4.146 +                                                size_t
   4.147 +-                                               ipAddressAddr_val_ptr_len);
   4.148 ++                                               ipAddressAddr_val_ptr_len,
   4.149 ++                                               long ipAddressAddr_ifIndex);
   4.150 + 
   4.151 + 
   4.152 + 

mercurial