mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
ID:368 - Fix handling of bridging-related parameters
1. my_addr is not set if an interface does not expose set_my_addr. Currently, the only interface which requires some special handling to set my_addr is OpenIPMI. But changing of my_addr still needed for other interfaces. So, we must set it regardless of presence of set_my_addr(). 2. Since set_my_addr() for serial interfaces only sets my_addr, we remove them as redundand. 3. Bridging is enabled when either trasit_addr or target_addr is not 0. Currentle transit_addr is not regarded. 4. target_lun does not relate to briging. It is needed for "raw" command. We set it regardles of bridging. Commit for: Dmitry Bazhenov
This commit is contained in:
parent
fb6e311d27
commit
c87aa0b96a
@ -940,36 +940,39 @@ ipmi_main(int argc, char ** argv,
|
||||
* used for open, Set the discovered IPMB address as my address if the
|
||||
* interface supports it.
|
||||
*/
|
||||
if (addr != 0 && addr != ipmi_main_intf->my_addr &&
|
||||
ipmi_main_intf->set_my_addr) {
|
||||
if (addr != 0 && addr != ipmi_main_intf->my_addr) {
|
||||
if (ipmi_main_intf->set_my_addr) {
|
||||
/*
|
||||
* Only set the interface address on interfaces which support
|
||||
* it
|
||||
* Some interfaces need special handling
|
||||
* when changing local address
|
||||
*/
|
||||
(void)ipmi_main_intf->set_my_addr(ipmi_main_intf, addr);
|
||||
}
|
||||
|
||||
/* If bridging addresses are specified, handle them */
|
||||
if (target_addr > 0) {
|
||||
ipmi_main_intf->target_addr = target_addr;
|
||||
ipmi_main_intf->target_lun = target_lun ;
|
||||
ipmi_main_intf->target_channel = target_channel ;
|
||||
/* set local address */
|
||||
ipmi_main_intf->my_addr = addr;
|
||||
}
|
||||
if (transit_addr > 0) {
|
||||
|
||||
ipmi_main_intf->target_addr = ipmi_main_intf->my_addr;
|
||||
|
||||
/* If bridging addresses are specified, handle them */
|
||||
if (transit_addr > 0 || target_addr > 0) {
|
||||
/* sanity check, transit makes no sense without a target */
|
||||
if ((transit_addr != 0 || transit_channel != 0) &&
|
||||
ipmi_main_intf->target_addr == 0) {
|
||||
target_addr == 0) {
|
||||
lprintf(LOG_ERR,
|
||||
"Transit address/channel %#x/%#x ignored. "
|
||||
"Target address must be specified!",
|
||||
transit_addr, transit_channel);
|
||||
goto out_free;
|
||||
}
|
||||
ipmi_main_intf->target_addr = target_addr;
|
||||
ipmi_main_intf->target_channel = target_channel ;
|
||||
|
||||
ipmi_main_intf->transit_addr = transit_addr;
|
||||
ipmi_main_intf->transit_channel = transit_channel;
|
||||
}
|
||||
if (ipmi_main_intf->target_addr > 0) {
|
||||
|
||||
|
||||
/* must be admin level to do this over lan */
|
||||
ipmi_intf_session_set_privlvl(ipmi_main_intf, IPMI_SESSION_PRIV_ADMIN);
|
||||
/* Get the ipmb address of the targeted entity */
|
||||
@ -986,6 +989,9 @@ ipmi_main(int argc, char ** argv,
|
||||
}
|
||||
}
|
||||
|
||||
/* set target LUN (for RAW command) */
|
||||
ipmi_main_intf->target_lun = target_lun ;
|
||||
|
||||
lprintf(LOG_DEBUG, "Interface address: my_addr %#x "
|
||||
"transit %#x:%#x target %#x:%#x "
|
||||
"ipmb_target %#x\n",
|
||||
|
@ -998,13 +998,6 @@ serial_bm_send_request(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
serial_bm_set_my_addr(struct ipmi_intf * intf, uint8_t addr)
|
||||
{
|
||||
intf->my_addr = addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Serial BM interface
|
||||
*/
|
||||
@ -1015,5 +1008,4 @@ struct ipmi_intf ipmi_serial_bm_intf = {
|
||||
.open = serial_bm_open,
|
||||
.close = serial_bm_close,
|
||||
.sendrecv = serial_bm_send_request,
|
||||
.set_my_addr = serial_bm_set_my_addr
|
||||
};
|
||||
|
@ -886,13 +886,7 @@ ipmi_serial_term_setup(struct ipmi_intf * intf)
|
||||
/* setup default LAN maximum request and response sizes */
|
||||
intf->max_request_data_size = IPMI_SERIAL_MAX_RQ_SIZE;
|
||||
intf->max_response_data_size = IPMI_SERIAL_MAX_RS_SIZE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ipmi_serial_term_set_my_addr(struct ipmi_intf * intf, uint8_t addr)
|
||||
{
|
||||
intf->my_addr = addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -903,5 +897,4 @@ struct ipmi_intf ipmi_serial_term_intf = {
|
||||
.open = ipmi_serial_term_open,
|
||||
.close = ipmi_serial_term_close,
|
||||
.sendrecv = ipmi_serial_term_send_cmd,
|
||||
.set_my_addr = ipmi_serial_term_set_my_addr
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user