drop more dead code
This commit is contained in:
parent
dc21a0d16b
commit
565ea0992d
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
||||
PROG= snmpd_ntpd
|
||||
SRCS= mib.c log.c timer.c util.c
|
||||
SRCS= mib.c log.c util.c
|
||||
MAN=
|
||||
|
||||
CFLAGS+= -Wall -I${.CURDIR}
|
||||
|
52
mib.c
52
mib.c
@ -19,50 +19,22 @@
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
//#include <sys/types.h>
|
||||
#include <sys/signal.h>
|
||||
//#include <sys/queue.h>
|
||||
#include <sys/proc.h>
|
||||
//#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
//#include <sys/time.h>
|
||||
//#include <sys/tree.h>
|
||||
//#include <sys/utsname.h>
|
||||
//#include <sys/sysctl.h>
|
||||
//#include <sys/sensors.h>
|
||||
//#include <sys/sched.h>
|
||||
//#include <sys/mount.h>
|
||||
//#include <sys/ioctl.h>
|
||||
//#include <sys/disk.h>
|
||||
|
||||
//#include <netinet/in.h>
|
||||
//#include <netinet/ip.h>
|
||||
//#include <netinet/ip_carp.h>
|
||||
//#include <netinet/ip_var.h>
|
||||
//#include <arpa/inet.h>
|
||||
//#include <net/if.h>
|
||||
//#include <net/if_types.h>
|
||||
//#include <net/pfvar.h>
|
||||
//#include <netinet/ip_ipsp.h>
|
||||
//#include <net/if_pfsync.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <event.h>
|
||||
//#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
//#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
//#include <kvm.h>
|
||||
//
|
||||
//#include "log.h"
|
||||
#include "snmpd.h"
|
||||
#include "mib.h"
|
||||
|
||||
@ -70,10 +42,6 @@ struct event connev;
|
||||
const char *agentxsocket = NULL;
|
||||
int agentxfd = -1;
|
||||
|
||||
//int pageshift;
|
||||
//#define pagetok(size) ((size) << pageshift)
|
||||
|
||||
//void pageshift_init(void);
|
||||
void snmp_connect(struct agentx *, void *, int);
|
||||
void snmp_tryconnect(int, short, void *);
|
||||
void snmp_read(int, short, void *);
|
||||
@ -172,8 +140,6 @@ main(int argc, char *argv[])
|
||||
if ((sac = agentx_context(sas, context)) == NULL)
|
||||
fatal("agentx_context");
|
||||
|
||||
/* kr_init requires sac */
|
||||
//pageshift_init();
|
||||
|
||||
if (agentxsocket != NULL) {
|
||||
if (strlcpy(agentxsocketdir, agentxsocket,
|
||||
@ -211,24 +177,6 @@ main(int argc, char *argv[])
|
||||
event_dispatch();
|
||||
}
|
||||
|
||||
#if 0
|
||||
#define LOG1024 10
|
||||
void
|
||||
pageshift_init(void)
|
||||
{
|
||||
long pagesize;
|
||||
|
||||
if ((pagesize = sysconf(_SC_PAGESIZE)) == -1)
|
||||
fatal("sysconf(_SC_PAGESIZE)");
|
||||
while (pagesize > 1) {
|
||||
pageshift++;
|
||||
pagesize >>= 1;
|
||||
}
|
||||
/* we only need the amount of log(2)1024 for our conversion */
|
||||
pageshift -= LOG1024;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
snmp_connect(struct agentx *sa, void *cookie, int close)
|
||||
{
|
||||
|
6
mib.h
6
mib.h
@ -18,6 +18,6 @@
|
||||
|
||||
#include <agentx.h>
|
||||
|
||||
#define HOTTIS_MIB 1,3,6,1,4,1,9676
|
||||
#define HOTTIS_NTPD HOTTIS_MIB, 1
|
||||
#define HOTTIS_NTPD_COUNTER HOTTIS_NTPD, 1
|
||||
#define HOTTIS_MIB 1,3,6,1,4,1,9676
|
||||
#define HOTTIS_NTPD HOTTIS_MIB, 1
|
||||
#define HOTTIS_NTPD_COUNTER HOTTIS_NTPD, 1
|
||||
|
98
snmpd.h
98
snmpd.h
@ -1,6 +1,6 @@
|
||||
/* $OpenBSD: snmpd.h,v 1.1.1.1 2022/09/01 14:20:33 martijn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2025 Wolfgang Hottgenroth <woho@hottis.de>
|
||||
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
|
||||
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
*
|
||||
@ -20,80 +20,66 @@
|
||||
#ifndef SNMPD_H
|
||||
#define SNMPD_H
|
||||
|
||||
#include <sys/tree.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/pfvar.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#include <ber.h>
|
||||
#include <stdio.h>
|
||||
#include <imsg.h>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#ifndef nitems
|
||||
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
|
||||
#endif
|
||||
//#ifndef nitems
|
||||
//#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
|
||||
//#endif
|
||||
|
||||
/*
|
||||
* common definitions for snmpd
|
||||
*/
|
||||
|
||||
#define CONF_FILE "/etc/snmpd.conf"
|
||||
#define SNMPD_SOCKET "/var/run/snmpd.sock"
|
||||
#define SNMPD_USER "_snmpd"
|
||||
#define SNMP_PORT "161"
|
||||
#define SNMPTRAP_PORT "162"
|
||||
//#define CONF_FILE "/etc/snmpd.conf"
|
||||
//#define SNMPD_SOCKET "/var/run/snmpd.sock"
|
||||
//#define SNMPD_USER "_snmpd"
|
||||
//#define SNMP_PORT "161"
|
||||
//#define SNMPTRAP_PORT "162"
|
||||
|
||||
#define SNMPD_MAXSTRLEN 484
|
||||
#define SNMPD_MAXCOMMUNITYLEN SNMPD_MAXSTRLEN
|
||||
#define SNMPD_MAXVARBIND 0x7fffffff
|
||||
#define SNMPD_MAXVARBINDLEN 1210
|
||||
#define SNMPD_MAXENGINEIDLEN 32
|
||||
#define SNMPD_MAXUSERNAMELEN 32
|
||||
#define SNMPD_MAXCONTEXNAMELEN 32
|
||||
//#define SNMPD_MAXSTRLEN 484
|
||||
//#define SNMPD_MAXCOMMUNITYLEN SNMPD_MAXSTRLEN
|
||||
//#define SNMPD_MAXVARBIND 0x7fffffff
|
||||
//#define SNMPD_MAXVARBINDLEN 1210
|
||||
//#define SNMPD_MAXENGINEIDLEN 32
|
||||
//#define SNMPD_MAXUSERNAMELEN 32
|
||||
//#define SNMPD_MAXCONTEXNAMELEN 32
|
||||
|
||||
#define SNMP_USM_MAXDIGESTLEN 48
|
||||
#define SNMP_USM_SALTLEN 8
|
||||
#define SNMP_USM_KEYLEN 64
|
||||
#define SNMP_CIPHER_KEYLEN 16
|
||||
//#define SNMP_USM_MAXDIGESTLEN 48
|
||||
//#define SNMP_USM_SALTLEN 8
|
||||
//#define SNMP_USM_KEYLEN 64
|
||||
//#define SNMP_CIPHER_KEYLEN 16
|
||||
//
|
||||
//#define SMALL_READ_BUF_SIZE 1024
|
||||
//#define READ_BUF_SIZE 65535
|
||||
//#define RT_BUF_SIZE 16384
|
||||
//#define MAX_RTSOCK_BUF (2 * 1024 * 1024)
|
||||
|
||||
#define SMALL_READ_BUF_SIZE 1024
|
||||
#define READ_BUF_SIZE 65535
|
||||
#define RT_BUF_SIZE 16384
|
||||
#define MAX_RTSOCK_BUF (2 * 1024 * 1024)
|
||||
//#define SNMP_ENGINEID_OLD 0x00
|
||||
//#define SNMP_ENGINEID_NEW 0x80 /* RFC3411 */
|
||||
|
||||
#define SNMP_ENGINEID_OLD 0x00
|
||||
#define SNMP_ENGINEID_NEW 0x80 /* RFC3411 */
|
||||
//#define SNMP_ENGINEID_FMT_IPv4 1
|
||||
//#define SNMP_ENGINEID_FMT_IPv6 2
|
||||
//#define SNMP_ENGINEID_FMT_MAC 3
|
||||
//#define SNMP_ENGINEID_FMT_TEXT 4
|
||||
//#define SNMP_ENGINEID_FMT_OCT 5
|
||||
//#define SNMP_ENGINEID_FMT_HH 129
|
||||
|
||||
#define SNMP_ENGINEID_FMT_IPv4 1
|
||||
#define SNMP_ENGINEID_FMT_IPv6 2
|
||||
#define SNMP_ENGINEID_FMT_MAC 3
|
||||
#define SNMP_ENGINEID_FMT_TEXT 4
|
||||
#define SNMP_ENGINEID_FMT_OCT 5
|
||||
#define SNMP_ENGINEID_FMT_HH 129
|
||||
//#define PEN_OPENBSD 30155
|
||||
|
||||
#define PEN_OPENBSD 30155
|
||||
|
||||
#if DEBUG
|
||||
#define DPRINTF log_debug
|
||||
#else
|
||||
#define DPRINTF(x...) do {} while(0)
|
||||
#endif
|
||||
//#if DEBUG
|
||||
//#define DPRINTF log_debug
|
||||
//#else
|
||||
//#define DPRINTF(x...) do {} while(0)
|
||||
//#endif
|
||||
|
||||
/*
|
||||
* daemon structures
|
||||
*/
|
||||
|
||||
struct snmpd {
|
||||
int sc_ncpu;
|
||||
int64_t *sc_cpustates;
|
||||
// int sc_ncpu;
|
||||
// int64_t *sc_cpustates;
|
||||
};
|
||||
|
||||
extern struct snmpd *snmpd_env;
|
||||
@ -103,7 +89,7 @@ u_long smi_getticks(void);
|
||||
|
||||
|
||||
/* timer.c */
|
||||
void timer_init(void);
|
||||
//void timer_init(void);
|
||||
|
||||
/* util.c */
|
||||
ssize_t sendtofrom(int, void *, size_t, int, struct sockaddr *,
|
||||
|
Loading…
x
Reference in New Issue
Block a user