]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SNMP changes to get snmpwalk working
authorwessels <>
Tue, 2 Dec 1997 05:45:44 +0000 (05:45 +0000)
committerwessels <>
Tue, 2 Dec 1997 05:45:44 +0000 (05:45 +0000)
21 files changed:
include/snmp.h
include/snmp_util.h
snmplib/Makefile.in
snmplib/mib.c
src/Makefile.in
src/access_log.cc
src/cache_cf.cc
src/cf.data.pre
src/cf_gen.cc
src/enums.h
src/fqdncache.cc
src/ipcache.cc
src/mib.txt
src/net_db.cc
src/protos.h
src/snmp_agent.cc
src/squid.h
src/stat.cc
src/structs.h
src/tools.cc
src/typedefs.h

index aead0a99557a3f8e23670ba26d1c089066c3adcb..e50aef0a765b95179a8a9212c702202e19804245 100644 (file)
@@ -120,7 +120,7 @@ typedef struct _conf_if_list {
 } conf_if_list;
 
 extern conf_if_list *if_list;
-
+extern void init_mib(const char *);
 extern int read_objid(char *input, oid * output, int *out_len);
 extern void snmp_add_null_var(struct snmp_pdu *, oid *, int);
 extern void sprint_objid(char *buf, oid * id, int idlen);
index cc35744ced487f3fa13d28b1e795a251f41983b6..399fa87d23d091a102a672db59fa6682fa05035c 100644 (file)
@@ -61,7 +61,7 @@ Util_file_read (char *file, int offset, char *data, int dataSz);
  * ** Write data into file
  */
 int
-Util_file_write (char *file, int offset, char *data, int dataSz))
+Util_file_write (char *file, int offset, char *data, int dataSz);
 
 
 /* ---------------------------------------------------------------------- */
@@ -69,13 +69,4 @@ Util_file_write (char *file, int offset, char *data, int dataSz))
 
 
 
-
-
-
-
-
-
-
-
-
 #endif
index d333fe94819a57e1f1b15749d34527112347585e..166225a54a6ce25e6cec2624ef653a72ca012d9f 100644 (file)
@@ -43,6 +43,8 @@ $(ALIB):    ${OBJS}
 mib.o:         mib.c
        $(CC) $(CFLAGS) $(MIBDEFS)      -c mib.c 
 
+distclean: celan
+       -rm -f Makefile
 clean:
        rm -f core *.o ${TARG} shared/*.o *.a *.so*
 
index d1a1aa2b42044d24594519d09b2d87362339ee63..dccedd517bb4835b2fa605b7977861213492f559 100644 (file)
@@ -593,6 +593,8 @@ void
 init_mib(const char *file)
 {
     char *prefix;
+       if (Mib!=NULL)
+               return;
 
     Mib = 0;
     if (file)
index 79f9c87b69bf2f56d4eb85104ddf804f1934d8fd..1d706a4f4f288c1a985e8862fe1cfe68394be814 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.102 1997/11/23 06:47:18 wessels Exp $
+#  $Id: Makefile.in,v 1.103 1997/12/01 22:45:47 wessels Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -18,9 +18,9 @@ STORE_KEY_SHA = # -DSTORE_KEY_SHA=1
 USE_ASYNC_IO   = # -DUSE_ASYNC_IO=1
 
 # define all three for SNMP support
-#SQUID_SNMP            = -DSQUID_SNMP=1
-#SQUID_MIB             = mib.txt 
-#SQUID_SNMP_LIBS       = -L../snmplib -lsnmp
+SQUID_SNMP             = -DSQUID_SNMP=1
+SQUID_MIB              = mib.txt 
+SQUID_SNMP_LIBS        = -L../snmplib -lsnmp
 
 DEFINES         = $(HOST_OPT) \
                   $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
@@ -40,7 +40,6 @@ srcdir                = @srcdir@
 VPATH          = @srcdir@
 
 DEFAULT_CONFIG_FILE     = $(sysconfdir)/squid.conf
-DEFAULT_SNMP_CONF      = $(sysconfdir)/snmp.conf
 DEFAULT_MIME_TABLE     = $(sysconfdir)/mime.conf
 DEFAULT_DNSSERVER       = $(libexecdir)/dnsserver
 DEFAULT_CACHE_LOG       = $(localstatedir)/logs/cache.log
@@ -52,7 +51,7 @@ DEFAULT_PINGER                = $(libexecdir)/pinger
 DEFAULT_UNLINKD                = $(libexecdir)/unlinkd
 DEFAULT_ICON_DIR       = $(sysconfdir)/icons
 DEFAULT_ERROR_DIR      = $(sysconfdir)/errors
-DEFAULT_MIB_PATH       = $(sysconfdir)/squidmib.txt
+DEFAULT_MIB_PATH       = $(sysconfdir)/mib.txt
 
 CC             = @CC@
 MAKEDEPEND     = @MAKEDEPEND@
@@ -206,7 +205,6 @@ cf.data: cf.data.pre Makefile
        s%@DEFAULT_STORE_LOG@%$(DEFAULT_STORE_LOG)%g;\
        s%@DEFAULT_PID_FILE@%$(DEFAULT_PID_FILE)%g;\
        s%@DEFAULT_SWAP_DIR@%$(DEFAULT_SWAP_DIR)%g;\
-       s%@DEFAULT_SNMP_CONF@%$(DEFAULT_SNMP_CONF)%g;\
        s%@DEFAULT_ICON_DIR@%$(DEFAULT_ICON_DIR)%g;\
         s%@DEFAULT_MIB_PATH@%$(DEFAULT_MIB_PATH)%g;\
        s%@DEFAULT_ERROR_DIR@%$(DEFAULT_ERROR_DIR)%g" < cf.data.pre >$@
@@ -288,13 +286,6 @@ install: all install-mkdirs
                echo "$(INSTALL_FILE) squid.conf $(sysconfdir)"; \
                $(INSTALL_FILE) squid.conf $(sysconfdir); \
        fi
-       $(INSTALL_FILE) snmp.conf $(sysconfdir)/snmp.conf.default
-       @if test -f $(sysconfdir)/snmp.conf ; then \
-                echo "$@ will not overwrite existing $(sysconfdir)/snmp.conf" ; \
-        else \
-                echo "$(INSTALL_FILE) snmp.conf $(sysconfdir)"; \
-                $(INSTALL_FILE) snmp.conf $(sysconfdir); \
-        fi
 
        $(INSTALL_FILE) mime.conf $(sysconfdir)/mime.conf.default
        @if test -f $(sysconfdir)/mime.conf ; then \
index 0f13e30c84dbb24366faf6a2045cec2400f9799e..30184e799bd7098d4892087ef5097a8e9320aeb1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: access_log.cc,v 1.12 1997/11/30 02:26:41 wessels Exp $
+ * $Id: access_log.cc,v 1.13 1997/12/01 22:45:48 wessels Exp $
  *
  * DEBUG: section 46    Access Log
  * AUTHOR: Duane Wessels
@@ -53,6 +53,7 @@ const char *log_tags[] =
     "UDP_DENIED",
     "UDP_INVALID",
     "UDP_MISS_NOFETCH",
+    "LOG_METER_EXPIRES",
     "LOG_TYPE_MAX"
 };
 
index dbad86fbcd077844756225eb65f30c16d4ef3c4b..1eef7606e62ba5af80e2ae76c57e72df0aa7b47c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.234 1997/11/23 06:48:39 wessels Exp $
+ * $Id: cache_cf.cc,v 1.235 1997/12/01 22:45:49 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -29,6 +29,8 @@
  */
 
 #include "squid.h"
