fix SOLv2 NACK and retry handling for Intel ESB2 BMC

This commit is contained in:
Duncan Laurie 2006-07-28 20:17:25 +00:00
parent fa21266ec2
commit d572add750
8 changed files with 348 additions and 301 deletions

View File

@ -530,6 +530,7 @@ typedef enum IPMI_OEM {
IPMI_OEM_TYAN = 6653, IPMI_OEM_TYAN = 6653,
IPMI_OEM_NEWISYS = 9237, IPMI_OEM_NEWISYS = 9237,
IPMI_OEM_SUPERMICRO = 10876, IPMI_OEM_SUPERMICRO = 10876,
IPMI_OEM_GOOGLE = 11129,
IPMI_OEM_KONTRON = 15000, IPMI_OEM_KONTRON = 15000,
} IPMI_OEM; } IPMI_OEM;

View File

@ -97,13 +97,13 @@ void printbuf(const uint8_t * buf, int len, const char * desc)
if (verbose < 1) if (verbose < 1)
return; return;
fprintf(stderr, "%s (%d bytes)\n", desc, len); fprintf(stderr, "%s (%d bytes)\r\n", desc, len);
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
if (((i%16) == 0) && (i != 0)) if (((i%16) == 0) && (i != 0))
fprintf(stderr, "\n"); fprintf(stderr, "\r\n");
fprintf(stderr, " %2.2x", buf[i]); fprintf(stderr, " %2.2x", buf[i]);
} }
fprintf(stderr, "\n"); fprintf(stderr, "\r\n");
} }
const char * val2str(uint16_t val, const struct valstr *vs) const char * val2str(uint16_t val, const struct valstr *vs)

View File

@ -559,7 +559,6 @@ ipmi_sol_set_param(struct ipmi_intf * intf,
data[0] = channel; data[0] = channel;
/* /*
* set-in-progress * set-in-progress
*/ */
@ -896,7 +895,6 @@ ipmi_sol_set_param(struct ipmi_intf * intf,
return -1; return -1;
} }
} }
else else
{ {
lprintf(LOG_ERR, "Error: invalid SOL parameter %s", param); lprintf(LOG_ERR, "Error: invalid SOL parameter %s", param);
@ -938,7 +936,6 @@ ipmi_sol_set_param(struct ipmi_intf * intf,
{ {
lprintf(LOG_ERR, "Error could not set \"set-in-progress\" " lprintf(LOG_ERR, "Error could not set \"set-in-progress\" "
"to \"set-complete\""); "to \"set-complete\"");
return -1;
} }
return -1; return -1;
@ -1084,9 +1081,21 @@ printSolEscapeSequences(struct ipmi_intf * intf)
static void static void
output(struct ipmi_rs * rsp) output(struct ipmi_rs * rsp)
{ {
if (rsp) /* Add checks to make sure it is actually SOL data, in general I see
* outside code mostly trying to guard against this happening, but
* some places fail to do so, so I do so here to make sure nothing gets
* through. If non-sol data comes through here, there is probably
* a packet that won't get processed somewhere else, but the alternative
* of outputting corrupt data is worse. Generally I see the get device
* id response make it here somehow. I assume it is a heartbeat and the
* other code will retry if it cares about the response and misses it.
*/
if (rsp &&
(rsp->session.authtype == IPMI_SESSION_AUTHTYPE_RMCP_PLUS) &&
(rsp->session.payloadtype == IPMI_PAYLOAD_TYPE_SOL))
{ {
int i; int i;
for (i = 0; i < rsp->data_len; ++i) for (i = 0; i < rsp->data_len; ++i)
putc(rsp->data[i], stdout); putc(rsp->data[i], stdout);
@ -1256,6 +1265,7 @@ processSolUserInput(
while (try < intf->session->retry) { while (try < intf->session->retry) {
v2_payload.payload.sol_packet.character_count = length; v2_payload.payload.sol_packet.character_count = length;
rsp = intf->send_sol(intf, &v2_payload); rsp = intf->send_sol(intf, &v2_payload);
if (rsp) if (rsp)
@ -1308,7 +1318,6 @@ ipmi_sol_keepalive(struct ipmi_intf * intf)
static int static int
ipmi_sol_red_pill(struct ipmi_intf * intf) ipmi_sol_red_pill(struct ipmi_intf * intf)
{ {
char * buffer; char * buffer;
int numRead; int numRead;
int bShouldExit = 0; int bShouldExit = 0;
@ -1401,8 +1410,10 @@ ipmi_sol_red_pill(struct ipmi_intf * intf)
bShouldExit = bBmcClosedSession = 1; bShouldExit = bBmcClosedSession = 1;
} }
else else
{
output(rs); output(rs);
} }
}
/* /*
@ -1553,7 +1564,6 @@ ipmi_sol_activate(struct ipmi_intf * intf, int looptest, int interval)
ap_rsp.payload_udp_port[0]; ap_rsp.payload_udp_port[0];
#if WORDS_BIGENDIAN #if WORDS_BIGENDIAN
intf->session->sol_data.max_inbound_payload_size = intf->session->sol_data.max_inbound_payload_size =
BSWAP_16(intf->session->sol_data.max_inbound_payload_size); BSWAP_16(intf->session->sol_data.max_inbound_payload_size);
@ -1564,7 +1574,7 @@ ipmi_sol_activate(struct ipmi_intf * intf, int looptest, int interval)
#endif #endif
intf->session->timeout = 3; intf->session->timeout = 1;
/* NOTE: the spec does allow for SOL traffic to be sent on /* NOTE: the spec does allow for SOL traffic to be sent on
@ -1583,7 +1593,6 @@ ipmi_sol_activate(struct ipmi_intf * intf, int looptest, int interval)
} }
} }
printf("[SOL Session operational. Use %c? for help]\r\n", printf("[SOL Session operational. Use %c? for help]\r\n",
intf->session->sol_escape_char); intf->session->sol_escape_char);
@ -1715,6 +1724,7 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
else if (!strncmp(argv[0], "activate", 8)) else if (!strncmp(argv[0], "activate", 8))
retval = ipmi_sol_activate(intf, 0, 0); retval = ipmi_sol_activate(intf, 0, 0);
/* /*
* Dectivate * Dectivate
*/ */
@ -1730,7 +1740,7 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
int cnt = 200; int cnt = 200;
int interval = 100; /* Unit is: ms */ int interval = 100; /* Unit is: ms */
if(argc > 3) if (argc > 3)
{ {
print_sol_usage(); print_sol_usage();
return -1; return -1;
@ -1746,11 +1756,11 @@ ipmi_sol_main(struct ipmi_intf * intf, int argc, char ** argv)
if(interval < 0) interval = 0; if(interval < 0) interval = 0;
} }
while(cnt > 0) while (cnt > 0)
{ {
printf("remain loop test counter: %d\n", cnt); printf("remain loop test counter: %d\n", cnt);
retval = ipmi_sol_activate(intf, 1, interval); retval = ipmi_sol_activate(intf, 1, interval);
if(retval) if (retval)
{ {
printf("SOL looptest failed: %d\n", retval); printf("SOL looptest failed: %d\n", retval);
break; break;

View File

@ -44,6 +44,7 @@ const struct valstr ipmi_oem_info[] = {
{ IPMI_OEM_TYAN, "Tyan Computer Corporation" }, { IPMI_OEM_TYAN, "Tyan Computer Corporation" },
{ IPMI_OEM_NEWISYS, "Newisys" }, { IPMI_OEM_NEWISYS, "Newisys" },
{ IPMI_OEM_SUPERMICRO, "Supermicro" }, { IPMI_OEM_SUPERMICRO, "Supermicro" },
{ IPMI_OEM_GOOGLE, "Google" },
{ IPMI_OEM_KONTRON, "Kontron" }, { IPMI_OEM_KONTRON, "Kontron" },
{ 0xffff , NULL }, { 0xffff , NULL },
}; };

View File

@ -40,7 +40,6 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#include <netdb.h> #include <netdb.h>
#include <fcntl.h> #include <fcntl.h>

View File

@ -40,9 +40,8 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#include <setjmp.h>
#include <netdb.h> #include <netdb.h>
#include <time.h>
#include <fcntl.h> #include <fcntl.h>
#include <assert.h> #include <assert.h>
@ -76,9 +75,6 @@ static struct ipmi_rq_entry * ipmi_req_entries;
static struct ipmi_rq_entry * ipmi_req_entries_tail; static struct ipmi_rq_entry * ipmi_req_entries_tail;
static sigjmp_buf jmpbuf;
static int ipmi_lanplus_setup(struct ipmi_intf * intf); static int ipmi_lanplus_setup(struct ipmi_intf * intf);
static int ipmi_lanplus_keepalive(struct ipmi_intf * intf); static int ipmi_lanplus_keepalive(struct ipmi_intf * intf);
static int ipmi_lan_send_packet(struct ipmi_intf * intf, uint8_t * data, int data_len); static int ipmi_lan_send_packet(struct ipmi_intf * intf, uint8_t * data, int data_len);
@ -265,13 +261,6 @@ void lanplus_swap(
static void
query_alarm(int signo)
{
siglongjmp(jmpbuf, 1);
}
static const struct valstr plus_payload_types_vals[] = { static const struct valstr plus_payload_types_vals[] = {
{ IPMI_PAYLOAD_TYPE_IPMI, "IPMI (0)" }, // IPMI Message { IPMI_PAYLOAD_TYPE_IPMI, "IPMI (0)" }, // IPMI Message
{ IPMI_PAYLOAD_TYPE_SOL, "SOL (1)" }, // SOL (Serial over LAN) { IPMI_PAYLOAD_TYPE_SOL, "SOL (1)" }, // SOL (Serial over LAN)
@ -384,7 +373,7 @@ ipmi_lan_send_packet(
uint8_t * data, int uint8_t * data, int
data_len) data_len)
{ {
if (verbose >= 2) if (verbose >= 5)
printbuf(data, data_len, ">> sending packet"); printbuf(data, data_len, ">> sending packet");
return send(intf->fd, data, data_len, 0); return send(intf->fd, data, data_len, 0);
@ -396,17 +385,22 @@ struct ipmi_rs *
ipmi_lan_recv_packet(struct ipmi_intf * intf) ipmi_lan_recv_packet(struct ipmi_intf * intf)
{ {
static struct ipmi_rs rsp; static struct ipmi_rs rsp;
int rc; fd_set read_set, err_set;
struct timeval tmout;
int ret;
/* setup alarm timeout */ FD_ZERO(&read_set);
if (sigsetjmp(jmpbuf, 1) != 0) { FD_SET(intf->fd, &read_set);
alarm(0);
FD_ZERO(&err_set);
FD_SET(intf->fd, &err_set);
tmout.tv_sec = intf->session->timeout;
tmout.tv_usec = 0;
ret = select(intf->fd + 1, &read_set, NULL, &err_set, &tmout);
if (ret < 0 || FD_ISSET(intf->fd, &err_set) || !FD_ISSET(intf->fd, &read_set))
return NULL; return NULL;
}
alarm(intf->session->timeout);
rc = recv(intf->fd, &rsp.data, IPMI_BUF_SIZE, 0);
alarm(0);
/* the first read may return ECONNREFUSED because the rmcp ping /* the first read may return ECONNREFUSED because the rmcp ping
* packet--sent to UDP port 623--will be processed by both the * packet--sent to UDP port 623--will be processed by both the
@ -418,22 +412,37 @@ ipmi_lan_recv_packet(struct ipmi_intf * intf)
* regardless of the order they were sent out. (unless the * regardless of the order they were sent out. (unless the
* response is read before the connection refused is returned) * response is read before the connection refused is returned)
*/ */
if (rc < 0) { ret = recv(intf->fd, &rsp.data, IPMI_BUF_SIZE, 0);
alarm(intf->session->timeout);
rc = recv(intf->fd, &rsp.data, IPMI_BUF_SIZE, 0); if (ret < 0) {
alarm(0); FD_ZERO(&read_set);
if (rc < 0) { FD_SET(intf->fd, &read_set);
perror("recv failed");
FD_ZERO(&err_set);
FD_SET(intf->fd, &err_set);
tmout.tv_sec = intf->session->timeout;
tmout.tv_usec = 0;
ret = select(intf->fd + 1, &read_set, NULL, &err_set, &tmout);
if (ret < 0) {
if (FD_ISSET(intf->fd, &err_set) || !FD_ISSET(intf->fd, &read_set))
return NULL;
ret = recv(intf->fd, &rsp.data, IPMI_BUF_SIZE, 0);
if (ret < 0)
return NULL; return NULL;
} }
} }
rsp.data[rc] = '\0';
rsp.data_len = rc;
if (verbose >= 2) if (ret == 0)
{ return NULL;
printbuf(rsp.data, rsp.data_len, "<< Received data");
} rsp.data[ret] = '\0';
rsp.data_len = ret;
if (verbose >= 5)
printbuf(rsp.data, rsp.data_len, "<< received packet");
return &rsp; return &rsp;
} }
@ -1247,6 +1256,7 @@ void read_ipmi_response(struct ipmi_rs * rsp, int * offset)
*/ */
void read_sol_packet(struct ipmi_rs * rsp, int * offset) void read_sol_packet(struct ipmi_rs * rsp, int * offset)
{ {
/* /*
* The data here should be decrypted by now. * The data here should be decrypted by now.
*/ */
@ -1274,29 +1284,25 @@ void read_sol_packet(struct ipmi_rs * rsp, int * offset)
rsp->payload.sol_packet.break_detected = rsp->payload.sol_packet.break_detected =
rsp->data[(*offset)++] & 0x04; rsp->data[(*offset)++] & 0x04;
lprintf(LOG_DEBUG, "SOL sequence number : 0x%02x", lprintf(LOG_DEBUG, "< SOL sequence number : 0x%02x",
rsp->payload.sol_packet.packet_sequence_number); rsp->payload.sol_packet.packet_sequence_number);
lprintf(LOG_DEBUG, "< SOL acked packet : 0x%02x",
lprintf(LOG_DEBUG, "SOL acked packet : 0x%02x",
rsp->payload.sol_packet.acked_packet_number); rsp->payload.sol_packet.acked_packet_number);
lprintf(LOG_DEBUG, "< SOL accepted char count : 0x%02x",
lprintf(LOG_DEBUG, "SOL accepted char count : 0x%02x",
rsp->payload.sol_packet.accepted_character_count); rsp->payload.sol_packet.accepted_character_count);
lprintf(LOG_DEBUG, "< SOL is nack : %s",
lprintf(LOG_DEBUG, "SOL is nack : %s",
rsp->payload.sol_packet.is_nack? "true" : "false"); rsp->payload.sol_packet.is_nack? "true" : "false");
lprintf(LOG_DEBUG, "< SOL xfer unavailable : %s",
lprintf(LOG_DEBUG, "SOL xfer unavailable : %s",
rsp->payload.sol_packet.transfer_unavailable? "true" : "false"); rsp->payload.sol_packet.transfer_unavailable? "true" : "false");
lprintf(LOG_DEBUG, "< SOL inactive : %s",
lprintf(LOG_DEBUG, "SOL inactive : %s",
rsp->payload.sol_packet.sol_inactive? "true" : "false"); rsp->payload.sol_packet.sol_inactive? "true" : "false");
lprintf(LOG_DEBUG, "< SOL transmit overrun : %s",
lprintf(LOG_DEBUG, "SOL transmit overrun : %s",
rsp->payload.sol_packet.transmit_overrun? "true" : "false"); rsp->payload.sol_packet.transmit_overrun? "true" : "false");
lprintf(LOG_DEBUG, "< SOL break detected : %s",
lprintf(LOG_DEBUG, "SOL break detected : %s",
rsp->payload.sol_packet.break_detected? "true" : "false"); rsp->payload.sol_packet.break_detected? "true" : "false");
if (verbose >= 5)
printbuf(rsp->data + *offset - 4, 4, "SOL MSG FROM BMC");
} }
@ -1409,6 +1415,27 @@ void getSolPayloadWireRep(
{ {
int i = 0; int i = 0;
lprintf(LOG_DEBUG, "> SOL sequence number : 0x%02x",
payload->payload.sol_packet.packet_sequence_number);
lprintf(LOG_DEBUG, "> SOL acked packet : 0x%02x",
payload->payload.sol_packet.acked_packet_number);
lprintf(LOG_DEBUG, "> SOL accepted char count : 0x%02x",
payload->payload.sol_packet.accepted_character_count);
lprintf(LOG_DEBUG, "> SOL is nack : %s",
payload->payload.sol_packet.is_nack ? "true" : "false");
lprintf(LOG_DEBUG, "> SOL assert ring wor : %s",
payload->payload.sol_packet.assert_ring_wor ? "true" : "false");
lprintf(LOG_DEBUG, "> SOL generate break : %s",
payload->payload.sol_packet.generate_break ? "true" : "false");
lprintf(LOG_DEBUG, "> SOL deassert cts : %s",
payload->payload.sol_packet.deassert_cts ? "true" : "false");
lprintf(LOG_DEBUG, "> SOL deassert dcd dsr : %s",
payload->payload.sol_packet.deassert_dcd_dsr ? "true" : "false");
lprintf(LOG_DEBUG, "> SOL flush inbound : %s",
payload->payload.sol_packet.flush_inbound ? "true" : "false");
lprintf(LOG_DEBUG, "> SOL flush outbound : %s",
payload->payload.sol_packet.flush_outbound ? "true" : "false");
msg[i++] = payload->payload.sol_packet.packet_sequence_number; msg[i++] = payload->payload.sol_packet.packet_sequence_number;
msg[i++] = payload->payload.sol_packet.acked_packet_number; msg[i++] = payload->payload.sol_packet.acked_packet_number;
msg[i++] = payload->payload.sol_packet.accepted_character_count; msg[i++] = payload->payload.sol_packet.accepted_character_count;
@ -1426,6 +1453,12 @@ void getSolPayloadWireRep(
payload->payload.sol_packet.data, payload->payload.sol_packet.data,
payload->payload.sol_packet.character_count); payload->payload.sol_packet.character_count);
lprintf(LOG_DEBUG, "> SOL character count : %d",
payload->payload.sol_packet.character_count);
if (payload->payload.sol_packet.character_count)
printbuf(payload->payload.sol_packet.data, payload->payload.sol_packet.character_count, "SOL SEND DATA");
/* /*
* At this point, the payload length becomes the whole payload * At this point, the payload length becomes the whole payload
* length, including the 4 bytes at the beginning of the SOL * length, including the 4 bytes at the beginning of the SOL
@ -1489,7 +1522,6 @@ ipmi_lanplus_build_v2x_msg(
/* msg will hold the entire message to be sent */ /* msg will hold the entire message to be sent */
uint8_t * msg; uint8_t * msg;
int len = 0; int len = 0;
@ -1531,7 +1563,6 @@ ipmi_lanplus_build_v2x_msg(
/* Payload Type -- also specifies whether were authenticated/encyrpted */ /* Payload Type -- also specifies whether were authenticated/encyrpted */
msg[IMPI_LANPLUS_OFFSET_PAYLOAD_TYPE] = payload->payload_type; msg[IMPI_LANPLUS_OFFSET_PAYLOAD_TYPE] = payload->payload_type;
if (session->v2_data.session_state == LANPLUS_STATE_ACTIVE) if (session->v2_data.session_state == LANPLUS_STATE_ACTIVE)
{ {
msg[IMPI_LANPLUS_OFFSET_PAYLOAD_TYPE] |= msg[IMPI_LANPLUS_OFFSET_PAYLOAD_TYPE] |=
@ -1560,7 +1591,6 @@ ipmi_lanplus_build_v2x_msg(
* encryption). * encryption).
*/ */
/* /*
* Payload * Payload
* *
@ -1586,6 +1616,10 @@ ipmi_lanplus_build_v2x_msg(
getSolPayloadWireRep(intf, getSolPayloadWireRep(intf,
msg + IPMI_LANPLUS_OFFSET_PAYLOAD, msg + IPMI_LANPLUS_OFFSET_PAYLOAD,
payload); payload);
if (verbose >= 5)
printbuf(msg + IPMI_LANPLUS_OFFSET_PAYLOAD, 4, "SOL MSG TO BMC");
len += payload->payload_length; len += payload->payload_length;
break; break;
@ -1640,7 +1674,6 @@ ipmi_lanplus_build_v2x_msg(
} }
/* Now we know the payload length */ /* Now we know the payload length */
msg[IMPI_LANPLUS_OFFSET_PAYLOAD_SIZE ] = msg[IMPI_LANPLUS_OFFSET_PAYLOAD_SIZE ] =
payload->payload_length & 0xff; payload->payload_length & 0xff;
@ -1648,7 +1681,6 @@ ipmi_lanplus_build_v2x_msg(
(payload->payload_length >> 8) & 0xff; (payload->payload_length >> 8) & 0xff;
/* /*
*------------------------------------------ *------------------------------------------
* SESSION TRAILER * SESSION TRAILER
@ -1688,7 +1720,6 @@ ipmi_lanplus_build_v2x_msg(
for (i = 0; i < integrity_pad_size; ++i) for (i = 0; i < integrity_pad_size; ++i)
msg[start_of_session_trailer + i] = 0xFF; msg[start_of_session_trailer + i] = 0xFF;
/* Pad length */ /* Pad length */
msg[start_of_session_trailer + integrity_pad_size] = integrity_pad_size; msg[start_of_session_trailer + integrity_pad_size] = integrity_pad_size;
@ -1696,7 +1727,6 @@ ipmi_lanplus_build_v2x_msg(
msg[start_of_session_trailer + integrity_pad_size + 1] = msg[start_of_session_trailer + integrity_pad_size + 1] =
0x07; /* Hardcoded per the spec, table 13-8 */ 0x07; /* Hardcoded per the spec, table 13-8 */
hmac_input_size = hmac_input_size =
12 + 12 +
payload->payload_length + payload->payload_length +
@ -1979,10 +2009,17 @@ ipmi_lanplus_send_payload(
int msg_length; int msg_length;
struct ipmi_session * session = intf->session; struct ipmi_session * session = intf->session;
int try = 0; int try = 0;
int xmit = 1;
time_t ltime;
if (!intf->opened && intf->open && intf->open(intf) < 0) if (!intf->opened && intf->open && intf->open(intf) < 0)
return NULL; return NULL;
while (try < session->retry) {
ltime = time(NULL);
if (xmit) {
if (payload->payload_type == IPMI_PAYLOAD_TYPE_IPMI) if (payload->payload_type == IPMI_PAYLOAD_TYPE_IPMI)
{ {
/* /*
@ -2095,13 +2132,11 @@ ipmi_lanplus_send_payload(
} }
while (try < session->retry) {
if (ipmi_lan_send_packet(intf, msg_data, msg_length) < 0) { if (ipmi_lan_send_packet(intf, msg_data, msg_length) < 0) {
lprintf(LOG_ERR, "IPMI LAN send command failed"); lprintf(LOG_ERR, "IPMI LAN send command failed");
return NULL; return NULL;
} }
}
/* if we are set to noanswer we do not expect response */ /* if we are set to noanswer we do not expect response */
if (intf->noanswer) if (intf->noanswer)
@ -2173,11 +2208,17 @@ ipmi_lanplus_send_payload(
rsp = ipmi_lan_poll_recv(intf); rsp = ipmi_lan_poll_recv(intf);
if (rsp) if (rsp)
break; break;
} }
xmit = ((time(NULL) - ltime) >= intf->session->timeout);
usleep(5000); usleep(5000);
if (xmit) {
/* incremet session timeout each retry */
intf->session->timeout++;
}
try++; try++;
} }
@ -2205,6 +2246,7 @@ ipmi_lanplus_send_payload(
* 0 if this isn't an ACK or we don't need to resend anything * 0 if this isn't an ACK or we don't need to resend anything
*/ */
int is_sol_partial_ack( int is_sol_partial_ack(
struct ipmi_intf * intf,
struct ipmi_v2_payload * v2_payload, struct ipmi_v2_payload * v2_payload,
struct ipmi_rs * rs) struct ipmi_rs * rs)
{ {
@ -2217,6 +2259,10 @@ int is_sol_partial_ack(
(rs->payload.sol_packet.accepted_character_count < (rs->payload.sol_packet.accepted_character_count <
v2_payload->payload.sol_packet.character_count)) v2_payload->payload.sol_packet.character_count))
{ {
if (ipmi_oem_active(intf, "intelplus") &&
rs->payload.sol_packet.accepted_character_count == 0)
return 0;
chars_to_resend = chars_to_resend =
v2_payload->payload.sol_packet.character_count - v2_payload->payload.sol_packet.character_count -
rs->payload.sol_packet.accepted_character_count; rs->payload.sol_packet.accepted_character_count;
@ -2283,10 +2329,11 @@ ipmi_lanplus_send_sol(
rs = ipmi_lanplus_send_payload(intf, v2_payload); rs = ipmi_lanplus_send_payload(intf, v2_payload);
/* Determine if we need to resend some of our data */ /* Determine if we need to resend some of our data */
chars_to_resend = is_sol_partial_ack(v2_payload, rs); chars_to_resend = is_sol_partial_ack(intf, v2_payload, rs);
while (rs && !rs->payload.sol_packet.transfer_unavailable &&
while (chars_to_resend) !rs->payload.sol_packet.is_nack &&
chars_to_resend)
{ {
/* /*
* We first need to handle any new data we might have * We first need to handle any new data we might have
@ -2309,7 +2356,7 @@ ipmi_lanplus_send_sol(
rs = ipmi_lanplus_send_payload(intf, v2_payload); rs = ipmi_lanplus_send_payload(intf, v2_payload);
chars_to_resend = is_sol_partial_ack(v2_payload, rs); chars_to_resend = is_sol_partial_ack(intf, v2_payload, rs);
} }
return rs; return rs;
@ -3172,7 +3219,6 @@ int
ipmi_lanplus_open(struct ipmi_intf * intf) ipmi_lanplus_open(struct ipmi_intf * intf)
{ {
int rc; int rc;
struct sigaction act;
struct get_channel_auth_cap_rsp auth_cap; struct get_channel_auth_cap_rsp auth_cap;
struct sockaddr_in addr; struct sockaddr_in addr;
struct ipmi_session *session; struct ipmi_session *session;
@ -3250,16 +3296,6 @@ ipmi_lanplus_open(struct ipmi_intf * intf)
return -1; return -1;
} }
/* setup alarm handler */
act.sa_handler = query_alarm;
act.sa_flags = 0;
if (sigemptyset(&act.sa_mask) == 0 &&
sigaction(SIGALRM, &act, NULL) < 0) {
lperror(LOG_ERR, "alarm signal");
intf->close(intf);
return -1;
}
intf->opened = 1; intf->opened = 1;

View File

@ -66,7 +66,7 @@
#define IPMI_LAN_CHANNEL_2 0x06 #define IPMI_LAN_CHANNEL_2 0x06
#define IPMI_LAN_CHANNEL_E 0x0e #define IPMI_LAN_CHANNEL_E 0x0e
#define IPMI_LAN_TIMEOUT 2 #define IPMI_LAN_TIMEOUT 1
#define IPMI_LAN_RETRY 4 #define IPMI_LAN_RETRY 4
#define IPMI_PRIV_CALLBACK 1 #define IPMI_PRIV_CALLBACK 1

View File

@ -30,6 +30,7 @@
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/ */
#include "ipmitool/log.h"
#include "ipmitool/ipmi_constants.h" #include "ipmitool/ipmi_constants.h"
#include "lanplus.h" #include "lanplus.h"
#include "lanplus_crypt_impl.h" #include "lanplus_crypt_impl.h"
@ -124,7 +125,7 @@ lanplus_HMAC(uint8_t mac,
evp_md = EVP_sha1(); evp_md = EVP_sha1();
else else
{ {
fprintf(stderr, "Invalid mac type 0x%x in lanplus_HMAC\n", mac); lprintf(LOG_DEBUG, "Invalid mac type 0x%x in lanplus_HMAC\n", mac);
assert(0); assert(0);
} }
@ -165,7 +166,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
if (input_length == 0) if (input_length == 0)
return; return;
if (verbose > 2) if (verbose >= 5)
{ {
printbuf(iv, 16, "encrypting with this IV"); printbuf(iv, 16, "encrypting with this IV");
printbuf(key, 16, "encrypting with this key"); printbuf(key, 16, "encrypting with this key");
@ -235,8 +236,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
EVP_CIPHER_CTX_set_padding(&ctx, 0); EVP_CIPHER_CTX_set_padding(&ctx, 0);
if (verbose >= 5)
if (verbose > 2)
{ {
printbuf(iv, 16, "decrypting with this IV"); printbuf(iv, 16, "decrypting with this IV");
printbuf(key, 16, "decrypting with this key"); printbuf(key, 16, "decrypting with this key");
@ -260,7 +260,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length)) if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
{ {
/* Error */ /* Error */
fprintf(stderr, "ERROR: decrypt update failed"); lprintf(LOG_DEBUG, "ERROR: decrypt update failed");
*bytes_written = 0; *bytes_written = 0;
return; return;
} }
@ -272,8 +272,8 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
{ {
char buffer[1000]; char buffer[1000];
ERR_error_string(ERR_get_error(), buffer); ERR_error_string(ERR_get_error(), buffer);
fprintf(stderr, "the ERR error %s", buffer); lprintf(LOG_DEBUG, "the ERR error %s", buffer);
fprintf(stderr, "ERROR: decrypt final failed"); lprintf(LOG_DEBUG, "ERROR: decrypt final failed");
*bytes_written = 0; *bytes_written = 0;
return; /* Error */ return; /* Error */
} }
@ -285,9 +285,9 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
} }
} }
if (verbose > 1) if (verbose >= 5)
{ {
fprintf(stderr, "Decrypted %d encrypted bytes", input_length); lprintf(LOG_DEBUG, "Decrypted %d encrypted bytes", input_length);
printbuf(output, *bytes_written, "Decrypted this data"); printbuf(output, *bytes_written, "Decrypted this data");
} }
} }