fix unlock behavior to always do set-complete

This commit is contained in:
Duncan Laurie
2006-09-11 16:14:01 +00:00
parent f61c3acbaf
commit e672819a9d

View File

@ -272,7 +272,7 @@ __set_lan_param(struct ipmi_intf * intf, uint8_t chan,
struct ipmi_rs * rsp; struct ipmi_rs * rsp;
struct ipmi_rq req; struct ipmi_rq req;
uint8_t msg_data[32]; uint8_t msg_data[32];
if (param < 0) if (param < 0)
return -1; return -1;
@ -394,9 +394,10 @@ ipmi_lanp_unlock(struct ipmi_intf * intf, uint8_t chan)
rc = __set_lan_param(intf, chan, IPMI_LANP_SET_IN_PROGRESS, &val, 1, 0); rc = __set_lan_param(intf, chan, IPMI_LANP_SET_IN_PROGRESS, &val, 1, 0);
if (rc < 0) { if (rc < 0) {
lprintf(LOG_DEBUG, "LAN Parameter Commit not supported"); lprintf(LOG_DEBUG, "LAN Parameter Commit not supported");
val = IPMI_LANP_WRITE_UNLOCK;
__set_lan_param(intf, chan, IPMI_LANP_SET_IN_PROGRESS, &val, 0, 0);
} }
val = IPMI_LANP_WRITE_UNLOCK;
__set_lan_param(intf, chan, IPMI_LANP_SET_IN_PROGRESS, &val, 1, 0);
} }
/* set_lan_param - Wrap LAN parameter write with set-in-progress lock /* set_lan_param - Wrap LAN parameter write with set-in-progress lock
@ -448,7 +449,7 @@ lan_set_arp_interval(struct ipmi_intf * intf,
struct lan_param *lp; struct lan_param *lp;
uint8_t interval; uint8_t interval;
int rc = 0; int rc = 0;
lp = get_lan_param(intf, chan, IPMI_LANP_GRAT_ARP); lp = get_lan_param(intf, chan, IPMI_LANP_GRAT_ARP);
if (lp == NULL) if (lp == NULL)
return -1; return -1;
@ -520,7 +521,7 @@ lan_set_arp_respond(struct ipmi_intf * intf,
static char priv_level_to_char(unsigned char priv_level) static char priv_level_to_char(unsigned char priv_level)
{ {
char ret = 'X'; char ret = 'X';
switch (priv_level) switch (priv_level)
{ {
case IPMI_SESSION_PRIV_CALLBACK: case IPMI_SESSION_PRIV_CALLBACK:
@ -801,7 +802,7 @@ ipmi_lan_print(struct ipmi_intf * intf, uint8_t chan)
priv_level_to_char(p->data[7] & 0x0F), priv_level_to_char(p->data[7] & 0x0F),
priv_level_to_char(p->data[7] >> 4), priv_level_to_char(p->data[7] >> 4),
priv_level_to_char(p->data[8] & 0x0F)); priv_level_to_char(p->data[8] & 0x0F));
/* Now print a legend */ /* Now print a legend */
printf("%-24s: %s\n", "", " X=Cipher Suite Unused"); printf("%-24s: %s\n", "", " X=Cipher Suite Unused");
printf("%-24s: %s\n", "", " c=CALLBACK"); printf("%-24s: %s\n", "", " c=CALLBACK");
@ -870,7 +871,7 @@ ipmi_lan_set_auth(struct ipmi_intf * intf, uint8_t chan, char * level, char * ty
data[2] = authtype; data[2] = authtype;
else if (strncasecmp(p, "admin", 5) == 0) else if (strncasecmp(p, "admin", 5) == 0)
data[3] = authtype; data[3] = authtype;
else else
lprintf(LOG_WARNING, "Invalid authentication level: %s", p); lprintf(LOG_WARNING, "Invalid authentication level: %s", p);
p = strchr(p, ','); p = strchr(p, ',');
if (p) if (p)
@ -1018,7 +1019,7 @@ ipmi_set_channel_access(struct ipmi_intf * intf, uint8_t channel, uint8_t enable
if (enable != 0) if (enable != 0)
rqdata[1] |= 0x2; /* set always available if enable is set */ rqdata[1] |= 0x2; /* set always available if enable is set */
rqdata[2] = 0x44; /* set channel privilege limit to ADMIN */ rqdata[2] = 0x44; /* set channel privilege limit to ADMIN */
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Set Channel Access for channel %d", channel); lprintf(LOG_ERR, "Unable to Set Channel Access for channel %d", channel);
@ -1068,7 +1069,7 @@ ipmi_set_user_access(struct ipmi_intf * intf, uint8_t channel, uint8_t userid)
rqdata[1] = userid & 0x3f; rqdata[1] = userid & 0x3f;
rqdata[2] = 0x4; rqdata[2] = 0x4;
rqdata[3] = 0; rqdata[3] = 0;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP; req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = 0x43; req.msg.cmd = 0x43;
@ -1164,7 +1165,7 @@ get_cmdline_cipher_suite_priv_data(char * arg, uint8_t * buf)
ret = -1; ret = -1;
break; break;
} }
if (ret != 0) if (ret != 0)
break; break;
else else
@ -1181,7 +1182,7 @@ get_cmdline_cipher_suite_priv_data(char * arg, uint8_t * buf)
} }
} }
} }
return ret; return ret;
} }
@ -1950,18 +1951,16 @@ ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return 0; return 0;
} }
if (verbose > 1) if (verbose > 1) {
{
uint8_t counter; uint8_t counter;
printf("--- Rx Stats ---\n"); printf("--- Rx Stats ---\n");
for(counter=0;counter<18;counter+=2) for (counter=0; counter<18; counter+=2) {
{ printf("%02X", *(rsp->data + counter));
printf("%02X", *(rsp->data + counter)); printf(" %02X - ", *(rsp->data + counter+1));
printf(" %02X - ", *(rsp->data + counter+1)); }
} printf("\n");
printf("\n"); }
}
statsTemp = ((*(rsp->data + 0)) << 8) | (*(rsp->data + 1)); statsTemp = ((*(rsp->data + 0)) << 8) | (*(rsp->data + 1));
printf("IP Rx Packet : %d\n", statsTemp); printf("IP Rx Packet : %d\n", statsTemp);
@ -2099,7 +2098,7 @@ ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
} }
else if (argc > 2) else if (argc > 2)
chan = (uint8_t)strtol(argv[2], NULL, 0); chan = (uint8_t)strtol(argv[2], NULL, 0);
if (chan < 2 || chan > IPMI_CHANNEL_NUMBER_MAX) if (chan < 2 || chan > IPMI_CHANNEL_NUMBER_MAX)
{ {
lprintf(LOG_ERR, "Invalid channel: %d", chan); lprintf(LOG_ERR, "Invalid channel: %d", chan);