openbsd-ports/net/zebra/patches/patch-ospfd_ospf_snmp_c
danh 8b348582f0 convert snmp FLAVOR to use net-snmp.
Maintainer timeout.  I do not see how this worked in the first place
without smux support.
2004-10-13 01:58:14 +00:00

121 lines
3.7 KiB
Plaintext

$OpenBSD: patch-ospfd_ospf_snmp_c,v 1.2 2004/10/13 01:58:14 danh Exp $
--- ospfd/ospf_snmp.c.orig Sat Jul 6 03:36:57 2002
+++ ospfd/ospf_snmp.c Fri Oct 8 13:28:56 2004
@@ -24,9 +24,8 @@
#include <zebra.h>
#ifdef HAVE_SNMP
-#include <asn1.h>
-#include <snmp.h>
-#include <snmp_impl.h>
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
#include "if.h"
#include "log.h"
@@ -1115,6 +1114,9 @@ ospfAreaRangeLookup (struct variable *v,
int len;
struct ospf_area *area;
struct ospf_area_range *range;
+ struct prefix_ipv4 p;
+ p.family = AF_INET;
+ p.prefixlen = IPV4_MAX_BITLEN;
if (exact)
{
@@ -1136,8 +1138,9 @@ ospfAreaRangeLookup (struct variable *v,
/* Lookup area range. */
oid2in_addr (offset, IN_ADDR_SIZE, range_net);
+ p.prefix = *range_net;
- return ospf_area_range_lookup (area, range_net);
+ return ospf_area_range_lookup (area, &p);
}
else
{
@@ -1201,7 +1204,6 @@ ospfAreaRangeEntry (struct variable *v,
{
struct ospf_area_range *range;
struct in_addr area_id;
-
struct in_addr range_net;
struct in_addr mask;
@@ -1217,7 +1219,7 @@ ospfAreaRangeEntry (struct variable *v,
return NULL;
/* Convert prefixlen to network mask format. */
- masklen2ip (range->node->p.prefixlen, &mask);
+ masklen2ip (range->subst_masklen, &mask);
/* Return the current value of the variable */
switch (v->magic)
@@ -1268,7 +1270,7 @@ ospfHostLookup (struct variable *v, oid
oid2in_addr (name + v->namelen, IN_ADDR_SIZE, addr);
- nbr_nbma = ospf_nbr_nbma_lookup_by_addr (*addr);
+ nbr_nbma = ospf_nbr_nbma_lookup (ospf_top, *addr);
return nbr_nbma;
}
@@ -1653,7 +1655,7 @@ ospfIfEntry (struct variable *v, oid *na
return SNMP_INTEGER (OSPF_POLL_INTERVAL_DEFAULT);
break;
case OSPFIFSTATE: /* 12 */
- return SNMP_INTEGER (oi->status);
+ return SNMP_INTEGER (oi->state);
break;
case OSPFIFDESIGNATEDROUTER: /* 13 */
return SNMP_IPADDRESS (DR (oi));
@@ -1662,7 +1664,7 @@ ospfIfEntry (struct variable *v, oid *na
return SNMP_IPADDRESS (BDR (oi));
break;
case OSPFIFEVENTS: /* 15 */
- return SNMP_INTEGER (oi->status_change);
+ return SNMP_INTEGER (oi->state_change);
break;
case OSPFIFAUTHKEY: /* 16 */
*var_len = 0;
@@ -1993,10 +1995,10 @@ ospfVirtIfEntry (struct variable *v, oid
return SNMP_INTEGER (OSPF_IF_PARAM (oi, v_wait));
break;
case OSPFVIRTIFSTATE:
- return SNMP_INTEGER (oi->status);
+ return SNMP_INTEGER (oi->state);
break;
case OSPFVIRTIFEVENTS:
- return SNMP_INTEGER (oi->status_change);
+ return SNMP_INTEGER (oi->state_change);
break;
case OSPFVIRTIFAUTHKEY:
*var_len = 0;
@@ -2031,7 +2033,7 @@ ospf_snmp_nbr_lookup (struct in_addr *nb
for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
if ((nbr = rn->info) != NULL
&& nbr != oi->nbr_self
- && nbr->status != NSM_Down
+ && nbr->state != NSM_Down
&& nbr->src.s_addr != 0)
{
if (IPV4_ADDR_SAME (&nbr->src, nbr_addr))
@@ -2059,7 +2061,7 @@ ospf_snmp_nbr_lookup_next (struct in_add
for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
if ((nbr = rn->info) != NULL
&& nbr != oi->nbr_self
- && nbr->status != NSM_Down
+ && nbr->state != NSM_Down
&& nbr->src.s_addr != 0)
{
if (first)
@@ -2173,7 +2175,7 @@ ospfNbrEntry (struct variable *v, oid *n
return SNMP_INTEGER (nbr->priority);
break;
case OSPFNBRSTATE:
- return SNMP_INTEGER (nbr->status);
+ return SNMP_INTEGER (nbr->state);
break;
case OSPFNBREVENTS:
return SNMP_INTEGER (nbr->state_change);