Hi Jan, Very nice -- docs and everything! :-)
This patch looks great and the new functionality is nice -- I've committed it to cvs. If anyone finds an issue with it that I missed, please let me know. Thank you! Carol On Thu, 2009-01-08 at 14:31 +0100, Jan Safranek wrote: > Currently it's possible to enable/disable access to channel using > ipmitool. But there is no way how to query for current setting. > > Attached patch adds new 'ipmitool sol payload status' command, using > "Get User Access Command" from IPMI 2.0 spec. > > Jan > plain text document attachment (ipmitool-1.8.10-payload-status.patch) > Implement "Get User Access Command" to allow admins to show current > status of an user. > > Usage: > $ ipmitool sol payload status 1 2 > User 2 on channel 1 is enabled > > > Author: Jan Safranek <jsafr...@redhat.com> > > Index: doc/ipmitool.1 > =================================================================== > RCS file: /cvsroot/ipmitool/ipmitool/doc/ipmitool.1,v > retrieving revision 1.35 > diff -u -r1.35 ipmitool.1 > --- doc/ipmitool.1 2 Jun 2008 03:24:00 -0000 1.35 > +++ doc/ipmitool.1 8 Jan 2009 13:17:12 -0000 > @@ -1875,10 +1875,10 @@ > the specified channel. If no channel is given, it will display > SOL configuration data for the currently used channel. > .TP > -\fIpayload\fP <\fIenable\fP | \fIdisable\fP> <\fBchannel number\fR> > <\fBuserid\fR> > +\fIpayload\fP <\fIenable\fP | \fIdisable\fP | \fIstatus\fP> <\fBchannel > number\fR> <\fBuserid\fR> > .br > > -Enable or disable SOL payload for the user on the specified channel. > +Enable, disable or show status of SOL payload for the user on the specified > channel. > .TP > \fIset\fP <\fBparameter\fR> <\fBvalue\fR> [<\fBchannel\fR>] > .br > Index: lib/ipmi_sol.c > =================================================================== > RCS file: /cvsroot/ipmitool/ipmitool/lib/ipmi_sol.c,v > retrieving revision 1.52 > diff -u -r1.52 ipmi_sol.c > --- lib/ipmi_sol.c 29 Sep 2008 18:24:02 -0000 1.52 > +++ lib/ipmi_sol.c 8 Jan 2009 13:17:12 -0000 > @@ -143,6 +143,51 @@ > return -1; > } > > +int > +ipmi_sol_payload_access_status(struct ipmi_intf * intf, > + uint8_t channel, > + uint8_t userid) > +{ > + struct ipmi_rq req; > + struct ipmi_rs *rsp; > + uint8_t data[2]; > + > + memset(&req, 0, sizeof(req)); > + req.msg.netfn = IPMI_NETFN_APP; > + req.msg.cmd = IPMI_GET_USER_PAYLOAD_ACCESS; > + req.msg.data = data; > + req.msg.data_len = sizeof(data); > + > + data[0] = channel & 0xf; /* channel */ > + data[1] = userid & 0x3f; /* user id */ > + rsp = intf->sendrecv(intf, &req); > + > + if (rsp == NULL) { > + lprintf(LOG_ERR, "Error: Unexpected data length (%d) received", > + rsp->data_len); > + return -1; > + } > + > + switch(rsp->ccode) { > + case 0x00: > + if (rsp->data_len != 4) { > + lprintf(LOG_ERR, "Error parsing SOL payload > status for user %d on channel %d", > + userid, channel); > + return -1; > + } > + > + printf("User %d on channel %d is %sabled\n", > + userid, channel, (rsp->data[0] & 0x02) ? > "en":"dis"); > + return 0; > + > + default: > + lprintf(LOG_ERR, "Error getting SOL payload status for > user %d on channel %d: %s", > + userid, channel, > + val2str(rsp->ccode, completion_code_vals)); > + return -1; > + } > +} > + > > /* > * ipmi_get_sol_info > @@ -1771,7 +1816,7 @@ > { > lprintf(LOG_NOTICE, "SOL Commands: info [<channel number>]"); > lprintf(LOG_NOTICE, " set <parameter> <value> [channel]"); > - lprintf(LOG_NOTICE, " payload <enable|disable> [channel] > [userid]"); > + lprintf(LOG_NOTICE, " payload <enable|disable|status> > [channel] [userid]"); > lprintf(LOG_NOTICE, " activate > [<usesolforkeepalive|nokeepalive>]"); > lprintf(LOG_NOTICE, " deactivate"); > lprintf(LOG_NOTICE, " looptest [<loop times>] [<loop > interval(in ms)>]"); > @@ -1846,15 +1891,7 @@ > uint8_t userid = 1; > int enable = -1; > > - if (!strncmp(argv[1], "enable", 6)) > - { > - enable = 1; > - } > - else if (!strncmp(argv[1], "disable", 7)) > - { > - enable = 0; > - } > - else > + if (argc == 1 || argc > 4) > { > print_sol_usage(); > return -1; > @@ -1869,6 +1906,24 @@ > userid = (uint8_t)strtol(argv[3], NULL, 0); > } > > + if (!strncmp(argv[1], "enable", 6)) > + { > + enable = 1; > + } > + else if (!strncmp(argv[1], "disable", 7)) > + { > + enable = 0; > + } > + else if (!strncmp(argv[1], "status", 6)) > + { > + return ipmi_sol_payload_access_status(intf, channel, > userid); > + } > + else > + { > + print_sol_usage(); > + return -1; > + } > + > retval = ipmi_sol_payload_access(intf, channel, userid, enable); > } > > ------------------------------------------------------------------------------ > Check out the new SourceForge.net Marketplace. > It is the best place to buy or sell services for > just about anything Open Source. > http://p.sf.net/sfu/Xq1LFB > _______________________________________________ Ipmitool-devel mailing list > Ipmitool-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ipmitool-devel ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Ipmitool-devel mailing list Ipmitool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipmitool-devel