Imported Upstream version 2.6.5
This commit is contained in:
parent
fefe62b2bd
commit
a1fa151fc7
201 changed files with 7974 additions and 709 deletions
|
@ -164,6 +164,12 @@ CFLAGS = @CFLAGS@
|
|||
CONFPATH = @CONFPATH@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
|
||||
CPPUNIT_LIBS = @CPPUNIT_LIBS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DBLATEX = @DBLATEX@
|
||||
DEFS = @DEFS@
|
||||
|
@ -267,6 +273,7 @@ abs_top_builddir = @abs_top_builddir@
|
|||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* nut-scanner.c: a tool to detect NUT supported devices
|
||||
*
|
||||
* Copyright (C) 2011 - Arnaud Quette <arnaud.quette@free.fr>
|
||||
* Copyright (C)
|
||||
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -122,16 +123,16 @@ static int printq(int quiet,const char *fmt, ...)
|
|||
return 0;
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
ret = vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
va_start(ap, fmt);
|
||||
ret = vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
nutscan_snmp_t sec;
|
||||
nutscan_snmp_t snmp_sec;
|
||||
int opt_ret;
|
||||
char * cidr = NULL;
|
||||
int allow_all = 0;
|
||||
|
@ -145,7 +146,7 @@ int main(int argc, char *argv[])
|
|||
void (*display_func)(nutscan_device_t * device);
|
||||
int ret_code = EXIT_SUCCESS;
|
||||
|
||||
memset(&sec,0,sizeof(sec));
|
||||
memset(&snmp_sec, 0, sizeof(snmp_sec));
|
||||
|
||||
nutscan_init();
|
||||
|
||||
|
@ -175,43 +176,43 @@ int main(int argc, char *argv[])
|
|||
if(!nutscan_avail_snmp) {
|
||||
goto display_help;
|
||||
}
|
||||
sec.community = strdup(optarg);
|
||||
snmp_sec.community = strdup(optarg);
|
||||
break;
|
||||
case 'l':
|
||||
if(!nutscan_avail_snmp) {
|
||||
goto display_help;
|
||||
}
|
||||
sec.secLevel = strdup(optarg);
|
||||
snmp_sec.secLevel = strdup(optarg);
|
||||
break;
|
||||
case 'u':
|
||||
if(!nutscan_avail_snmp) {
|
||||
goto display_help;
|
||||
}
|
||||
sec.secName = strdup(optarg);
|
||||
snmp_sec.secName = strdup(optarg);
|
||||
break;
|
||||
case 'W':
|
||||
if(!nutscan_avail_snmp) {
|
||||
goto display_help;
|
||||
}
|
||||
sec.authPassword = strdup(optarg);
|
||||
snmp_sec.authPassword = strdup(optarg);
|
||||
break;
|
||||
case 'X':
|
||||
if(!nutscan_avail_snmp) {
|
||||
goto display_help;
|
||||
}
|
||||
sec.privPassword = strdup(optarg);
|
||||
snmp_sec.privPassword = strdup(optarg);
|
||||
break;
|
||||
case 'w':
|
||||
if(!nutscan_avail_snmp) {
|
||||
goto display_help;
|
||||
}
|
||||
sec.authProtocol = strdup(optarg);
|
||||
snmp_sec.authProtocol = strdup(optarg);
|
||||
break;
|
||||
case 'x':
|
||||
if(!nutscan_avail_snmp) {
|
||||
goto display_help;
|
||||
}
|
||||
sec.privProtocol = strdup(optarg);
|
||||
snmp_sec.privProtocol = strdup(optarg);
|
||||
break;
|
||||
case 'S':
|
||||
if(!nutscan_avail_snmp) {
|
||||
|
@ -374,11 +375,11 @@ display_help:
|
|||
else {
|
||||
printq(quiet,"Scanning SNMP bus.\n");
|
||||
#ifdef HAVE_PTHREAD
|
||||
if( pthread_create(&thread[TYPE_SNMP],NULL,run_snmp,&sec)) {
|
||||
if( pthread_create(&thread[TYPE_SNMP],NULL,run_snmp,&snmp_sec)) {
|
||||
nutscan_avail_snmp = 0;
|
||||
}
|
||||
#else
|
||||
dev[TYPE_SNMP] = nutscan_scan_snmp(start_ip,end_ip,timeout,&sec);
|
||||
dev[TYPE_SNMP] = nutscan_scan_snmp(start_ip,end_ip,timeout,&snmp_sec);
|
||||
#endif /* HAVE_PTHREAD */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ static snmp_device_id_t snmp_device_table[] = {
|
|||
{ ".1.3.6.1.4.1.17373.3.1.1.0" , "aphel_genesisII", ".1.3.6.1.4.1.17373"},
|
||||
{ ".1.3.6.1.4.1.534.6.6.6.1.1.12.0" , "aphel_revelation", ".1.3.6.1.4.1.534.6.6.6"},
|
||||
{ ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0" , "eaton_epdu", ".1.3.6.1.4.1.534.6.6.7"},
|
||||
{ "" , "pulizzi_monitored", NULL},
|
||||
{ ".1.3.6.1.4.1.20677.1" , "pulizzi_switched1", ".1.3.6.1.4.1.20677.1"},
|
||||
{ ".1.3.6.1.4.1.20677.1" , "pulizzi_switched2", ".1.3.6.1.4.1.20677.2"},
|
||||
{ "1.3.6.1.4.1.534.1.1.2.0" , "pw", ".1.3.6.1.4.1.534.1"},
|
||||
{ ".1.3.6.1.4.1.705.1.1.1.0" , "mge", ".1.3.6.1.4.1.705.1"},
|
||||
{ ".1.3.6.1.4.1.318.1.1.1.1.1.1.0" , "apcc", NULL},
|
||||
|
|
|
@ -70,6 +70,7 @@ static usb_device_id_t usb_device_table[] = {
|
|||
{ 0x06da, 0x0004, "blazer_usb" },
|
||||
{ 0x06da, 0x0005, "blazer_usb" },
|
||||
{ 0x06da, 0x0201, "blazer_usb" },
|
||||
{ 0x06da, 0x0601, "blazer_usb" },
|
||||
{ 0x06da, 0xffff, "usbhid-ups" },
|
||||
{ 0x075d, 0x0300, "usbhid-ups" },
|
||||
{ 0x0764, 0x0005, "usbhid-ups" },
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* scan_ipmi.c: detect NUT supported Power Supply Units
|
||||
*
|
||||
* Copyright (C) 2011 - Arnaud Quette <arnaud.quette@free.fr>
|
||||
* Copyright (C)
|
||||
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -35,8 +36,12 @@ static const char *dl_error = NULL;
|
|||
|
||||
static int (*nut_ipmi_fru_parse_close_device_id) (ipmi_fru_parse_ctx_t ctx);
|
||||
static void (*nut_ipmi_fru_parse_ctx_destroy) (ipmi_fru_parse_ctx_t ctx);
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
static void (*nut_ipmi_sdr_ctx_destroy) (ipmi_sdr_ctx_t ctx);
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
static void (*nut_ipmi_sdr_cache_ctx_destroy) (ipmi_sdr_cache_ctx_t ctx);
|
||||
static void (*nut_ipmi_sdr_parse_ctx_destroy) (ipmi_sdr_parse_ctx_t ctx);
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
static ipmi_fru_parse_ctx_t (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx_t ipmi_ctx);
|
||||
static int (*nut_ipmi_fru_parse_ctx_set_flags) (ipmi_fru_parse_ctx_t ctx, unsigned int flags);
|
||||
static int (*nut_ipmi_fru_parse_open_device_id) (ipmi_fru_parse_ctx_t ctx, uint8_t fru_device_id);
|
||||
|
@ -97,6 +102,15 @@ int nutscan_load_ipmi_library()
|
|||
goto err;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
|
||||
*(void **) (&nut_ipmi_sdr_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_sdr_ctx_destroy");
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
*(void **) (&nut_ipmi_sdr_cache_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_sdr_cache_ctx_destroy");
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
|
@ -106,6 +120,7 @@ int nutscan_load_ipmi_library()
|
|||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
*(void **) (&nut_ipmi_fru_parse_ctx_create) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_create");
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
|
@ -172,15 +187,28 @@ err:
|
|||
/* end of dynamic link library stuff */
|
||||
|
||||
/* Cleanup IPMI contexts */
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
|
||||
ipmi_sdr_ctx_t sdr_ctx)
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
|
||||
ipmi_sdr_cache_ctx_t sdr_cache_ctx,
|
||||
ipmi_sdr_parse_ctx_t sdr_parse_ctx)
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
{
|
||||
if (fru_parse_ctx) {
|
||||
(*nut_ipmi_fru_parse_close_device_id) (fru_parse_ctx);
|
||||
(*nut_ipmi_fru_parse_ctx_destroy) (fru_parse_ctx);
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
|
||||
if (sdr_ctx) {
|
||||
(*nut_ipmi_sdr_ctx_destroy) (sdr_ctx);
|
||||
}
|
||||
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
if (sdr_cache_ctx) {
|
||||
(*nut_ipmi_sdr_cache_ctx_destroy) (sdr_cache_ctx);
|
||||
}
|
||||
|
@ -188,6 +216,8 @@ static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
|
|||
if (sdr_parse_ctx) {
|
||||
(*nut_ipmi_sdr_parse_ctx_destroy) (sdr_parse_ctx);
|
||||
}
|
||||
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
}
|
||||
|
||||
/* Return 1 if supported, 0 otherwise */
|
||||
|
@ -198,8 +228,12 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
unsigned int area_length = 0;
|
||||
uint8_t areabuf[IPMI_FRU_PARSE_AREA_SIZE_MAX+1];
|
||||
ipmi_fru_parse_ctx_t fru_parse_ctx = NULL;
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
ipmi_sdr_ctx_t sdr_ctx = NULL;
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
ipmi_sdr_cache_ctx_t sdr_cache_ctx = NULL;
|
||||
ipmi_sdr_parse_ctx_t sdr_parse_ctx = NULL;
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
/* Parse FRU information */
|
||||
if (!(fru_parse_ctx = (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx)))
|
||||
|
@ -211,13 +245,21 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
/* lots of motherboards calculate checksums incorrectly */
|
||||
if ((*nut_ipmi_fru_parse_ctx_set_flags) (fru_parse_ctx, IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
|
||||
{
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
|
||||
#else
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_cache_ctx, sdr_parse_ctx);
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((*nut_ipmi_fru_parse_open_device_id) (fru_parse_ctx, ipmi_id) < 0)
|
||||
{
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
|
||||
#else
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_cache_ctx, sdr_parse_ctx);
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -235,7 +277,11 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
areabuf,
|
||||
IPMI_FRU_PARSE_AREA_SIZE_MAX) < 0)
|
||||
{
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
|
||||
#else
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_cache_ctx, sdr_parse_ctx);
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -244,14 +290,22 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
if (area_type == IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION)
|
||||
{
|
||||
/* Found a POWER_SUPPLY record */
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
|
||||
#else
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_cache_ctx, sdr_parse_ctx);
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} while ((ret = (*nut_ipmi_fru_parse_next) (fru_parse_ctx)) == 1);
|
||||
|
||||
/* No need for further errors checking */
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
|
||||
#else
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_cache_ctx, sdr_parse_ctx);
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -297,7 +351,7 @@ nutscan_device_t * nutscan_scan_ipmi()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* Loop through all possible devices */
|
||||
/* Loop through all possible components */
|
||||
for (ipmi_id = 0 ; ipmi_id <= IPMI_FRU_DEVICE_ID_MAX ; ipmi_id++) {
|
||||
|
||||
if (is_ipmi_device_supported(ipmi_ctx, ipmi_id)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue