Skip to content

Commit

Permalink
lib: Remove smux option for snmp
Browse files Browse the repository at this point in the history
The smux.c code has not been able to compile for 2+ years
and no-one has noticed. Additionally net-snmp has marked
smux integration as deprecated for quite some time as well.

Since no-one has noticed and it's been broken and smux integration
is deprecated let's just remove this from the code base.

From looking at the code, it sure looks like SNMP could use
a decent cleanup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
  • Loading branch information
donaldsharp committed Aug 23, 2018
1 parent d8d084d commit 807ed4e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1,532 deletions.
7 changes: 3 additions & 4 deletions configure.ac
Expand Up @@ -382,7 +382,7 @@ AC_ARG_ENABLE(bgp-vnc,
AC_ARG_WITH(rfp-path, AC_ARG_WITH(rfp-path,
AS_HELP_STRING([--with-rfp-path[=DIR]],[path to replaced stub RFP used with BGP VNC])) AS_HELP_STRING([--with-rfp-path[=DIR]],[path to replaced stub RFP used with BGP VNC]))
AC_ARG_ENABLE(snmp, AC_ARG_ENABLE(snmp,
AS_HELP_STRING([--enable-snmp=ARG], [enable SNMP support (smux or agentx)])) AS_HELP_STRING([--enable-snmp], [enable SNMP support for agentx]))
AC_ARG_ENABLE(zeromq, AC_ARG_ENABLE(zeromq,
AS_HELP_STRING([--enable-zeromq], [enable ZeroMQ handler (libfrrzmq)])) AS_HELP_STRING([--enable-zeromq], [enable ZeroMQ handler (libfrrzmq)]))
AC_ARG_WITH(libpam, AC_ARG_WITH(libpam,
Expand Down Expand Up @@ -1496,14 +1496,13 @@ int main(void);
yes) yes)
SNMP_METHOD=agentx SNMP_METHOD=agentx
;; ;;
smux|agentx) agentx)
SNMP_METHOD="${enable_snmp}" SNMP_METHOD="${enable_snmp}"
;; ;;
*) *)
AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx]) AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use yes or agentx])
;; ;;
esac esac
AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd]) AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd) AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
fi fi
Expand Down
115 changes: 5 additions & 110 deletions doc/user/snmp.rst
Expand Up @@ -7,8 +7,8 @@ SNMP Support
:abbr:`SNMP (Simple Network Managing Protocol)` is a widely implemented feature :abbr:`SNMP (Simple Network Managing Protocol)` is a widely implemented feature
for collecting network information from router and/or host. FRR itself does for collecting network information from router and/or host. FRR itself does
not support SNMP agent (server daemon) functionality but is able to connect to not support SNMP agent (server daemon) functionality but is able to connect to
a SNMP agent using the SMUX protocol (:rfc:`1227`) or the AgentX protocol a SNMP agent using the the AgentX protocol (:rfc:`2741`) and make the
(:rfc:`2741`) and make the routing protocol MIBs available through it. routing protocol MIBs available through it.


Note that SNMP Support needs to be enabled at compile-time and loaded as module Note that SNMP Support needs to be enabled at compile-time and loaded as module
on daemon startup. Refer to :ref:`loadable-module-support` on the latter. on daemon startup. Refer to :ref:`loadable-module-support` on the latter.
Expand All @@ -18,16 +18,10 @@ on daemon startup. Refer to :ref:`loadable-module-support` on the latter.
Getting and installing an SNMP agent Getting and installing an SNMP agent
==================================== ====================================


There are several SNMP agent which support SMUX or AgentX. We recommend to use The supported SNMP agent is AgentX. We recommend to use
the latest version of `net-snmp` which was formerly known as `ucd-snmp`. It is the latest version of `net-snmp` which was formerly known as `ucd-snmp`. It is
free and open software and available at `http://www.net-snmp.org/ <http://www.net-snmp.org/>`_ free and open software and available at `http://www.net-snmp.org/ <http://www.net-snmp.org/>`_
and as binary package for most Linux distributions. `net-snmp` has to be and as binary package for most Linux distributions.
compiled with `--with-mib-modules=agentx` to be able to accept connections from
FRR using AgentX protocol or with `--with-mib-modules=smux` to use SMUX
protocol.

Nowadays, SMUX is a legacy protocol. The AgentX protocol should be preferred
for any new deployment. Both protocols have the same coverage.


.. _agentx-configuration: .. _agentx-configuration:


Expand All @@ -42,7 +36,7 @@ master SNMP agent (snmpd) and each of the FRR daemons must be configured. In
:file:`/etc/snmp/snmpd.conf`, the ``master agentx`` directive should be added. :file:`/etc/snmp/snmpd.conf`, the ``master agentx`` directive should be added.
In each of the FRR daemons, ``agentx`` command will enable AgentX support. In each of the FRR daemons, ``agentx`` command will enable AgentX support.