+#include "snmp.h"
+#include "snmp_config.h"
 
 static const char *const T_SECOND_STR = "second";
 static const char *const T_MINUTE_STR = "minute";
@@ -52,6 +54,7 @@ static void self_destruct(void);
 static void wordlistAdd(wordlist **, const char *);
 
 static void configDoConfigure(void);
+static void parse_snmp_conf(snmpconf **);
 static void parse_refreshpattern(refresh_t **);
 static int parseTimeUnits(const char *unit);
 static void parseTimeLine(time_t * tptr, const char *units);
@@ -64,6 +67,13 @@ static void parseBytesLine(size_t * bptr, const char *units);
 static size_t parseBytesUnits(const char *unit);
 static void free_all(void);
 static void requirePathnameExists(const char *name, const char *path);
+/*
+extern int create_view ( char **);
+extern int create_user ( char **);
+extern int create_community (char **);
+extern void tokenize ( char *, char **, int );
+*/
+extern struct tree *Mib;
 
 static void
 self_destruct(void)
@@ -351,6 +361,35 @@ dump_acl(StoreEntry * entry, const char *name, acl * acl)
     storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
 }
 
+static void
+parse_snmp_conf(snmpconf **s)
+{
+       static char buff[256];
+       static char *tokens[10], *p;
+       if (Mib==NULL)
+       {
+               if (Config.Snmp.mibPath) 
+                       init_mib(Config.Snmp.mibPath) ;
+               else
+                       fatal("snmp_mib_path should be defined before any snmp_agent_conf\n");
+       }
+       p=strtok(NULL, null_string);
+       strcpy(buff,p);
+       tokenize(buff, tokens, 10 );
+
+       if ( !strcmp("view", tokens[0]) ) {
+               if (create_view(tokens) < 0 ) 
+                       debug(49,5)("snmp: parse_snmpconf(): error\n");
+       } else if ( !strcmp("user", tokens[0])) {
+               if (create_user(tokens) < 0 )
+                       debug(49,5)("snmp: parse_snmpconf(): error\n");
+       } else if ( !strcmp("community", tokens[0] )) { 
+               if ( create_community(tokens) < 0 ) 
+                       debug(49,5)("snmp: parse_snmpconf(): error\n");
+       } else 
+               debug(49,5)("snmp: unknown directive %s\n",tokens[0]);
+}
+
 static void
 parse_acl(acl ** acl)
 {
@@ -874,6 +913,12 @@ parse_onoff(int *var)
 #define dump_eol dump_string
 #define free_eol free_string
 
+static void
+dump_snmp_conf(StoreEntry *entry, const char *name, snmpconf *head) 
+{
+       storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
+}
+
 static void
 dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
 {
@@ -935,6 +980,17 @@ parse_refreshpattern(refresh_t ** head)
     safe_free(pattern);
 }
 
+static void
+free_snmp_conf(snmpconf **head)
+{
+       snmpconf *t;
+       while (( t= *head ) != NULL ) { 
+       *head=t->next;
+       safe_free(t->line);
+       safe_free(t);
+       }
+}
+
 static void
 free_refreshpattern(refresh_t ** head)
 {
index 827175242f63c63648039a9549cf16537f42f5c2..e8f3eb64893a5d5aca8795d65c86c4f8e7a4b2fc 100644 (file)
@@ -1925,6 +1925,59 @@ DOC_START
 maximum_single_addr_tries 3
 DOC_END
 
+NAME: snmp_port
+TYPE: ushort
+LOC: Config.Port.snmp
+DEFAULT: 3401
+DOC_START
+       Port for snmp. <=0 to disable.
+DOC_END
+
+NAME: snmp_config_file
+TYPE: string
+LOC: Config.Snmp.configFile
+DEFAULT: @DEFAULT_SNMP_CONF@
+DOC_START
+       External snmp configuration file, CMU-snmpd style.
+DOC_END
+
+NAME: snmp_do_queueing
+TYPE: onoff
+LOC: Config.Snmp.do_queueing
+DEFAULT: on
+DOC_START
+       If disabled, snmp packets will not be queued but delivered 
+       immediately. This could be performant when you want to monitor
+       a cache in trouble, but this could also bring squid to block.
+DOC_END
+
+NAME: forward_snmpd_port
+TYPE: ushort
+LOC: Config.Snmp.localPort
+DEFAULT: 0
+DOC_START
+       This configures whether we should be forwarding SNMP requests
+       to another snmpd. The reason for putting this piece of functionality
+       into squid was to enable access to the system's installed
+       snmpd with minimal changes.
+       This option is turned off by default, check with your /etc/services
+       for your system's snmp port (usually 161).
+       We do not use getservbyname() to allow you to set squid into port 161
+       and your system's snmpd to another port by changing /etc/services.
+
+        WARNING: Because of squid acting as a proxy snmpd for system  
+        you have to do security checks on THIS snmpd for all objects.
+        Check your snmp_config_file
+DOC_END
+
+NAME: snmp_mib_path
+TYPE: string
+LOC: Config.Snmp.mibPath
+DEFAULT: @DEFAULT_MIB_PATH@
+DOC_START
+       The location of squid's mib.
+DOC_END
+
 NAME: snmp_port
 TYPE: ushort
 LOC: Config.Port.snmp
@@ -1968,13 +2021,43 @@ DOC_START
        snmp_config_file
 DOC_END
 
-NAME: snmp_mib_path
+NAME: trap_sink
 TYPE: string
-LOC: Config.Snmp.mibPath
-DEFAULT: @DEFAULT_MIB_PATH@
+LOC: Config.Snmp.trap_sink
+DEFAULT: 127.0.0.1
 DOC_START
-       The location of squid's mib.
+       Hostname or ip address of trap sink for snmp
 DOC_END
 
+NAME: snmp_trap_community
+TYPE: string
+LOC: Config.Snmp.trap_community
+DEFAULT: public
+DOC_START
+       Community name for traps
+DOC_END
+
+NAME: snmp_enable_authen_traps
+TYPE: onoff
+LOC: Config.Snmp.conf_authtraps
+DEFAULT: off
+DOC_START
+       Enable SNMP authenticated traps
+DOC_END
+
+NAME: snmp_agent_conf
+TYPE: snmp_conf
+LOC: Config.Snmp.snmpconf
+DEFAULT: none
+DOC_START
+       Define snmp views, users and communities 
+       Example:
+               snmp_agent_conf view all .1.3.6 included
+               snmp_agent_conf view squid .1.3.6 included
+               snmp_agent_conf user squid - all all public
+               snmp_agent_conf user all all all all  squid
+               snmp_agent_conf community public squid squid
+               snmp_agent_conf community readwrite all all
+DOC_END
 
 EOF
index faeef18e26aa1342cd65d277f6c25f11a4779905..5549121ae7a51cf1fa9f0bd74064a2d3248302d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cf_gen.cc,v 1.15 1997/11/05 05:29:19 wessels Exp $
+ * $Id: cf_gen.cc,v 1.16 1997/12/01 22:45:50 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Max Okumoto
@@ -48,6 +48,8 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <assert.h>
+#include "snmp.h"
+#include "snmp_config.h"
 
 #define MAX_LINE       1024    /* longest configuration line */
 #define _PATH_PARSER           "cf_parser.c"
index b4df7669a05db9f19efabdc7cd9c9b85333513a1..a13d1d7828fdd2109b6c9ad1daff1d955aa4e3c8 100644 (file)
@@ -20,6 +20,7 @@ typedef enum {
     LOG_UDP_DENIED,
     LOG_UDP_INVALID,
     LOG_UDP_MISS_NOFETCH,
+    LOG_METER_EXPIRES,
     LOG_TYPE_MAX
 } log_type;
 
@@ -362,3 +363,9 @@ typedef enum {
     ACCESS_ALLOWED,
     ACCESS_REQ_PROXY_AUTH
 } allow_t;
+
+enum {
+SNMP_C_VIEW,
+SNMP_C_USER,
+SNMP_C_COMMUNITY
+};
index 75cf0c20f8e8012635b7fbe06a0e7ed5a69fa4f8..a8499e28c68a4de7239396d4fd7bcb6263835596 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fqdncache.cc,v 1.69 1997/11/28 08:19:56 wessels Exp $
+ * $Id: fqdncache.cc,v 1.70 1997/12/01 22:45:51 wessels Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -140,8 +140,8 @@ static void fqdncache_dnsHandleRead(int, void *);
 static fqdncache_entry *fqdncache_parsebuffer(const char *buf, dnsserver_t *);
 static int fqdncache_purgelru(void);
 static void fqdncache_release(fqdncache_entry *);
-static fqdncache_entry *fqdncache_GetFirst(void);
-static fqdncache_entry *fqdncache_GetNext(void);
+ fqdncache_entry *fqdncache_GetFirst(void);
+ fqdncache_entry *fqdncache_GetNext(void);
 static fqdncache_entry *fqdncache_create(const char *name);
 static void fqdncache_add_to_hash(fqdncache_entry *);
 static void fqdncache_call_pending(fqdncache_entry *);
@@ -240,13 +240,13 @@ fqdncache_get(const char *name)
     return f;
 }
 
-static fqdncache_entry *
+ fqdncache_entry *
 fqdncache_GetFirst(void)
 {
     return (fqdncache_entry *) hash_first(fqdn_table);
 }
 
-static fqdncache_entry *
+ fqdncache_entry *
 fqdncache_GetNext(void)
 {
     return (fqdncache_entry *) hash_next(fqdn_table);
index 44c309d66d294cd84c1d5ed02139db752609a57c..e850bc3f7c417b1861b31ede037d3709e705d8e6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipcache.cc,v 1.146 1997/11/28 08:20:29 wessels Exp $
+ * $Id: ipcache.cc,v 1.147 1997/12/01 22:45:52 wessels Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -130,7 +130,7 @@ static struct {
     int release_locked;
 } IpcacheStats;
 
-static dlink_list lru_list;
+ dlink_list lru_list;
 
 static int ipcache_testname(void);
 #if OLD_CODE
index eb7276be5488b63997135381c9e1f26dae9452ed..6f5da2fa441bbafb1e7fbf2a5f0ea947fcd1e5f0 100644 (file)
@@ -1,8 +1,20 @@
 -- File: SQUID.MIB
 -- kostas@nlanr.net
 -- Created    : 11/ 2/97 kostas@nlanr.net
--- Last Update: 11/18/97 kostas@nlanr.net
+-- Last Update: 12/1/97 kostas@nlanr.net
 
+SQUID-MIB DEFINITIONS ::= BEGIN
+               IMPORTS
+               TimeTicks,
+               Counter                FROM RFC1155-SMI
+               DisplayString          FROM RFC1158-MIB
+               mib-2                  FROM RFC1213-MIB
+               OBJECT-TYPE            FROM RFC-1212
+               TRAP-TYPE              FROM RFC-1215;
+
+-- 
+-- definitions included for standalone agent/managers
+--
 
 mgmt                   OBJECT IDENTIFIER ::= { iso org(3) dod(6) internet(1) 2 }
 mib                    OBJECT IDENTIFIER ::= { mgmt 1 }
@@ -11,24 +23,18 @@ experimental        OBJECT IDENTIFIER ::= { internet 3 }
 private                OBJECT IDENTIFIER ::= { internet 4 }
 enterprises            OBJECT IDENTIFIER ::= { private 1 }
 nsfnet         OBJECT IDENTIFIER ::= { experimental 25 } 
+squid          OBJECT IDENTIFIER ::= { nsfnet 17 }
 
-
---     SQUID-MIB DEFINITIONS ::= BEGIN
---             IMPORTS
---              TimeTicks,
---              Counter                FROM RFC1155-SMI
---                     DisplayString          FROM RFC1158-MIB
---             mib-2                  FROM RFC1213-MIB
---             OBJECT-TYPE            FROM RFC-1212
---             TRAP-TYPE              FROM RFC-1215;
-       squid   OBJECT IDENTIFIER ::= { nsfnet 17 }
-
+--
+-- Major MIB groups
+--
        cacheSystem     OBJECT IDENTIFIER ::= { squid 1 }
        cacheConfig     OBJECT IDENTIFIER ::= { squid 2 }
        cachePerf       OBJECT IDENTIFIER ::= { squid 3 }
-       cacheAccounting OBJECT IDENTIFIER ::= { squid 4 }
+       cacheAccounting OBJECT IDENTIFIER ::= { squid 6 }
        cacheSecurity   OBJECT IDENTIFIER ::= { squid 5 }
-       cacheNetwork    OBJECT IDENTIFIER ::= { squid 6 } 
+       cacheNetwork    OBJECT IDENTIFIER ::= { squid 4 } 
+
 
 --
 -- cacheSystem group
@@ -59,7 +65,7 @@ nsfnet                OBJECT IDENTIFIER ::= { experimental 25 }
 --
 -- config group
 --
--- Contains configuration information including peers, acls etc.
+-- Contains configuration information including peers etc.
 
 
        cacheAdmin OBJECT-TYPE
@@ -129,7 +135,7 @@ nsfnet              OBJECT IDENTIFIER ::= { experimental 25 }
                 ::= { cacheStorageConfig 6 }
 
        cacheWaisRelayHost OBJECT-TYPE
-                SYNTAX OCTET STRING
+                SYNTAX DisplayString
                 ACCESS read-only
                 STATUS mandatory
                 DESCRIPTION
@@ -146,7 +152,6 @@ nsfnet              OBJECT IDENTIFIER ::= { experimental 25 }
 
        cacheTimeoutValues OBJECT IDENTIFIER ::= { cacheConfig 6 }
 
-
        cacheReadTimeout  OBJECT-TYPE
                 SYNTAX Integer
                 ACCESS read-only
@@ -174,7 +179,7 @@ nsfnet              OBJECT IDENTIFIER ::= { experimental 25 }
 
 
        cacheLoggingLevel OBJECT-TYPE
-               SYNTAX Integer 
+               SYNTAX DisplayString
                ACCESS read-write
                STATUS mandatory
                DESCRIPTION
@@ -213,51 +218,59 @@ nsfnet            OBJECT IDENTIFIER ::= { experimental 25 }
          cachePeerState        INTEGER
        }
 
+       cachePeerId OBJECT-TYPE
+               SYNTAX Integer
+               ACCESS read-only
+               STATUS current
+       ::= { cachePeerEntry 1 }
        cachePeerName OBJECT-TYPE
                SYNTAX DisplayString
                ACCESS read-only
                STATUS current
-       ::= { cachePeerEntry 1 } 
+       ::= { cachePeerEntry 2 } 
 
        cachePeerIP OBJECT-TYPE
                 SYNTAX IpAddress
                 ACCESS read-only
                 STATUS current
-        ::= { cachePeerEntry 2 }
-
-       cachePeerPortHttp OBJECT-TYPE
-                SYNTAX INTEGER
-                ACCESS read-only
-                STATUS current
         ::= { cachePeerEntry 3 }
 
-       cachePeerPortIcp OBJECT-TYPE
+       cachePeerPortHttp OBJECT-TYPE
                 SYNTAX INTEGER
                 ACCESS read-only
                 STATUS current
         ::= { cachePeerEntry 4 }
 
-       cachePeerType OBJECT-TYPE
+       cachePeerPortIcp OBJECT-TYPE
                 SYNTAX INTEGER
                 ACCESS read-only
                 STATUS current
         ::= { cachePeerEntry 5 }
 
+--     cachePeerType OBJECT-TYPE
+--                SYNTAX INTEGER
+--                ACCESS read-only
+--                STATUS current
+--        ::= { cachePeerEntry 6 }
+
        cachePeerState OBJECT-TYPE
                 SYNTAX INTEGER
                 ACCESS read-only
                 STATUS current
-        ::= { cachePeerEntry 6 }
+        ::= { cachePeerEntry 7 }
 
        cachePeerType OBJECT-TYPE
                 SYNTAX INTEGER { 
-                                parent(1), sibling(2), multicast(3), none(4)
+                                parent(1), 
+                               sibling(2), 
+                               multicast(3), 
+                               none(4)
                                 }
                 MAX-ACCESS not-accessible
                 STATUS current
                 DESCRIPTION 
                         " Peer Type "
-       ::= { cachePeerEntry 4 } 
+       ::= { cachePeerEntry 6 } 
 
 --
 -- cacheNetwork group
@@ -340,7 +353,7 @@ nsfnet              OBJECT IDENTIFIER ::= { experimental 25 }
        
        -- IP cache info
 
-       IPcacheTable OBJECT-TYPE
+       ipCacheTable OBJECT-TYPE
                 SYNTAX SEQUENCE OF iPcacheEntry
                 ACCESS read-only
                 STATUS current
@@ -355,10 +368,11 @@ nsfnet            OBJECT IDENTIFIER ::= { experimental 25 }
                 STATUS current
                 DESCRIPTION 
                         " An entry in cachePeerTable " 
-                INDEX   { IPcacheEntryIP }
-                ::= { IPcacheTable 1 }
+                INDEX   { IPcacheEntryId }
+                ::= { ipCacheTable 1 }
 
         IPcacheEntry ::= SEQUENCE {
+         IPcacheEntryId                Integer,
           IPcacheEntryName         OCTET STRING,
           IPcacheEntryIP           IpAddress,
           IPcacheEntryState        INTEGER, 
@@ -373,27 +387,33 @@ nsfnet            OBJECT IDENTIFIER ::= { experimental 25 }
                         " State of IP cache entry " 
                ::= { iPcacheEntry 3 } 
 
+       IPcacheEntryId OBJECT-TYPE
+               SYNTAX Integer
+               ACCESS read-only
+               STATUS current
+       ::= { iPcacheEntry 1 } 
+
        IPcacheEntryName OBJECT-TYPE
                 SYNTAX OCTET STRING
                 ACCESS read-only
                 STATUS current
-       ::= { iPcacheEntry 1 }
+       ::= { iPcacheEntry 2 }
 
        IPcacheEntryIP OBJECT-TYPE
                 SYNTAX IpAddress
                 ACCESS read-only
                 STATUS current
-        ::= { iPcacheEntry 2 }
+        ::= { iPcacheEntry 3 }
 
        IPcacheEntryState OBJECT-TYPE
                 SYNTAX Integer
                 ACCESS read-only
                 STATUS current
-        ::= { iPcacheEntry 3 }
+        ::= { iPcacheEntry 4 }
 
        -- fqdn cache info
 
-        FQDNcacheTable OBJECT-TYPE
+        fQDNcacheTable OBJECT-TYPE
                 SYNTAX SEQUENCE OF fQDNcacheEntry
                 ACCESS read-only
                 STATUS current
@@ -408,10 +428,11 @@ nsfnet            OBJECT IDENTIFIER ::= { experimental 25 }
                 STATUS current
                 DESCRIPTION 
                         " An entry in cachePeerTable " 
-                INDEX   { FQDNcacheEntryName }
-                ::= { IPcacheTable 1 }
+                INDEX   { FQDNcacheEntryId }
+                ::= { fQDNcacheTable 1 }
 
         FQDNcacheEntry ::= SEQUENCE {
+         FQDNcacheEntryId              Integer,
           FQDNcacheEntryName         OCTET STRING,
           FQDNcacheEntryIP           IpAddress,
          FQDNcacheEntryLastRef      TimeTicks,
@@ -419,35 +440,41 @@ nsfnet            OBJECT IDENTIFIER ::= { experimental 25 }
           FQDNcacheEntryState        INTEGER
         }
 
+       FQDNcacheEntryId OBJECT-TYPE
+               SYNTAX Integer
+               ACCESS read-only
+               STATUS current
+       ::= { fQDNcacheEntry 1 }
+
        FQDNcacheEntryName OBJECT-TYPE
                 SYNTAX OCTET STRING
                 ACCESS read-only
                 STATUS current
-       ::= { fQDNcacheEntry 1 }
+       ::= { fQDNcacheEntry 2 }
 
        FQDNcacheEntryIP OBJECT-TYPE
                 SYNTAX IpAddress
                 ACCESS read-only
                 STATUS current
-        ::= { fQDNcacheEntry 2 }
+        ::= { fQDNcacheEntry 3 }
 
        FQDNcacheEntryLastRef OBJECT-TYPE
                 SYNTAX TimeTicks
                 ACCESS read-only
                 STATUS current
-        ::= { fQDNcacheEntry 3}
+        ::= { fQDNcacheEntry 4}
 
        FQDNcacheEntryExpires OBJECT-TYPE
                 SYNTAX TimeTicks
                 ACCESS read-only
                 STATUS current
-        ::= { fQDNcacheEntry 4}
+        ::= { fQDNcacheEntry 5}
 
        FQDNcacheEntryState OBJECT-TYPE
                 SYNTAX Integer
                 ACCESS read-only
                 STATUS current
-        ::= { fQDNcacheEntry 5}
+        ::= { fQDNcacheEntry 6}
 
 
 
@@ -458,7 +485,7 @@ nsfnet              OBJECT IDENTIFIER ::= { experimental 25 }
                 STATUS current
                 DESCRIPTION 
                         "  state of  FQDN cache entry "
-                ::= { fQDNcacheEntry 3  }
+                ::= { fQDNcacheEntry 7  }
 
 
        cacheTCPconnections OBJECT-TYPE
@@ -485,13 +512,13 @@ nsfnet            OBJECT IDENTIFIER ::= { experimental 25 }
                        " Throughput of incoming traffic in 5 min intervals "
                ::= { cacheNetwork 6 } 
 
---     cacheOutThroughput OBJECT-TYPE
-----           SYNTAX Integer32
-  --              ACCESS read-only
-   --             STATUS current
-    --            DESCRIPTION 
---                     "Throughput of outgoing traffic in 5 min intevals"
---             ::= { cacheNetwork 7 }
+       cacheOutThroughput OBJECT-TYPE
+               SYNTAX Integer32
+                ACCESS read-only
+                STATUS current
+                DESCRIPTION 
+                       " Throughput of outgoing traffic in 5 min intevals"
+               ::= { cacheNetwork 7 }
 
 --
 -- performance group { squid 3 }
@@ -637,12 +664,42 @@ nsfnet            OBJECT IDENTIFIER ::= { experimental 25 }
                 ::= { cacheSysPerf 7 }
 
        cacheNumObjCount OBJECT-TYPE
-                SYNTAX Counter32                 MAX-ACCESS read-only
+                SYNTAX Counter32                 
+               MAX-ACCESS read-only
                 STATUS  current
                 DESCRIPTION
                         " Number of objects "
                 ::= { cacheSysPerf 8 }
 
+        cacheCurrentMemSize OBJECT-TYPE
+                SYNTAX Counter32
+                ACCESS read-only
+                STATUS mandatory
+                ::= { cacheSysPerf 9 }
+
+        cacheCurrentLRUExpiration OBJECT-TYPE
+                SYNTAX TimeTicks
+                ACCESS read-only
+                STATUS mandatory
+                ::= { cacheSysPerf 10 }
+
+        cacheCurrentUnlinkRequests OBJECT-TYPE
+                SYNTAX Counter32
+                ACCESS read-only
+                STATUS mandatory
+                ::= { cacheSysPerf 11 }
+
+        cacheCurrentUnusedFileDescrCount OBJECT-TYPE
+                SYNTAX Gauge32
+                ACCESS read-only
+                STATUS mandatory
+                ::= { cacheSysPerf 12 }
+
+       cacheCurrentReservedFileDescrCount  OBJECT-TYPE
+                SYNTAX Gauge32
+                ACCESS read-only
+                STATUS mandatory
+                ::= { cacheSysPerf 13 }
 
        --
        -- cacheProtoStats
@@ -733,6 +790,34 @@ nsfnet             OBJECT IDENTIFIER ::= { experimental 25 }
                 STATUS mandatory
                 ::= { cacheProtoStatEntry 9 }
        
+
+       cacheProtoAggregateStats OBJECT IDENTIFIER ::= { cacheProtoStats 2 }
+
+       cacheClientHttpRequests  OBJECT-TYPE
+                SYNTAX Counter32
+                ACCESS read-only
+                STATUS mandatory
+                ::= { cacheProtoAggregateStats 1 }
+
+       cacheICPpktsSent OBJECT-TYPE
+                SYNTAX Counter32
+                ACCESS read-only
+                STATUS mandatory
+                ::= { cacheProtoAggregateStats 2 }
+
+       cacheICPpktsRecv OBJECT-TYPE
+                SYNTAX Counter32
+                ACCESS read-only
+                STATUS mandatory
+                ::= { cacheProtoAggregateStats 3 }
+
+       cacheCurrentSwapSize OBJECT-TYPE
+                SYNTAX Counter32
+                ACCESS read-only
+                STATUS mandatory
+                ::= { cacheProtoAggregateStats 4 }
+
+
        
        -- 
        -- cachePeerStats
@@ -745,7 +830,7 @@ nsfnet              OBJECT IDENTIFIER ::= { experimental 25 }
                 DESCRIPTION
                         " Table containing aggregate statistics 
                           per supported protocol "
-                ::= { cacheProtoStats 2 }
+                ::= { cachePeerStats 1 }
 
         cachePeerStatEntry OBJECT-TYPE
                 SYNTAX CachePeerStatEntry
@@ -863,4 +948,4 @@ nsfnet              OBJECT IDENTIFIER ::= { experimental 25 }
          cacheProtoAclMask     IpAddress
           cacheProtoAclType     INTEGER
         }
-
+END
index f33e47d458ab7eb94ddd9551a4cf7e8ad2bb428d..b9247e57fae292b5bdb9e49e1f2145467ecbbab0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: net_db.cc,v 1.51 1997/11/05 05:29:32 wessels Exp $
+ * $Id: net_db.cc,v 1.52 1997/12/01 22:45:53 wessels Exp $
  *
  * DEBUG: section 37    Network Measurement Database
  * AUTHOR: Duane Wessels
 
 #include "squid.h"
 
-#if USE_ICMP
 
-static hash_table *addr_table = NULL;
+#if USE_ICMP
+hash_table *addr_table = NULL;
 static hash_table *host_table = NULL;
 
 static struct in_addr networkFromInaddr(struct in_addr a);
 static void netdbRelease(netdbEntry * n);
-static netdbEntry *netdbGetFirst(hash_table * table);
-static netdbEntry *netdbGetNext(hash_table * table);
 static void netdbHashInsert(netdbEntry * n, struct in_addr addr);
 static void netdbHashDelete(const char *key);
 static void netdbHashLink(netdbEntry * n, const char *hostname);
@@ -115,13 +113,13 @@ netdbLookupHost(const char *key)
     return hptr ? (netdbEntry *) hptr->item : NULL;
 }
 
