|
@@ -125,7 +125,7 @@ ipmi_req_add_entry(struct ipmi_intf * intf, struct ipmi_rq * req, uint8_t req_se
|
|
|
|
|
|
e = malloc(sizeof(struct ipmi_rq_entry));
|
|
|
if (e == NULL) {
|
|
|
- lprintf(LOG_ERR, "ipmitool: malloc failure");
|
|
|
+ printf("ipmitool: malloc failure");
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
@@ -141,7 +141,7 @@ ipmi_req_add_entry(struct ipmi_intf * intf, struct ipmi_rq * req, uint8_t req_se
|
|
|
ipmi_req_entries_tail->next = e;
|
|
|
|
|
|
ipmi_req_entries_tail = e;
|
|
|
- lprintf(LOG_DEBUG+3, "added list entry seq=0x%02x cmd=0x%02x",
|
|
|
+ printf("added list entry seq=0x%02x cmd=0x%02x",
|
|
|
e->rq_seq, e->req.msg.cmd);
|
|
|
return e;
|
|
|
}
|
|
@@ -170,7 +170,7 @@ ipmi_req_remove_entry(uint8_t seq, uint8_t cmd)
|
|
|
e = e->next;
|
|
|
}
|
|
|
if (e) {
|
|
|
- lprintf(LOG_DEBUG+3, "removed list entry seq=0x%02x cmd=0x%02x",
|
|
|
+ printf("removed list entry seq=0x%02x cmd=0x%02x",
|
|
|
seq, cmd);
|
|
|
saved_next_entry = e->next;
|
|
|
p->next = (p->next == e->next) ? NULL : e->next;
|
|
@@ -204,7 +204,7 @@ ipmi_req_clear_entries(void)
|
|
|
|
|
|
e = ipmi_req_entries;
|
|
|
while (e) {
|
|
|
- lprintf(LOG_DEBUG+3, "cleared list entry seq=0x%02x cmd=0x%02x",
|
|
|
+ printf("cleared list entry seq=0x%02x cmd=0x%02x",
|
|
|
e->rq_seq, e->req.msg.cmd);
|
|
|
if (e->next != NULL) {
|
|
|
p = e->next;
|
|
@@ -223,19 +223,20 @@ ipmi_req_clear_entries(void)
|
|
|
static int
|
|
|
get_random(void *data, int len)
|
|
|
{
|
|
|
- int fd = open("/dev/urandom", O_RDONLY);
|
|
|
- int rv;
|
|
|
+ //int fd = open("/dev/urandom", O_RDONLY);
|
|
|
+ static int rv = 0x12345678;
|
|
|
|
|
|
- if (fd < 0)
|
|
|
- return errno;
|
|
|
- if (len < 0) {
|
|
|
- close(fd);
|
|
|
- return errno; /* XXX: ORLY? */
|
|
|
- }
|
|
|
+ // if (fd < 0)
|
|
|
+ // return errno;
|
|
|
+ // if (len < 0) {
|
|
|
+ // close(fd);
|
|
|
+ // return errno; /* XXX: ORLY? */
|
|
|
+ // }
|
|
|
|
|
|
- rv = read(fd, data, len);
|
|
|
+ // rv = read(fd, data, len);
|
|
|
|
|
|
- close(fd);
|
|
|
+ // close(fd);
|
|
|
+ rv++;
|
|
|
return rv;
|
|
|
}
|
|
|
|
|
@@ -350,7 +351,7 @@ ipmi_handle_pong(struct ipmi_intf * intf, struct ipmi_rs * rsp)
|
|
|
|
|
|
pong = (struct rmcp_pong *)rsp->data;
|
|
|
|
|
|
- lprintf(LOG_DEBUG,
|
|
|
+ printf(
|
|
|
"Received IPMI/RMCP response packet: \n"
|
|
|
" IPMI%s Supported\n"
|
|
|
" ASF Version %s\n"
|
|
@@ -403,14 +404,14 @@ ipmi_lan_ping(struct ipmi_intf * intf)
|
|
|
|
|
|
data = malloc(len);
|
|
|
if (data == NULL) {
|
|
|
- lprintf(LOG_ERR, "ipmitool: malloc failure");
|
|
|
+ printf( "ipmitool: malloc failure");
|
|
|
return -1;
|
|
|
}
|
|
|
memset(data, 0, len);
|
|
|
memcpy(data, &rmcp_ping, sizeof(rmcp_ping));
|
|
|
memcpy(data+sizeof(rmcp_ping), &asf_ping, sizeof(asf_ping));
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "Sending IPMI/RMCP presence ping packet");
|
|
|
+ printf( "Sending IPMI/RMCP presence ping packet");
|
|
|
|
|
|
rv = ipmi_lan_send_packet(intf, data, len);
|
|
|
|
|
@@ -418,7 +419,7 @@ ipmi_lan_ping(struct ipmi_intf * intf)
|
|
|
data = NULL;
|
|
|
|
|
|
if (rv < 0) {
|
|
|
- lprintf(LOG_ERR, "Unable to send IPMI presence ping packet");
|
|
|
+ printf( "Unable to send IPMI presence ping packet");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -477,7 +478,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
|
|
/* handled by rest of function */
|
|
|
break;
|
|
|
default:
|
|
|
- lprintf(LOG_DEBUG, "Invalid RMCP class: %x",
|
|
|
+ printf( "Invalid RMCP class: %x",
|
|
|
rmcp_rsp.class);
|
|
|
rsp = ipmi_lan_recv_packet(intf);
|
|
|
continue;
|
|
@@ -522,28 +523,28 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
|
|
|
|
|
x++; /* On ISOL there's and additional fifth byte before the data starts */
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "SOL sequence number : 0x%02x",
|
|
|
+ printf( "SOL sequence number : 0x%02x",
|
|
|
rsp->payload.sol_packet.packet_sequence_number);
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "SOL acked packet : 0x%02x",
|
|
|
+ printf( "SOL acked packet : 0x%02x",
|
|
|
rsp->payload.sol_packet.acked_packet_number);
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "SOL accepted char count : 0x%02x",
|
|
|
+ printf( "SOL accepted char count : 0x%02x",
|
|
|
rsp->payload.sol_packet.accepted_character_count);
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "SOL is nack : %s",
|
|
|
+ printf( "SOL is nack : %s",
|
|
|
rsp->payload.sol_packet.is_nack? "true" : "false");
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "SOL xfer unavailable : %s",
|
|
|
+ printf( "SOL xfer unavailable : %s",
|
|
|
rsp->payload.sol_packet.transfer_unavailable? "true" : "false");
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "SOL inactive : %s",
|
|
|
+ printf( "SOL inactive : %s",
|
|
|
rsp->payload.sol_packet.sol_inactive? "true" : "false");
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "SOL transmit overrun : %s",
|
|
|
+ printf( "SOL transmit overrun : %s",
|
|
|
rsp->payload.sol_packet.transmit_overrun? "true" : "false");
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "SOL break detected : %s",
|
|
|
+ printf( "SOL break detected : %s",
|
|
|
rsp->payload.sol_packet.break_detected? "true" : "false");
|
|
|
}
|
|
|
else
|
|
@@ -567,36 +568,36 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
|
|
if (verbose > 2)
|
|
|
printbuf(rsp->data, rsp->data_len, "ipmi message header");
|
|
|
|
|
|
- lprintf(LOG_DEBUG+1, "<< IPMI Response Session Header");
|
|
|
- lprintf(LOG_DEBUG+1, "<< Authtype : %s",
|
|
|
+ printf( "<< IPMI Response Session Header");
|
|
|
+ printf( "<< Authtype : %s",
|
|
|
val2str(rsp->session.authtype, ipmi_authtype_session_vals));
|
|
|
- lprintf(LOG_DEBUG+1, "<< Sequence : 0x%08lx",
|
|
|
+ printf( "<< Sequence : 0x%08lx",
|
|
|
(long)rsp->session.seq);
|
|
|
- lprintf(LOG_DEBUG+1, "<< Session ID : 0x%08lx",
|
|
|
+ printf( "<< Session ID : 0x%08lx",
|
|
|
(long)rsp->session.id);
|
|
|
- lprintf(LOG_DEBUG+1, "<< IPMI Response Message Header");
|
|
|
- lprintf(LOG_DEBUG+1, "<< Rq Addr : %02x",
|
|
|
+ printf( "<< IPMI Response Message Header");
|
|
|
+ printf( "<< Rq Addr : %02x",
|
|
|
rsp->payload.ipmi_response.rq_addr);
|
|
|
- lprintf(LOG_DEBUG+1, "<< NetFn : %02x",
|
|
|
+ printf( "<< NetFn : %02x",
|
|
|
rsp->payload.ipmi_response.netfn);
|
|
|
- lprintf(LOG_DEBUG+1, "<< Rq LUN : %01x",
|
|
|
+ printf( "<< Rq LUN : %01x",
|
|
|
rsp->payload.ipmi_response.rq_lun);
|
|
|
- lprintf(LOG_DEBUG+1, "<< Rs Addr : %02x",
|
|
|
+ printf( "<< Rs Addr : %02x",
|
|
|
rsp->payload.ipmi_response.rs_addr);
|
|
|
- lprintf(LOG_DEBUG+1, "<< Rq Seq : %02x",
|
|
|
+ printf( "<< Rq Seq : %02x",
|
|
|
rsp->payload.ipmi_response.rq_seq);
|
|
|
- lprintf(LOG_DEBUG+1, "<< Rs Lun : %01x",
|
|
|
+ printf( "<< Rs Lun : %01x",
|
|
|
rsp->payload.ipmi_response.rs_lun);
|
|
|
- lprintf(LOG_DEBUG+1, "<< Command : %02x",
|
|
|
+ printf( "<< Command : %02x",
|
|
|
rsp->payload.ipmi_response.cmd);
|
|
|
- lprintf(LOG_DEBUG+1, "<< Compl Code : 0x%02x",
|
|
|
+ printf( "<< Compl Code : 0x%02x",
|
|
|
rsp->ccode);
|
|
|
|
|
|
/* now see if we have outstanding entry in request list */
|
|
|
entry = ipmi_req_lookup_entry(rsp->payload.ipmi_response.rq_seq,
|
|
|
rsp->payload.ipmi_response.cmd);
|
|
|
if (entry) {
|
|
|
- lprintf(LOG_DEBUG+2, "IPMI Request Match found");
|
|
|
+ printf( "IPMI Request Match found");
|
|
|
if ((intf->target_addr != our_address) && bridge_possible) {
|
|
|
if ((rsp->data_len) && (rsp->payload.ipmi_response.netfn == 7) &&
|
|
|
(rsp->payload.ipmi_response.cmd != 0x34)) {
|
|
@@ -632,7 +633,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
|
|
} else {
|
|
|
//x += sizeof(rsp->payload.ipmi_response);
|
|
|
if (rsp->data[x-1] != 0)
|
|
|
- lprintf(LOG_DEBUG, "WARNING: Bridged "
|
|
|
+ printf( "WARNING: Bridged "
|
|
|
"cmd ccode = 0x%02x",
|
|
|
rsp->data[x-1]);
|
|
|
}
|
|
@@ -640,7 +641,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
|
|
ipmi_req_remove_entry(rsp->payload.ipmi_response.rq_seq,
|
|
|
rsp->payload.ipmi_response.cmd);
|
|
|
} else {
|
|
|
- lprintf(LOG_INFO, "IPMI Request Match NOT FOUND");
|
|
|
+ printf( "IPMI Request Match NOT FOUND");
|
|
|
rsp = ipmi_lan_recv_packet(intf);
|
|
|
continue;
|
|
|
}
|
|
@@ -750,7 +751,7 @@ ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_rq * req, int isRetry)
|
|
|
len += 8;
|
|
|
msg = malloc(len);
|
|
|
if (msg == NULL) {
|
|
|
- lprintf(LOG_ERR, "ipmitool: malloc failure");
|
|
|
+ printf( "ipmitool: malloc failure");
|
|
|
return NULL;
|
|
|
}
|
|
|
memset(msg, 0, len);
|
|
@@ -834,19 +835,19 @@ ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_rq * req, int isRetry)
|
|
|
msg[len++] = entry->rq_seq << 2;
|
|
|
msg[len++] = req->msg.cmd;
|
|
|
|
|
|
- lprintf(LOG_DEBUG+1, ">> IPMI Request Session Header (level %d)", entry->bridging_level);
|
|
|
- lprintf(LOG_DEBUG+1, ">> Authtype : %s",
|
|
|
+ printf( ">> IPMI Request Session Header (level %d)", entry->bridging_level);
|
|
|
+ printf( ">> Authtype : %s",
|
|
|
val2str(s->authtype, ipmi_authtype_session_vals));
|
|
|
- lprintf(LOG_DEBUG+1, ">> Sequence : 0x%08lx", (long)s->in_seq);
|
|
|
- lprintf(LOG_DEBUG+1, ">> Session ID : 0x%08lx", (long)s->session_id);
|
|
|
- lprintf(LOG_DEBUG+1, ">> IPMI Request Message Header");
|
|
|
- lprintf(LOG_DEBUG+1, ">> Rs Addr : %02x", intf->target_addr);
|
|
|
- lprintf(LOG_DEBUG+1, ">> NetFn : %02x", req->msg.netfn);
|
|
|
- lprintf(LOG_DEBUG+1, ">> Rs LUN : %01x", 0);
|
|
|
- lprintf(LOG_DEBUG+1, ">> Rq Addr : %02x", IPMI_REMOTE_SWID);
|
|
|
- lprintf(LOG_DEBUG+1, ">> Rq Seq : %02x", entry->rq_seq);
|
|
|
- lprintf(LOG_DEBUG+1, ">> Rq Lun : %01x", 0);
|
|
|
- lprintf(LOG_DEBUG+1, ">> Command : %02x", req->msg.cmd);
|
|
|
+ printf( ">> Sequence : 0x%08lx", (long)s->in_seq);
|
|
|
+ printf( ">> Session ID : 0x%08lx", (long)s->session_id);
|
|
|
+ printf( ">> IPMI Request Message Header");
|
|
|
+ printf( ">> Rs Addr : %02x", intf->target_addr);
|
|
|
+ printf( ">> NetFn : %02x", req->msg.netfn);
|
|
|
+ printf( ">> Rs LUN : %01x", 0);
|
|
|
+ printf( ">> Rq Addr : %02x", IPMI_REMOTE_SWID);
|
|
|
+ printf( ">> Rq Seq : %02x", entry->rq_seq);
|
|
|
+ printf( ">> Rq Lun : %01x", 0);
|
|
|
+ printf( ">> Command : %02x", req->msg.cmd);
|
|
|
|
|
|
/* message data */
|
|
|
if (req->msg.data_len) {
|
|
@@ -906,15 +907,15 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
|
|
int try = 0;
|
|
|
int isRetry = 0;
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "ipmi_lan_send_cmd:opened=[%d], open=[%d]",
|
|
|
+ printf( "ipmi_lan_send_cmd:opened=[%d], open=[%d]",
|
|
|
intf->opened, intf->open);
|
|
|
|
|
|
if (intf->opened == 0 && intf->open != NULL) {
|
|
|
if (intf->open(intf) < 0) {
|
|
|
- lprintf(LOG_DEBUG, "Failed to open LAN interface");
|
|
|
+ printf( "Failed to open LAN interface");
|
|
|
return NULL;
|
|
|
}
|
|
|
- lprintf(LOG_DEBUG, "\topened=[%d], open=[%d]",
|
|
|
+ printf( "\topened=[%d], open=[%d]",
|
|
|
intf->opened, intf->open);
|
|
|
}
|
|
|
|
|
@@ -923,7 +924,7 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
|
|
|
|
|
entry = ipmi_lan_build_cmd(intf, req, isRetry);
|
|
|
if (entry == NULL) {
|
|
|
- lprintf(LOG_ERR, "Aborting send command, unable to build");
|
|
|
+ printf( "Aborting send command, unable to build");
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
@@ -957,7 +958,7 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
|
|
|
|
|
usleep(5000);
|
|
|
if (++try >= intf->ssn_params.retry) {
|
|
|
- lprintf(LOG_DEBUG, " No response from remote controller");
|
|
|
+ printf( " No response from remote controller");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -1008,7 +1009,7 @@ ipmi_lan_build_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp, int * llen)
|
|
|
|
|
|
msg = malloc(len);
|
|
|
if (msg == NULL) {
|
|
|
- lprintf(LOG_ERR, "ipmitool: malloc failure");
|
|
|
+ printf( "ipmitool: malloc failure");
|
|
|
return NULL;
|
|
|
}
|
|
|
memset(msg, 0, len);
|
|
@@ -1091,7 +1092,7 @@ ipmi_lan_send_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp)
|
|
|
|
|
|
msg = ipmi_lan_build_rsp(intf, rsp, &len);
|
|
|
if (len <= 0 || msg == NULL) {
|
|
|
- lprintf(LOG_ERR, "Invalid response packet");
|
|
|
+ printf( "Invalid response packet");
|
|
|
if (msg != NULL) {
|
|
|
free(msg);
|
|
|
msg = NULL;
|
|
@@ -1103,7 +1104,7 @@ ipmi_lan_send_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp)
|
|
|
(struct sockaddr *)&intf->session->addr,
|
|
|
intf->session->addrlen);
|
|
|
if (rv < 0) {
|
|
|
- lprintf(LOG_ERR, "Packet send failed");
|
|
|
+ printf( "Packet send failed");
|
|
|
if (msg != NULL) {
|
|
|
free(msg);
|
|
|
msg = NULL;
|
|
@@ -1164,7 +1165,7 @@ uint8_t * ipmi_lan_build_sol_msg(struct ipmi_intf * intf,
|
|
|
|
|
|
msg = malloc(len);
|
|
|
if (msg == NULL) {
|
|
|
- lprintf(LOG_ERR, "ipmitool: malloc failure");
|
|
|
+ printf( "ipmitool: malloc failure");
|
|
|
return NULL;
|
|
|
}
|
|
|
memset(msg, 0, len);
|
|
@@ -1263,7 +1264,7 @@ ipmi_lan_send_sol_payload(struct ipmi_intf * intf,
|
|
|
|
|
|
msg = ipmi_lan_build_sol_msg(intf, payload, &len);
|
|
|
if (len <= 0 || msg == NULL) {
|
|
|
- lprintf(LOG_ERR, "Invalid SOL payload packet");
|
|
|
+ printf( "Invalid SOL payload packet");
|
|
|
if (msg != NULL) {
|
|
|
free(msg);
|
|
|
msg = NULL;
|
|
@@ -1271,7 +1272,7 @@ ipmi_lan_send_sol_payload(struct ipmi_intf * intf,
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
- lprintf(LOG_DEBUG, ">> SENDING A SOL MESSAGE\n");
|
|
|
+ printf( ">> SENDING A SOL MESSAGE\n");
|
|
|
|
|
|
for (;;) {
|
|
|
if (ipmi_lan_send_packet(intf, msg, len) < 0) {
|
|
@@ -1307,7 +1308,7 @@ ipmi_lan_send_sol_payload(struct ipmi_intf * intf,
|
|
|
|
|
|
usleep(5000);
|
|
|
if (++try >= intf->ssn_params.retry) {
|
|
|
- lprintf(LOG_DEBUG, " No response from remote controller");
|
|
|
+ printf( " No response from remote controller");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -1595,44 +1596,44 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
|
|
|
|
|
rsp = intf->sendrecv(intf, &req);
|
|
|
if (rsp == NULL) {
|
|
|
- lprintf(LOG_INFO, "Get Auth Capabilities command failed");
|
|
|
+ printf( "Get Auth Capabilities command failed");
|
|
|
return -1;
|
|
|
}
|
|
|
if (verbose > 2)
|
|
|
printbuf(rsp->data, rsp->data_len, "get_auth_capabilities");
|
|
|
|
|
|
if (rsp->ccode > 0) {
|
|
|
- lprintf(LOG_INFO, "Get Auth Capabilities command failed: %s",
|
|
|
+ printf( "Get Auth Capabilities command failed: %s",
|
|
|
val2str(rsp->ccode, completion_code_vals));
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "Channel %02x Authentication Capabilities:",
|
|
|
+ printf( "Channel %02x Authentication Capabilities:",
|
|
|
rsp->data[0]);
|
|
|
- lprintf(LOG_DEBUG, " Privilege Level : %s",
|
|
|
+ printf( " Privilege Level : %s",
|
|
|
val2str(req.msg.data[1], ipmi_privlvl_vals));
|
|
|
- lprintf(LOG_DEBUG, " Auth Types : %s%s%s%s%s",
|
|
|
+ printf( " Auth Types : %s%s%s%s%s",
|
|
|
(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_NONE) ? "NONE " : "",
|
|
|
(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_MD2) ? "MD2 " : "",
|
|
|
(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_MD5) ? "MD5 " : "",
|
|
|
(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_PASSWORD) ? "PASSWORD " : "",
|
|
|
(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_OEM) ? "OEM " : "");
|
|
|
- lprintf(LOG_DEBUG, " Per-msg auth : %sabled",
|
|
|
+ printf( " Per-msg auth : %sabled",
|
|
|
(rsp->data[2] & IPMI_AUTHSTATUS_PER_MSG_DISABLED) ?
|
|
|
"dis" : "en");
|
|
|
- lprintf(LOG_DEBUG, " User level auth : %sabled",
|
|
|
+ printf( " User level auth : %sabled",
|
|
|
(rsp->data[2] & IPMI_AUTHSTATUS_PER_USER_DISABLED) ?
|
|
|
"dis" : "en");
|
|
|
- lprintf(LOG_DEBUG, " Non-null users : %sabled",
|
|
|
+ printf( " Non-null users : %sabled",
|
|
|
(rsp->data[2] & IPMI_AUTHSTATUS_NONNULL_USERS_ENABLED) ?
|
|
|
"en" : "dis");
|
|
|
- lprintf(LOG_DEBUG, " Null users : %sabled",
|
|
|
+ printf( " Null users : %sabled",
|
|
|
(rsp->data[2] & IPMI_AUTHSTATUS_NULL_USERS_ENABLED) ?
|
|
|
"en" : "dis");
|
|
|
- lprintf(LOG_DEBUG, " Anonymous login : %sabled",
|
|
|
+ printf( " Anonymous login : %sabled",
|
|
|
(rsp->data[2] & IPMI_AUTHSTATUS_ANONYMOUS_USERS_ENABLED) ?
|
|
|
"en" : "dis");
|
|
|
- lprintf(LOG_DEBUG, "");
|
|
|
+ printf( "");
|
|
|
|
|
|
s->authstatus = rsp->data[2];
|
|
|
|
|
@@ -1672,15 +1673,15 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
|
|
}
|
|
|
else {
|
|
|
if (!(rsp->data[1] & 1<<p->authtype_set))
|
|
|
- lprintf(LOG_ERR, "Authentication type %s not supported",
|
|
|
+ printf( "Authentication type %s not supported",
|
|
|
val2str(p->authtype_set, ipmi_authtype_session_vals));
|
|
|
else
|
|
|
- lprintf(LOG_ERR, "No supported authtypes found");
|
|
|
+ printf( "No supported authtypes found");
|
|
|
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "Proceeding with AuthType %s",
|
|
|
+ printf( "Proceeding with AuthType %s",
|
|
|
val2str(s->authtype, ipmi_authtype_session_vals));
|
|
|
|
|
|
return 0;
|
|
@@ -1710,7 +1711,7 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
|
|
|
|
|
|
rsp = intf->sendrecv(intf, &req);
|
|
|
if (rsp == NULL) {
|
|
|
- lprintf(LOG_ERR, "Get Session Challenge command failed");
|
|
|
+ printf( "Get Session Challenge command failed");
|
|
|
return -1;
|
|
|
}
|
|
|
if (verbose > 2)
|
|
@@ -1719,13 +1720,13 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
|
|
|
if (rsp->ccode > 0) {
|
|
|
switch (rsp->ccode) {
|
|
|
case 0x81:
|
|
|
- lprintf(LOG_ERR, "Invalid user name");
|
|
|
+ printf( "Invalid user name");
|
|
|
break;
|
|
|
case 0x82:
|
|
|
- lprintf(LOG_ERR, "NULL user name not enabled");
|
|
|
+ printf( "NULL user name not enabled");
|
|
|
break;
|
|
|
default:
|
|
|
- lprintf(LOG_ERR, "Get Session Challenge command failed: %s",
|
|
|
+ printf( "Get Session Challenge command failed: %s",
|
|
|
val2str(rsp->ccode, completion_code_vals));
|
|
|
}
|
|
|
return -1;
|
|
@@ -1734,9 +1735,9 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
|
|
|
memcpy(&s->session_id, rsp->data, 4);
|
|
|
memcpy(s->challenge, rsp->data + 4, 16);
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "Opening Session");
|
|
|
- lprintf(LOG_DEBUG, " Session ID : %08lx", (long)s->session_id);
|
|
|
- lprintf(LOG_DEBUG, " Challenge : %s", buf2str(s->challenge, 16));
|
|
|
+ printf( "Opening Session");
|
|
|
+ printf( " Session ID : %08lx", (long)s->session_id);
|
|
|
+ printf( " Challenge : %s", buf2str(s->challenge, 16));
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -1764,7 +1765,7 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
|
|
uint8_t * special = ipmi_auth_special(s);
|
|
|
memcpy(intf->session->authcode, special, 16);
|
|
|
memset(msg_data + 2, 0, 16);
|
|
|
- lprintf(LOG_DEBUG, " OEM Auth : %s",
|
|
|
+ printf( " OEM Auth : %s",
|
|
|
buf2str(special, 16));
|
|
|
} else {
|
|
|
memcpy(msg_data + 2, s->challenge, 16);
|
|
@@ -1778,14 +1779,14 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
|
|
|
|
|
s->active = 1;
|
|
|
|
|
|
- lprintf(LOG_DEBUG, " Privilege Level : %s",
|
|
|
+ printf( " Privilege Level : %s",
|
|
|
val2str(msg_data[1], ipmi_privlvl_vals));
|
|
|
- lprintf(LOG_DEBUG, " Auth Type : %s",
|
|
|
+ printf( " Auth Type : %s",
|
|
|
val2str(s->authtype, ipmi_authtype_session_vals));
|
|
|
|
|
|
rsp = intf->sendrecv(intf, &req);
|
|
|
if (rsp == NULL) {
|
|
|
- lprintf(LOG_ERR, "Activate Session command failed");
|
|
|
+ printf( "Activate Session command failed");
|
|
|
s->active = 0;
|
|
|
return -1;
|
|
|
}
|
|
@@ -1796,31 +1797,31 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
|
|
fprintf(stderr, "Activate Session error:");
|
|
|
switch (rsp->ccode) {
|
|
|
case 0x81:
|
|
|
- lprintf(LOG_ERR, "\tNo session slot available");
|
|
|
+ printf( "\tNo session slot available");
|
|
|
break;
|
|
|
case 0x82:
|
|
|
- lprintf(LOG_ERR, "\tNo slot available for given user - "
|
|
|
+ printf( "\tNo slot available for given user - "
|
|
|
"limit reached");
|
|
|
break;
|
|
|
case 0x83:
|
|
|
- lprintf(LOG_ERR, "\tNo slot available to support user "
|
|
|
+ printf( "\tNo slot available to support user "
|
|
|
"due to maximum privilege capacity");
|
|
|
break;
|
|
|
case 0x84:
|
|
|
- lprintf(LOG_ERR, "\tSession sequence out of range");
|
|
|
+ printf( "\tSession sequence out of range");
|
|
|
break;
|
|
|
case 0x85:
|
|
|
- lprintf(LOG_ERR, "\tInvalid session ID in request");
|
|
|
+ printf( "\tInvalid session ID in request");
|
|
|
break;
|
|
|
case 0x86:
|
|
|
- lprintf(LOG_ERR, "\tRequested privilege level "
|
|
|
+ printf( "\tRequested privilege level "
|
|
|
"exceeds limit");
|
|
|
break;
|
|
|
case 0xd4:
|
|
|
- lprintf(LOG_ERR, "\tInsufficient privilege level");
|
|
|
+ printf( "\tInsufficient privilege level");
|
|
|
break;
|
|
|
default:
|
|
|
- lprintf(LOG_ERR, "\t%s",
|
|
|
+ printf( "\t%s",
|
|
|
val2str(rsp->ccode, completion_code_vals));
|
|
|
}
|
|
|
return -1;
|
|
@@ -1834,18 +1835,18 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
|
|
if (s->authstatus & IPMI_AUTHSTATUS_PER_MSG_DISABLED)
|
|
|
s->authtype = IPMI_SESSION_AUTHTYPE_NONE;
|
|
|
else if (s->authtype != (rsp->data[0] & 0xf)) {
|
|
|
- lprintf(LOG_ERR, "Invalid Session AuthType %s in response",
|
|
|
+ printf( "Invalid Session AuthType %s in response",
|
|
|
val2str(s->authtype, ipmi_authtype_session_vals));
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "\nSession Activated");
|
|
|
- lprintf(LOG_DEBUG, " Auth Type : %s",
|
|
|
+ printf( "\nSession Activated");
|
|
|
+ printf( " Auth Type : %s",
|
|
|
val2str(rsp->data[0], ipmi_authtype_session_vals));
|
|
|
- lprintf(LOG_DEBUG, " Max Priv Level : %s",
|
|
|
+ printf( " Max Priv Level : %s",
|
|
|
val2str(rsp->data[9], ipmi_privlvl_vals));
|
|
|
- lprintf(LOG_DEBUG, " Session ID : %08lx", (long)s->session_id);
|
|
|
- lprintf(LOG_DEBUG, " Inbound Seq : %08lx\n", (long)s->in_seq);
|
|
|
+ printf( " Session ID : %08lx", (long)s->session_id);
|
|
|
+ printf( " Inbound Seq : %08lx\n", (long)s->in_seq);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -1876,7 +1877,7 @@ ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
|
|
|
bridge_possible = backup_bridge_possible;
|
|
|
|
|
|
if (rsp == NULL) {
|
|
|
- lprintf(LOG_ERR, "Set Session Privilege Level to %s failed",
|
|
|
+ printf( "Set Session Privilege Level to %s failed",
|
|
|
val2str(privlvl, ipmi_privlvl_vals));
|
|
|
return -1;
|
|
|
}
|
|
@@ -1884,13 +1885,13 @@ ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
|
|
|
printbuf(rsp->data, rsp->data_len, "set_session_privlvl");
|
|
|
|
|
|
if (rsp->ccode > 0) {
|
|
|
- lprintf(LOG_ERR, "Set Session Privilege Level to %s failed: %s",
|
|
|
+ printf( "Set Session Privilege Level to %s failed: %s",
|
|
|
val2str(privlvl, ipmi_privlvl_vals),
|
|
|
val2str(rsp->ccode, completion_code_vals));
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "Set Session Privilege Level to %s\n",
|
|
|
+ printf( "Set Session Privilege Level to %s\n",
|
|
|
val2str(rsp->data[0], ipmi_privlvl_vals));
|
|
|
|
|
|
return 0;
|
|
@@ -1920,24 +1921,24 @@ ipmi_close_session_cmd(struct ipmi_intf * intf)
|
|
|
|
|
|
rsp = intf->sendrecv(intf, &req);
|
|
|
if (rsp == NULL) {
|
|
|
- lprintf(LOG_ERR, "Close Session command failed");
|
|
|
+ printf( "Close Session command failed");
|
|
|
return -1;
|
|
|
}
|
|
|
if (verbose > 2)
|
|
|
printbuf(rsp->data, rsp->data_len, "close_session");
|
|
|
|
|
|
if (rsp->ccode == 0x87) {
|
|
|
- lprintf(LOG_ERR, "Failed to Close Session: invalid "
|
|
|
+ printf( "Failed to Close Session: invalid "
|
|
|
"session ID %08lx", (long)session_id);
|
|
|
return -1;
|
|
|
}
|
|
|
if (rsp->ccode > 0) {
|
|
|
- lprintf(LOG_ERR, "Close Session command failed: %s",
|
|
|
+ printf( "Close Session command failed: %s",
|
|
|
val2str(rsp->ccode, completion_code_vals));
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- lprintf(LOG_DEBUG, "Closed Session %08lx\n", (long)session_id);
|
|
|
+ printf( "Closed Session %08lx\n", (long)session_id);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -1999,7 +2000,7 @@ ipmi_lan_activate_session(struct ipmi_intf * intf)
|
|
|
close_fail:
|
|
|
ipmi_close_session_cmd(intf);
|
|
|
fail:
|
|
|
- lprintf(LOG_ERR, "Error: Unable to establish LAN session");
|
|
|
+ printf( "Error: Unable to establish LAN session");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -2044,18 +2045,18 @@ ipmi_lan_open(struct ipmi_intf * intf)
|
|
|
p->retry = IPMI_LAN_RETRY;
|
|
|
|
|
|
if (p->hostname == NULL || strlen((const char *)p->hostname) == 0) {
|
|
|
- lprintf(LOG_ERR, "No hostname specified!");
|
|
|
+ printf( "No hostname specified!");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
if (ipmi_intf_socket_connect(intf) == -1) {
|
|
|
- lprintf(LOG_ERR, "Could not open socket!");
|
|
|
+ printf( "Could not open socket!");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
s = (struct ipmi_session *)malloc(sizeof(struct ipmi_session));
|
|
|
if (!s) {
|
|
|
- lprintf(LOG_ERR, "ipmitool: malloc failure");
|
|
|
+ printf( "ipmitool: malloc failure");
|
|
|
goto fail;
|
|
|
}
|
|
|
|
|
@@ -2070,12 +2071,14 @@ ipmi_lan_open(struct ipmi_intf * intf)
|
|
|
memcpy(&s->authcode, &p->authcode_set, sizeof(s->authcode));
|
|
|
s->addrlen = sizeof(s->addr);
|
|
|
if (getsockname(intf->fd, (struct sockaddr *)&s->addr, &s->addrlen)) {
|
|
|
+ printf("---> getsockname error!\n");
|
|
|
goto fail;
|
|
|
}
|
|
|
|
|
|
/* try to open session */
|
|
|
rc = ipmi_lan_activate_session(intf);
|
|
|
if (rc < 0) {
|
|
|
+ printf("---> active session error!\n");
|
|
|
goto fail;
|
|
|
}
|
|
|
|
|
@@ -2087,10 +2090,11 @@ ipmi_lan_open(struct ipmi_intf * intf)
|
|
|
|
|
|
/* now allow bridging */
|
|
|
bridge_possible = 1;
|
|
|
+ printf("---> return intf->fd %d\n", intf->fd);
|
|
|
return intf->fd;
|
|
|
|
|
|
fail:
|
|
|
- lprintf(LOG_ERR, "Error: Unable to establish IPMI v1.5 / RMCP session");
|
|
|
+ printf( "Error: Unable to establish IPMI v1.5 / RMCP session");
|
|
|
intf->close(intf);
|
|
|
return -1;
|
|
|
}
|