SHA256
1
0
forked from pool/ipmitool

Accepting request 452397 from home:fgerling:branches:systemsmanagement

- Update to latest version: 1.8.18
D	0001-Incorporate-upstream-comments-to-289-add-whitespace.patch

OBS-URL: https://build.opensuse.org/request/show/452397
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/ipmitool?expand=0&rev=37
This commit is contained in:
Thomas Renninger 2017-01-25 13:24:35 +00:00 committed by Git OBS Bridge
parent 61368ed885
commit 5f27f49b74
7 changed files with 19 additions and 344 deletions

View File

@ -1,311 +0,0 @@
From f48ce96e7fd0d2fe198845f0e2bd76f95d221fb3 Mon Sep 17 00:00:00 2001
From: Charles Rose <charles_rose@dell.com>
Date: Thu, 12 Dec 2013 16:10:11 -0500
Subject: [PATCH] Incorporate upstream comments to #289, add whitespace, other
cleanup
---
contrib/bmc-snmp-proxy | 130 +++++++++++++++++++++++++++++--------------------
1 file changed, 76 insertions(+), 54 deletions(-)
Index: ipmitool-1.8.17/contrib/bmc-snmp-proxy
===================================================================
--- ipmitool-1.8.17.orig/contrib/bmc-snmp-proxy 2016-05-03 15:12:49.493408552 +0200
+++ ipmitool-1.8.17/contrib/bmc-snmp-proxy 2016-05-03 15:15:11.553530150 +0200
@@ -3,7 +3,7 @@
#
# bmc-snmp-proxy: Set SNMP proxy to BMC (Baseboard Management Controller)
#
-# version: 0.6
+# version: 0.62
#
# Authors: Charles Rose <charles_rose@dell.com>
# Jordan Hargrave <jordan_hargrave@dell.com>
@@ -24,9 +24,9 @@
SYSCONF_DIR="/etc/sysconfig"
CONFIG="${SYSCONF_DIR}/bmc-snmp-proxy"
-SNMPD_LOCAL_CONF_DIR="/etc/snmp/bmc"
-SNMPD_LOCAL_CONF="${SNMPD_LOCAL_CONF_DIR}/snmpd.local.conf"
-TRAPD_LOCAL_CONF="${SNMPD_LOCAL_CONF_DIR}/snmptrapd.local.conf"
+SNMPD_BMC_CONF_DIR="/etc/snmp/bmc"
+SNMPD_BMC_CONF="${SNMPD_BMC_CONF_DIR}/snmpd.local.conf"
+TRAPD_BMC_CONF="${SNMPD_BMC_CONF_DIR}/snmptrapd.local.conf"
TRAPD_CONF="/etc/snmp/snmptrapd.conf"
@@ -66,7 +66,7 @@ bmc_info_exists()
check_snmp()
{
- if [ ! -d /etc/snmp ] && [ ! -x /usr/sbin/snmpd ]; then
+ if [ ! -d /etc/snmp ] || [ ! -x /usr/sbin/snmpd ]; then
RETVAL=12
fi
return $RETVAL
@@ -81,11 +81,12 @@ write_snmp_conf()
printf "###############################################\n"
printf "# Automatically created by %s #\n" "${SCRIPT_NAME}"
printf "###############################################\n"
- printf "view bmcview included %s 80\n" "${BMC_OID}"
- printf "com2sec -Cn bmc_ctx bmc_sec default bmc_cmty\n"
- printf "group bmc_grp v1 bmc_sec\n"
- printf "access bmc_grp bmc_ctx any noauth exact bmcview none none\n"
- printf "proxy -Cn bmc_ctx -v 1 %s\n" "${PROXY_TOKEN}"
+ printf "#view bmcview included %s 80\n" "${BMC_OID}"
+ printf "#com2sec -Cn bmc_ctx bmc_sec default bmc_cmty\n"
+ printf "#group bmc_grp v1 bmc_sec\n"
+ printf "#access bmc_grp bmc_ctx any noauth exact bmcview none none\n"
+ printf "#proxy -Cn bmc_ctx -v 1 %s\n" "${PROXY_TOKEN}"
+ printf "proxy -v 1 %s\n" "${PROXY_TOKEN}"
printf "###############################################\n"
}
@@ -116,27 +117,28 @@ set_snmp_proxy()
if check_vars; then
PROXY_TOKEN="-c ${BMC_COMMUNITY} ${BMC_IPv4} ${BMC_OID}"
- if [ ! -d ${SNMPD_LOCAL_CONF_DIR} ] && \
- mkdir ${SNMPD_LOCAL_CONF_DIR}; then
- write_snmp_conf > ${SNMPD_LOCAL_CONF}
- [ $? -ne 0 ] && RETVAL=4
+ if [ -d ${SNMPD_BMC_CONF_DIR} ]; then
+ write_snmp_conf > ${SNMPD_BMC_CONF} || RETVAL=4
fi
else
RETVAL=3
fi
}
-
set_snmpd_conf_path()
{
- for SYSCONF in ${SYSCONF_DIR}/snmp*d;
+ if [ ! -d ${SNMPD_BMC_CONF_DIR} ]; then
+ mkdir ${SNMPD_BMC_CONF_DIR} || RETVAL=7
+ fi
+
+ # We need SNMPCONFPATH set for both snmpd and snmptrapd
+ for sysconf in ${SYSCONF_DIR}/snmp*d;
do
- if grep -q "${SNMPD_LOCAL_CONF_DIR}" "${SYSCONF}" > \
- /dev/null 2>&1; then
- continue
- else
- printf "SNMPCONFPATH=%s\n" "${SNMPD_LOCAL_CONF_DIR}" \
- >> ${SYSCONF} || RETVAL=7
+ if ! grep -q "^SNMPCONFPATH.*${SNMPD_BMC_CONF_DIR}" \
+ "${sysconf}" > /dev/null 2>&1; then
+ printf "SNMPCONFPATH=/etc/snmp:%s\n" \
+ "${SNMPD_BMC_CONF_DIR}" >> ${sysconf} || \
+ RETVAL=7
fi
done
return $RETVAL
@@ -144,9 +146,8 @@ set_snmpd_conf_path()
disable_snmp_proxy()
{
- if [ -f ${SNMPD_LOCAL_CONF} ]; then
- rm -f ${SNMPD_LOCAL_CONF}
- [ $? -ne 0 ] && RETVAL=5
+ if [ -f ${SNMPD_BMC_CONF} ]; then
+ rm -f ${SNMPD_BMC_CONF} || RETVAL=5
fi
}
#############################################################################
@@ -156,6 +157,7 @@ disable_snmp_proxy()
pick_alert_dest()
{
test_ip="$1"
+ # We have 4 IPv4 and 4 IPv6 alert dest. We will set IPv4 for now.
for ALERT_DEST in `seq 1 4`
do
temp_ip=$(${IPMITOOL} lan alert print ${CHANNEL} ${ALERT_DEST}\
@@ -169,12 +171,12 @@ pick_alert_dest()
set_alert_dest_ip()
{
${IPMITOOL} lan alert set ${CHANNEL} ${ALERT_DEST} ipaddr ${1} \
- retry 4 type pet >/dev/null 2>&1
- [ $? -ne 0 ] && RETVAL=8
+ retry 4 type pet >/dev/null 2>&1 || RETVAL=8
}
-bmc_alert_dest()
+config_bmc_alert_dest()
{
+ # call with enable|disable
# Pick the first active LAN channel
for CHANNEL in `seq 1 14`
do
@@ -184,12 +186,12 @@ bmc_alert_dest()
# If TRAPD_IP is already set as an alert dest,
if pick_alert_dest "${TRAPD_IP}"; then
- # reset: reset it if we are called with reset
- [ "${1}" = "reset" ] && \
+ # disable: reset it if we are called with disable
+ [ "${1}" = "disable" ] && \
set_alert_dest_ip "0.0.0.0"
# else, find the next free alert dest,
elif pick_alert_dest "0.0.0.0"; then
- [ "${1}" = "reset" ] && \
+ [ "${1}" = "disable" ] && \
return $RETVAL
# set: the TRAPD_IP
set_alert_dest_ip "${TRAPD_IP}"
@@ -200,39 +202,50 @@ bmc_alert_dest()
return $RETVAL
}
-set_ipmi_alert()
+set_ipmi_pef()
{
- ${IPMITOOL} lan set ${CHANNEL} alert "${1}" >/dev/null 2>&1
- [ $? -ne 0 ] && RETVAL=10
+ # Needs ipmitool-1.8.13 + patches
+ ${IPMITOOL} pef setpolicy ${ALERT_DEST} "${1}" >/dev/null 2>&1 || \
+ RETVAL=10
}
get_host_ip()
{
- # Get host's IP that the BMC can reach.
+ # Get host's IP that the BMC can reach. This is at best a hack.
IFACE=$(/usr/sbin/ip -o -f inet address |awk '!/: lo/ {print $2}')
+
for dev in ${IFACE}
do
- ping -c 1 -I ${dev} ${BMC_IPv4} > /dev/null 2>&1
+ temp_ping=$(ping -c 1 -I ${dev} ${BMC_IPv4})
+ [ $? -ne 0 ] && continue
+
+ printf -- "%s" "$temp_ping"| awk 'NR==1{print $5}' && break
done
}
config_bmc_alert()
{
+ # Do two things
+ # Set/Reset TRAP IP in BMC
+ # Enable/Disable PEF alerting in BMC for TRAP
+
# Get Host's IP that the BMC can send traps to
TRAPD_IP=$(get_host_ip)
# Set Host's IP as the alert destination in the BMC
- valid_ip ${TRAPD_IP} && bmc_alert_dest "${ACTION}"
+ valid_ip ${TRAPD_IP} && config_bmc_alert_dest "${ACTION}"
+
+ # Enable/Disable alerting on the LAN channel
+ [ $RETVAL -eq 0 ] && set_ipmi_pef "${ACTION}"
- # Enable alerting on the LAN channel
- [ $RETVAL -eq 0 ] && set_ipmi_alert "${ACTION}"
+ return $RETVAL
}
write_trapd_conf()
{
printf "###############################################\n"
printf "# Automatically created by %s #\n" "${SCRIPT_NAME}"
- printf "forward %s %s\n" "${BMC_OID}*" "${FORWARD_HOST}"
+ printf "forward default %s\n" "${FORWARD_HOST}"
printf "###############################################\n"
}
@@ -240,10 +253,9 @@ config_trapd()
{
# Proceed only if snmptrapd is available on the system
if [ -f ${TRAPD_CONF} ]; then
- write_trapd_conf > ${TRAPD_LOCAL_CONF}
- [ $? -ne 0 ] && RETVAL=11
+ write_trapd_conf > ${TRAPD_BMC_CONF} || RETVAL=11
else
- return 1
+ RETVAL=11
fi
}
@@ -253,6 +265,7 @@ trap_sink_exists()
# multiple
FORWARD_HOST=$(awk '/^trap.*sink/{print $2}; /^informsink/{print $2}' \
/etc/snmp/snmpd*conf | head -1)
+
if [ -z "${FORWARD_HOST}" ]; then
# there is no trapsink setup.
return 1
@@ -265,19 +278,20 @@ trap_sink_exists()
trap_forward()
{
NO_TRAP=0
- ACTION=${1} # set or reset
+ ACTION=${1} # enable or disable
- if [ "${ACTION}" = "set" ]; then
+ if [ "${ACTION}" = "enable" ]; then
# Get trapd config,
if trap_sink_exists; then
- config_trapd && config_bmc_alert
+ config_bmc_alert && config_trapd
else
# exit silently if there is no sink
NO_TRAP=1
fi
else
- if [ -f ${TRAPD_LOCAL_CONF} ]; then
- rm -f ${TRAPD_LOCAL_CONF} >/dev/null 2>&1
+ if [ -f ${TRAPD_BMC_CONF} ]; then
+ rm -f ${TRAPD_BMC_CONF} >/dev/null 2>&1
+ config_bmc_alert
else
NO_TRAP=1
fi
@@ -292,7 +306,6 @@ service_reload()
service $1 reload
[ $? -ne 0 ] && RETVAL=6
fi
- return
}
#############################################################################
@@ -304,7 +317,7 @@ start()
[ $RETVAL -eq 0 ] && service_reload snmpd
if [ "${TRAP_FORWARD}" = "yes" ]; then
- trap_forward "set"
+ trap_forward "enable"
[ $RETVAL -eq 0 ] && [ $NO_TRAP -eq 0 ] && \
service_reload snmptrapd
fi
@@ -320,7 +333,7 @@ stop()
[ $RETVAL -eq 0 ] && service_reload snmpd
if [ "${TRAP_FORWARD}" = "yes" ]; then
- trap_forward "reset"
+ trap_forward "disable"
[ $RETVAL -eq 0 ] && [ $NO_TRAP -eq 0 ] && \
service_reload snmptrapd
fi
@@ -333,7 +346,7 @@ status()
{
eval_gettext "${SCRIPT_NAME}: snmp proxy to BMC is "
# Checking for lockfile is better.
- #if grep -q "^proxy" "${SNMPD_LOCAL_CONF}" > /dev/null 2>&1 ; then
+ #if grep -q "^proxy" "${SNMPD_BMC_CONF}" > /dev/null 2>&1 ; then
if [ -f ${LOCKFILE} ]; then
eval_gettext "set"
else
@@ -364,10 +377,10 @@ case "$RETVAL" in
0|1) ;;
2) eval_gettext "${SCRIPT_NAME}: failed to read ${BMC_INFO} " 1>&2 ;;
3) eval_gettext "${SCRIPT_NAME}: failed to get proxy config." 1>&2 ;;
- 4) eval_gettext "${SCRIPT_NAME}: failed to set ${SNMPD_LOCAL_CONF}." 1>&2 ;;
+ 4) eval_gettext "${SCRIPT_NAME}: failed to set ${SNMPD_BMC_CONF}." 1>&2 ;;
5) eval_gettext "${SCRIPT_NAME}: failed to disable snmp proxy." 1>&2 ;;
6) eval_gettext "${SCRIPT_NAME}: failed to reload snmpd." 1>&2 ;;
- 7) eval_gettext "${SCRIPT_NAME}: failed to update ${SYSCONF}." 1>&2 ;;
+ 7) eval_gettext "${SCRIPT_NAME}: failed to set snmpd config." 1>&2 ;;
8) eval_gettext "${SCRIPT_NAME}: failed to set IPMI alert dest." 1>&2 ;;
9) eval_gettext "${SCRIPT_NAME}: no free IPMI alert dest." 1>&2 ;;
10) eval_gettext "${SCRIPT_NAME}: failed to set IPMI PEF." 1>&2 ;;