-static netdbEntry *
+netdbEntry *
 netdbGetFirst(hash_table * table)
 {
     return (netdbEntry *) hash_first(table);
 }
 
-static netdbEntry *
+netdbEntry *
 netdbGetNext(hash_table * table)
 {
     return (netdbEntry *) hash_next(table);
index 6efeb431d1f5e49c4b15fd29a9c2a498418cd399..0337010438343ddf992db73df308df72d9ed7ffb 100644 (file)
@@ -328,6 +328,8 @@ extern void netdbFreeMemory(void);
 extern int netdbHostHops(const char *host);
 extern int netdbHostRtt(const char *host);
 extern void netdbUpdatePeer(request_t *, peer * e, int rtt, int hops);
+extern netdbEntry *netdbGetFirst(hash_table * table);
+extern netdbEntry *netdbGetNext(hash_table * table);
 
 extern void objcachePasswdAdd(cachemgr_passwd **, char *, wordlist *);
 extern void objcachePasswdDestroy(cachemgr_passwd ** a);
@@ -432,6 +434,7 @@ extern int storePendingNClients(const StoreEntry *);
 extern int storeWriteCleanLogs(int reopen);
 extern HASHCMP urlcmp;
 extern EVH storeMaintainSwapSpace;
+
 extern void storeExpireNow(StoreEntry *);
 extern void storeReleaseRequest(StoreEntry *);
 extern void storeRotateLog(void);
index 2f38bd96f737877b2362da8ca2d2187684ccc43f..21e01547b5b0256e4b9e2035cf905330b7239da6 100644 (file)
@@ -44,12 +44,6 @@ int  create_identical();
 int    parse_var_op_list();
 void setVariable();
 
-#if kinetics
-char   version_descr[];
-oid    version_id[];
-int    version_id_len;
-#endif
-
 struct pbuf *definitelyGetBuf();
 int get_community();
 
@@ -191,16 +185,19 @@ long              *ireqid;
                        create_report( session, out_sn_data, out_length, -ret, reqid );
                        return 1;
                } else {
+                       debug(49,5)("snmp_agent_parse: asn_parse failed\n");
                        return 0;
                }
            } else if( ret > 0 ) {
                increment_stat( ret );
+               debug(49,5)("snmp_agent_parse: authorization failed>0 ");
                return 0;
            }
 
     } else if( version == SNMP_VERSION_1 ) {
            if( (ret = get_community( sid )) != 0 ) {
                increment_stat(ret);
+               debug(49,5)("snmp_agent_parse: get_community failed\n");
                return 0;
            }
            session->version = SNMP_VERSION_1;
@@ -233,8 +230,12 @@ long               *ireqid;
 
     if( msgtype == GETBULK_REQ_MSG ) {
        if( session->version == SNMP_VERSION_1 ) 
+       {
+               debug(49,5)("snmp_agent_parse: getbulk but version 1\n");
                return 0;
+       }
     } else if (msgtype != GET_REQ_MSG && msgtype != GETNEXT_REQ_MSG && msgtype != SET_REQ_MSG ) {
+               debug(49,5)("snmp_agent_parse: unknown request type\n");
        return 0;
     }
     sn_data = asn_parse_int(sn_data, &length, &type, &reqid, sizeof(reqid));
@@ -346,6 +347,7 @@ long                *ireqid;
                  *out_length = packet_end - out_auth;
                  return 1;
              }