:file:`/etc/snmp/snmpd.conf`: :file:`/etc/snmp/zebra.conf`:


:: ::


Expand Down Expand Up @@ -97,105 +91,6 @@ need to configure FRR to use another transport, you can configure it through
agentXSocket tcp:192.168.15.12:705 agentXSocket tcp:192.168.15.12:705




.. _smux-configuration:

SMUX configuration
==================

To enable SMUX protocol support, FRR must have been build with the
:option:`--enable-snmp` option.

A separate connection has then to be established between the SNMP agent (snmpd)
and each of the FRR daemons. This connections each use different OID numbers
and passwords. Be aware that this OID number is not the one that is used in
queries by clients, it is solely used for the intercommunication of the
daemons.

In the following example the ospfd daemon will be connected to the snmpd daemon
using the password "frr_ospfd". For testing it is recommending to take exactly
the below snmpd.conf as wrong access restrictions can be hard to debug.

:file:`/etc/snmp/snmpd.conf`:

::

#
# example access restrictions setup
#
com2sec readonly default public
group MyROGroup v1 readonly
view all included .1 80
access MyROGroup "" any noauth exact all none none
#
# the following line is relevant for FRR
#
smuxpeer .1.3.6.1.4.1.3317.1.2.5 frr_ospfd

:file:`/etc/frr/ospf`:

::

! ... the rest of ospfd.conf has been omitted for clarity ...
!
smux peer .1.3.6.1.4.1.3317.1.2.5 frr_ospfd
!


After restarting snmpd and frr, a successful connection can be verified in the
syslog and by querying the SNMP daemon:

::

snmpd[12300]: [smux_accept] accepted fd 12 from 127.0.0.1:36255
snmpd[12300]: accepted smux peer: \\
oid GNOME-PRODUCT-ZEBRA-MIB::ospfd, frr-0.96.5

# snmpwalk -c public -v1 localhost .1.3.6.1.2.1.14.1.1
OSPF-MIB::ospfRouterId.0 = IpAddress: 192.168.42.109


Be warned that the current version (5.1.1) of the Net-SNMP daemon writes a line
for every SNMP connect to the syslog which can lead to enormous log file sizes.
If that is a problem you should consider to patch snmpd and comment out the
troublesome `snmp_log()` line in the function `netsnmp_agent_check_packet()` in
`agent/snmp_agent.c`.

MIB and command reference
=========================

The following OID numbers are used for the interprocess communication of snmpd and
the FRR daemons with SMUX only.::

. (OIDs below .iso.org.dod.internet.private.enterprises)
zebra .1.3.6.1.4.1.3317.1.2.1 .gnome.gnomeProducts.zebra.zserv
bgpd .1.3.6.1.4.1.3317.1.2.2 .gnome.gnomeProducts.zebra.bgpd
ripd .1.3.6.1.4.1.3317.1.2.3 .gnome.gnomeProducts.zebra.ripd
ospfd .1.3.6.1.4.1.3317.1.2.5 .gnome.gnomeProducts.zebra.ospfd
ospf6d .1.3.6.1.4.1.3317.1.2.6 .gnome.gnomeProducts.zebra.ospf6d


Sadly, SNMP has not been implemented in all daemons yet. The following
OID numbers are used for querying the SNMP daemon by a client:::

zebra .1.3.6.1.2.1.4.24 .iso.org.dot.internet.mgmt.mib-2.ip.ipForward
ospfd .1.3.6.1.2.1.14 .iso.org.dot.internet.mgmt.mib-2.ospf
bgpd .1.3.6.1.2.1.15 .iso.org.dot.internet.mgmt.mib-2.bgp
ripd .1.3.6.1.2.1.23 .iso.org.dot.internet.mgmt.mib-2.rip2
ospf6d .1.3.6.1.3.102 .iso.org.dod.internet.experimental.ospfv3


The following syntax is understood by the FRR daemons for configuring SNMP
using SMUX:

.. index:: smux peer OID
.. clicmd:: smux peer OID
.. index:: no smux peer OID
.. clicmd:: no smux peer OID
.. index:: smux peer OID PASSWORD
.. clicmd:: smux peer OID PASSWORD
.. index:: no smux peer OID PASSWORD
.. clicmd:: no smux peer OID PASSWORD

Here is the syntax for using AgentX: Here is the syntax for using AgentX:


.. index:: agentx .. index:: agentx
Expand Down

0 comments on commit 807ed4e

Please sign in to comment.