View File

@ -1,8 +1,8 @@
Index: ipmitool-1.8.17/lib/helper.c
Index: ipmitool-1.8.18/lib/helper.c
===================================================================
--- ipmitool-1.8.17.orig/lib/helper.c 2016-05-01 10:03:39.000000000 +0200
+++ ipmitool-1.8.17/lib/helper.c 2016-05-03 14:09:39.830095667 +0200
@@ -664,7 +664,6 @@ ipmi_start_daemon(struct ipmi_intf *intf
--- ipmitool-1.8.18.orig/lib/helper.c
+++ ipmitool-1.8.18/lib/helper.c
@@ -829,7 +829,6 @@ ipmi_start_daemon(struct ipmi_intf *intf
#endif
chdir("/");
@ -10,11 +10,11 @@ Index: ipmitool-1.8.17/lib/helper.c
for (fd=0; fd<64; fd++) {
if (fd != intf->fd)
Index: ipmitool-1.8.17/src/ipmievd.c
Index: ipmitool-1.8.18/src/ipmievd.c
===================================================================
--- ipmitool-1.8.17.orig/src/ipmievd.c 2016-05-01 10:03:39.000000000 +0200
+++ ipmitool-1.8.17/src/ipmievd.c 2016-05-03 14:09:39.838096118 +0200
@@ -702,6 +702,7 @@ ipmievd_main(struct ipmi_event_intf * ei
--- ipmitool-1.8.18.orig/src/ipmievd.c
+++ ipmitool-1.8.18/src/ipmievd.c
@@ -701,6 +701,7 @@ ipmievd_main(struct ipmi_event_intf * ei
int i, rc;
int daemon = 1;
struct sigaction act;
@ -22,7 +22,7 @@ Index: ipmitool-1.8.17/src/ipmievd.c
memset(pidfile, 0, 64);
sprintf(pidfile, "%s%d", DEFAULT_PIDFILE, eintf->intf->devnum);
@@ -764,8 +765,9 @@ ipmievd_main(struct ipmi_event_intf * ei
@@ -763,8 +764,9 @@ ipmievd_main(struct ipmi_event_intf * ei
ipmi_start_daemon(eintf->intf);

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3541244fe81298dbd611795a60f969f41c6073f05a23487999707b5be79792d0
size 474729

3
ipmitool-1.8.18.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0c1ba3b1555edefb7c32ae8cd6a3e04322056bc087918f07189eeedfc8b81e01
size 795278

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jan 25 12:23:27 UTC 2017 - felix.gerling@suse.com
- Update to latest version: 1.8.18
D 0001-Incorporate-upstream-comments-to-289-add-whitespace.patch
-------------------------------------------------------------------
Tue May 3 13:08:43 UTC 2016 - trenn@suse.de

View File

@ -27,7 +27,7 @@ Url: http://ipmitool.sourceforge.net/
Summary: Utility for IPMI Control
License: BSD-3-Clause
Group: System/Management
Version: 1.8.17
Version: 1.8.18
Release: 0
Source: http://heanet.dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.bz2
Source1: ipmievd.service
@ -36,7 +36,6 @@ Patch3: fwum_enhance_output.patch
Patch6: fix_file_permissions.patch
Patch8: several_more_compile_fixes.patch
Patch9: ipmitool_adjust_suse.paths
Patch10: 0001-Incorporate-upstream-comments-to-289-add-whitespace.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# bmc-snmp-proxy needs /usr/sbin/snmpd
@ -68,7 +67,6 @@ and setting LAN configuration, and chassis power control.
%patch6 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
touch INSTALL NEWS

View File

@ -8,24 +8,6 @@ Index: ipmitool-1.8.17/lib/ipmi_ekanalyzer.c
===================================================================
--- ipmitool-1.8.17.orig/lib/ipmi_ekanalyzer.c 2016-05-01 10:03:39.000000000 +0200
+++ ipmitool-1.8.17/lib/ipmi_ekanalyzer.c 2016-05-03 14:09:46.242458958 +0200
@@ -3363,7 +3363,7 @@ ipmi_ek_display_board_p2p_record(struct
printf("\n");
offset += sizeof(struct fru_picmgext_guid);
}
- for (offset;
+ for (;
offset < record->header.len;
offset += sizeof(struct fru_picmgext_link_desc)) {
/* to solve little endian/big endian problem */
@@ -3522,7 +3522,7 @@ ipmi_ek_display_radial_ipmb0_record(stru
if (record->data[offset] < 1) {
return;
}
- for (offset; offset < record->header.len;) {
+ for (; offset < record->header.len;) {
unsigned char entry_count = 0;
printf(" IPMB-0 Hub Descriptor\n");
printf("\tHardware Address: 0x%02x\n",
@@ -3980,7 +3980,7 @@ ipmi_ek_display_clock_config_record(stru
(feature & 1) ? "Source" : "Receiver");
printf("\tFamily: 0x%02x - AccLVL: 0x%02x\n",