From: Amos Jeffries Date: Sun, 20 Dec 2009 10:18:22 +0000 (+1300) Subject: Bug 2811: pt 1: Correct Peer table OID numbering X-Git-Tag: SQUID_3_2_0_1~501 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=263f9f5f0b4b48b254717b98a0667f1ed6cfbd64;p=thirdparty%2Fsquid.git Bug 2811: pt 1: Correct Peer table OID numbering The IPv6 alterations to the cache_peer table display should not have altered existing OID numbers. This fixes that by bumping the new table format to a new OID number .1.3.6.1.4.1.3495.1.5.1.3 for version 3 of the table. NP: version 1 of the table was in 2.0->2.5, and 3.0 version 2 of the table was in 2.6+ --- diff --git a/include/cache_snmp.h b/include/cache_snmp.h index 058164549c..2617757125 100644 --- a/include/cache_snmp.h +++ b/include/cache_snmp.h @@ -236,7 +236,7 @@ enum { MESH_END }; -/* cachePeerTable CachePeerEntry */ +/* CachePeerTableEntry (version 3) */ enum { MESH_PTBL_START = 0, MESH_PTBL_INDEX = 1, /* cachePeerIndex */ diff --git a/src/mib.txt b/src/mib.txt index 81b5ebd3d1..dba27db7c1 100644 --- a/src/mib.txt +++ b/src/mib.txt @@ -724,15 +724,15 @@ squid MODULE-IDENTITY ::= { cacheMesh 1 } cachePeerEntry OBJECT-TYPE - SYNTAX CachePeerEntry + SYNTAX CachePeerTableEntry MAX-ACCESS not-accessible STATUS current DESCRIPTION - " An entry in cachePeerTable " + " An entry in cachePeerTable (version 3) " INDEX { cachePeerIndex } - ::= { cachePeerTable 1 } + ::= { cachePeerTable 3 } - CachePeerEntry ::= SEQUENCE { + CachePeerTableEntry ::= SEQUENCE { cachePeerIndex CachePeerTableIndex, cachePeerName DisplayString, cachePeerAddressType InetAddressType, diff --git a/src/snmp_core.cc b/src/snmp_core.cc index 3f140057a1..6b825b618c 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -235,27 +235,30 @@ snmpInit(void) /* cachePeerTable - 1.3.6.1.4.1.3495.1.5.1 */ snmpAddNodeStr("1.3.6.1.4.1.3495.1.5", MESH_PTBL, NULL, NULL); - /* CachePeerEntry - 1.3.6.1.4.1.3495.1.5.1.1 */ - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1", 1, NULL, NULL); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_INDEX, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_NAME, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_ADDR_TYPE, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_ADDR, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_HTTP, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_ICP, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_TYPE, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_STATE, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_SENT, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_PACKED, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_FETCHES, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_RTT, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_IGN, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_KEEPAL_S, snmp_meshPtblFn, peer_Inst); - snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.1", MESH_PTBL_KEEPAL_R, snmp_meshPtblFn, peer_Inst); - + /* CachePeerTableEntry (version 3) - 1.3.6.1.4.1.3495.1.5.1.3 */ + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1", 3, NULL, NULL); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_INDEX, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_NAME, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_ADDR_TYPE, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_ADDR, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_HTTP, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_ICP, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_TYPE, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_STATE, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_SENT, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_PACKED, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_FETCHES, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_RTT, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_IGN, snmp_meshPtblFn, peer_Inst); + snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_KEEPAL_S, snmp_meshPtblFn, peer_Inst); + mib_tree_last = snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.1.3", MESH_PTBL_KEEPAL_R, snmp_meshPtblFn, peer_Inst); + +#if 0 /* cacheClientTable - 1.3.6.1.4.1.3495.1.5.2 */ snmpAddNodeStr("1.3.6.1.4.1.3495.1.5", MESH_CTBL, NULL, NULL); + /* BUG 2811: we NEED to create a reliable index for the clientDb and morph this to version 3 of the table. */ + /* cacheClientEntry - 1.3.6.1.4.1.3495.1.5.2.1 */ snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.2", 1, NULL, NULL); snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.2.1", MESH_CTBL_ADDR_TYPE, snmp_meshCtblFn, client_Inst); @@ -268,6 +271,7 @@ snmpInit(void) snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.2.1", MESH_CTBL_ICPBYTES, snmp_meshCtblFn, client_Inst); snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.2.1", MESH_CTBL_ICPHITS, snmp_meshCtblFn, client_Inst); mib_tree_last = snmpAddNodeStr("1.3.6.1.4.1.3495.1.5.2.1", MESH_CTBL_ICPHITBYTES, snmp_meshCtblFn, client_Inst); +#endif debugs(49, 9, "snmpInit: Completed SNMP mib tree structure"); } @@ -883,7 +887,7 @@ snmpTreeEntry(oid entry, snint len, mib_tree_entry * current) mib_tree_entry *next = NULL; int count = 0; - while ((!next) && (count < current->children)) { + while ((!next) && current && (count < current->children)) { if (current->leaves[count]->name[len] == entry) { next = current->leaves[count]; }