aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bsnmpd/modules
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bsnmpd/modules')
-rw-r--r--usr.sbin/bsnmpd/modules/Makefile6
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt101
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_atm/Makefile21
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend22
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def56
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c301
6 files changed, 1 insertions, 506 deletions
diff --git a/usr.sbin/bsnmpd/modules/Makefile b/usr.sbin/bsnmpd/modules/Makefile
index 60c253b71875..6640bb62d112 100644
--- a/usr.sbin/bsnmpd/modules/Makefile
+++ b/usr.sbin/bsnmpd/modules/Makefile
@@ -4,11 +4,7 @@
.PATH: ${SRCTOP}/contrib/bsnmp/snmpd
-.if ${MK_ATM} != "no"
-_snmp_atm= snmp_atm
-.endif
-
-SUBDIR= ${_snmp_atm} \
+SUBDIR= \
snmp_bridge \
snmp_hostres \
snmp_lm75 \
diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt b/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt
deleted file mode 100644
index f2887418e212..000000000000
--- a/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt
+++ /dev/null
@@ -1,101 +0,0 @@
---
--- Copyright (c) 2004
--- Hartmut Brandt.
--- All rights reserved.
---
--- Author: Hartmut Brandt <harti@freebsd.org>
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
--- 1. Redistributions of source code must retain the above copyright
--- notice, this list of conditions and the following disclaimer.
--- 2. Redistributions in binary form must reproduce the above copyright
--- notice, this list of conditions and the following disclaimer in the
--- documentation and/or other materials provided with the distribution.
---
--- THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
--- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
--- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
--- ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
--- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
--- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
--- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
--- SUCH DAMAGE.
---
--- $FreeBSD$
---
--- Private Begemot MIB for ATM interfaces on FreeBSD
---
-BEGEMOT-ATM-FREEBSD-MIB DEFINITIONS ::= BEGIN
-
-IMPORTS
- MODULE-IDENTITY, OBJECT-TYPE
- FROM SNMPv2-SMI
- NgNodeIdOrZero
- FROM BEGEMOT-NETGRAPH-MIB
- begemotAtmSysGroup, begemotAtmIfEntry
- FROM BEGEMOT-ATM-MIB;
-
-begemotAtmFreeBSDGroup MODULE-IDENTITY
- LAST-UPDATED "200408060000Z"
- ORGANIZATION "German Aerospace Centre"
- CONTACT-INFO
- " Hartmut Brandt
-
- Postal: German Aerospace Centre (DLR)
- Institute of Communications and Navigation
- 82234 Wessling
- Germany
-
- Fax: +49 8153 28 2844
-
- E-mail: harti@freebsd.org"
- DESCRIPTION
- "The FreeBSD specific Begemot MIB for ATM interfaces."
- REVISION "200408060000Z"
- DESCRIPTION
- "Initial revision."
- ::= { begemotAtmSysGroup 1 }
-
--- Netgraph
-begemotAtmNgGroup OBJECT IDENTIFIER ::= { begemotAtmFreeBSDGroup 1 }
-
---
--- Interfaces table
---
-begemotAtmNgIfTable OBJECT-TYPE
- SYNTAX SEQUENCE OF BegemotAtmNgIfEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "This table contains an entry for each hardware ATM
- interface. The table is indexed by the interface index."
- ::= { begemotAtmNgGroup 1 }
-
-begemotAtmNgIfEntry OBJECT-TYPE
- SYNTAX BegemotAtmNgIfEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "This is a table entry describing one ATM hardware interface."
- AUGMENTS { begemotAtmIfEntry }
- ::= { begemotAtmNgIfTable 1 }
-
-BegemotAtmNgIfEntry ::= SEQUENCE {
- begemotAtmNgIfNodeId NgNodeIdOrZero
-}
-
-begemotAtmNgIfNodeId OBJECT-TYPE
- SYNTAX NgNodeIdOrZero
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The netgraph node id of the interface. If there is no
- node corresponding to the interface, this is 0."
- ::= { begemotAtmNgIfEntry 1 }
-
-END
diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile
deleted file mode 100644
index 82bd325dcaa3..000000000000
--- a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# $FreeBSD$
-#
-# Author: Harti Brandt <harti@freebsd.org>
-
-CONTRIB= ${SRCTOP}/contrib/ngatm
-.PATH: ${CONTRIB}/snmp_atm
-
-MOD= atm
-SRCS= snmp_atm.c atm_sys.c
-XSYM= begemotAtm
-MAN= snmp_atm.3
-
-BMIBS= BEGEMOT-ATM.txt BEGEMOT-ATM-FREEBSD-MIB.txt
-DEFS= ${MOD}_tree.def atm_freebsd.def
-INCS= snmp_${MOD}.h
-
-EXTRAMIBDEFS= atm_freebsd.def
-
-CFLAGS+= -I${CONTRIB}/snmp_atm
-
-.include <bsd.snmpmod.mk>
diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend
deleted file mode 100644
index 0d3689874fa8..000000000000
--- a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend
+++ /dev/null
@@ -1,22 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- gnu/lib/csu \
- gnu/lib/libgcc \
- include \
- include/xlocale \
- lib/${CSU_DIR} \
- lib/libbsnmp/libbsnmp \
- lib/libc \
- lib/libcompiler_rt \
- usr.sbin/bsnmpd/modules \
- usr.sbin/bsnmpd/modules/snmp_mibII \
- usr.sbin/bsnmpd/modules/snmp_netgraph \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def b/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def
deleted file mode 100644
index 6cc61d012184..000000000000
--- a/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Copyright (c) 2004
-# Hartmut Brandt.
-# All rights reserved.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD$
-#
-# SNMP module for ATM hardware interfaces.
-#
-# $Begemot: libunimsg/snmp_atm/atm_tree.def,v 1.2 2004/08/05 07:14:22 brandt Exp $
-#
-(1 internet
- (4 private
- (1 enterprises
- (12325 fokus
- (1 begemot
- (101 begemotAtm
- (1 begemotAtmObjects
- (4 begemotAtmSysGroup
- (1 begemotAtmFreeBSDGroup
- (1 begemotAtmNgGroup
- (1 begemotAtmNgIfTable
- (1 begemotAtmNgIfEntry : INTEGER op_atmif_ng
- (1 begemotAtmIfNodeId UNSIGNED32 GET)
- ))
- )
- )
- )
- )
- ))
- )
- )
-))
diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c b/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c
deleted file mode 100644
index c0699f7c2b3d..000000000000
--- a/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 2001-2002
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- * Copyright (c) 2003-2004
- * Hartmut Brandt.
- * All rights reserved.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- *
- * SNMP module for ATM hardware interfaces - FreeBSD/Ng specific part.
- */
-
-#include "atm.h"
-#include "atm_tree.h"
-#include "atm_oid.h"
-
-#include <stdlib.h>
-#include <syslog.h>
-#include <string.h>
-
-#include <net/if_atm.h>
-
-#include <bsnmp/snmp_netgraph.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/atm/ng_atm.h>
-
-static const struct hwinfo {
- const char *device;
- const char *vendor;
-} hwinfo[] = {
- ATM_DEVICE_NAMES
-};
-
-struct atmif_sys {
- ng_ID_t atm_node;
- void *regc; /* cookie registration */
-};
-
-/*
- * Find the interface for a given node
- */
-struct atmif *
-atm_node2if(u_int node)
-{
- struct atmif_priv *aif;
-
- if (node != 0)
- TAILQ_FOREACH(aif, &atmif_list, link)
- if (aif->sys->atm_node == node)
- return (&aif->pub);
- return (NULL);
-}
-
-u_int
-atm_if2node(struct atmif *pub)
-{
- struct atmif_priv *aif = (struct atmif_priv *)pub;
-
- return (aif->sys->atm_node);
-}
-
-/*
- * Destroy system dependend stuff.
- */
-void
-atmif_sys_destroy(struct atmif_priv *aif)
-{
-
- ng_unregister_cookie(aif->sys->regc);
- free(aif->sys);
- free(aif->pub.mib);
-}
-
-/*
- * Handle a message from the ATM node
- */
-static void
-handle_atm_message(const struct ng_mesg *mesg, const char *path __unused,
- ng_ID_t node, void *uarg)
-{
- struct atmif_priv *aif = uarg;
- enum atmif_carrier_state ost;
-
- switch (mesg->header.cmd) {
-
- case NGM_ATM_IF_CHANGE:
- {
- const struct ngm_atm_if_change *arg;
-
- ost = aif->pub.carrier;
- if (mesg->header.arglen != sizeof(*arg)) {
- syslog(LOG_ERR, "ATM_IF_CHANGE: wrong size");
- atmif_check_carrier(aif);
- return;
- }
- arg = (const struct ngm_atm_if_change *)
- (const void *)mesg->data;
-
- if (arg->carrier)
- aif->pub.carrier = ATMIF_CARRIER_ON;
- else
- aif->pub.carrier = ATMIF_CARRIER_OFF;
-
- if (ost != aif->pub.carrier)
- atmif_send_notification(aif, ATMIF_NOTIFY_CARRIER,
- (uintptr_t)ost);
- return;
- }
-
- case NGM_ATM_VCC_CHANGE:
- {
- const struct ngm_atm_vcc_change *arg;
-
- if (mesg->header.arglen != sizeof(*arg)) {
- syslog(LOG_ERR, "ATM_VCC_CHANGE: wrong size");
- return;
- }
- arg = (const struct ngm_atm_vcc_change *)
- (const void *)mesg->data;
- atmif_send_notification(aif, ATMIF_NOTIFY_VCC,
- (uintptr_t)(((arg->vpi & 0xff) << 24) |
- ((arg->vci & 0xffff) << 8) | (arg->state & 1)));
- return;
- }
- }
- syslog(LOG_WARNING, "spurious message %u from node [%x]",
- mesg->header.cmd, node);
-}
-
-/*
- * Attach to an ATM interface
- */
-int
-atmif_sys_attach_if(struct atmif_priv *aif)
-{
- struct ng_mesg *resp, *resp1;
- struct namelist *list;
- u_int i;
-
- if ((aif->sys = malloc(sizeof(*aif->sys))) == NULL) {
- syslog(LOG_CRIT, "out of memory");
- return (-1);
- }
- memset(aif->sys, 0, sizeof(*aif->sys));
-
- if ((aif->pub.mib = malloc(sizeof(*aif->pub.mib))) == NULL) {
- free(aif->sys);
- syslog(LOG_CRIT, "out of memory");
- return (-1);
- }
-
- atmif_sys_fill_mib(aif);
-
- /*
- * Get ATM node Id. Must do it the hard way by scanning all nodes
- * because the name may be wrong.
- */
- if ((resp = ng_dialog_id(snmp_node, NGM_GENERIC_COOKIE, NGM_LISTNODES,
- NULL, 0)) == NULL) {
- syslog(LOG_ERR, "cannot fetch node list: %m");
- free(aif->sys);
- return (-1);
- }
- list = (struct namelist *)(void *)resp->data;
-
- for (i = 0; i < list->numnames; i++) {
- if (strcmp(list->nodeinfo[i].type, NG_ATM_NODE_TYPE) != 0)
- continue;
- if ((resp1 = ng_dialog_id(list->nodeinfo[i].id,
- NGM_ATM_COOKIE, NGM_ATM_GET_IFNAME, NULL, 0)) == NULL)
- continue;
- if (strcmp(resp1->data, aif->pub.ifp->name) == 0) {
- free(resp1);
- break;
- }
- free(resp1);
- }
- if (i == list->numnames)
- aif->sys->atm_node = 0;
- else
- aif->sys->atm_node = list->nodeinfo[i].id;
-
- free(resp);
-
- if ((aif->sys->regc = ng_register_cookie(module, NGM_ATM_COOKIE,
- aif->sys->atm_node, handle_atm_message, aif)) == NULL) {
- syslog(LOG_ERR, "cannot register cookie: %m");
- free(aif->sys);
- return (-1);
- }
- return (0);
-}
-
-/*
- * Table of all ATM interfaces - Ng part
- */
-int
-op_atmif_ng(struct snmp_context *ctx __unused, struct snmp_value *value,
- u_int sub, u_int vindex __unused, enum snmp_op op)
-{
- struct atmif_priv *aif;
- int err;
-
- if ((err = atmif_get_aif(value, sub, op, &aif)) != SNMP_ERR_NOERROR)
- return (err);
-
- if (op == SNMP_OP_SET) {
- switch (value->var.subs[sub - 1]) {
-
- default:
- return (SNMP_ERR_NOT_WRITEABLE);
- }
- }
-
- switch (value->var.subs[sub - 1]) {
-
- case LEAF_begemotAtmIfNodeId:
- value->v.uint32 = aif->sys->atm_node;
- return (SNMP_ERR_NOERROR);
- }
- abort();
-}
-
-/*
- * Get vendor string
- */
-int
-atm_sys_get_hw_vendor(struct atmif_priv *aif, struct snmp_value *value)
-{
-
- if (aif->pub.mib->device >= sizeof(hwinfo) / sizeof(hwinfo[0]))
- return (string_get(value, "unknown", -1));
- return (string_get(value, hwinfo[aif->pub.mib->device].vendor, -1));
-}
-
-/*
- * Get device string
- */
-int
-atm_sys_get_hw_device(struct atmif_priv *aif, struct snmp_value *value)
-{
-
- if (aif->pub.mib->device >= sizeof(hwinfo) / sizeof(hwinfo[0]))
- return (string_get(value, "unknown", -1));
- return (string_get(value, hwinfo[aif->pub.mib->device].device, -1));
-}
-
-/*
- * Extract the ATM MIB from the interface's private MIB
- */
-void
-atmif_sys_fill_mib(struct atmif_priv *aif)
-{
- struct ifatm_mib *mib;
-
- if (aif->pub.ifp->specmiblen != sizeof(struct ifatm_mib)) {
- syslog(LOG_ERR, "atmif MIB has wrong size %zu",
- aif->pub.ifp->specmiblen);
- memset(aif->pub.mib, 0, sizeof(*aif->pub.mib));
- aif->pub.mib->version = 0;
- return;
- }
- mib = (struct ifatm_mib *)aif->pub.ifp->specmib;
-
- aif->pub.mib->device = mib->device;
- aif->pub.mib->serial = mib->serial;
- aif->pub.mib->hw_version = mib->hw_version;
- aif->pub.mib->sw_version = mib->sw_version;
- aif->pub.mib->media = mib->media;
-
- memcpy(aif->pub.mib->esi, mib->esi, 6);
- aif->pub.mib->pcr = mib->pcr;
- aif->pub.mib->vpi_bits = mib->vpi_bits;
- aif->pub.mib->vci_bits = mib->vci_bits;
- aif->pub.mib->max_vpcs = mib->max_vpcs;
- aif->pub.mib->max_vccs = mib->max_vccs;
-}