summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Knight <joel@cvs.openbsd.org>2012-01-31 18:00:47 +0000
committerJoel Knight <joel@cvs.openbsd.org>2012-01-31 18:00:47 +0000
commitfb2734338e58fdc20118207adfd74a2658654471 (patch)
tree3cddf52047a7cf835e68c4790de5bf6c06e93854
parentffc51d5ef3767fc247e880062988195c72983503 (diff)
Add the OPENBSD-CARP-MIB to snmpd
ok camield@, "start committing" deraadt@
-rw-r--r--share/snmp/Makefile3
-rw-r--r--share/snmp/OPENBSD-CARP-MIB.txt310
-rw-r--r--share/snmp/OPENBSD-SNMPD-CONF.txt6
-rw-r--r--usr.sbin/snmpd/mib.c237
-rw-r--r--usr.sbin/snmpd/mib.h71
5 files changed, 619 insertions, 8 deletions
diff --git a/share/snmp/Makefile b/share/snmp/Makefile
index c2a33761c14..94a3b3cd76d 100644
--- a/share/snmp/Makefile
+++ b/share/snmp/Makefile
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile,v 1.1 2008/12/23 18:32:10 reyk Exp $
+# $OpenBSD: Makefile,v 1.2 2012/01/31 18:00:46 joel Exp $
FILES= OPENBSD-SNMPD-CONF.txt OPENBSD-BASE-MIB.txt
FILES+= OPENBSD-MEM-MIB.txt OPENBSD-SENSORS-MIB.txt
+FILES+= OPENBSD-CARP-MIB.txt
all clean cleandir depend lint obj tags: _SUBDIRUSE
diff --git a/share/snmp/OPENBSD-CARP-MIB.txt b/share/snmp/OPENBSD-CARP-MIB.txt
new file mode 100644
index 00000000000..8296927f476
--- /dev/null
+++ b/share/snmp/OPENBSD-CARP-MIB.txt
@@ -0,0 +1,310 @@
+-- $OpenBSD: OPENBSD-CARP-MIB.txt,v 1.1 2012/01/31 18:00:46 joel Exp $
+--
+-- Copyright (c) 2006-2011 Joel Knight <knight.joel@gmail.com>
+--
+-- Permission to use, copy, modify, and distribute this document for any
+-- purpose with or without fee is hereby granted, provided that the above
+-- copyright notice and this permission notice appear in all copies.
+--
+-- THE DOCUMENT IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+-- WITH REGARD TO THIS DOCUMENT INCLUDING ALL IMPLIED WARRANTIES OF
+-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS DOCUMENT.
+
+
+OPENBSD-CARP-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, NOTIFICATION-TYPE, OBJECT-TYPE,
+ Counter64, Integer32, enterprises
+ FROM SNMPv2-SMI
+
+ TruthValue
+ FROM SNMPv2-TC
+
+ openBSD
+ FROM OPENBSD-BASE-MIB
+
+ MODULE-COMPLIANCE, OBJECT-GROUP
+ FROM SNMPv2-CONF;
+
+carpMIBObjects MODULE-IDENTITY
+ LAST-UPDATED "201105130000Z"
+ ORGANIZATION "OpenBSD"
+ CONTACT-INFO "
+ Author: Joel Knight
+ email: knight.joel@gmail.com
+ www: www.packetmischief.ca/openbsd-snmp-mibs/
+ "
+ DESCRIPTION "The MIB module for gathering information about
+ Common Address Redundancy Protocol (CARP) interfaces.
+ "
+ ::= { openBSD 6 }
+
+
+-- define the sections of the MIB
+
+carpSysctl OBJECT IDENTIFIER ::= { carpMIBObjects 1 }
+carpIf OBJECT IDENTIFIER ::= { carpMIBObjects 2 }
+carpStats OBJECT IDENTIFIER ::= { carpMIBObjects 3 }
+
+
+-- carpSysctl
+carpAllow OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Indicates whether the node will respond to CARP packets."
+ ::= { carpSysctl 1 }
+
+carpPreempt OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Indicates whether preemption is enabled."
+ ::= { carpSysctl 2 }
+
+carpLog OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Indicates whether logging of invalud CARP packets is enabled."
+ ::= { carpSysctl 3 }
+
+
+-- carpIf
+
+carpIfNumber OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of CARP interfaces present on this system."
+ ::= { carpIf 1 }
+
+carpIfTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF CarpIfEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A list of individual CARP interfaces. The number of entries is
+ given by the value of carpIfNumber."
+ ::= { carpIf 2 }
+
+carpIfEntry OBJECT-TYPE
+ SYNTAX CarpIfEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "An entry containing management information applicable to a
+ particular CARP interface."
+ INDEX { carpIfIndex }
+ ::= { carpIfTable 1 }
+
+CarpIfEntry ::=
+ SEQUENCE {
+ carpIfIndex Integer32,
+ carpIfDescr OCTET STRING,
+ carpIfVhid Integer32,
+ carpIfDev OCTET STRING,
+ carpIfAdvbase Integer32,
+ carpIfAdvskew Integer32,
+ carpIfState Integer32
+ }
+
+carpIfIndex OBJECT-TYPE
+ SYNTAX Integer32 (1..2147483647)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "A unique value, greater than zero, for each CARP interface."
+ ::= { carpIfEntry 1 }
+
+carpIfDescr OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The name of the CARP interface."
+ ::= { carpIfEntry 2 }
+
+carpIfVhid OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The Virtual HostID of the CARP interface."
+ ::= { carpIfEntry 3 }
+
+carpIfDev OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The parent interface that the CARP interface is bound to."
+ ::= { carpIfEntry 4 }
+
+carpIfAdvbase OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The advbase value of the CARP interface."
+ ::= { carpIfEntry 5 }
+
+carpIfAdvskew OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The advskew value of the CARP interface."
+ ::= { carpIfEntry 6 }
+
+carpIfState OBJECT-TYPE
+ SYNTAX INTEGER { init(0), backup(1), master(2) }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Indicates the operational state of the CARP interface."
+ ::= { carpIfEntry 7 }
+
+
+-- carpStats
+
+carpIpPktsRecv OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of IPv4 CARP packets received on all interfaces."
+ ::= { carpStats 1 }
+
+carpIp6PktsRecv OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of IPv6 CARP packets received on all interfaces."
+ ::= { carpStats 2 }
+
+carpPktDiscardsForBadInterface OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of packets discarded due to being received on a
+ non-CARP interface."
+ ::= { carpStats 3 }
+
+carpPktDiscardsForWrongTtl OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of packets discarded due to having a TTL less
+ than 255."
+ ::= { carpStats 4 }
+
+carpPktShorterThanHeader OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of packets received on any interface that is
+ shorter than the size of the CARP packet header."
+ ::= { carpStats 5 }
+
+carpPktDiscardsForBadChecksum OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of packets discarded due to bad checksum."
+ ::= { carpStats 6 }
+
+carpPktDiscardsForBadVersion OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of packets discarded due to bad version in
+ the packet header."
+ ::= { carpStats 7 }
+
+carpPktDiscardsForTooShort OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of packets discarded due to being too short."
+ ::= { carpStats 8 }
+
+carpPktDiscardsForBadAuth OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of packets discarded because they failed the
+ HMAC authentication check."
+ ::= { carpStats 9 }
+
+carpPktDiscardsForBadVhid OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of packets discarded due to incorrect VHID in
+ the packet header."
+ ::= { carpStats 10 }
+
+carpPktDiscardsForBadAddressList OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of packets discarded due to bad addresses in
+ the CARP packet."
+ ::= { carpStats 11 }
+
+carpIpPktsSent OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of IPv4 CARP packets sent on all interfaces."
+ ::= { carpStats 12 }
+
+carpIp6PktsSent OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of IPv6 CARP packets sent on all interfaces."
+ ::= { carpStats 13 }
+
+carpNoMemory OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of CARP advertisements that failed because memory
+ could not be allocated."
+ ::= { carpStats 14 }
+
+carpTransitionsToMaster OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of times the host has transitioned to MASTER state
+ for any CARP group."
+ ::= { carpStats 15 }
+
+END
+
diff --git a/share/snmp/OPENBSD-SNMPD-CONF.txt b/share/snmp/OPENBSD-SNMPD-CONF.txt
index cd70a80051c..b8758235171 100644
--- a/share/snmp/OPENBSD-SNMPD-CONF.txt
+++ b/share/snmp/OPENBSD-SNMPD-CONF.txt
@@ -1,4 +1,4 @@
--- $OpenBSD: OPENBSD-SNMPD-CONF.txt,v 1.2 2010/06/11 10:45:37 jsg Exp $
+-- $OpenBSD: OPENBSD-SNMPD-CONF.txt,v 1.3 2012/01/31 18:00:46 joel Exp $
--
-- Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org>
--
@@ -74,4 +74,8 @@ IMPORTS
memMIBObjects
FROM OPENBSD-MEM-MIB;
+ -- CARP interface & statistics MIB, OPENBSD-CARP-MIB.txt
+ carpMIBObjects
+ FROM OPENBSD-CARP-MIB;
+
END
diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c
index fc9a31c07c4..7ac40315e5f 100644
--- a/usr.sbin/snmpd/mib.c
+++ b/usr.sbin/snmpd/mib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mib.c,v 1.48 2012/01/30 22:04:28 joel Exp $ */
+/* $OpenBSD: mib.c,v 1.49 2012/01/31 18:00:46 joel Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net>
@@ -27,13 +27,16 @@
#include <sys/sysctl.h>
#include <sys/sensors.h>
#include <sys/sched.h>
+#include <sys/socket.h>
#include <sys/mount.h>
+#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_types.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
+#include <netinet/ip_carp.h>
#include <netinet/ip_var.h>
#include <arpa/inet.h>
@@ -1210,14 +1213,27 @@ mib_ifrcvtable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
}
/*
- * Defined in OPENBSD-SENSORS-MIB.txt
- * (http://packetmischief.ca/openbsd/snmp/)
- */
+ * Defined in
+ * - OPENBSD-SENSORS-MIB.txt
+ * - OPENBSD-CARP-MIB.txt
+ * (http://www.packetmischief.ca/openbsd-snmp-mibs/)
+ */
+
+struct carpif {
+ struct carpreq carpr;
+ struct kif kif;
+};
int mib_sensornum(struct oid *, struct ber_oid *, struct ber_element **);
int mib_sensors(struct oid *, struct ber_oid *, struct ber_element **);
const char *mib_sensorunit(struct sensor *);
char *mib_sensorvalue(struct sensor *);
+int mib_carpsysctl(struct oid *, struct ber_oid *, struct ber_element **);
+int mib_carpstats(struct oid *, struct ber_oid *, struct ber_element **);
+int mib_carpiftable(struct oid *, struct ber_oid *, struct ber_element **);
+int mib_carpifnum(struct oid *, struct ber_oid *, struct ber_element **);
+struct carpif
+ *mib_carpifget(struct carpif *, u_int);
int mib_memiftable(struct oid *, struct ber_oid *, struct ber_element **);
static struct oid openbsd_mib[] = {
@@ -1230,6 +1246,33 @@ static struct oid openbsd_mib[] = {
{ MIB(sensorValue), OID_TRD, mib_sensors },
{ MIB(sensorUnits), OID_TRD, mib_sensors },
{ MIB(sensorStatus), OID_TRD, mib_sensors },
+ { MIB(carpMIBObjects), OID_MIB },
+ { MIB(carpAllow), OID_RD, mib_carpsysctl },
+ { MIB(carpPreempt), OID_RD, mib_carpsysctl },
+ { MIB(carpLog), OID_RD, mib_carpsysctl },
+ { MIB(carpIpPktsRecv), OID_RD, mib_carpstats },
+ { MIB(carpIp6PktsRecv), OID_RD, mib_carpstats },
+ { MIB(carpPktDiscardsBadIface), OID_RD, mib_carpstats },
+ { MIB(carpPktDiscardsBadTtl), OID_RD, mib_carpstats },
+ { MIB(carpPktShorterThanHdr), OID_RD, mib_carpstats },
+ { MIB(carpDiscardsBadCksum), OID_RD, mib_carpstats },
+ { MIB(carpDiscardsBadVersion), OID_RD, mib_carpstats },
+ { MIB(carpDiscardsTooShort), OID_RD, mib_carpstats },
+ { MIB(carpDiscardsBadAuth), OID_RD, mib_carpstats },
+ { MIB(carpDiscardsBadVhid), OID_RD, mib_carpstats },
+ { MIB(carpDiscardsBadAddrList), OID_RD, mib_carpstats },
+ { MIB(carpIpPktsSent), OID_RD, mib_carpstats },
+ { MIB(carpIp6PktsSent), OID_RD, mib_carpstats },
+ { MIB(carpNoMemory), OID_RD, mib_carpstats },
+ { MIB(carpTransitionsToMaster), OID_RD, mib_carpstats },
+ { MIB(carpIfNumber), OID_RD, mib_carpifnum },
+ { MIB(carpIfIndex), OID_TRD, mib_carpiftable },
+ { MIB(carpIfDescr), OID_TRD, mib_carpiftable },
+ { MIB(carpIfVhid), OID_TRD, mib_carpiftable },
+ { MIB(carpIfDev ), OID_TRD, mib_carpiftable },
+ { MIB(carpIfAdvbase), OID_TRD, mib_carpiftable },
+ { MIB(carpIfAdvskew), OID_TRD, mib_carpiftable },
+ { MIB(carpIfState), OID_TRD, mib_carpiftable },
{ MIB(memMIBObjects), OID_MIB },
{ MIB(memMIBVersion), OID_RD, mps_getint, NULL, NULL,
OIDVER_OPENBSD_MEM },
@@ -1418,6 +1461,192 @@ mib_sensorvalue(struct sensor *s)
}
int
+mib_carpsysctl(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
+{
+ size_t len;
+ int mib[] = { CTL_NET, PF_INET, IPPROTO_CARP, 0 };
+ int v;
+
+ mib[3] = oid->o_oid[OIDIDX_carpsysctl];
+ len = sizeof(v);
+
+ if (sysctl(mib, 4, &v, &len, NULL, 0) == -1)
+ return (1);
+
+ *elm = ber_add_integer(*elm, v);
+ return (0);
+}
+
+int
+mib_carpstats(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
+{
+ int mib[] = { CTL_NET, PF_INET, IPPROTO_CARP,
+ CARPCTL_STATS };
+ size_t len;
+ struct carpstats stats;
+ int i;
+ struct statsmap {
+ u_int8_t m_id;
+ u_int64_t *m_ptr;
+ } mapping[] = {
+ { 1, &stats.carps_ipackets },
+ { 2, &stats.carps_ipackets6 },
+ { 3, &stats.carps_badif },
+ { 4, &stats.carps_badttl },
+ { 5, &stats.carps_hdrops },
+ { 6, &stats.carps_badsum },
+ { 7, &stats.carps_badver },
+ { 8, &stats.carps_badlen },
+ { 9, &stats.carps_badauth },
+ { 10, &stats.carps_badvhid },
+ { 11, &stats.carps_badaddrs },
+ { 12, &stats.carps_opackets },
+ { 13, &stats.carps_opackets6 },
+ { 14, &stats.carps_onomem },
+ { 15, &stats.carps_preempt }
+ };
+
+ len = sizeof(stats);
+
+ if (sysctl(mib, 4, &stats, &len, NULL, 0) == -1)
+ return (1);
+
+ for (i = 0;
+ (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
+ if (oid->o_oid[OIDIDX_carpstats] == mapping[i].m_id) {
+ *elm = ber_add_integer(*elm, *mapping[i].m_ptr);
+ ber_set_header(*elm, BER_CLASS_APPLICATION,
+ SNMP_T_COUNTER64);
+ return (0);
+ }
+ }
+
+ return (-1);
+}
+
+int
+mib_carpifnum(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
+{
+ struct kif *kif;
+ int c = 0;
+
+ for (kif = kr_getif(0); kif != NULL;
+ kif = kr_getnextif(kif->if_index))
+ if (kif->if_type == IFT_CARP)
+ c++;
+
+ *elm = ber_add_integer(*elm, c);
+ return (0);
+}
+
+struct carpif *
+mib_carpifget(struct carpif *cif, u_int idx)
+{
+ struct kif *kif;
+ int s;
+ struct ifreq ifr;
+ struct carpreq carpr;
+
+ if ((kif = kr_getif(idx)) == NULL || kif->if_type != IFT_CARP) {
+ /*
+ * It may happen that an interface with a specific index
+ * does not exist, has been removed, or is not a carp(4)
+ * interface. Jump to the next available carp(4) interface
+ * index.
+ */
+ for (kif = kr_getif(0); kif != NULL;
+ kif = kr_getnextif(kif->if_index)) {
+ if (kif->if_type != IFT_CARP)
+ continue;
+ if (kif->if_index > idx)
+ break;
+
+ }
+ if (kif == NULL)
+ return (NULL);
+ }
+ idx = kif->if_index;
+
+ /* Update interface information */
+ kr_updateif(idx);
+ if ((kif = kr_getif(idx)) == NULL) {
+ log_debug("mib_carpifget: interface %d disappeared?", idx);
+ return (NULL);
+ }
+
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+ return (NULL);
+
+ memset(&ifr, 0, sizeof(ifr));
+ strlcpy(ifr.ifr_name, kif->if_name, sizeof(ifr.ifr_name));
+ memset((char *)&carpr, 0, sizeof(carpr));
+ ifr.ifr_data = (caddr_t)&carpr;
+
+ if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1)
+ return (NULL);
+
+ memset(cif, 0, sizeof(struct carpif));
+ memcpy(&cif->carpr, &carpr, sizeof(struct carpreq));
+ memcpy(&cif->kif, kif, sizeof(struct kif));
+
+ close(s);
+
+ return (cif);
+}
+
+int
+mib_carpiftable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
+{
+ u_int32_t idx;
+ struct carpif *cif;
+
+ if ((cif = malloc(sizeof(struct carpif))) == NULL)
+ return (1);
+
+ /* Get and verify the current row index */
+ idx = o->bo_id[OIDIDX_carpIfEntry];
+
+ if ((cif = mib_carpifget(cif, idx)) == NULL) {
+ free(cif);
+ return (1);
+ }
+
+ /* Tables need to prepend the OID on their own */
+ o->bo_id[OIDIDX_carpIfEntry] = cif->kif.if_index;
+ *elm = ber_add_oid(*elm, o);
+
+ switch (o->bo_id[OIDIDX_carpIf]) {
+ case 1:
+ *elm = ber_add_integer(*elm, cif->kif.if_index);
+ break;
+ case 2:
+ *elm = ber_add_string(*elm, cif->kif.if_name);
+ break;
+ case 3:
+ *elm = ber_add_integer(*elm, cif->carpr.carpr_vhids[0]);
+ break;
+ case 4:
+ *elm = ber_add_string(*elm, cif->carpr.carpr_carpdev);
+ break;
+ case 5:
+ *elm = ber_add_integer(*elm, cif->carpr.carpr_advbase);
+ break;
+ case 6:
+ *elm = ber_add_integer(*elm, cif->carpr.carpr_advskews[0]);
+ break;
+ case 7:
+ *elm = ber_add_integer(*elm, cif->carpr.carpr_states[0]);
+ break;
+ default:
+ free(cif);
+ return (1);
+ }
+
+ free(cif);
+ return (0);
+}
+
+int
mib_memiftable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
{
struct ber_element *ber = *elm;
diff --git a/usr.sbin/snmpd/mib.h b/usr.sbin/snmpd/mib.h
index eaee05cf935..ba25b8fe855 100644
--- a/usr.sbin/snmpd/mib.h
+++ b/usr.sbin/snmpd/mib.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mib.h,v 1.21 2010/09/20 16:29:51 sthen Exp $ */
+/* $OpenBSD: mib.h,v 1.22 2012/01/31 18:00:46 joel Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net>
@@ -412,7 +412,6 @@
#define MIB_sensorValue MIB_sensorEntry, 5
#define MIB_sensorUnits MIB_sensorEntry, 6
#define MIB_sensorStatus MIB_sensorEntry, 7
-#define MIB_carpMIBObjects MIB_openBSD, 3
#define MIB_ipsecMIBObjects MIB_openBSD, 4
#define MIB_memMIBObjects MIB_openBSD, 5
#define MIB_memMIBVersion MIB_memMIBObjects, 1
@@ -423,6 +422,42 @@
#define OIDIDX_memIfEntry 11
#define MIB_memIfName MIB_memIfEntry, 1
#define MIB_memIfLiveLocks MIB_memIfEntry, 2
+#define MIB_carpMIBObjects MIB_openBSD, 6
+#define MIB_carpSysctl MIB_carpMIBObjects, 1
+#define MIB_carpAllow MIB_carpSysctl, 1
+#define MIB_carpPreempt MIB_carpSysctl, 2
+#define MIB_carpLog MIB_carpSysctl, 3
+#define OIDIDX_carpsysctl 9
+#define MIB_carpIf MIB_carpMIBObjects, 2
+#define MIB_carpIfNumber MIB_carpIf, 1
+#define MIB_carpIfTable MIB_carpIf, 2
+#define MIB_carpIfEntry MIB_carpIfTable, 1
+#define OIDIDX_carpIf 11
+#define OIDIDX_carpIfEntry 12
+#define MIB_carpIfIndex MIB_carpIfEntry, 1
+#define MIB_carpIfDescr MIB_carpIfEntry, 2
+#define MIB_carpIfVhid MIB_carpIfEntry, 3
+#define MIB_carpIfDev MIB_carpIfEntry, 4
+#define MIB_carpIfAdvbase MIB_carpIfEntry, 5
+#define MIB_carpIfAdvskew MIB_carpIfEntry, 6
+#define MIB_carpIfState MIB_carpIfEntry, 7
+#define OIDIDX_carpstats 9
+#define MIB_carpStats MIB_carpMIBObjects, 3
+#define MIB_carpIpPktsRecv MIB_carpStats, 1
+#define MIB_carpIp6PktsRecv MIB_carpStats, 2
+#define MIB_carpPktDiscardsBadIface MIB_carpStats, 3
+#define MIB_carpPktDiscardsBadTtl MIB_carpStats, 4
+#define MIB_carpPktShorterThanHdr MIB_carpStats, 5
+#define MIB_carpDiscardsBadCksum MIB_carpStats, 6
+#define MIB_carpDiscardsBadVersion MIB_carpStats, 7
+#define MIB_carpDiscardsTooShort MIB_carpStats, 8
+#define MIB_carpDiscardsBadAuth MIB_carpStats, 9
+#define MIB_carpDiscardsBadVhid MIB_carpStats, 10
+#define MIB_carpDiscardsBadAddrList MIB_carpStats, 11
+#define MIB_carpIpPktsSent MIB_carpStats, 12
+#define MIB_carpIp6PktsSent MIB_carpStats, 13
+#define MIB_carpNoMemory MIB_carpStats, 14
+#define MIB_carpTransitionsToMaster MIB_carpStats, 15
#define MIB_localSystem MIB_openBSD, 23
#define MIB_SYSOID_DEFAULT MIB_openBSD, 23, 1
#define MIB_localTest MIB_openBSD, 42
@@ -701,6 +736,38 @@
{ MIBDECL(memIfEntry) }, \
{ MIBDECL(memIfName) }, \
{ MIBDECL(memIfLiveLocks) }, \
+ { MIBDECL(carpMIBObjects) }, \
+ { MIBDECL(carpSysctl) }, \
+ { MIBDECL(carpAllow) }, \
+ { MIBDECL(carpPreempt) }, \
+ { MIBDECL(carpLog) }, \
+ { MIBDECL(carpIf) }, \
+ { MIBDECL(carpIfNumber) }, \
+ { MIBDECL(carpIfTable) }, \
+ { MIBDECL(carpIfEntry) }, \
+ { MIBDECL(carpIfIndex) }, \
+ { MIBDECL(carpIfDescr) }, \
+ { MIBDECL(carpIfVhid) }, \
+ { MIBDECL(carpIfDev) }, \
+ { MIBDECL(carpIfAdvbase) }, \
+ { MIBDECL(carpIfAdvskew) }, \
+ { MIBDECL(carpIfState) }, \
+ { MIBDECL(carpStats) }, \
+ { MIBDECL(carpIpPktsRecv) }, \
+ { MIBDECL(carpIp6PktsRecv) }, \
+ { MIBDECL(carpPktDiscardsBadIface) }, \
+ { MIBDECL(carpPktDiscardsBadTtl) }, \
+ { MIBDECL(carpPktShorterThanHdr) }, \
+ { MIBDECL(carpDiscardsBadCksum) }, \
+ { MIBDECL(carpDiscardsBadVersion) }, \
+ { MIBDECL(carpDiscardsTooShort) }, \
+ { MIBDECL(carpDiscardsBadAuth) }, \
+ { MIBDECL(carpDiscardsBadVhid) }, \
+ { MIBDECL(carpDiscardsBadAddrList) }, \
+ { MIBDECL(carpIpPktsSent) }, \
+ { MIBDECL(carpIp6PktsSent) }, \
+ { MIBDECL(carpNoMemory) }, \
+ { MIBDECL(carpTransitionsToMaster) }, \
{ MIBDECL(localSystem) }, \
{ MIBDECL(localTest) }, \
\