+               debug(49,5)("snmp_agent_parse: problem in ERR_NOERROR\n");
              return 0;
        } else {
              parse_var_op_list(sn_data, length, out_sn_data, *out_length,
@@ -405,8 +407,10 @@ long               *ireqid;
                *out_length = packet_end - out_auth;
                return 1;
            }
+       debug(49,5)("snmp_agent_parse: create_identical failed\n");
            return 0;
        default:
+               debug(49,5)("snmp_agent_parse: hey, something's wrong\n");
            return 0;
     }
 
@@ -488,6 +492,7 @@ parse_var_op_list(sn_data, length, out_sn_data, out_length, index, msgtype, acti
        if (sn_data == NULL)
            return PARSE_ERROR;
        /* now attempt to retrieve the variable on the local entity */
+       debug(49,5)("snmp:before getStatPtr...\n");
        statP = getStatPtr(var_name, &var_name_len, &statType, &statLen, &acl, 
                exact, &write_method, session->version, &noSuchObject, 
                msgtype==SET_REQ_MSG ? session->writeView : session->readView );
@@ -630,7 +635,7 @@ create_identical(snmp_in, snmp_out, snmp_length, errstat, errindex)
     int                    length, headerLength;
     u_char *headerPtr, *reqidPtr, *errstatPtr, *errindexPtr, *varListPtr;
 
-    bcopy((char *)snmp_in, (char *)snmp_out, snmp_length);
+    memcpy((char *)snmp_out, (char *)snmp_in, snmp_length);
     length = snmp_length;
     headerPtr = snmp_auth_parse(snmp_out, &length, sid, &sidlen, (long *)&dummy);
     sid[sidlen] = 0;
@@ -774,8 +779,9 @@ int get_community(sessionid)
 u_char      *sessionid;
 {
     communityEntry *cp;
-
-    for( cp = communities; cp; cp = cp->next ) {
+       debug(49,5)("get_community: %s on %d\n",sessionid, getpid());
+    for( cp = Config.Snmp.communities; cp; cp = cp->next ) {
+               debug(49,5)("get_community: %s\n", cp->name);
         if (!strcmp(cp->name, (char *)sessionid))
             break;
     }
index befc48984affbb7481cc0a1a0b5d000c85f00880..73ba559f3c2884244c6ca23cf428617d246d6b68 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.137 1997/11/30 02:52:09 wessels Exp $
+ * $Id: squid.h,v 1.138 1997/12/01 22:45:57 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
 #define storeKeyHashCmp urlcmp
 #define storeKeyHashHash hash4
 #endif
+#ifdef SQUID_SNMP
+#include "snmp.h"
+#include "snmp_config.h"
+#endif
 
 /* Needed for poll() on Linux at least */
 #if HAVE_POLL
index 8962bb35b9766879931c080ca07a0acfee52ab22..51ba62ad4159c9b7d9d6fbadf73bed36b47f113a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.176 1997/11/28 08:11:58 wessels Exp $
+ * $Id: stat.cc,v 1.177 1997/12/01 22:45:57 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -115,7 +115,7 @@ static void proto_count(cacheinfo *, protocol_t, log_type);
 static void proto_newobject(cacheinfo *, protocol_t, int, int);
 static void proto_purgeobject(cacheinfo *, protocol_t, int);
 static void proto_touchobject(cacheinfo *, protocol_t, int);
-static int memoryAccounted(void);
+ int memoryAccounted(void);
 static void statAvgTick(void *notused);
 
 #ifdef XMALLOC_STATISTICS
@@ -496,7 +496,7 @@ statFiledescriptors(StoreEntry * sentry)
     storeAppendPrintf(sentry, close_bracket);
 }
 
-static int
+ int
 memoryAccounted(void)
 {
     return (int)
index 5c6779d021cd8602475cdd165440500ec06a1741..09384ef1c1ba6ce88dbe12347497c5485e4fb91e 100644 (file)
@@ -34,6 +34,12 @@ struct _acl_deny_info_list {
     struct _acl_deny_info_list *next;
 };
 
+struct _snmpconf {
+       char *line;
+       int type;
+       struct _snmpconf *next;
+};
+
 struct _acl {
     char name[ACL_NAME_SZ];
     squid_acl type;
@@ -131,8 +137,15 @@ struct _SquidConfig {
        char *configFile;
        char *agentInfo;
        char *mibPath;
+       char *trap_community;
+       char *trap_sink;
        u_short localPort;
        int do_queueing;
+       int conf_authtraps;
+       struct _snmpconf *snmpconf;
+       viewEntry       *views;
+       usecEntry       *users;
+       communityEntry  *communities;
     } Snmp;
     struct {
        char *log;
@@ -612,7 +625,7 @@ struct _net_db_peer {
 
 struct _netdbEntry {
     char *key;
-    struct _net_db *next;
+    struct _netdbEntry *next;
     char network[16];
     int pings_sent;
     int pings_recv;
index 236335583f3b1aef5f5ab6788b6a08ccc51d354e..b126a100a471997d5111861360c2f6e1b93aa44d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.131 1997/11/28 08:12:02 wessels Exp $
+ * $Id: tools.cc,v 1.132 1997/12/01 22:45:59 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -178,9 +178,9 @@ dumpMallocStats(void)
 #if HAVE_MSTATS && HAVE_GNUMALLOC_H
     struct mstats ms = mstats();
     fprintf(debug_log, "\ttotal space in arena:  %6d KB\n",
-       ms.bytes_total >> 10);
+       (int) (ms.bytes_total >> 10));
     fprintf(debug_log, "\tTotal free:            %6d KB %d%%\n",
-       ms.bytes_free >> 10,
+       (int) (ms.bytes_free >> 10),
        percent(ms.bytes_free, ms.bytes_total));
 #elif HAVE_MALLINFO
     struct mallinfo mp;
index 787b73d673f34f2c72182ebfe9e70a96d3c49320..5ba339f66269dbee9c3491caf0b68c37b53b8933 100644 (file)
@@ -14,6 +14,7 @@ typedef struct _acl_time_data acl_time_data;
 typedef struct _acl_name_list acl_name_list;
 typedef struct _acl_deny_info_list acl_deny_info_list;
 typedef struct _acl acl;
+typedef struct _snmpconf snmpconf;
 typedef struct _acl_list acl_list;
 typedef struct _acl_access acl_access;
 typedef struct _aclCheck_t aclCheck_t;
@@ -104,8 +105,8 @@ typedef void SIGHDLR(int sig);
 
 /* 32 bit integer compatability hack */
 #if SIZEOF_INT == 4
-typedef int num32;
-typedef unsigned int u_num32;
+/*typedef int num32;
+typedef unsigned int u_num32;*/
 #elif SIZEOF_LONG == 4
 typedef long num32;
 typedef unsigned long u_num32;