version 1.1.1.3, 2013/07/21 23:54:40
|
version 1.1.1.4, 2016/11/02 10:09:12
|
Line 48
|
Line 48
|
#include "ospfd/ospf_ism.h" |
#include "ospfd/ospf_ism.h" |
#include "ospfd/ospf_dump.h" |
#include "ospfd/ospf_dump.h" |
#include "ospfd/ospf_snmp.h" |
#include "ospfd/ospf_snmp.h" |
| |
/* OSPF2-MIB. */ |
/* OSPF2-MIB. */ |
#define OSPF2MIB 1,3,6,1,2,1,14 |
#define OSPF2MIB 1,3,6,1,2,1,14 |
|
|
Line 204
|
Line 204
|
#define TIMETICKS ASN_TIMETICKS |
#define TIMETICKS ASN_TIMETICKS |
#define IPADDRESS ASN_IPADDRESS |
#define IPADDRESS ASN_IPADDRESS |
#define STRING ASN_OCTET_STR |
#define STRING ASN_OCTET_STR |
| |
/* Declare static local variables for convenience. */ |
/* Declare static local variables for convenience. */ |
SNMP_LOCAL_VARIABLES |
SNMP_LOCAL_VARIABLES |
|
|
Line 213 oid ospf_oid [] = { OSPF2MIB };
|
Line 213 oid ospf_oid [] = { OSPF2MIB };
|
oid ospf_trap_oid [] = { OSPF2MIB, 16, 2 }; /* Not reverse mappable! */ |
oid ospf_trap_oid [] = { OSPF2MIB, 16, 2 }; /* Not reverse mappable! */ |
|
|
/* IP address 0.0.0.0. */ |
/* IP address 0.0.0.0. */ |
static struct in_addr ospf_empty_addr = {0}; | static struct in_addr ospf_empty_addr = { .s_addr = 0 }; |
|
|
/* Hook functions. */ |
/* Hook functions. */ |
static u_char *ospfGeneralGroup (struct variable *, oid *, size_t *, |
static u_char *ospfGeneralGroup (struct variable *, oid *, size_t *, |
Line 501 struct variable ospf_variables[] =
|
Line 501 struct variable ospf_variables[] =
|
{OSPFAREAAGGREGATEEFFECT, INTEGER, RWRITE, ospfAreaAggregateEntry, |
{OSPFAREAAGGREGATEEFFECT, INTEGER, RWRITE, ospfAreaAggregateEntry, |
3, {14, 1, 6}} |
3, {14, 1, 6}} |
}; |
}; |
| |
/* The administrative status of OSPF. When OSPF is enbled on at least |
/* The administrative status of OSPF. When OSPF is enbled on at least |
one interface return 1. */ |
one interface return 1. */ |
static int |
static int |
Line 986 ospfLsdbLookup (struct variable *v, oid *name, size_t
|
Line 986 ospfLsdbLookup (struct variable *v, oid *name, size_t
|
offsetlen = *length - v->namelen; |
offsetlen = *length - v->namelen; |
len = offsetlen; |
len = offsetlen; |
|
|
if (len > IN_ADDR_SIZE) | if (len > (int)IN_ADDR_SIZE) |
len = IN_ADDR_SIZE; |
len = IN_ADDR_SIZE; |
|
|
oid2in_addr (offset, len, area_id); |
oid2in_addr (offset, len, area_id); |
Line 1026 ospfLsdbLookup (struct variable *v, oid *name, size_t
|
Line 1026 ospfLsdbLookup (struct variable *v, oid *name, size_t
|
else |
else |
{ |
{ |
ls_id_next = 0; |
ls_id_next = 0; |
if (len > IN_ADDR_SIZE) | if (len > (int)IN_ADDR_SIZE) |
len = IN_ADDR_SIZE; |
len = IN_ADDR_SIZE; |
|
|
oid2in_addr (offset, len, ls_id); |
oid2in_addr (offset, len, ls_id); |
Line 1042 ospfLsdbLookup (struct variable *v, oid *name, size_t
|
Line 1042 ospfLsdbLookup (struct variable *v, oid *name, size_t
|
else |
else |
{ |
{ |
router_id_next = 0; |
router_id_next = 0; |
if (len > IN_ADDR_SIZE) | if (len > (int)IN_ADDR_SIZE) |
len = IN_ADDR_SIZE; |
len = IN_ADDR_SIZE; |
|
|
oid2in_addr (offset, len, router_id); |
oid2in_addr (offset, len, router_id); |
Line 1152 ospfAreaRangeLookup (struct variable *v, oid *name, si
|
Line 1152 ospfAreaRangeLookup (struct variable *v, oid *name, si
|
{ |
{ |
oid *offset; |
oid *offset; |
int offsetlen; |
int offsetlen; |
unsigned int len; | int len; |
struct ospf *ospf; |
struct ospf *ospf; |
struct ospf_area *area; |
struct ospf_area *area; |
struct ospf_area_range *range; |
struct ospf_area_range *range; |
Line 1193 ospfAreaRangeLookup (struct variable *v, oid *name, si
|
Line 1193 ospfAreaRangeLookup (struct variable *v, oid *name, si
|
offsetlen = *length - v->namelen; |
offsetlen = *length - v->namelen; |
|
|
len = offsetlen; |
len = offsetlen; |
if (len > IN_ADDR_SIZE) | if (len > (int)IN_ADDR_SIZE) |
len = IN_ADDR_SIZE; |
len = IN_ADDR_SIZE; |
|
|
oid2in_addr (offset, len, area_id); |
oid2in_addr (offset, len, area_id); |
Line 1215 ospfAreaRangeLookup (struct variable *v, oid *name, si
|
Line 1215 ospfAreaRangeLookup (struct variable *v, oid *name, si
|
|
|
if (len < 0) |
if (len < 0) |
len = 0; |
len = 0; |
if (len > IN_ADDR_SIZE) | if (len > (int)IN_ADDR_SIZE) |
len = IN_ADDR_SIZE; |
len = IN_ADDR_SIZE; |
|
|
oid2in_addr (offset, len, range_net); |
oid2in_addr (offset, len, range_net); |
Line 1407 ospfHostEntry (struct variable *v, oid *name, size_t *
|
Line 1407 ospfHostEntry (struct variable *v, oid *name, size_t *
|
} |
} |
return NULL; |
return NULL; |
} |
} |
| |
struct list *ospf_snmp_iflist; |
struct list *ospf_snmp_iflist; |
|
|
struct ospf_snmp_if |
struct ospf_snmp_if |
{ |
{ |
struct in_addr addr; |
struct in_addr addr; |
unsigned int ifindex; | ifindex_t ifindex; |
struct interface *ifp; |
struct interface *ifp; |
}; |
}; |
|
|
Line 1455 ospf_snmp_if_update (struct interface *ifp)
|
Line 1455 ospf_snmp_if_update (struct interface *ifp)
|
struct prefix *p; |
struct prefix *p; |
struct ospf_snmp_if *osif; |
struct ospf_snmp_if *osif; |
struct in_addr *addr; |
struct in_addr *addr; |
unsigned int ifindex; | ifindex_t ifindex; |
|
|
ospf_snmp_if_delete (ifp); |
ospf_snmp_if_delete (ifp); |
|
|
Line 1530 ospf_snmp_is_if_have_addr (struct interface *ifp)
|
Line 1530 ospf_snmp_is_if_have_addr (struct interface *ifp)
|
} |
} |
|
|
static struct ospf_interface * |
static struct ospf_interface * |
ospf_snmp_if_lookup (struct in_addr *ifaddr, unsigned int *ifindex) | ospf_snmp_if_lookup (struct in_addr *ifaddr, ifindex_t *ifindex) |
{ |
{ |
struct listnode *node; |
struct listnode *node; |
struct ospf_snmp_if *osif; |
struct ospf_snmp_if *osif; |
Line 1554 ospf_snmp_if_lookup (struct in_addr *ifaddr, unsigned
|
Line 1554 ospf_snmp_if_lookup (struct in_addr *ifaddr, unsigned
|
} |
} |
|
|
static struct ospf_interface * |
static struct ospf_interface * |
ospf_snmp_if_lookup_next (struct in_addr *ifaddr, unsigned int *ifindex, | ospf_snmp_if_lookup_next (struct in_addr *ifaddr, ifindex_t *ifindex, |
int ifaddr_next, int ifindex_next) | int ifaddr_next, ifindex_t ifindex_next) |
{ |
{ |
struct ospf_snmp_if *osif; |
struct ospf_snmp_if *osif; |
struct listnode *nn; |
struct listnode *nn; |
Line 1638 ospf_snmp_iftype (struct interface *ifp)
|
Line 1638 ospf_snmp_iftype (struct interface *ifp)
|
|
|
static struct ospf_interface * |
static struct ospf_interface * |
ospfIfLookup (struct variable *v, oid *name, size_t *length, |
ospfIfLookup (struct variable *v, oid *name, size_t *length, |
struct in_addr *ifaddr, unsigned int *ifindex, int exact) | struct in_addr *ifaddr, ifindex_t *ifindex, int exact) |
{ |
{ |
unsigned int len; |
unsigned int len; |
int ifaddr_next = 0; |
int ifaddr_next = 0; |
int ifindex_next = 0; | ifindex_t ifindex_next = 0; |
struct ospf_interface *oi; |
struct ospf_interface *oi; |
oid *offset; |
oid *offset; |
|
|
Line 1694 static u_char *
|
Line 1694 static u_char *
|
ospfIfEntry (struct variable *v, oid *name, size_t *length, int exact, |
ospfIfEntry (struct variable *v, oid *name, size_t *length, int exact, |
size_t *var_len, WriteMethod **write_method) |
size_t *var_len, WriteMethod **write_method) |
{ |
{ |
unsigned int ifindex; | ifindex_t ifindex; |
struct in_addr ifaddr; |
struct in_addr ifaddr; |
struct ospf_interface *oi; |
struct ospf_interface *oi; |
struct ospf *ospf; |
struct ospf *ospf; |
Line 1802 ospfIfEntry (struct variable *v, oid *name, size_t *le
|
Line 1802 ospfIfEntry (struct variable *v, oid *name, size_t *le
|
|
|
static struct ospf_interface * |
static struct ospf_interface * |
ospfIfMetricLookup (struct variable *v, oid *name, size_t *length, |
ospfIfMetricLookup (struct variable *v, oid *name, size_t *length, |
struct in_addr *ifaddr, unsigned int *ifindex, int exact) | struct in_addr *ifaddr, ifindex_t *ifindex, int exact) |
{ |
{ |
unsigned int len; |
unsigned int len; |
int ifaddr_next = 0; |
int ifaddr_next = 0; |
int ifindex_next = 0; | ifindex_t ifindex_next = 0; |
struct ospf_interface *oi; |
struct ospf_interface *oi; |
oid *offset; |
oid *offset; |
int metric; |
int metric; |
Line 1866 ospfIfMetricEntry (struct variable *v, oid *name, size
|
Line 1866 ospfIfMetricEntry (struct variable *v, oid *name, size
|
size_t *var_len, WriteMethod **write_method) |
size_t *var_len, WriteMethod **write_method) |
{ |
{ |
/* Currently we support metric 1 only. */ |
/* Currently we support metric 1 only. */ |
unsigned int ifindex; | ifindex_t ifindex; |
struct in_addr ifaddr; |
struct in_addr ifaddr; |
struct ospf_interface *oi; |
struct ospf_interface *oi; |
struct ospf *ospf; |
struct ospf *ospf; |
Line 1911 ospfIfMetricEntry (struct variable *v, oid *name, size
|
Line 1911 ospfIfMetricEntry (struct variable *v, oid *name, size
|
} |
} |
return NULL; |
return NULL; |
} |
} |
| |
struct route_table *ospf_snmp_vl_table; |
struct route_table *ospf_snmp_vl_table; |
|
|
void |
void |
Line 1927 ospf_snmp_vl_add (struct ospf_vl_data *vl_data)
|
Line 1927 ospf_snmp_vl_add (struct ospf_vl_data *vl_data)
|
lp.adv_router = vl_data->vl_peer; |
lp.adv_router = vl_data->vl_peer; |
|
|
rn = route_node_get (ospf_snmp_vl_table, (struct prefix *) &lp); |
rn = route_node_get (ospf_snmp_vl_table, (struct prefix *) &lp); |
|
if (rn->info) |
|
route_unlock_node (rn); |
|
|
rn->info = vl_data; |
rn->info = vl_data; |
} |
} |
|
|
Line 2127 ospfVirtIfEntry (struct variable *v, oid *name, size_t
|
Line 2130 ospfVirtIfEntry (struct variable *v, oid *name, size_t
|
} |
} |
return NULL; |
return NULL; |
} |
} |
| |
static struct ospf_neighbor * |
static struct ospf_neighbor * |
ospf_snmp_nbr_lookup (struct ospf *ospf, struct in_addr *nbr_addr, |
ospf_snmp_nbr_lookup (struct ospf *ospf, struct in_addr *nbr_addr, |
unsigned int *ifindex) | ifindex_t *ifindex) |
{ |
{ |
struct listnode *node, *nnode; |
struct listnode *node, *nnode; |
struct ospf_interface *oi; |
struct ospf_interface *oi; |
Line 2158 ospf_snmp_nbr_lookup (struct ospf *ospf, struct in_add
|
Line 2161 ospf_snmp_nbr_lookup (struct ospf *ospf, struct in_add
|
} |
} |
|
|
static struct ospf_neighbor * |
static struct ospf_neighbor * |
ospf_snmp_nbr_lookup_next (struct in_addr *nbr_addr, unsigned int *ifindex, | ospf_snmp_nbr_lookup_next (struct in_addr *nbr_addr, ifindex_t *ifindex, |
int first) |
int first) |
{ |
{ |
struct listnode *nn; |
struct listnode *nn; |
Line 2205 ospf_snmp_nbr_lookup_next (struct in_addr *nbr_addr, u
|
Line 2208 ospf_snmp_nbr_lookup_next (struct in_addr *nbr_addr, u
|
|
|
static struct ospf_neighbor * |
static struct ospf_neighbor * |
ospfNbrLookup (struct variable *v, oid *name, size_t *length, |
ospfNbrLookup (struct variable *v, oid *name, size_t *length, |
struct in_addr *nbr_addr, unsigned int *ifindex, int exact) | struct in_addr *nbr_addr, ifindex_t *ifindex, int exact) |
{ |
{ |
unsigned int len; |
unsigned int len; |
int first; |
int first; |
Line 2300 ospfNbrEntry (struct variable *v, oid *name, size_t *l
|
Line 2303 ospfNbrEntry (struct variable *v, oid *name, size_t *l
|
size_t *var_len, WriteMethod **write_method) |
size_t *var_len, WriteMethod **write_method) |
{ |
{ |
struct in_addr nbr_addr; |
struct in_addr nbr_addr; |
unsigned int ifindex; | ifindex_t ifindex; |
struct ospf_neighbor *nbr; |
struct ospf_neighbor *nbr; |
struct ospf_interface *oi; |
struct ospf_interface *oi; |
|
|
Line 2360 ospfNbrEntry (struct variable *v, oid *name, size_t *l
|
Line 2363 ospfNbrEntry (struct variable *v, oid *name, size_t *l
|
} |
} |
return NULL; |
return NULL; |
} |
} |
| |
static u_char * |
static u_char * |
ospfVirtNbrEntry (struct variable *v, oid *name, size_t *length, int exact, |
ospfVirtNbrEntry (struct variable *v, oid *name, size_t *length, int exact, |
size_t *var_len, WriteMethod **write_method) |
size_t *var_len, WriteMethod **write_method) |
Line 2419 ospfVirtNbrEntry (struct variable *v, oid *name, size_
|
Line 2422 ospfVirtNbrEntry (struct variable *v, oid *name, size_
|
} |
} |
return NULL; |
return NULL; |
} |
} |
| |
static struct ospf_lsa * |
static struct ospf_lsa * |
ospfExtLsdbLookup (struct variable *v, oid *name, size_t *length, u_char *type, |
ospfExtLsdbLookup (struct variable *v, oid *name, size_t *length, u_char *type, |
struct in_addr *ls_id, struct in_addr *router_id, int exact) |
struct in_addr *ls_id, struct in_addr *router_id, int exact) |
Line 2572 ospfExtLsdbEntry (struct variable *v, oid *name, size_
|
Line 2575 ospfExtLsdbEntry (struct variable *v, oid *name, size_
|
} |
} |
return NULL; |
return NULL; |
} |
} |
| |
static u_char * |
static u_char * |
ospfAreaAggregateEntry (struct variable *v, oid *name, size_t *length, |
ospfAreaAggregateEntry (struct variable *v, oid *name, size_t *length, |
int exact, size_t *var_len, WriteMethod **write_method) |
int exact, size_t *var_len, WriteMethod **write_method) |
Line 2608 ospfAreaAggregateEntry (struct variable *v, oid *name,
|
Line 2611 ospfAreaAggregateEntry (struct variable *v, oid *name,
|
} |
} |
return NULL; |
return NULL; |
} |
} |
| |
/* OSPF Traps. */ |
/* OSPF Traps. */ |
#define IFSTATECHANGE 16 |
#define IFSTATECHANGE 16 |
#define VIRTIFSTATECHANGE 1 |
#define VIRTIFSTATECHANGE 1 |