snmp/snmp_iface.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
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@588 1 Index: agent/mibgroup/ip-mib/data_access/ipaddress_common.c
michael@588 2 --- agent/mibgroup/ip-mib/data_access/ipaddress_common.c.orig 2011-09-28 06:53:47.000000000 +0200
michael@588 3 +++ agent/mibgroup/ip-mib/data_access/ipaddress_common.c 2012-02-18 21:20:51.943118452 +0100
michael@588 4 @@ -452,6 +452,7 @@
michael@588 5 {
michael@588 6 const netsnmp_ipaddress_entry *lh = (const netsnmp_ipaddress_entry *)lhs;
michael@588 7 const netsnmp_ipaddress_entry *rh = (const netsnmp_ipaddress_entry *)rhs;
michael@588 8 + int rc;
michael@588 9
michael@588 10 netsnmp_assert(NULL != lhs);
michael@588 11 netsnmp_assert(NULL != rhs);
michael@588 12 @@ -467,7 +468,19 @@
michael@588 13 /*
michael@588 14 * length equal, compare address
michael@588 15 */
michael@588 16 - return memcmp(lh->ia_address, rh->ia_address, lh->ia_address_len);
michael@588 17 + rc = memcmp(lh->ia_address, rh->ia_address, lh->ia_address_len);
michael@588 18 + if (rc)
michael@588 19 + return rc;
michael@588 20 +
michael@588 21 + /*
michael@588 22 + * address same, compare ifIndex
michael@588 23 + */
michael@588 24 + if (lh->if_index < rh->if_index)
michael@588 25 + return -1;
michael@588 26 + else if (lh->if_index > rh->if_index)
michael@588 27 + return 1;
michael@588 28 +
michael@588 29 + return 0;
michael@588 30 }
michael@588 31
michael@588 32 #ifndef NETSNMP_FEATURE_REMOVE_IPADDRESS_COMMON_COPY_UTILITIES
michael@588 33 Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h
michael@588 34 --- agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h.orig 2011-09-28 06:53:47.000000000 +0200
michael@588 35 +++ agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h 2012-02-18 21:20:51.939850024 +0100
michael@588 36 @@ -106,7 +106,9 @@
michael@588 37 * simplistic map of address length to type
michael@588 38 */
michael@588 39 #define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4 4
michael@588 40 +#define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4Z 5
michael@588 41 #define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6 16
michael@588 42 +#define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6Z 17
michael@588 43
michael@588 44
michael@588 45 /*************************************************************
michael@588 46 Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c
michael@588 47 --- agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c.orig 2012-02-18 21:02:55.315118127 +0100
michael@588 48 +++ agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c 2012-02-18 21:20:51.933373869 +0100
michael@588 49 @@ -262,9 +262,10 @@
michael@588 50 if ((NULL != rowreq_ctx) &&
michael@588 51 (MFD_SUCCESS ==
michael@588 52 ipAddressTable_indexes_set(rowreq_ctx,
michael@588 53 - ipaddress_entry->ia_address_len,
michael@588 54 + ipaddress_entry->ia_address_len + 1,
michael@588 55 ipaddress_entry->ia_address,
michael@588 56 - ipaddress_entry->ia_address_len))) {
michael@588 57 + ipaddress_entry->ia_address_len,
michael@588 58 + ipaddress_entry->if_index))) {
michael@588 59 if (CONTAINER_INSERT(container, rowreq_ctx) < 0) {
michael@588 60 DEBUGMSGTL (("ipAddressTable:access","container insert failed for new entry\n"));
michael@588 61 ipAddressTable_release_rowreq_ctx(rowreq_ctx);
michael@588 62 Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c
michael@588 63 --- agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c.orig 2011-09-28 06:53:47.000000000 +0200
michael@588 64 +++ agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c 2012-02-18 21:24:03.877503380 +0100
michael@588 65 @@ -355,10 +355,18 @@
michael@588 66 *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV4;
michael@588 67 break;
michael@588 68
michael@588 69 + case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4Z:
michael@588 70 + *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV4Z;
michael@588 71 + break;
michael@588 72 +
michael@588 73 case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6:
michael@588 74 *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV6;
michael@588 75 break;
michael@588 76
michael@588 77 + case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6Z:
michael@588 78 + *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV6Z;
michael@588 79 + break;
michael@588 80 +
michael@588 81 default:
michael@588 82 snmp_log(LOG_ERR, "couldn't map value %ld for ipAddressAddrType\n",
michael@588 83 raw_ipAddressAddrType_val);
michael@588 84 @@ -389,8 +397,10 @@
michael@588 85 ipAddressTable_indexes_set_tbl_idx(ipAddressTable_mib_index * tbl_idx,
michael@588 86 long ipAddressAddrType_val,
michael@588 87 u_char *ipAddressAddr_val_ptr,
michael@588 88 - size_t ipAddressAddr_val_ptr_len)
michael@588 89 + size_t ipAddressAddr_val_ptr_len,
michael@588 90 + long ipAddressAddr_ifIndex)
michael@588 91 {
michael@588 92 + uint32_t zone = htonl(ipAddressAddr_ifIndex);
michael@588 93 DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_indexes_set_tbl_idx", "called\n"));
michael@588 94
michael@588 95 /*
michael@588 96 @@ -416,6 +426,11 @@
michael@588 97 memcpy(tbl_idx->ipAddressAddr, ipAddressAddr_val_ptr,
michael@588 98 ipAddressAddr_val_ptr_len * sizeof(ipAddressAddr_val_ptr[0]));
michael@588 99
michael@588 100 + /** zone */
michael@588 101 + tbl_idx->ipAddressAddr_len += sizeof(zone);
michael@588 102 + memcpy(&tbl_idx->ipAddressAddr[ipAddressAddr_val_ptr_len *
michael@588 103 + sizeof(ipAddressAddr_val_ptr[0])],
michael@588 104 + &zone, sizeof(zone));
michael@588 105
michael@588 106 return MFD_SUCCESS;
michael@588 107 } /* ipAddressTable_indexes_set_tbl_idx */
michael@588 108 @@ -437,7 +452,8 @@
michael@588 109 ipAddressTable_indexes_set(ipAddressTable_rowreq_ctx * rowreq_ctx,
michael@588 110 u_long ipAddressAddrType_val,
michael@588 111 u_char *ipAddressAddr_val_ptr,
michael@588 112 - size_t ipAddressAddr_val_ptr_len)
michael@588 113 + size_t ipAddressAddr_val_ptr_len,
michael@588 114 + long ipAddressAddr_ifIndex)
michael@588 115 {
michael@588 116 DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_indexes_set",
michael@588 117 "called\n"));
michael@588 118 @@ -446,7 +462,8 @@
michael@588 119 ipAddressTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
michael@588 120 ipAddressAddrType_val,
michael@588 121 ipAddressAddr_val_ptr,
michael@588 122 - ipAddressAddr_val_ptr_len))
michael@588 123 + ipAddressAddr_val_ptr_len,
michael@588 124 + ipAddressAddr_ifIndex))
michael@588 125 return MFD_ERROR;
michael@588 126
michael@588 127 /*
michael@588 128 Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h
michael@588 129 --- agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h.orig 2011-09-28 06:53:47.000000000 +0200
michael@588 130 +++ agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h 2012-02-18 21:25:15.751422674 +0100
michael@588 131 @@ -273,14 +273,16 @@
michael@588 132 long ipAddressAddrType_val,
michael@588 133 u_char *ipAddressAddr_val_ptr,
michael@588 134 size_t
michael@588 135 - ipAddressAddr_val_ptr_len);
michael@588 136 + ipAddressAddr_val_ptr_len,
michael@588 137 + long ipAddressAddr_ifIndex);
michael@588 138 int ipAddressTable_indexes_set(ipAddressTable_rowreq_ctx *
michael@588 139 rowreq_ctx,
michael@588 140 u_long
michael@588 141 ipAddressAddrType_val,
michael@588 142 u_char *ipAddressAddr_val_ptr,
michael@588 143 size_t
michael@588 144 - ipAddressAddr_val_ptr_len);
michael@588 145 + ipAddressAddr_val_ptr_len,
michael@588 146 + long ipAddressAddr_ifIndex);
michael@588 147
michael@588 148
michael@588 149

mercurial