]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/agentx.c
*: make consistent & update GPLv2 file headers
[mirror_frr.git] / lib / agentx.c
index 4175e7ba927e96131e860ebb1057b713e038ef86..fda634bb860973ed0acae5c8d8ddd816b1513d95 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING.  If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.  
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
 
-#if defined HAVE_SNMP && defined SNMP_AGENTX
+#ifdef SNMP_AGENTX
 #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h>
 #include <net-snmp/agent/net-snmp-agent-includes.h>
@@ -85,8 +84,11 @@ agentx_events_update(void)
   FD_ZERO (&fds);
   snmp_select_info (&maxfd, &fds, &timeout, &block);
 
-  if (!block)
-    timeout_thr = thread_add_timer_tv (agentx_tm, agentx_timeout, NULL, &timeout);
+  if (!block) {
+    timeout_thr = NULL;
+    thread_add_timer_tv(agentx_tm, agentx_timeout, NULL, &timeout,
+                        &timeout_thr);
+  }
 
   ln = listhead (events);
   thr = ln ? listgetdata (ln) : NULL;
@@ -114,7 +116,8 @@ agentx_events_update(void)
       else if (FD_ISSET (fd, &fds))
         {
           struct listnode *newln;
-          thr = thread_add_read (agentx_tm, agentx_read, NULL, fd);
+          thr = NULL;
+          thread_add_read(agentx_tm, agentx_read, NULL, fd, &thr);
           newln = listnode_add_before (events, ln, thr);
           thr->arg = newln;
         }
@@ -134,7 +137,8 @@ agentx_events_update(void)
 static struct cmd_node agentx_node =
 {
   SMUX_NODE,
-  ""                            /* AgentX has no interface. */
+  "",                           /* AgentX has no interface. */
+  1
 };
 
 /* Logging NetSNMP messages */
@@ -165,7 +169,7 @@ config_write_agentx (struct vty *vty)
 {
   if (agentx_enabled)
       vty_out (vty, "agentx%s", VTY_NEWLINE);
-  return 0;
+  return 1;
 }
 
 DEFUN (agentx_enable,
@@ -183,7 +187,7 @@ DEFUN (agentx_enable,
       return CMD_SUCCESS;
     }
   vty_out (vty, "SNMP AgentX already enabled%s", VTY_NEWLINE);
-  return CMD_WARNING;
+  return CMD_SUCCESS;
 }
 
 DEFUN (no_agentx,
@@ -315,4 +319,4 @@ smux_trap (struct variable *vp, size_t vp_len,
   return 1;
 }
 
-#endif /* HAVE_SNMP */
+#endif /* SNMP_AGENTX */