- Fix lan set access command to use value already save within parameters for PEF and authentication

- This was causing problem to implementation where PEF alerting is not supported.
- Enable PEF was hard coded.
This commit is contained in:
Jean-Michel Audet 2006-09-21 14:03:42 +00:00
parent 34b21d2d57
commit 9fcde40c97

View File

@ -1004,18 +1004,46 @@ ipmi_set_channel_access(struct ipmi_intf * intf, uint8_t channel, uint8_t enable
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t rqdata[3];
uint8_t byteEnable;
memset(&req, 0, sizeof(req));
/* RETREIVE VALUE IN NVRAM */
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = 0x40;
req.msg.cmd = 0x41; /* Get Channel Access Command */
req.msg.data = rqdata;
req.msg.data_len = 2;
memset(rqdata, 0, 2);
rqdata[0] = channel & 0xf;
rqdata[1] = 0x40; /* retreive NV */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get Channel Access for channel %d", channel);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Set Channel Access for channel %d failed: %s",
channel, val2str(rsp->ccode, completion_code_vals));
return -1;
}
else
{
byteEnable = *(rsp->data + 0);
}
/* SAVE TO NVRAM */
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = 0x40; /* Set Channel Access Command */
req.msg.data = rqdata;
req.msg.data_len = 3;
/* SAVE TO NVRAM */
memset(rqdata, 0, 3);
rqdata[0] = channel & 0xf;
rqdata[1] = 0x40; /* set pef enabled, per-msg auth enabled */
rqdata[1] = 0x40 | (byteEnable & 0x38); /* use previously set values */
if (enable != 0)
rqdata[1] |= 0x2; /* set always available if enable is set */
rqdata[2] = 0x44; /* set channel privilege limit to ADMIN */
@ -1031,10 +1059,42 @@ ipmi_set_channel_access(struct ipmi_intf * intf, uint8_t channel, uint8_t enable
return -1;
}
/* RETREIVE VALUE IN NVRAM */
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = 0x41; /* Get Channel Access Command */
req.msg.data = rqdata;
req.msg.data_len = 2;
memset(rqdata, 0, 2);
rqdata[0] = channel & 0xf;
rqdata[1] = 0x80; /* retreive NV */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get Channel Access for channel %d", channel);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Set Channel Access for channel %d failed: %s",
channel, val2str(rsp->ccode, completion_code_vals));
return -1;
}
else
{
byteEnable = *(rsp->data + 0);
}
/* SAVE TO CURRENT */
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = 0x40; /* Set Channel Access Command */
req.msg.data = rqdata;
req.msg.data_len = 3;
memset(rqdata, 0, 3);
rqdata[0] = channel & 0xf;
rqdata[1] = 0x80; /* set pef enabled, per-msg auth enabled */
rqdata[1] = 0x80 | (byteEnable & 0x38); /* use previously set values */
if (enable != 0)
rqdata[1] |= 0x2; /* set always available if enable is set */
rqdata[2] = 0x84; /* set channel privilege limit to ADMIN */