summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_snmp.c39
-rw-r--r--lib/smux.c95
-rw-r--r--ospf6d/ospf6_snmp.c10
-rw-r--r--ospfd/ospf_snmp.c124
-rw-r--r--ripd/rip_snmp.c14
-rw-r--r--zebra/zebra_snmp.c33
6 files changed, 172 insertions, 143 deletions
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 576e3e09..0f44e68d 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -43,6 +43,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_attr.h"
#include "bgpd/bgp_route.h"
#include "bgpd/bgp_fsm.h"
+#include "bgpd/bgp_snmp.h"
/* BGP4-MIB described in RFC1657. */
#define BGP4MIB 1,3,6,1,2,1,15
@@ -128,12 +129,18 @@ oid bgp_oid [] = { BGP4MIB };
static struct in_addr bgp_empty_addr = {0};
/* Hook functions. */
-static u_char *bgpVersion ();
-static u_char *bgpLocalAs ();
-static u_char *bgpPeerTable ();
-static u_char *bgpRcvdPathAttrTable ();
-static u_char *bgpIdentifier ();
-static u_char *bgp4PathAttrTable ();
+static u_char *bgpVersion (struct variable *, oid [], size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *bgpLocalAs (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *bgpPeerTable (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *bgpRcvdPathAttrTable (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *bgpIdentifier (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *bgp4PathAttrTable (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
/* static u_char *bgpTraps (); */
struct variable bgp_variables[] =
@@ -277,7 +284,7 @@ bgpLocalAs (struct variable *v, oid name[], size_t *length,
return SNMP_INTEGER (bgp->as);
}
-struct peer *
+static struct peer *
peer_lookup_addr_ipv4 (struct in_addr *src)
{
struct bgp *bgp;
@@ -302,7 +309,7 @@ peer_lookup_addr_ipv4 (struct in_addr *src)
return NULL;
}
-struct peer *
+static struct peer *
bgp_peer_lookup_next (struct in_addr *src)
{
struct bgp *bgp;
@@ -335,7 +342,7 @@ bgp_peer_lookup_next (struct in_addr *src)
return NULL;
}
-struct peer *
+static struct peer *
bgpPeerTable_lookup (struct variable *v, oid name[], size_t *length,
struct in_addr *addr, int exact)
{
@@ -374,7 +381,7 @@ bgpPeerTable_lookup (struct variable *v, oid name[], size_t *length,
}
/* BGP write methods. */
-int
+static int
write_bgpPeerTable (int action, u_char *var_val,
u_char var_val_type, size_t var_val_len,
u_char *statP, oid *name, size_t length,
@@ -383,7 +390,7 @@ write_bgpPeerTable (int action, u_char *var_val,
struct in_addr addr;
struct peer *peer;
long intval;
- int bigsize = SNMP_MAX_LEN;
+ size_t bigsize = SNMP_MAX_LEN;
if (var_val_type != ASN_INTEGER)
{
@@ -446,7 +453,7 @@ write_bgpPeerTable (int action, u_char *var_val,
return SNMP_ERR_NOERROR;
}
-u_char *
+static u_char *
bgpPeerTable (struct variable *v, oid name[], size_t *length,
int exact, size_t *var_len, WriteMethod **write_method)
{
@@ -586,7 +593,7 @@ bgpPeerTable (struct variable *v, oid name[], size_t *length,
return NULL;
}
-u_char *
+static u_char *
bgpIdentifier (struct variable *v, oid name[], size_t *length,
int exact, size_t *var_len, WriteMethod **write_method)
{
@@ -603,7 +610,7 @@ bgpIdentifier (struct variable *v, oid name[], size_t *length,
return SNMP_IPADDRESS (bgp->router_id);
}
-u_char *
+static u_char *
bgpRcvdPathAttrTable (struct variable *v, oid name[], size_t *length,
int exact, size_t *var_len, WriteMethod **write_method)
{
@@ -614,7 +621,7 @@ bgpRcvdPathAttrTable (struct variable *v, oid name[], size_t *length,
return NULL;
}
-struct bgp_info *
+static struct bgp_info *
bgp4PathAttrLookup (struct variable *v, oid name[], size_t *length,
struct bgp *bgp, struct prefix_ipv4 *addr, int exact)
{
@@ -751,7 +758,7 @@ bgp4PathAttrLookup (struct variable *v, oid name[], size_t *length,
return NULL;
}
-u_char *
+static u_char *
bgp4PathAttrTable (struct variable *v, oid name[], size_t *length,
int exact, size_t *var_len, WriteMethod **write_method)
{
diff --git a/lib/smux.c b/lib/smux.c
index 4a3696c7..fd0c89c2 100644
--- a/lib/smux.c
+++ b/lib/smux.c
@@ -138,7 +138,7 @@ oid_compare (oid *o1, int o1_len, oid *o2, int o2_len)
return 0;
}
-int
+static int
oid_compare_part (oid *o1, int o1_len, oid *o2, int o2_len)
{
int i;
@@ -156,7 +156,7 @@ oid_compare_part (oid *o1, int o1_len, oid *o2, int o2_len)
return 0;
}
-void
+static void
smux_oid_dump (const char *prefix, oid *oid, size_t oid_len)
{
unsigned int i;
@@ -173,7 +173,7 @@ smux_oid_dump (const char *prefix, oid *oid, size_t oid_len)
zlog_debug ("%s: %s", prefix, buf);
}
-int
+static int
smux_socket ()
{
int ret;
@@ -266,7 +266,7 @@ smux_socket ()
return sock;
}
-void
+static void
smux_getresp_send (oid objid[], size_t objid_len, long reqid, long errstat,
long errindex, u_char val_type, void *arg, size_t arg_len)
{
@@ -324,13 +324,13 @@ smux_getresp_send (oid objid[], size_t objid_len, long reqid, long errstat,
asn_build_sequence(h1,&length,(u_char)SMUX_GETRSP,ptr-h1e);
if (debug_smux)
- zlog_debug ("SMUX getresp send: %ld", (ptr - buf));
+ zlog_debug ("SMUX getresp send: %td", (ptr - buf));
ret = send (smux_sock, buf, (ptr - buf), 0);
}
-char *
-smux_var (char *ptr, size_t len, oid objid[], size_t *objid_len,
+static u_char *
+smux_var (u_char *ptr, size_t len, oid objid[], size_t *objid_len,
size_t *var_val_len,
u_char *var_val_type,
void **var_value)
@@ -341,14 +341,14 @@ smux_var (char *ptr, size_t len, oid objid[], size_t *objid_len,
u_char *val;
if (debug_smux)
- zlog_debug ("SMUX var parse: len %ld", len);
+ zlog_debug ("SMUX var parse: len %zd", len);
/* Parse header. */
ptr = asn_parse_header (ptr, &len, &type);
if (debug_smux)
{
- zlog_debug ("SMUX var parse: type %d len %ld", type, len);
+ zlog_debug ("SMUX var parse: type %d len %zd", type, len);
zlog_debug ("SMUX var parse: type must be %d",
(ASN_SEQUENCE | ASN_CONSTRUCTOR));
}
@@ -430,7 +430,7 @@ smux_var (char *ptr, size_t len, oid objid[], size_t *objid_len,
ucd-snmp smux and as such suppose, that the peer receives in the message
only one variable. Fortunately, IBM seems to do the same in AIX. */
-int
+static int
smux_set (oid *reqid, size_t *reqid_len,
u_char val_type, void *val, size_t val_len, int action)
{
@@ -498,7 +498,7 @@ smux_set (oid *reqid, size_t *reqid_len,
return SNMP_ERR_NOSUCHNAME;
}
-int
+static int
smux_get (oid *reqid, size_t *reqid_len, int exact,
u_char *val_type,void **val, size_t *val_len)
{
@@ -564,7 +564,7 @@ smux_get (oid *reqid, size_t *reqid_len, int exact,
return SNMP_ERR_NOSUCHNAME;
}
-int
+static int
smux_getnext (oid *reqid, size_t *reqid_len, int exact,
u_char *val_type,void **val, size_t *val_len)
{
@@ -650,8 +650,8 @@ smux_getnext (oid *reqid, size_t *reqid_len, int exact,
}
/* GET message header. */
-char *
-smux_parse_get_header (char *ptr, size_t *len, long *reqid)
+static u_char *
+smux_parse_get_header (u_char *ptr, size_t *len, long *reqid)
{
u_char type;
long errstat;
@@ -667,19 +667,19 @@ smux_parse_get_header (char *ptr, size_t *len, long *reqid)
ptr = asn_parse_int (ptr, len, &type, &errstat, sizeof (errstat));
if (debug_smux)
- zlog_debug ("SMUX GET errstat %ld len: %ld", errstat, *len);
+ zlog_debug ("SMUX GET errstat %ld len: %zd", errstat, *len);
/* Error index. */
ptr = asn_parse_int (ptr, len, &type, &errindex, sizeof (errindex));
if (debug_smux)
- zlog_debug ("SMUX GET errindex %ld len: %ld", errindex, *len);
+ zlog_debug ("SMUX GET errindex %ld len: %zd", errindex, *len);
return ptr;
}
-void
-smux_parse_set (char *ptr, size_t len, int action)
+static void
+smux_parse_set (u_char *ptr, size_t len, int action)
{
long reqid;
oid oid[MAX_OID_LEN];
@@ -690,7 +690,7 @@ smux_parse_set (char *ptr, size_t len, int action)
int ret;
if (debug_smux)
- zlog_debug ("SMUX SET(%s) message parse: len %ld",
+ zlog_debug ("SMUX SET(%s) message parse: len %zd",
(RESERVE1 == action) ? "RESERVE1" : ((FREE == action) ? "FREE" : "COMMIT"),
len);
@@ -709,8 +709,8 @@ smux_parse_set (char *ptr, size_t len, int action)
smux_getresp_send (oid, oid_len, reqid, ret, 3, ASN_NULL, NULL, 0);
}
-void
-smux_parse_get (char *ptr, size_t len, int exact)
+static void
+smux_parse_get (u_char *ptr, size_t len, int exact)
{
long reqid;
oid oid[MAX_OID_LEN];
@@ -721,7 +721,7 @@ smux_parse_get (char *ptr, size_t len, int exact)
int ret;
if (debug_smux)
- zlog_debug ("SMUX GET message parse: len %ld", len);
+ zlog_debug ("SMUX GET message parse: len %zd", len);
/* Parse GET message header. */
ptr = smux_parse_get_header (ptr, &len, &reqid);
@@ -743,8 +743,8 @@ smux_parse_get (char *ptr, size_t len, int exact)
}
/* Parse SMUX_CLOSE message. */
-void
-smux_parse_close (char *ptr, int len)
+static void
+smux_parse_close (u_char *ptr, int len)
{
long reason = 0;
@@ -757,10 +757,10 @@ smux_parse_close (char *ptr, int len)
}
/* SMUX_RRSP message. */
-void
-smux_parse_rrsp (char *ptr, size_t len)
+static void
+smux_parse_rrsp (u_char *ptr, size_t len)
{
- char val;
+ u_char val;
long errstat;
ptr = asn_parse_int (ptr, &len, &val, &errstat, sizeof (errstat));
@@ -770,8 +770,8 @@ smux_parse_rrsp (char *ptr, size_t len)
}
/* Parse SMUX message. */
-int
-smux_parse (char *ptr, size_t len)
+static int
+smux_parse (u_char *ptr, size_t len)
{
/* This buffer we'll use for SOUT message. We could allocate it with
malloc and save only static pointer/lenght, but IMHO static
@@ -791,7 +791,7 @@ process_rest: /* see note below: YYY */
ptr = asn_parse_header (ptr, &len, &type);
if (debug_smux)
- zlog_debug ("SMUX message received type: %d rest len: %ld", type, len);
+ zlog_debug ("SMUX message received type: %d rest len: %zd", type, len);
switch (type)
{
@@ -883,7 +883,7 @@ process_rest: /* see note below: YYY */
}
/* SMUX message read function. */
-int
+static int
smux_read (struct thread *t)
{
int sock;
@@ -939,13 +939,13 @@ smux_read (struct thread *t)
return 0;
}
-int
+static int
smux_open (int sock)
{
u_char buf[BUFSIZ];
u_char *ptr;
size_t len;
- u_long version;
+ long version;
u_char progname[] = QUAGGA_PROGNAME "-" QUAGGA_VERSION;
if (debug_smux)
@@ -983,7 +983,7 @@ smux_open (int sock)
ptr = asn_build_string (ptr, &len,
(u_char)
(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
- smux_passwd, strlen (smux_passwd));
+ (u_char *)smux_passwd, strlen (smux_passwd));
/* Fill in real SMUX header. We exclude ASN header size (2). */
len = BUFSIZ;
@@ -1034,13 +1034,13 @@ smux_trap (oid *name, size_t namelen,
val = SNMP_TRAP_ENTERPRISESPECIFIC;
ptr = asn_build_int (ptr, &len,
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
- &val, sizeof (val));
+ (long *)&val, sizeof (val));
/* Specific trap integer. */
val = sptrap;
ptr = asn_build_int (ptr, &len,
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
- &val, sizeof (val));
+ (long *)&val, sizeof (val));
/* Timeticks timestamp. */
val = 0;
@@ -1118,7 +1118,7 @@ smux_trap (oid *name, size_t namelen,
return send (smux_sock, buf, (ptr - buf), 0);
}
-int
+static int
smux_register (int sock)
{
u_char buf[BUFSIZ];
@@ -1175,7 +1175,7 @@ smux_register (int sock)
}
/* Try to connect to SNMP agent. */
-int
+static int
smux_connect (struct thread *t)
{
int ret;
@@ -1226,7 +1226,7 @@ smux_connect (struct thread *t)
}
/* Clear all SMUX related resources. */
-void
+static void
smux_stop ()
{
if (smux_read_thread)
@@ -1269,7 +1269,7 @@ smux_event (enum smux_event event, int sock)
}
}
-int
+static int
smux_str2oid (const char *str, oid *oid, size_t *oid_len)
{
int len;
@@ -1312,7 +1312,7 @@ smux_str2oid (const char *str, oid *oid, size_t *oid_len)
return 0;
}
-oid *
+static oid *
smux_oid_dup (oid *objid, size_t objid_len)
{
oid *new;
@@ -1323,7 +1323,7 @@ smux_oid_dup (oid *objid, size_t objid_len)
return new;
}
-int
+static int
smux_peer_oid (struct vty *vty, const char *oid_str, const char *passwd_str)
{
int ret;
@@ -1387,7 +1387,7 @@ smux_header_generic (struct variable *v, oid *name, size_t *length, int exact,
return MATCH_SUCCEEDED;
}
-int
+static int
smux_peer_default ()
{
if (smux_oid)
@@ -1467,7 +1467,7 @@ ALIAS (no_smux_peer,
"SMUX peering object ID\n"
"SMUX peering password\n")
-int
+static int
config_write_smux (struct vty *vty)
{
int first = 1;
@@ -1504,13 +1504,6 @@ smux_register_mib (const char *descr, struct variable *var,
listnode_add_sort(treelist, tree);
}
-void
-smux_reset ()
-{
- /* Setting configuration to default. */
- smux_peer_default ();
-}
-
/* Compare function to keep treelist sorted */
static int
smux_tree_cmp(struct subtree *tree1, struct subtree *tree2)
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index 8d9842ce..5ac7846d 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
@@ -47,6 +47,7 @@
#include "ospf6_message.h"
#include "ospf6_neighbor.h"
#include "ospf6d.h"
+#include "ospf6_snmp.h"
/* OSPFv3-MIB */
#define OSPFv3MIB 1,3,6,1,3,102
@@ -128,9 +129,12 @@ oid ospfv3_oid [] = { OSPFv3MIB };
static struct in_addr ospf6_empty_id = {0};
/* Hook functions. */
-static u_char *ospfv3GeneralGroup ();
-static u_char *ospfv3AreaEntry ();
-static u_char *ospfv3AreaLsdbEntry ();
+static u_char *ospfv3GeneralGroup (struct variable *, oid *, size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *ospfv3AreaEntry (struct variable *, oid *, size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *ospfv3AreaLsdbEntry (struct variable *, oid *, size_t *,
+ int, size_t *, WriteMethod **);
struct variable ospfv3_variables[] =
{
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index e6ce1f01..c47d432e 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -53,6 +53,7 @@
#include "ospfd/ospf_flood.h"
#include "ospfd/ospf_ism.h"
#include "ospfd/ospf_dump.h"
+#include "ospfd/ospf_snmp.h"
/* OSPF2-MIB. */
#define OSPF2MIB 1,3,6,1,2,1,14
@@ -220,19 +221,32 @@ oid ospf_oid [] = { OSPF2MIB };
static struct in_addr ospf_empty_addr = {0};
/* Hook functions. */
-static u_char *ospfGeneralGroup ();
-static u_char *ospfAreaEntry ();
-static u_char *ospfStubAreaEntry ();
-static u_char *ospfLsdbEntry ();
-static u_char *ospfAreaRangeEntry ();
-static u_char *ospfHostEntry ();
-static u_char *ospfIfEntry ();
-static u_char *ospfIfMetricEntry ();
-static u_char *ospfVirtIfEntry ();
-static u_char *ospfNbrEntry ();
-static u_char *ospfVirtNbrEntry ();
-static u_char *ospfExtLsdbEntry ();
-static u_char *ospfAreaAggregateEntry ();
+static u_char *ospfGeneralGroup (struct variable *, oid *, size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *ospfAreaEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfStubAreaEntry (struct variable *, oid *, size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *ospfLsdbEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfAreaRangeEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfHostEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfIfEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfIfMetricEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfVirtIfEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfNbrEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfVirtNbrEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfExtLsdbEntry (struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static u_char *ospfAreaAggregateEntry (struct variable *, oid *, size_t *,
+ int, size_t *, WriteMethod **);
struct variable ospf_variables[] =
{
@@ -495,7 +509,7 @@ struct variable ospf_variables[] =
/* The administrative status of OSPF. When OSPF is enbled on at least
one interface return 1. */
-int
+static int
ospf_admin_stat (struct ospf *ospf)
{
struct listnode *node;
@@ -612,7 +626,7 @@ ospfGeneralGroup (struct variable *v, oid *name, size_t *length,
return NULL;
}
-struct ospf_area *
+static struct ospf_area *
ospf_area_lookup_next (struct ospf *ospf, struct in_addr *area_id, int first)
{
struct ospf_area *area;
@@ -643,7 +657,7 @@ ospf_area_lookup_next (struct ospf *ospf, struct in_addr *area_id, int first)
return NULL;
}
-struct ospf_area *
+static struct ospf_area *
ospfAreaLookup (struct variable *v, oid name[], size_t *length,
struct in_addr *addr, int exact)
{
@@ -746,7 +760,7 @@ ospfAreaEntry (struct variable *v, oid *name, size_t *length, int exact,
return NULL;
}
-struct ospf_area *
+static struct ospf_area *
ospf_stub_area_lookup_next (struct in_addr *area_id, int first)
{
struct ospf_area *area;
@@ -776,7 +790,7 @@ ospf_stub_area_lookup_next (struct in_addr *area_id, int first)
return NULL;
}
-struct ospf_area *
+static struct ospf_area *
ospfStubAreaLookup (struct variable *v, oid name[], size_t *length,
struct in_addr *addr, int exact)
{
@@ -877,7 +891,7 @@ ospfStubAreaEntry (struct variable *v, oid *name, size_t *length,
return NULL;
}
-struct ospf_lsa *
+static struct ospf_lsa *
lsdb_lookup_next (struct ospf_area *area, u_char *type, int type_next,
struct in_addr *ls_id, int ls_id_next,
struct in_addr *router_id, int router_id_next)
@@ -912,7 +926,7 @@ lsdb_lookup_next (struct ospf_area *area, u_char *type, int type_next,
return NULL;
}
-struct ospf_lsa *
+static struct ospf_lsa *
ospfLsdbLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *area_id, u_char *type,
struct in_addr *ls_id, struct in_addr *router_id, int exact)
@@ -1124,7 +1138,7 @@ ospfLsdbEntry (struct variable *v, oid *name, size_t *length, int exact,
return NULL;
}
-struct ospf_area_range *
+static struct ospf_area_range *
ospfAreaRangeLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *area_id, struct in_addr *range_net,
int exact)
@@ -1273,7 +1287,7 @@ ospfAreaRangeEntry (struct variable *v, oid *name, size_t *length, int exact,
return NULL;
}
-struct ospf_nbr_nbma *
+static struct ospf_nbr_nbma *
ospfHostLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *addr, int exact)
{
@@ -1388,7 +1402,7 @@ struct ospf_snmp_if
struct interface *ifp;
};
-struct ospf_snmp_if *
+static struct ospf_snmp_if *
ospf_snmp_if_new ()
{
struct ospf_snmp_if *osif;
@@ -1398,7 +1412,7 @@ ospf_snmp_if_new ()
return osif;
}
-void
+static void
ospf_snmp_if_free (struct ospf_snmp_if *osif)
{
XFREE (0, osif);
@@ -1488,7 +1502,7 @@ ospf_snmp_if_update (struct interface *ifp)
listnode_add_after (ospf_snmp_iflist, pn, osif);
}
-int
+static int
ospf_snmp_is_if_have_addr (struct interface *ifp)
{
struct listnode *nn;
@@ -1504,7 +1518,7 @@ ospf_snmp_is_if_have_addr (struct interface *ifp)
return 0;
}
-struct ospf_interface *
+static struct ospf_interface *
ospf_snmp_if_lookup (struct in_addr *ifaddr, unsigned int *ifindex)
{
struct listnode *node;
@@ -1528,7 +1542,7 @@ ospf_snmp_if_lookup (struct in_addr *ifaddr, unsigned int *ifindex)
return oi;
}
-struct ospf_interface *
+static struct ospf_interface *
ospf_snmp_if_lookup_next (struct in_addr *ifaddr, unsigned int *ifindex,
int ifaddr_next, int ifindex_next)
{
@@ -1563,19 +1577,21 @@ ospf_snmp_if_lookup_next (struct in_addr *ifaddr, unsigned int *ifindex,
{
/* Usual interface */
if (ifaddr->s_addr)
- /* The interface must have valid AF_INET connected address */
- /* it must have lager IPv4 address value than the lookup entry */
- if ((ospf_snmp_is_if_have_addr(osif->ifp)) &&
- (ntohl (osif->addr.s_addr) > ntohl (ifaddr->s_addr)))
- {
- *ifaddr = osif->addr;
- *ifindex = osif->ifindex;
+ {
+ /* The interface must have valid AF_INET connected address */
+ /* it must have lager IPv4 address value than the lookup entry */
+ if ((ospf_snmp_is_if_have_addr(osif->ifp)) &&
+ (ntohl (osif->addr.s_addr) > ntohl (ifaddr->s_addr)))
+ {
+ *ifaddr = osif->addr;
+ *ifindex = osif->ifindex;
- /* and it must be an OSPF interface */
- oi = ospf_if_lookup_by_local_addr (ospf, osif->ifp, *ifaddr);
- if (oi)
- return oi;
- }
+ /* and it must be an OSPF interface */
+ oi = ospf_if_lookup_by_local_addr (ospf, osif->ifp, *ifaddr);
+ if (oi)
+ return oi;
+ }
+ }
/* Unnumbered interface */
else
/* The interface must NOT have valid AF_INET connected address */
@@ -1595,7 +1611,7 @@ ospf_snmp_if_lookup_next (struct in_addr *ifaddr, unsigned int *ifindex,
return NULL;
}
-int
+static int
ospf_snmp_iftype (struct interface *ifp)
{
#define ospf_snmp_iftype_broadcast 1
@@ -1609,7 +1625,7 @@ ospf_snmp_iftype (struct interface *ifp)
return ospf_snmp_iftype_broadcast;
}
-struct ospf_interface *
+static struct ospf_interface *
ospfIfLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *ifaddr, unsigned int *ifindex, int exact)
{
@@ -1665,7 +1681,7 @@ ospfIfLookup (struct variable *v, oid *name, size_t *length,
static u_char *
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;
struct in_addr ifaddr;
@@ -1769,7 +1785,7 @@ ospfIfEntry (struct variable *v, oid *name, size_t *length, int exact,
#define OSPF_SNMP_METRIC_VALUE 1
-struct ospf_interface *
+static struct ospf_interface *
ospfIfMetricLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *ifaddr, unsigned int *ifindex, int exact)
{
@@ -1915,7 +1931,7 @@ ospf_snmp_vl_delete (struct ospf_vl_data *vl_data)
route_unlock_node (rn);
}
-struct ospf_vl_data *
+static struct ospf_vl_data *
ospf_snmp_vl_lookup (struct in_addr *area_id, struct in_addr *neighbor)
{
struct prefix_ls lp;
@@ -1938,7 +1954,7 @@ ospf_snmp_vl_lookup (struct in_addr *area_id, struct in_addr *neighbor)
return NULL;
}
-struct ospf_vl_data *
+static struct ospf_vl_data *
ospf_snmp_vl_lookup_next (struct in_addr *area_id, struct in_addr *neighbor,
int first)
{
@@ -1975,7 +1991,7 @@ ospf_snmp_vl_lookup_next (struct in_addr *area_id, struct in_addr *neighbor,
return NULL;
}
-struct ospf_vl_data *
+static struct ospf_vl_data *
ospfVirtIfLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *area_id, struct in_addr *neighbor, int exact)
{
@@ -2025,7 +2041,7 @@ ospfVirtIfLookup (struct variable *v, oid *name, size_t *length,
static u_char *
ospfVirtIfEntry (struct variable *v, oid *name, size_t *length, int exact,
- size_t *var_len, WriteMethod **write_method)
+ size_t *var_len, WriteMethod **write_method)
{
struct ospf_vl_data *vl_data;
struct ospf_interface *oi;
@@ -2089,7 +2105,7 @@ ospfVirtIfEntry (struct variable *v, oid *name, size_t *length, int exact,
return NULL;
}
-struct ospf_neighbor *
+static struct ospf_neighbor *
ospf_snmp_nbr_lookup (struct ospf *ospf, struct in_addr *nbr_addr,
unsigned int *ifindex)
{
@@ -2118,7 +2134,7 @@ ospf_snmp_nbr_lookup (struct ospf *ospf, struct in_addr *nbr_addr,
return NULL;
}
-struct ospf_neighbor *
+static struct ospf_neighbor *
ospf_snmp_nbr_lookup_next (struct in_addr *nbr_addr, unsigned int *ifindex,
int first)
{
@@ -2164,7 +2180,7 @@ ospf_snmp_nbr_lookup_next (struct in_addr *nbr_addr, unsigned int *ifindex,
return NULL;
}
-struct ospf_neighbor *
+static struct ospf_neighbor *
ospfNbrLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *nbr_addr, unsigned int *ifindex, int exact)
{
@@ -2258,7 +2274,7 @@ ospf_snmp_neighbor_state(u_char nst)
static u_char *
ospfNbrEntry (struct variable *v, oid *name, size_t *length, int exact,
- size_t *var_len, WriteMethod **write_method)
+ size_t *var_len, WriteMethod **write_method)
{
struct in_addr nbr_addr;
unsigned int ifindex;
@@ -2320,7 +2336,7 @@ ospfNbrEntry (struct variable *v, oid *name, size_t *length, int exact,
static u_char *
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)
{
struct ospf_vl_data *vl_data;
struct in_addr area_id;
@@ -2373,7 +2389,7 @@ ospfVirtNbrEntry (struct variable *v, oid *name, size_t *length, int exact,
return NULL;
}
-struct ospf_lsa *
+static struct ospf_lsa *
ospfExtLsdbLookup (struct variable *v, oid *name, size_t *length, u_char *type,
struct in_addr *ls_id, struct in_addr *router_id, int exact)
{
@@ -2466,7 +2482,7 @@ ospfExtLsdbLookup (struct variable *v, oid *name, size_t *length, u_char *type,
static u_char *
ospfExtLsdbEntry (struct variable *v, oid *name, size_t *length, int exact,
- size_t *var_len, WriteMethod **write_method)
+ size_t *var_len, WriteMethod **write_method)
{
struct ospf_lsa *lsa;
struct lsa_header *lsah;
diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c
index d02c7610..61c47c71 100644
--- a/ripd/rip_snmp.c
+++ b/ripd/rip_snmp.c
@@ -93,10 +93,14 @@ oid rip_oid [] = { RIPV2MIB };
struct route_table *rip_ifaddr_table;
/* Hook functions. */
-static u_char *rip2Globals ();
-static u_char *rip2IfStatEntry ();
-static u_char *rip2IfConfAddress ();
-static u_char *rip2PeerTable ();
+static u_char *rip2Globals (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *rip2IfStatEntry (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *rip2IfConfAddress (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char *rip2PeerTable (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
struct variable rip_variables[] =
{
@@ -215,7 +219,7 @@ rip_ifaddr_delete (struct interface *ifp, struct connected *ifc)
}
}
-struct interface *
+static struct interface *
rip_ifaddr_lookup_next (struct in_addr *addr)
{
struct prefix_ipv4 p;
diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c
index 7e66e2f6..0fde4bb8 100644
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -90,10 +90,14 @@ extern struct zebra_t zebrad;
oid ipfw_oid [] = { IPFWMIB };
/* Hook functions. */
-u_char * ipFwNumber ();
-u_char * ipFwTable ();
-u_char * ipCidrNumber ();
-u_char * ipCidrTable ();
+static u_char * ipFwNumber (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char * ipFwTable (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char * ipCidrNumber (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
+static u_char * ipCidrTable (struct variable *, oid [], size_t *,
+ int, size_t *, WriteMethod **);
struct variable zebra_variables[] =
{
@@ -133,7 +137,7 @@ struct variable zebra_variables[] =
};
-u_char *
+static u_char *
ipFwNumber (struct variable *v, oid objid[], size_t *objid_len,
int exact, size_t *val_len, WriteMethod **write_method)
{
@@ -158,7 +162,7 @@ ipFwNumber (struct variable *v, oid objid[], size_t *objid_len,
return (u_char *)&result;
}
-u_char *
+static u_char *
ipCidrNumber (struct variable *v, oid objid[], size_t *objid_len,
int exact, size_t *val_len, WriteMethod **write_method)
{
@@ -183,7 +187,7 @@ ipCidrNumber (struct variable *v, oid objid[], size_t *objid_len,
return (u_char *)&result;
}
-int
+static int
in_addr_cmp(u_char *p1, u_char *p2)
{
int i;
@@ -199,7 +203,7 @@ in_addr_cmp(u_char *p1, u_char *p2)
return 0;
}
-int
+static int
in_addr_add(u_char *p, int num)
{
int i, ip0;
@@ -224,7 +228,8 @@ in_addr_add(u_char *p, int num)
return 1;
}
-int proto_trans(int type)
+static int
+proto_trans(int type)
{
switch (type)
{
@@ -251,7 +256,7 @@ int proto_trans(int type)
}
}
-void
+static void
check_replace(struct route_node *np2, struct rib *rib2,
struct route_node **np, struct rib **rib)
{
@@ -294,7 +299,7 @@ check_replace(struct route_node *np2, struct rib *rib2,
return;
}
-void
+static void
get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len,
int exact, struct route_node **np, struct rib **rib)
{
@@ -339,7 +344,7 @@ get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len,
* ipForwardDest, ipForwardProto, ipForwardPolicy, ipForwardNextHop
*/
- if (*objid_len > v->namelen)
+ if (*objid_len > (unsigned) v->namelen)
oid2in_addr (objid + v->namelen, MIN(4, *objid_len - v->namelen), &dest);
if (*objid_len > (unsigned) v->namelen + 4)
@@ -441,7 +446,7 @@ get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len,
return;
}
-u_char *
+static u_char *
ipFwTable (struct variable *v, oid objid[], size_t *objid_len,
int exact, size_t *val_len, WriteMethod **write_method)
{
@@ -546,7 +551,7 @@ ipFwTable (struct variable *v, oid objid[], size_t *objid_len,
return NULL;
}
-u_char *
+static u_char *
ipCidrTable (struct variable *v, oid objid[], size_t *objid_len,
int exact, size_t *val_len, WriteMethod **write_method)
{