diff --git a/ipmitool/bldipmi.pl b/ipmitool/bldipmi.pl index bfe63be..c542c4b 100755 --- a/ipmitool/bldipmi.pl +++ b/ipmitool/bldipmi.pl @@ -94,7 +94,7 @@ if (! grep /libcrypto.so/, @output) { exit 1; } -my $objrpm = "$blddir/RPMS/$arch/ipmitool-xcat-$version-0.$arch.rpm"; +my $objrpm = "$blddir/RPMS/$arch/ipmitool-xcat-$version-1.$arch.rpm"; my $dstdir = "/tmp/build/$os/$arch"; # check the build result diff --git a/ipmitool/debian/changelog b/ipmitool/debian/changelog index 95029f5..880d0a8 100644 --- a/ipmitool/debian/changelog +++ b/ipmitool/debian/changelog @@ -1,3 +1,9 @@ +ipmitool-xcat (1.8.17-1) unstable; urgency=low + * Make ipmitool exit gracefully when receiving `INT`, `TERM` or `HUP` signal. + * Close the intf(lanplus) session when the sol session at BMC side is closed. + + -- chenglch Mon, 31 Oct 2016 13:24:00 +0100 + ipmitool-xcat (1.8.17-0) unstable; urgency=low * Upgrade to 1.8.17 version diff --git a/ipmitool/debian/patches/ipmitool-1.8.17-solactivate.patch b/ipmitool/debian/patches/ipmitool-1.8.17-solactivate.patch deleted file mode 120000 index 549515d..0000000 --- a/ipmitool/debian/patches/ipmitool-1.8.17-solactivate.patch +++ /dev/null @@ -1 +0,0 @@ -../../ipmitool-1.8.17-solactivate.patch \ No newline at end of file diff --git a/ipmitool/debian/patches/series b/ipmitool/debian/patches/series index 77360ca..c4b5f52 100644 --- a/ipmitool/debian/patches/series +++ b/ipmitool/debian/patches/series @@ -1,4 +1,3 @@ ipmitool-1.8.17-saneretry.patch ipmitool-1.8.17-rflash.patch -ipmitool-1.8.17-solactivate.patch ipmitool-1.8.17-signal.patch diff --git a/ipmitool/ipmitool-1.8.17-signal.patch b/ipmitool/ipmitool-1.8.17-signal.patch index b5ff435..92788ff 100644 --- a/ipmitool/ipmitool-1.8.17-signal.patch +++ b/ipmitool/ipmitool-1.8.17-signal.patch @@ -1,21 +1,21 @@ ---- ipmitool-1.8.17/include/ipmitool/ipmi_sol.h 2016-05-06 10:48:54.000000000 -0400 -+++ ipmitool-1.8.17-signal/include/ipmitool/ipmi_sol.h 2016-09-08 14:28:20.051574790 -0400 -@@ -104,5 +104,6 @@ - uint8_t channel, - struct sol_config_parameters * params); - -+void leave_raw_mode(void); - - #endif /* IPMI_SOL_H */ +diff -uNr ipmitool-1.8.17/lib/ipmi_main.c ipmitool-1.8.17-signal/lib/ipmi_main.c --- ipmitool-1.8.17/lib/ipmi_main.c 2016-05-06 10:48:54.000000000 -0400 -+++ ipmitool-1.8.17-signal/lib/ipmi_main.c 2016-09-08 14:32:32.011584407 -0400 -@@ -271,23 +271,25 @@ ++++ ipmitool-1.8.17-signal/lib/ipmi_main.c 2016-11-03 22:38:41.868914065 -0400 +@@ -92,6 +92,7 @@ + + extern int verbose; + extern int csv_output; ++extern int sol_activated; + extern const struct valstr ipmi_privlvl_vals[]; + extern const struct valstr ipmi_authtype_session_vals[]; + +@@ -271,24 +272,30 @@ if (cmdlist != NULL) ipmi_cmd_print(cmdlist); } -/* ipmi_catch_sigint - Handle the interrupt signal (Ctrl-C), close the - * interface, and exit ipmitool with error (-1) -+ /* ipmi_catch_sig - Handle the interrupt signal (Ctrl-C),TERM signal, ++ /* ipmi_catch_sig - Handle the interrupt signal (Ctrl-C),TERM signal, + * and HUP signal. Close the interface, and exit + * ipmitool with error (-1) * @@ -29,19 +29,31 @@ -void ipmi_catch_sigint() +void ipmi_catch_sig(const int sig) { - if (ipmi_main_intf != NULL) { +- if (ipmi_main_intf != NULL) { - printf("\nSIGN INT: Close Interface %s\n",ipmi_main_intf->desc); -+ printf("\nSIGN %s: Close Interface %s\n",strsignal(sig), ipmi_main_intf->desc); - /* reduce retry count to a single retry */ - ipmi_main_intf->ssn_params.retry = 1; - /* close interface */ - ipmi_main_intf->close(ipmi_main_intf); - } -+ leave_raw_mode(); - exit(-1); +- /* reduce retry count to a single retry */ +- ipmi_main_intf->ssn_params.retry = 1; +- /* close interface */ +- ipmi_main_intf->close(ipmi_main_intf); +- } +- exit(-1); ++ if (sol_activated == 1) { ++ printf("\nSIGN %s: Deactivate sol session\r\n",strsignal(sig)); ++ sol_activated = 0; ++ } else { ++ if (ipmi_main_intf != NULL) { ++ printf("\nSIGN %s: Close Interface %s\n",strsignal(sig), ipmi_main_intf->desc); ++ /* reduce retry count to a single retry */ ++ ipmi_main_intf->ssn_params.retry = 1; ++ /* close interface */ ++ ipmi_main_intf->close(ipmi_main_intf); ++ } ++ exit(-1); ++ } } -@@ -420,7 +422,9 @@ + /* ipmi_parse_hex - convert hexadecimal numbers to ascii string +@@ -420,7 +427,9 @@ /* save program name */ progname = strrchr(argv[0], '/'); progname = ((progname == NULL) ? argv[0] : progname+1); @@ -52,3 +64,110 @@ while ((argflag = getopt(argc, (char **)argv, OPTION_STRING)) != -1) { +diff -uNr ipmitool-1.8.17/lib/ipmi_sol.c ipmitool-1.8.17-signal/lib/ipmi_sol.c +--- ipmitool-1.8.17/lib/ipmi_sol.c 2016-11-03 22:31:55.998893852 -0400 ++++ ipmitool-1.8.17-signal/lib/ipmi_sol.c 2016-11-04 01:18:45.669370142 -0400 +@@ -46,6 +46,7 @@ + #include + #include + #include ++#include + + #if defined(HAVE_CONFIG_H) + # include +@@ -98,7 +99,7 @@ + static int _use_sol_for_keepalive = 0; + + extern int verbose; +- ++int sol_activated = 0; + /* + * ipmi_sol_payload_access + */ +@@ -1556,6 +1557,11 @@ + FD_SET(0, &read_fds); + FD_SET(intf->fd, &read_fds); + ++ if (sol_activated == 0) { ++ bBmcClosedSession = 0; ++ keepAliveRet = 0; ++ break; ++ } + if (!ipmi_oem_active(intf,"i82571spt")) + { + /* Send periodic keepalive packet */ +@@ -1584,6 +1590,11 @@ + { + if (retval == -1) + { ++ if (errno == EINTR) { ++ bBmcClosedSession = 0; ++ keepAliveRet = 0; ++ break; ++ } + /* ERROR */ + perror("select"); + return -1; +@@ -1629,6 +1640,10 @@ + { + output(rs); + } ++ else ++ { ++ bShouldExit = bBmcClosedSession = 1; ++ } + /* + * Should recv_sol come back null, the incoming packet was not ours. + * Just fall through, the keepalive logic will determine if +@@ -1647,24 +1662,23 @@ + } + } + } +- +- leave_raw_mode(); +- +- if (keepAliveRet != 0) +- { +- lprintf(LOG_ERR, "Error: No response to keepalive - Terminating session"); +- /* attempt to clean up anyway */ +- ipmi_sol_deactivate(intf, instance); +- exit(1); +- } +- +- if (bBmcClosedSession) +- { +- lprintf(LOG_ERR, "SOL session closed by BMC"); +- exit(1); +- } +- else +- ipmi_sol_deactivate(intf, instance); ++ ++ leave_raw_mode(); ++ ipmi_sol_deactivate(intf, instance); ++ if (keepAliveRet != 0) ++ { ++ lprintf(LOG_ERR, "Error: No response to keepalive - Terminating session"); ++ return -1; ++ } ++ if (bBmcClosedSession) ++ { ++ lprintf(LOG_ERR, "SOL session closed by BMC"); ++ return -1; ++ } else if (sol_activated == 0) ++ { ++ lprintf(LOG_ERR, "SOL session closed by signal"); ++ return -1; ++ } + + return 0; + } +@@ -1748,7 +1762,8 @@ + data[3] = 0x00; /* reserved */ + data[4] = 0x00; /* reserved */ + data[5] = 0x00; /* reserved */ +- ++ /* Make sure deactivate code sent to BMC no matter what the status is */ ++ sol_activated = 1; + rsp = intf->sendrecv(intf, &req); + + if (NULL != rsp) { diff --git a/ipmitool/ipmitool-1.8.17-solactivate.patch b/ipmitool/ipmitool-1.8.17-solactivate.patch deleted file mode 100644 index 1aee0e4..0000000 --- a/ipmitool/ipmitool-1.8.17-solactivate.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -uNr ipmitool-1.8.17/lib/ipmi_sol.c ipmitool-1.8.17-solactivate/lib/ipmi_sol.c ---- ipmitool-1.8.17/lib/ipmi_sol.c 2016-05-06 10:48:54.000000000 -0400 -+++ ipmitool-1.8.17-solactivate/lib/ipmi_sol.c 2016-09-27 13:55:08.091124971 -0400 -@@ -1652,6 +1652,9 @@ - { - output(rs); - } -+ else { -+ bShouldExit = bBmcClosedSession = 1; -+ } - /* - * Should recv_sol come back null, the incoming packet was not ours. - * Just fall through, the keepalive logic will determine if diff --git a/ipmitool/ipmitool.spec b/ipmitool/ipmitool.spec index 3ba13df..78cd6ff 100644 --- a/ipmitool/ipmitool.spec +++ b/ipmitool/ipmitool.spec @@ -1,15 +1,14 @@ Name: ipmitool-xcat Summary: ipmitool - Utility for IPMI control Version: 1.8.17 -Release: 0 +Release: 1 License: BSD Group: Utilities Packager: IBM Corp. Source: ipmitool-%{version}.tar.gz Patch: ipmitool-%{version}-saneretry.patch Patch2: ipmitool-%{version}-rflash.patch -Patch3: ipmitool-%{version}-solactivate.patch -Patch4: ipmitool-%{version}-signal.patch +Patch3: ipmitool-%{version}-signal.patch Buildroot: /var/tmp/ipmitool-root %description @@ -36,7 +35,6 @@ fi %patch -p1 %patch2 -p1 %patch3 -p1 -%patch4 -p1 %build ./configure --with-kerneldir \ @@ -66,6 +64,9 @@ fi %changelog +* Wed Nov 04 2016 1.8.17-1 + Make ipmitool exit gracefully when receiving `INT`, `TERM` or `HUP` signal. + Close the intf(lanplus) session when the sol session at BMC side is closed. * Wed Nov 04 2015 1.8.15 Delete user prompt to upgrade firmware * Wed Apr 27 2011 1.8.11-3