incorrect extend is executed

Takumi Kadode <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAFptgzm_VaDc-DDbvyA1YqzsyFCSXayygCv+UmoVa+U5BZmbCw@mail.gmail.com>
Hello

I met strange result.

I added following line in snmpd.conf.
   extend test_sh1         /bin/echo echo1
   extend test_sh2         /bin/echo echo2

And, I executed snmpwalk with OID
"NET-SNMP-EXTEND-MIB::nsExtendOutLine.test_sh1" .
Then not only "/bin/echo echo1" but also "/bin/echo echo2" is executed.

I attached a patch. If my understanding is correct, could you please
include it in future release ?

Thank you,

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
extend-fix.patch (application/octet-stream, 936 B)
diff --git agent/mibgroup/agent/extend.c agent/mibgroup/agent/extend.c
index 68a11e2..c5a1686 100644
--- agent/mibgroup/agent/extend.c
+++ agent/mibgroup/agent/extend.c
@@ -1310,6 +1310,21 @@ _extend_find_entry( netsnmp_request_info       *request,
                      */
                     line_idx = 1;
                     for (eptr = eptr->next ; eptr; eptr = eptr->next ) {
+
+		    	/*
+			 * fix incorrect extend call.
+			 *
+			 * With below snmpd.conf, if you call test_sh1 extend,
+			 * "/bin/echo echo2" is also excuted.
+			 *
+			 * [snmpd.conf]
+			 *    extend test_sh1         /bin/echo echo1
+			 *    extend test_sh2         /bin/echo echo2
+			 */
+		    	if( 0 != strcmp( eptr->token, token)){
+				continue;
+			}
+
                         if ((eptr->flags & NS_EXTEND_FLAGS_ACTIVE) &&
                             (netsnmp_cache_check_and_reload( eptr->cache ) >= 0 )) {
                             break;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.