OpenIPMI-2.0.27/0000755000175000017500000000000013437611467010177 500000000000000OpenIPMI-2.0.27/OpenIPMIutils.pc.in0000644000175000017500000000036012002623311013462 00000000000000prefix=@prefix@ exec_prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ Name: OpenIPMIutils Description: Utilities used by the OpenIPMI library. Version: @VERSION@ Requires: Libs: -L${libdir} -lOpenIPMIutils Cflags: -I${includedir} OpenIPMI-2.0.27/OpenIPMIposix.pc.in0000644000175000017500000000041612002623311013466 00000000000000prefix=@prefix@ exec_prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ Name: OpenIPMIposix Description: POSIX unthreaded OS handler for OpenIPMI Version: @VERSION@ Requires: OpenIPMIutils Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMIposix Cflags: -I${includedir} OpenIPMI-2.0.27/lanserv/0000755000175000017500000000000013437611466011650 500000000000000OpenIPMI-2.0.27/lanserv/ipmi_lan.50000664000175000017500000002415713075744321013454 00000000000000.TH ipmi_lan 5 06/26/12 OpenIPMI "IPMI LAN Interface config file" .SH NAME ipmi/lan.conf \- IPMI LAN Interface config file .SH SYNOPSIS .B /etc/ipmi/lan.conf .SH DESCRIPTION The .B ipmi_sim and .B ipmilan commands are configured using this configuration file. .SH CONFIGURATION ITEMS The following fields are used in many commands: .I "boolean" May be "\fBtrue\fP", "\fBfalse\fP", "\fBon\fP" or "\fBoff\fP". .I "priv" An IPMI privilege level. This may be "\fBcallback\fP", "\fBuser\fP", "\fBoperator\fP", or "\fBadmin\fP". .I "auth" An IPMI authorization type. This may be "\fBnone\fP" for no authentication, "\fBstraight\fP" for straight, in-the-clear password authentication, "\fBmd2\fP" for use MD2 message digest authentication, or "\fBmd5\fP" for using MD5 message digest authentication. .SH FILE STRUCTURE Blank lines and lines starting with `#' are ignored. .PP The following commands are allowed the configuration file: .TP \fBname\fP \fI"name"\fP Set a name for the BMC. This will control other things, like the default value of the ipmi_sim startup command file and the place where persistent data is stored. .TP \fBuser\fP \fIusernum\fP \fIenabled\fP \fIusername\fP \fIpassword\fP \fImax-priv\fP \fImax-session\fP .I usernum specifies the user number for the user. Note that user number \fB0\fP is invalid, and user number \fB1\fP is the special "anonymous" user, whose username is ignored. This value may be up to \fB63\fP, the maximum possible IPMI user. If you want anonymous access, you .B must have a user number \fB1\fI. .I enabled is a boolean that specified whether the user is enabled or not. .I username specifies the name of the user, specified as a name. .I password specifies the password of the user, specified as a name. .I max-priv specifies the maximum privilege level allowed for the user. .I max.sessions specifies the maximum number of session the user may open. .TP \fBstartcmd\fP \fI"cmd"\fP specifies a command to execute when a power on is requested. This lets a virtual machine be started that can then connect back to the simulator. The simulator does management of the process here, and the power on state of the process depends on if the process exists or not. If a poweroff is requested, if the process is connected to a VM serial interface, a graceful shutdown is first requested. If the process does not terminate in a specified amount of time, a SIGTERM is sent to the process. The SIGTERM is sent immediately if there is no connection. If the process doesn't go way in another specified amount of time, a SIGKILL is sent. .TP \fBstartnow\fPtrue|false\fI\fP If true, start the startcmd at the startup of the simulator. Otherwise wait until a poweron is issued. .TP \fBpoweroff_wait\fP \fIseconds\fP specifies the amount of time to wait for the startcmd to do a graceful shutdown on a powerdown request. The simulator will send a request to the target, wait this amount of time, and then do a SIGTERM kill on the process. If this is zero, a SIGTERM will not be done (nor will a SIGKILL). Note that if the simulator does not have a connection to the VM, the graceful shutdown is skipped and a SIGTERM is done immediately. Default time is 60 seconds. .TP \fBkill_wait\fP \fIseconds\fP specifies the amount of time to wait for SIGTERM to kill the process. If the process does not terminate in this period of time, send a SIGKILL kill. If this is zero, don't send the SIGKILL. Default time is 20 seconds. .TP \fBconsole\fP \fIaddress\fP \fIport\fP specifies that a console port be opened at the given address and port. You can telnet to the console and execute emulation commands. Note that this is a pretty huge security hole, it should only be used for debugging in a captive environment. .TP \fBserial\fP \fIchannel\fP \fIaddr\fP \fIport\fP [\fIoption\fP [\fIoption\fP [...]]] .I channel specifies the channel number or type. This may be \fBkcs\fP, \fBsmic\fP, or \fBbt\fP or it may be 15. Currently, only the system interface channel (channel 15) is supported for serial interfaces, if the others are specified it is channel 15 and the given interface is reported in channel configuration commands. .I addr specifies the IP address to listen on for connections. .I port specifies the port to listen on for connections. Valid options are: .I codec name specifies which codec to use on the serial port. Valid options are: \fBTerminalMode\fP, \fBDirect\fP, \fBRadisysAscii\fP, and \fBVM\fP. The first three are implementations of IPMI serial interfaces on certain systems and might be used for simulations of that system. The \fBVM\fP is probably the most interesting; it is designed to be used with a virtual machine like qemu. .I oem name specified implementation of some OEM custom commands and options on the interface. Valid options oare \fBPigeonPoint\fP and \fBRadisys\fP. .I attn c1[,c2[...]] specifies a list of characters, separated by commas, to use as the attention character on the interface. Generally the default is correct. The characters are specified as decimal, octal, or hex digits in C style. .I ipmb addr specifies the IPMI address of the interface. The default, 0x20, is usually correct, but when emulating ATCA systems this might be required. .TP \fBsol\fP \fIdevice\fP \fIdefault_baud\fP [\fIhistory=size[,backupfile=filename]\fP] [\fIhistoryfru=frunum\fP] Allow a Serial Over LAN (SOL) connection to the given device. This will be over interface 1 for the MC. .I device is the full path to the device name. It can also be in the form "tcp:address:port" or "telnet:address:port" to do connections over tcp (without or with telnet processing). This is useful for providing SOL access to qemu ports. .I default_baud sets the initial default baud rate to use. This is overriden by the persistent SOL settings. .I history creates a history device on SOL interface 2. The size is the size of the buffer. Data from the device is stored in the history buffer all the time. Connecting to SOL interface 2 will cause the full history buffer to be dumped. If .I backupfile is specified, then the history is made persistent. However, it is only stored when a catchable signal or normal shutdown is done, so a poweroff or fatal signal will cause the data to be lost. .I historyfru makes the history available via the given FRU number on the MC. Note that if the connection fails to come up, the simulator will continue to try to connect. This way you can fix UDP serial ports or qemu sessions and it will automatically reconnect. .TP \fBloadlib\fP \fI"module"\fP [\fI"options"\fP] Load the given shared object into the program. .I "module" is the full path to the module. It must be in quotes. .I "options" is an optional string in quotes that passes options to the module. The contents of the string are not specified, the module defines that. The module may have a number of functions that are called: .I ipmi_sim_module_print_version(sys_data_t *sys, char *options) is called when ipmi_sim is started with the version print option. This way the versions of all loaded modules may be printed. The module should print it's version. You must provide this function. .I ipmi_sim_module_init(sys_data_t *sys, char *options) is called after the configuration file is read and before any other initialization is done. The module should do most of its initialization here. You must provide this function. .I ipmi_sim_module_post_init(sys_data_t *sys) is called after ipmi_sim has finished initializing. This function is optional. .P The .I sys parameter is used for most functions interfacing to the main ipmi_sim code, like logging, timers, and a few of the MC calls. The contents are opaque to the module. .TP \fBstartlan\fP \fIchannel\fP Starts a LAN configuration area. This specifies the settings for a LAN connection using the given channel. This may be specified more than once in a file to support multiple LAN connections. Commands following this, up to \fBendlan\fP, are LAN-specific commands listed below. .I channel specifies the channel to set the LAN configuration for. .SH LAN CONFIGURATION COMMANDS The following commands are only valid inside a \fBstartlen\fP area. .TP \fBaddr\fP \fIIP-address\fP [\fIUDP-port\fP] .I IP-address specifies the IP address to use for an IP port. Up to 4 addresses may be specified. If no address is specified, it defaults to one port at \fB0.0.0.0\fP (for every address on the machine) at port \fB623\fP. .I UDP-port specifies an optional port to listen on. It defaults to \fB623\fP (the standard port). .TP .BI PEF_alerting\ boolean Turn PEF alerting on or off (not currently supported). .TP .BI per_msg_auth\ boolean Turn per-message authentication on or off. .TP .BI priv_limit\ priv The maximum privilege allowed on this interface. .TP \fBallowed_auths_callback\fP [\fIauth\fP [\fIauth\fP [...]]] .I auth specifies allowed authorization levels for the callback privilege level. Only the levels specified on this line are allowed for the authorization level. If this line is not present, callback authorization cannot be used. .TP \fBallowed_auths_user\fP [\fIauth\fP [\fIauth\fP [...]]] .I auth specifies allowed authorization levels for the user privilege level. Only the levels specified on this line are allowed for the authorization level. If this line is not present, user authorization cannot be used. .TP \fBallowed_auths_operator\fP [\fIauth\fP [\fIauth\fP [...]]] .I auth specifies allowed authorization levels for the operator privilege level. Only the levels specified on this line are allowed for the authorization level. If this line is not present, operator authorization cannot be used. .TP \fBallowed_auths_admin\fP [\fIauth\fP [\fIauth\fP [...]]] .I auth specifies allowed authorization levels for the admin privilege level. Only the levels specified on this line are allowed for the authorization level. If this line is not present, user authorization cannot be used. .TP \fBguid\fP \fIname\fP Allows the 16-byte GUID for the IPMI LAN connection to be specified. If this is not specified, then the GUID command is not supported. .SH "FILES" /etc/ipmi_lan.conf .SH "SEE ALSO" .BR ipmilan (8), ipmi_sim (1) .SH "KNOWN PROBLEMS" IPMI is unnecessarily complicated. .SH AUTHOR .PP Corey Minyard OpenIPMI-2.0.27/lanserv/ipmisim1.sdrs0000664000175000017500000000460513107042442014206 00000000000000 sdr type 18 device_slave_address 0x20 device_channel_number 0 chassis true ipmb_event_gen false ipmb_event_recv false fru_inventory true sel true sdr true sensor true entity_id system_board entity_instance 1 id_string "IPMI sim1" endsdr # Watchdog timer sdr type 3 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 0 entity_id system_board entity_instance 1 sensor_type Watchdog_2 event_reading_type_code 0x6f id_string "watchdog" endsdr # Temperature sensor on the main board sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 1 entity_id system_board entity_instance 1 sensor_type Temperature init_scanning true init_sensor_type true default_sensor_scan_on true event_reading_type_code 1 analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit degrees_C modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 id_string "MBTemp" endsdr # Temperature sensor on the sub board sdr type 1 sensor_owner_id 0x30 sensor_owner_lun 0 channel_number 0 sensor_number 1 entity_id system_board entity_instance 1 sensor_type Temperature init_scanning true init_sensor_type true default_sensor_scan_on true event_reading_type_code 1 analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit degrees_C modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 id_string "SubTemp" endsdr # A presence sensor for memory module 1 sdr type 2 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 2 entity_id memory_module entity_instance 1 sensor_type Entity_Presence event_reading_type_code 0x6f event0_state_ret true assert_event0 true deassert_event0 true event1_state_ret true assert_event1 true deassert_event1 true id_string "mm1pres" endsdr # A FRU device locator for memory module 2 sdr type 0x11 device_access_address 0x30 fru_device_address 3 logical_fru 1 lun 0 device_type 0x10 device_type_modifier 0 fru_entity_id memory_module fru_entity_instance 2 id_string "mm2frudev" endsdrOpenIPMI-2.0.27/lanserv/bmc_app.c0000664000175000017500000006776313160062145013345 00000000000000/* * bmc_app.c * * MontaVista IPMI code for emulating a MC. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2012 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include "bmc.h" #include #include #include #include #include #include #include static void handle_get_device_id(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { memset(rdata, 0, 12); rdata[1] = mc->device_id; rdata[2] = ((mc->has_device_sdrs << 0x7) | (mc->device_revision & 0xf)); rdata[3] = mc->major_fw_rev & 0x7f; rdata[4] = mc->minor_fw_rev; rdata[5] = 0x02; rdata[6] = mc->device_support; memcpy(rdata+7, mc->mfg_id, 3); memcpy(rdata+10, mc->product_id, 2); memcpy(rdata+12, mc->aux_fw_rev, 4); *rdata_len = 16; } void ipmi_mc_set_dev_revision(lmc_data_t *mc, unsigned char dev_revision) { mc->device_revision = dev_revision; } void ipmi_mc_set_fw_revision(lmc_data_t *mc, unsigned char fw_revision_major, unsigned char fw_revision_minor) { mc->major_fw_rev = fw_revision_major; mc->minor_fw_rev = fw_revision_minor; } void ipmi_mc_set_aux_fw_revision(lmc_data_t *mc, unsigned char aux_fw_revision[4]) { memcpy(mc->aux_fw_rev, aux_fw_revision, 4); } void ipmi_mc_setfw_versions() { } /* Returns tenths of a second (deciseconds). */ static long diff_timeval_dc(struct timeval *tv1, struct timeval *tv2) { long rv; rv = (tv1->tv_sec - tv2->tv_sec) * 10; rv += (tv1->tv_usec - tv2->tv_usec + 50000) / 100000; return rv; } static void add_timeval(struct timeval *tv1, struct timeval *tv2) { tv1->tv_sec += tv2->tv_sec; tv1->tv_usec += tv2->tv_usec; while (tv1->tv_usec >= 1000000) { tv1->tv_usec -= 1000000; tv1->tv_sec += 1; } while (tv1->tv_usec <= 0) { tv1->tv_usec += 1000000; tv1->tv_sec -= 1; } } static void sub_timeval(struct timeval *tv1, struct timeval *tv2) { tv1->tv_sec -= tv2->tv_sec; tv1->tv_usec -= tv2->tv_usec; while (tv1->tv_usec >= 1000000) { tv1->tv_usec -= 1000000; tv1->tv_sec += 1; } while (tv1->tv_usec <= 0) { tv1->tv_usec += 1000000; tv1->tv_sec -= 1; } } static void handle_get_watchdog_timer(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { long v = 0; static struct timeval zero_tv = {0, 0}; if (!mc->watchdog_timer) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } if (mc->watchdog_running) { struct timeval now; mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &now); v = diff_timeval_dc(&mc->watchdog_expiry, &now); if (v < 0) v = 0; } rdata[0] = 0; rdata[1] = mc->watchdog_use; rdata[2] = mc->watchdog_action; rdata[3] = mc->watchdog_pretimeout; rdata[4] = mc->watchdog_expired; ipmi_set_uint16(rdata + 7, v); v = diff_timeval_dc(&mc->watchdog_time, &zero_tv); ipmi_set_uint16(rdata + 5, v); *rdata_len = 7; } void watchdog_timeout(void *cb_data) { lmc_data_t *mc = cb_data; channel_t *bchan = mc->channels[15]; sensor_t *sens = mc->sensors[0][WATCHDOG_SENSOR_NUM]; if (!mc->watchdog_running) goto out; if( !sens ) { // NOTE(noelbk): The watchdog sensor should have been defined // earlier, but don't SEGFAULT if it isn't goto out; } if (! mc->watchdog_preaction_ran) { struct timeval tv, now; switch (IPMI_MC_WATCHDOG_GET_PRE_ACTION(mc)) { case IPMI_MC_WATCHDOG_PRE_NMI: mc->msg_flags |= IPMI_MC_MSG_FLAG_WATCHDOG_TIMEOUT_MASK; bchan->hw_op(bchan, HW_OP_SEND_NMI); set_sensor_bit(mc, sens, 8, 1, 0xc8, (2 << 4) | 0xf, 0xff, 1); break; case IPMI_MC_WATCHDOG_PRE_MSG_INT: mc->msg_flags |= IPMI_MC_MSG_FLAG_WATCHDOG_TIMEOUT_MASK; if (bchan->set_atn && !IPMI_MC_MSG_FLAG_EVT_BUF_FULL_SET(mc)) bchan->set_atn(bchan, 1, IPMI_MC_MSG_INTS_ON(mc)); set_sensor_bit(mc, sens, 8, 1, 0xc8, (3 << 4) | 0xf, 0xff, 1); break; default: goto do_full_expiry; } mc->watchdog_preaction_ran = 1; /* Issued the pretimeout, do the rest of the timeout now. */ mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &now); tv = mc->watchdog_expiry; sub_timeval(&tv, &now); if (tv.tv_sec == 0) { tv.tv_sec = 0; tv.tv_usec = 0; } mc->sysinfo->start_timer(mc->watchdog_timer, &tv); goto out; } do_full_expiry: mc->watchdog_running = 0; /* Stop the watchdog on a timeout */ mc->watchdog_expired |= (1 << IPMI_MC_WATCHDOG_GET_USE(mc)); switch (IPMI_MC_WATCHDOG_GET_ACTION(mc)) { case IPMI_MC_WATCHDOG_ACTION_NONE: set_sensor_bit(mc, sens, 0, 1, 0xc0, mc->watchdog_use & 0xf, 0xff, 1); break; case IPMI_MC_WATCHDOG_ACTION_RESET: set_sensor_bit(mc, sens, 1, 1, 0xc1, mc->watchdog_use & 0xf, 0xff, 1); bchan->hw_op(bchan, HW_OP_RESET); break; case IPMI_MC_WATCHDOG_ACTION_POWER_DOWN: set_sensor_bit(mc, sens, 2, 1, 0xc2, mc->watchdog_use & 0xf, 0xff, 1); bchan->hw_op(bchan, HW_OP_POWEROFF); if (bchan->stop_cmd) bchan->stop_cmd(bchan, 0); break; case IPMI_MC_WATCHDOG_ACTION_POWER_CYCLE: set_sensor_bit(mc, sens, 3, 1, 0xc3, mc->watchdog_use & 0xf, 0xff, 1); bchan->hw_op(bchan, HW_OP_POWEROFF); if (bchan->stop_cmd) bchan->stop_cmd(bchan, 0); start_poweron_timer(mc); break; } out: return; } static void do_watchdog_reset(lmc_data_t *mc) { struct timeval tv; if (IPMI_MC_WATCHDOG_GET_ACTION(mc) == IPMI_MC_WATCHDOG_ACTION_NONE) { mc->watchdog_running = 0; return; } mc->watchdog_preaction_ran = 0; /* Timeout is in tenths of a second, offset is in seconds */ mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &mc->watchdog_expiry); add_timeval(&mc->watchdog_expiry, &mc->watchdog_time); tv = mc->watchdog_time; if (IPMI_MC_WATCHDOG_GET_PRE_ACTION(mc) != IPMI_MC_WATCHDOG_PRE_NONE) { tv.tv_sec -= mc->watchdog_pretimeout; if (tv.tv_sec < 0) { tv.tv_sec = 0; tv.tv_usec = 0; } } mc->watchdog_running = 1; mc->sysinfo->start_timer(mc->watchdog_timer, &tv); } static void handle_set_watchdog_timer(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned int val; channel_t *bchan; if (!mc->watchdog_timer) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } if (check_msg_length(msg, 6, rdata, rdata_len)) return; val = msg->data[0] & 0x7; /* Validate use */ if (val == 0 || val > 5) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[0] = 0; bchan = mc->channels[15]; val = msg->data[1] & 0x7; /* Validate action */ switch (val) { case IPMI_MC_WATCHDOG_ACTION_NONE: break; case IPMI_MC_WATCHDOG_ACTION_RESET: rdata[0] = !HW_OP_CAN_RESET(bchan); break; case IPMI_MC_WATCHDOG_ACTION_POWER_DOWN: case IPMI_MC_WATCHDOG_ACTION_POWER_CYCLE: rdata[0] = !HW_OP_CAN_POWER(bchan); break; default: rdata[0] = IPMI_INVALID_DATA_FIELD_CC; } if (rdata[0]) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } val = (msg->data[1] >> 4) & 0x7; /* Validate preaction */ switch (val) { case IPMI_MC_WATCHDOG_PRE_MSG_INT: case IPMI_MC_WATCHDOG_PRE_NONE: break; case IPMI_MC_WATCHDOG_PRE_NMI: if (!HW_OP_CAN_NMI(bchan)) { /* NMI not supported. */ rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } default: /* We don't support PRE_SMI */ rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } mc->watchdog_initialized = 1; mc->watchdog_use = msg->data[0] & IPMI_MC_WATCHDOG_USE_MASK; mc->watchdog_action = msg->data[1] & IPMI_MC_WATCHDOG_ACTION_MASK; mc->watchdog_pretimeout = msg->data[2]; mc->watchdog_expired &= ~msg->data[3]; val = msg->data[4] | (((uint16_t) msg->data[5]) << 8); mc->watchdog_time.tv_sec = val / 10; mc->watchdog_time.tv_usec = (val % 10) * 100000; if (mc->watchdog_running & IPMI_MC_WATCHDOG_GET_DONT_STOP(mc)) do_watchdog_reset(mc); else mc->watchdog_running = 0; } static void handle_reset_watchdog_timer(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!mc->watchdog_timer) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } if (!mc->watchdog_initialized) { rdata[0] = 0x80; *rdata_len = 1; return; } do_watchdog_reset(mc); rdata[0] = 0x00; *rdata_len = 1; } static void handle_get_channel_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char lchan; unsigned char medium_type; unsigned char protocol_type; unsigned char session_support; unsigned char active_sessions; if (msg->len < 1) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } lchan = msg->data[0]; if (lchan == 0xe) lchan = msg->channel; else if (lchan >= IPMI_MAX_CHANNELS) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (!mc->channels[lchan]) { if (lchan == 0) { /* The IPMB channel is always there. */ medium_type = IPMI_CHANNEL_MEDIUM_IPMB; protocol_type = IPMI_CHANNEL_PROTOCOL_IPMB; session_support = IPMI_CHANNEL_SESSION_LESS; active_sessions = 0; } else { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } } else { medium_type = mc->channels[lchan]->medium_type; protocol_type = mc->channels[lchan]->protocol_type; session_support = mc->channels[lchan]->session_support; active_sessions = mc->channels[lchan]->active_sessions; } rdata[0] = 0; rdata[1] = lchan; rdata[2] = medium_type; rdata[3] = protocol_type; rdata[4] = (session_support << 6) | active_sessions; rdata[5] = 0xf2; rdata[6] = 0x1b; rdata[7] = 0x00; rdata[8] = 0x00; rdata[9] = 0x00; *rdata_len = 10; } static void handle_get_channel_access(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char lchan; channel_t *chan; uint8_t upd; if (msg->len < 2) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } lchan = msg->data[0]; if (lchan == 0xe) lchan = msg->channel; else if (lchan >= IPMI_MAX_CHANNELS) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (!mc->channels[lchan]) { if (lchan == 0) { rdata[0] = 0; rdata[1] = 0; rdata[2] = 0; *rdata_len = 3; return; } rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } chan = mc->channels[lchan]; upd = (msg->data[1] >> 6) & 0x3; rdata[0] = 0; if (upd == 2) { rdata[1] = ((chan->PEF_alerting << 5) | 0x2); rdata[2] = chan->privilege_limit; *rdata_len = 3; } else if (upd == 1) { rdata[1] = ((chan->PEF_alerting_nonv << 5) | 0x2); rdata[2] = chan->privilege_limit_nonv; *rdata_len = 3; } else { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } } static void handle_set_global_enables(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char old_evint = IPMI_MC_EVBUF_FULL_INT_ENABLED(mc); unsigned char old_int = IPMI_MC_MSG_INTS_ON(mc); channel_t *bchan; if (check_msg_length(msg, 1, rdata, rdata_len)) return; rdata[0] = 0; *rdata_len = 1; mc->global_enables = msg->data[0]; bchan = mc->channels[15]; if (!bchan || !bchan->set_atn) return; if (!old_int && IPMI_MC_MSG_INTS_ON(mc) && HW_OP_CAN_IRQ(bchan)) bchan->hw_op(bchan, HW_OP_IRQ_ENABLE); else if (old_int && !IPMI_MC_MSG_INTS_ON(mc) && HW_OP_CAN_IRQ(bchan)) bchan->hw_op(bchan, HW_OP_IRQ_DISABLE); if ((!old_evint && IPMI_MC_EVBUF_FULL_INT_ENABLED(mc) && mc->ev_in_q) || (old_int && !IPMI_MC_MSG_INTS_ON(mc) && mc->channels[15]->recv_q_tail)) bchan->set_atn(bchan, 1, IPMI_MC_EVBUF_FULL_INT_ENABLED(mc)); } static void handle_get_global_enables(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { rdata[0] = 0; rdata[1] = mc->global_enables; *rdata_len = 2; } static void cleanup_ascii_16(uint8_t *c) { int i; i = 0; while ((i < 16) && (*c != 0)) { c++; i++; } while (i < 16) { *c = 0; c++; i++; } } static void set_users_changed(lmc_data_t *mc) { mc->users_changed = 1; mc->emu->users_changed = 1; } static void handle_set_user_access(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint8_t user; uint8_t priv; uint8_t newv; int changed = 0; if (msg->len < 3) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (!mc->sysinfo) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } user = msg->data[1] & 0x3f; if (user == 0) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } priv = msg->data[2] & 0xf; /* Allow privilege level F as the "no access" privilege */ if (((priv == 0) || (priv > 4)) && (priv != 0xf)) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (msg->data[0] & 0x80) { newv = (msg->data[0] >> 4) & 1; if (newv != mc->users[user].valid) { mc->users[user].valid = newv; changed = 1; } newv = (msg->data[0] >> 5) & 1; if (newv != mc->users[user].link_auth) { mc->users[user].link_auth = newv; changed = 1; } newv = (msg->data[0] >> 6) & 1; if (newv != mc->users[user].cb_only) { mc->users[user].cb_only = newv; changed = 1; } } if (priv != mc->users[user].privilege) { mc->users[user].privilege = priv; changed = 1; } if (msg->len >= 4) { /* Got the session limit byte. */ newv = msg->data[3] & 0xf; if (newv != mc->users[user].max_sessions) { mc->users[user].max_sessions = newv; changed = 1; } } if (changed) set_users_changed(mc); rdata[0] = 0; *rdata_len = 1; } static void handle_get_user_access(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int i; uint8_t user; if (msg->len < 2) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (!mc->sysinfo) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } user = msg->data[1] & 0x3f; if (user == 0) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = MAX_USERS; /* Number of enabled users. */ rdata[2] = 0; for (i=1; i<=MAX_USERS; i++) { if (mc->users[i].valid) rdata[2]++; } /* Only fixed user name is user 1. */ rdata[3] = mc->users[1].valid; rdata[4] = ((mc->users[user].valid << 4) | (mc->users[user].link_auth << 5) | (mc->users[user].cb_only << 6) | mc->users[user].privilege); *rdata_len = 5; } static void handle_set_user_name(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint8_t user; if (msg->len < 17) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (!mc->sysinfo) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } user = msg->data[0] & 0x3f; if (user <= 1) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } memcpy(mc->users[user].username, msg->data+1, 16); cleanup_ascii_16(mc->users[user].username); set_users_changed(mc); rdata[0] = 0; *rdata_len = 1; } static void handle_get_user_name(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint8_t user; if (msg->len < 1) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (!mc->sysinfo) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } user = msg->data[0] & 0x3f; if ((user <= 1) || (user > MAX_USERS)) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[0] = 0; memcpy(rdata+1, mc->users[user].username, 16); *rdata_len = 17; } static void handle_set_user_password(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint8_t user; uint8_t op; if (msg->len < 2) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (!mc->sysinfo) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } user = msg->data[0] & 0x3f; if (user == 0) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } op = msg->data[1] & 0x3; if (op == 0) { mc->users[user].valid = 0; } else if (op == 1) { mc->users[user].valid = 1; } else { if (msg->len < 18) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (op == 2) { memcpy(mc->users[user].pw, msg->data+2, 16); } else { /* Nothing to do for test password, we accept anything. */ } } set_users_changed(mc); rdata[0] = 0; *rdata_len = 1; } static void handle_set_channel_access(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char lchan; channel_t *chan; if (msg->len < 3) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } lchan = msg->data[0]; if (lchan == 0xe) lchan = msg->channel; else if (lchan >= IPMI_MAX_CHANNELS) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (!mc->sysinfo || !mc->channels[lchan]) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } if (!mc->sysinfo || !mc->channels[lchan]) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } chan = mc->channels[lchan]; if (!chan->set_chan_access) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } chan->set_chan_access(chan, msg, rdata, rdata_len); } static void handle_read_event_msg_buffer(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { channel_t *chan = mc->channels[15]; if (!mc->sysinfo) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } if (!mc->ev_in_q) { rdata[0] = 0x80; *rdata_len = 1; return; } rdata[0] = 0; memcpy(rdata + 1, mc->evq, 16); *rdata_len = 17; mc->ev_in_q = 0; mc->msg_flags &= ~IPMI_MC_MSG_FLAG_EVT_BUF_FULL; if (chan->set_atn) chan->set_atn(chan, !!mc->msg_flags, IPMI_MC_EVBUF_FULL_INT_ENABLED(mc)); } static void handle_get_msg_flags(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { rdata[0] = 0; rdata[1] = mc->msg_flags; *rdata_len = 2; } static void handle_clear_msg_flags(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { channel_t *chan = mc->channels[15]; if (check_msg_length(msg, 1, rdata, rdata_len)) return; mc->msg_flags &= ~msg->data[0]; if (msg->data[0] & IPMI_MC_MSG_FLAG_EVT_BUF_FULL) mc->ev_in_q = 0; if (msg->data[0] & IPMI_MC_MSG_FLAG_RCV_MSG_QUEUE) { while (chan->recv_q_head) { msg_t *qmsg = chan->recv_q_head; chan->recv_q_head = qmsg->next; free(qmsg); } chan->recv_q_tail = NULL; } if (chan->set_atn) chan->set_atn(chan, !!mc->msg_flags, IPMI_MC_MSG_INTS_ON(mc)); rdata[0] = 0; *rdata_len = 1; } static void handle_get_msg(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { msg_t *qmsg; channel_t *chan = mc->channels[15]; if (!mc->sysinfo) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } qmsg = chan->recv_q_head; if (!qmsg) { rdata[0] = 0x80; *rdata_len = 1; return; } if (qmsg->len + 2 > *rdata_len) { rdata[0] = IPMI_REQUESTED_DATA_LENGTH_EXCEEDED_CC; *rdata_len = 1; return; } chan->recv_q_head = qmsg->next; if (!qmsg->next) { chan->recv_q_tail = NULL; mc->msg_flags &= ~IPMI_MC_MSG_FLAG_RCV_MSG_QUEUE; if (chan->set_atn) chan->set_atn(chan, !!mc->msg_flags, IPMI_MC_MSG_INTS_ON(mc)); } rdata[0] = 0; rdata[1] = 0; /* Always channel 0 for now, FIXME - privilege level? */ /* * Note that we chop off the first byte because the destination * address is not in the get message response. */ memcpy(rdata + 2, qmsg->data + 1, qmsg->len + 1); *rdata_len = qmsg->len - 1 + 2; free(qmsg); } static void handle_get_payload_activation_status(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { channel_t *channel = mc->channels[msg->channel]; if (!mc->sol.configured || !channel->set_associated_mc) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } if (msg->len < 1) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } rdata[0] = 0; *rdata_len = 4; if ((msg->data[0] & 0xf) == IPMI_RMCPP_PAYLOAD_TYPE_SOL) { rdata[1] = 1; /* Only one SOL session at a time */ rdata[2] = mc->sol.active; rdata[3] = 0; } else { rdata[1] = 0; rdata[2] = 0; rdata[3] = 0; } } static void handle_get_payload_instance_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { channel_t *channel = mc->channels[msg->channel]; if (msg->len < 2) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (!mc->sol.configured || !channel->set_associated_mc) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } if ((msg->data[0] & 0xf) != IPMI_RMCPP_PAYLOAD_TYPE_SOL) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (msg->data[1] != 1) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[0] = 0; ipmi_set_uint32(rdata + 1, mc->sol.session_id); rdata[5] = 1; memset(rdata + 6, 0, 7); *rdata_len = 13; } static void handle_get_channel_payload_support(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { channel_t *channel; if (msg->len < 1) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } channel = mc->channels[msg->data[0] & 0xf]; rdata[0] = 0; rdata[1] = ((1 << 1) | ((mc->sol.configured && channel->set_associated_mc) << 2)); memset(rdata + 2, 0, 7); *rdata_len = 9; } static void handle_activate_payload(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { channel_t *channel = msg->orig_channel; if (!mc->sol.configured || !channel->set_associated_mc) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } if (msg->len < 6) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if ((msg->data[0] & 0xf) != IPMI_RMCPP_PAYLOAD_TYPE_SOL) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if ((msg->data[0] & 0xf) != IPMI_RMCPP_PAYLOAD_TYPE_SOL) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } ipmi_sol_activate(mc, channel, msg, rdata, rdata_len); } static void handle_deactivate_payload(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { channel_t *channel = msg->orig_channel; if (!mc->sol.configured || !channel->set_associated_mc) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } if (msg->len < 6) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if ((msg->data[0] & 0xf) != IPMI_RMCPP_PAYLOAD_TYPE_SOL) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if ((msg->data[0] & 0xf) != IPMI_RMCPP_PAYLOAD_TYPE_SOL) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } ipmi_sol_deactivate(mc, channel, msg, rdata, rdata_len); } cmd_handler_f app_netfn_handlers[256] = { [IPMI_GET_DEVICE_ID_CMD] = handle_get_device_id, [IPMI_GET_WATCHDOG_TIMER_CMD] = handle_get_watchdog_timer, [IPMI_SET_WATCHDOG_TIMER_CMD] = handle_set_watchdog_timer, [IPMI_RESET_WATCHDOG_TIMER_CMD] = handle_reset_watchdog_timer, [IPMI_GET_CHANNEL_INFO_CMD] = handle_get_channel_info, [IPMI_GET_CHANNEL_ACCESS_CMD] = handle_get_channel_access, [IPMI_SET_BMC_GLOBAL_ENABLES_CMD] = handle_set_global_enables, [IPMI_GET_BMC_GLOBAL_ENABLES_CMD] = handle_get_global_enables, [IPMI_SET_USER_ACCESS_CMD] = handle_set_user_access, [IPMI_GET_USER_ACCESS_CMD] = handle_get_user_access, [IPMI_SET_USER_NAME_CMD] = handle_set_user_name, [IPMI_GET_USER_NAME_CMD] = handle_get_user_name, [IPMI_SET_USER_PASSWORD_CMD] = handle_set_user_password, [IPMI_SET_CHANNEL_ACCESS_CMD] = handle_set_channel_access, [IPMI_READ_EVENT_MSG_BUFFER_CMD] = handle_read_event_msg_buffer, [IPMI_GET_MSG_CMD] = handle_get_msg, [IPMI_GET_MSG_FLAGS_CMD] = handle_get_msg_flags, [IPMI_CLEAR_MSG_FLAGS_CMD] = handle_clear_msg_flags, [IPMI_GET_PAYLOAD_ACTIVATION_STATUS_CMD] = handle_get_payload_activation_status, [IPMI_GET_PAYLOAD_INSTANCE_INFO_CMD] = handle_get_payload_instance_info, [IPMI_GET_CHANNEL_PAYLOAD_SUPPORT_CMD] = handle_get_channel_payload_support, [IPMI_ACTIVATE_PAYLOAD_CMD] = handle_activate_payload, [IPMI_DEACTIVATE_PAYLOAD_CMD] = handle_deactivate_payload }; OpenIPMI-2.0.27/lanserv/ipmi_sim.10000644000175000017500000001130413115245676013456 00000000000000.TH ipmi_sim 1 06/26/12 OpenIPMI "IPMI LAN BMC Simulator" .SH "NAME" ipmi_sim \- IPMI LAN BMC Simulator .SH SYNOPSIS .B ipmi_sim .RB [ \-c .IR config-file ] .RB [ \-f .IR command-file ] .RB [ \-x .IR command ] .RB [ \-s .IR state-dir ] .RB [ \-d ] .RB [ \-n ] .SH "DESCRIPTION" The .B ipmi_sim daemon emulates an IPMI BMC simulator that may be accessed using the IPMI 1.5 or 2.0 LAN protocol, or via various serial protocols. It is useful stand-along for prototyping, it may be used with a virtual machine such as QEMU to provide an IPMI BMC emulator, and it may be used to implement an actual BMC (where it's not such a simulator any more) .B ipmi_sim supports the full authentication capabilities of the IPMI LAN protocol. .B ipmi_sim supports multiple IP addresses for fault-tolerance. Note that messages coming in on an address are always sent back out on the same address they came in. .SH "OPTIONS" .TP .BI \-c\ config-file Set the configuration file to one other than the default of .I "/etc/ipmi/lan.conf". See ipmi_lan(5) for details. .TP .BI \-f\ command-file Specify a command file to execute when .B ipmi_sim is starting. This is generally used to set up the IPMI environment. See ipmi_sim_cmd(5) for details. .TP .B \-x\ command Execute a single command. .TP .BI \-s\ state-dir Specify a state directory for .B ipmi_sim to use instead of the default. The state directory must exist, and .B ipmi_sim will store information there for when it restarts. For instance, if someone changes user information, then it will store the new user information there and what is in the config file will no longer be used. .TP .TP .B \-d Turns on debugging to standard output (if -n is not specified) and the debug output of syslog. .TP .B \-n Disables console and I/O on standard input and output. .SH "CONFIGURATION" Configuration is accomplished through the file .IR /etc/ipmi/lan.conf . A file with another name or path may be specified using the .B \-c option. See the ipmi_lan(5) config file man page for more details. .SH "COMMANDS" When .B ipmi_sim starts up, it has an empty environment with no BMC or management controllers. You have to execute commands to set things up. The commands can also be used to set sensor states, inject events, and other things you might want to do when simulating a BMC. See the ipmi_sim_cmd(5) man page for details. .SH "SECURITY" .B ipmi_sim implements normal IPMI security. The default is no access for anyone, so the default is pretty safe, but be careful what you add, because this is access to control your box. \fBstraight\fP and \fBnone\fP authorizations are not recommended, you should probably stick with \fBmd2\fP or \fBmd5\fP if you are not using \fBRMCP+\fP. .SH "PERSISTENCE" Things that are supposed to be persistent in a BMC are kept in files, generall in /var/ipmi_sim/, where is the name of the BMC specified in the configuration file. The following things are persistent: .TP .BI SDRs - This is named sdr..main and is the main SDR repository. .TP .BI SEL - This is named sel.. .TP .BI Users - This is named users.mc. .TP .BI LAN\ parameters - This is named lanparm.mc.. .TP .BI SOL\ parameters - This is named sol.mc. .P The is the hexadecimal number of the MC. .SH "Serial Over LAN (SOL)" .B ipmi_sim implements Serial Over LAN for hooking an RMCP+ connection to a standard Unix serial port. This is configured in the ipmi_lan(5) configuration file. A SOL interface is done on a per-MC basis. So if the MC is set to a non-BMC, you can define a SOL interface on it and it will work if you reroute the commands to that MC. It's a little weird, but it works. Only interface 1 is supported at the moment. A SOL interface can also hold history that is kept even if nothing is connected to the SOL interface from the LAN. So if you want to see what has happened on the serial port, you can connect to interface 2 and it will dump the history. The history is optionally persistent, if the program terminates normally and is restarted, the history is restored if it is configured to do so. A SOL interface can create a FRU on the MC to let you fetch the history via the FRU interface. .SH "SIGNALS" .TP 0.5i .B SIGHUP .B ipmi_sim should handle SIGHUP and reread it's configuration files. However, it doesn't right now. It might in the future, for now you will have to kill it and restart it. Clients should handle reconnecting in this case. If they don't, they are broken. .SH "ERROR OUTPUT" At startup, all error output goes to stderr. After that, all error output goes to syslog. .SH "FILES" /etc/ipmi_lan.conf .SH "SEE ALSO" .BR ipmi_lan (5), ipmi_sim_cmd (5), ipmi_ui (1), openipmish (1) .SH AUTHOR .PP Corey Minyard OpenIPMI-2.0.27/lanserv/README.yourownbmc0000664000175000017500000002004513136646220014646 00000000000000 Using ipmi_sim For A Real BMC ----------------------------- So you want to create a real BMC. This is now possible with the simulator. So it's really not a simulator in this case, but that's its heritage, so the name is still stuck. Maybe I'll change it later. Anyway, It can do most of the work without even writing any C code, just with configuration. It probably won't do everything you want out of the box, though, so it has plugin capability to let you add your own code to handle special conditions. This documentation assumes a good working knowledge of IPMI. How It Works ------------ The simulator has the two standard configuration files as defined in the ipmi_sim_cmd.5 and ipmi_lan.5 man pages. The LAN configuration file defines the lan interfaces and a few other things, like SOL configuration. The emulator command file has commands to define the IPMI structure of the system, like management controllers, sensors, FRU data, SDRs, etc. So to create a BMC, you define the LAN interfaces, the management controllers, the sensors, etc. in your system. You can tie the FRU data to physical files on the system (like EEPROMS in sysfs, or real files). You can tie the sensors to files, like sensors in sysfs. You can also write custom code and tie it in to set the sensor values. Management Controllers ---------------------- To have a management controller handled by ipmi_sim, you have to add it via the mc_add command, then you have to enable it with mc_enable. This is a virtual management controller. You have to add the BMC at 0x20, of course, but you can add others, too, if that makes sense. For instance, if you have multiple boards in the system, it may make sense to define a virtual MC for each board. This is pretty simple. Note that the capabilities you set with the mc_add command affect what the MC can do. You can't add SDRs, for instance, if the MC doesn't have SDR capability. LAN Configuration ----------------- The LAN configuration file mostly defines the LAN interfaces. It also has a lot of simulator configuration, like how to start virtual machine sessions tied to the management controllers and how the VMs interface to the simulator. These aren't terribly useful for a real BMC (though the serial interface might one day with some modifications). The name of the BMC is set here. This is used for a few things, like to tell where to store persistent information (in /var/ipmi_sim/) and in logging. A few other things in the file are SOL configuration, chassis control handling, and loading custom code. These are discussed later. Sensors ------- Sensors are added with the emulator command file with the sensor_add command. This command also lets you poll a file for data and has a lot of options for massaging the data from the file into the 256 byte value returned by an IPMI sensor. It also lets you tie a dependency to a discrete sensor, so that the enabling of the sensor can be done based on a bit in the other discrete sensor. For instance, a power supply sensor has a presence bit in it, the power supply voltage and current sensors can depend on that bit to be enabled or disabled. If you are writing custom code to handle a sensor, you still have to add it with sensor_add, then you can use the sensor number to manipulate the sensor's value. You have three main functions to do this: ipmi_mc_sensor_set_enabled() will let you enable or disable a sensor directly. Generally you would modify the sensor enable based upon the presence of the entity the sensor measures. ipmi_mc_sensor_set_value() sets a threshold sensor's value. ipmi_mc_sensor_set_bit() sets/clears a discrete sensor bit. SDRs ---- If you have sensors, you need SDRs to describe them. You can directly add these via the emulator command main_sdr_add (or device_sdr_add), but that only deals with raw data and is a fairly inconvenient way to do this. The main SDRs for an MC are persistent and stored in /var/ipmi_sim/.main. For instance, the main SDRs for a BMC at 0x20 are in /var/ipmi_sim//sdr.20.main. If the user makes changes, they are stored there. But, you can store your SDRs here, too. The easier way is to use the SDR compiler in the sdrcomp directory, which can output data in the persistence format. Then you can write your SDRs in a more human-readable (or perhaps ipmi-engineer-readable) format rather than just a bunch of bits. Then generate the file and copy it into the right place. Serial Over LAN --------------- As mentioned earlier, you can define SOL port in the lan configuration file. You can assign a physical serial port to a SOL port. This is described in the docs and is pretty straightforward. There are a couple of unusual things about this, though. One is that you can create a SOL interface on an MC besides the BMC. But the standard SOL protocol will still work with it. This means you can use "ipmitool -t " to address a specific SOL instance, which is convenient if you want to tie SOL interfaces to specific MCs. Yes, it's kind of an abuse of the spec, but it works and is convenient. The other unusual thing about the SOL implementation is that it can have a history buffer. So say you want to keep around the last 64K or so of data without having to be constantly connected to the BMC. You can define a 64K history buffer and connect to the BMC later to fetch it. You have two ways to fetch it. The first is that the history buffer appears as a second SOL instance at instance 2. So you can connect to SOL instance 2 and it will dump all the history. The disadvantage of this approach is that ipmitool cannot connect to SOL instances besides 1 without a special patch. The other way to fetch it is to define a FRU data buffer that holds the history. You can define which FRU device does this. Then you can use the FRU data fetching commands to get the data. The disadvantage of this is that FRU data is limited to 64K. FRU Data -------- FRU data has already been mentioned with respect to SOL, but you can create FRU data for an MC with the mc_add_fru_data emulator command. You can either directly define the FRU data there (not ideal for a real BMC) or tie it to a file. Reading and writing all work. Chassis Control --------------- You can define an external command to handle chassis control commands. The ipmi_sim_chassiscontrol file gives a framework for writing your own script for handling this, and defines the various things that can be done. This is how reset, power, and boot control are done. Custom Code ----------- As mentioned before, you can load your own custom modules to do whatever you like. Any module must define the following function: int ipmi_sim_module_init(sys_data_t *sys, const char *initstr); This is used to initialize the module. It is called after the configuration has been read from the LAN configuration file, but before the emulator commands are run. The module must also define the following function: int ipmi_sim_module_print_version(sys_data_t *sys, char *initstr); This should print out an identifier and version number to standard out. The module may optionally define the following function: int ipmi_sim_module_post_init(sys_data_t *sys); This is called after the emulator command file is run. This can be used to finish up configuration of things, add functions to sensors, do any sensor initialization, or anything else that needs to be done after the emulator commands are run. The include files in lanserv/OpenIPMI define the interface function that a module may use. Primarily, serv.h and mcserv.c. Threading --------- The ipmi_sim code itself is not multi-threaded. You cannot have concurrent calls into any of the code. You can, however, define your own threads using pthreads as long as none of them call into the ipmi_sim code. What's Still Missing -------------------- ipmi_sim currently does not have any provisions for direct IPMI support or the handling of any I2C commands. This should be fairly easy to add, but has not yet been needed. Lots of other things are probably missing, too, of course, but it's hard to know what you don't know...OpenIPMI-2.0.27/lanserv/README.design0000644000175000017500000001476212116456523013724 00000000000000This directory contains two programs: lanserv and ipmi_sim. These grew out of a need to be able to test OpenIPMI without having to have real hardware, but they have taken on more than that. lanserv is a program that provides a LAN connection for a BMC that does not otherwise have a LAN connection. It takes a standard Linux IPMI device and implements the IPMI LAN protocol. ipmi_sim is a full IPMI simulator and does not require a real BMC. It can be used to simulate an entire IPMI system, including satellite MCs. You can use it over a LAN connection, or it provides a serial interface so it can be used with QEMU or other VMs. The serial interface implements the serial protocols available on many ATCA blades, and it also emulates a protocol so it may be used for emulation of a standard IPMI interface (KCS, SMIC, BT, SSIF) including the handling of reset, power, and interrupts. Files ----- The include files are in the OpenIPMI directory: lanserv.h - The configuration of a LAN interface is defined in this file. mcserv.h - This defines the interface for an MC. msg.h - This defines an IPMI message that is passed around, and a few other global things that pretty much everything uses. This is separate from serv.h because of chicken and egg problems. serserv.h - The configuration of a serial interface. serv.h - This defines data structures used by the whole system. The code is in this directory: lanserv.c - The main file for the lanserv program. config.c - Reads a configuration file. This defines things that are common between lanserv and ipmi_sim, LAN configuration, serial port configuration, users, etc. lanserv_config.c - Specific code for reading in LAN configuration, used by config.c. priv_table.c - Holds the tables used map IPMI commands to their required privilege levels. bmc.c - The basic code dealing MC command routing and configuration. bmc.h - Internal include file for communication between the various bmc_xxx files. bmc_app.c - Handling for application commands (get device info, etc.) bmc_chassis.c - Handling for chassis-specific commands. bmc_picmg.c - Handling for PICMG (ATCA) specific commands. bmc_sensor.c - Handling for sensor specific commands. bmc_storage.c - Handling for FRU and SDR commands. bmc_transport.c - Handling for LAN control commands. config.c - Read the configuration file. emu_cmd.c - Implements a command language used for both configuration and control of the MCs in ipmi_sim. It is used by configuration files (see the .emu files) to define the system, and it can be used to generate real-time events by setting sensor values. emu.h - Defines the interface between bmc_xxx.c and emu_cmd.c extcmd.c - Code for running the external command for dealing with LAN configuration. ipmi_sim.c - The main file for the ipmi_sim program. lanserv_asf.c - Handles LAN ASF commands. lanserv_config.c- Handles reading LAN configuration, called from config.c lanserv_ipmi.c - An implementation of the IPMI LAN protocol. lanserv_oem_force.c - Some OEM handling for some older Force computer systems. persist.c - Handling for writing and reading persistent information for the MC. priv_table.c - Privilege lookups for commands, to know which privilege levels are required for each command. serial_ipmi.c - An implementation of the IPMI serial protocols, and also code to handle reading a serial configuration line. serv.c - General utilities used by a lot of the system. sol.c - An implementation of the serial over LAN protocol. And here's a few other miscellaneous things: ipmi_checksum.c - A program that takes a string of bytes and generates an IPMI checksum. Primarily used for testing. ipmisim1.emu - emu commands for creating a simple IPMI system. atca.emu - emu commands for creating a more complex ATCA system. lan.conf - A configuration file example. sdrcomp (directory) - A compiler for SDRs. marvell-bmc (directory) - Code for implementing a BMC for a Marvell server. General Design (for ipmi_sim) ----------------------------- The ipmi_sim.c file has all the startup code and handles all the I/O and timers for the simulator. It does all the system initialization, opens all the the necessary sockets, and handles the input and output for the sockets and the emu_cmd emulator. The rest of the simulator is completely event-driven and does no I/O on it's own. ipmi_sim uses the POSIX OS handler defined in the ../unix directory. When ipmi_sim.c starts up, it defines the sysinfo structure, which provides interfaces for doing timers, logging, LAN and serial initialization, and message output. It then reads the configuration file and the emu file. As part of reading the configuration file, LAN and serial interfaces are implemented. These result in callbacks into the ipmi_sim.c code to open the sockets. When a message comes in on the LAN interface, ipmi_sim will either call handle_asf() (in lanserv_asf.c) or ipmi_handle_lan_msg() (in lanserv_ipmi.c) depending on the message type. lanserv_ipmi.c will handle the IPMI LAN protocol part. It handles session establishment for both RMCP and RMCP+, it handles checking the privilege levels for command, and it handles all the LAN-specific IPMI commands. This code may send an immediate response to a message, or if a normal message comes in, it will send it to channel_smi_send() (in serv.c). channel_smi_send() will call the channel-specific handling callback, which will generall result it in going back to ipmi_sim.c's smi_send() function. smi_send() calls ipmi_emu_handle_msg() in bmc.c to handle the message ipmi_emu_handle_msg() will route the command to the proper function to handle it. It passes in a response message to the handler, which the handler must fill in. Then it will call ipmi_handle_smi_rsp() (in serv.c) to send the response. ipmi_handle_smi_rsp() does a little bit of formatting then calls the channel-specific return_rsp() function. In the LAN case, this results in lan_return_rsp() (in lanserv_ipmi.c) being called. lan_return_rsp() does the formatting and handling to transmit the message then calls the send_out function variable, resulting in lan_send() in ipmi_sim.c being called. That transmits the message. The serial case is similar, substituting the serial code for the LAN code. Serial Over LAN (SOL) --------------------- The sol.c code has three tie-ins to the rest of the code: It is called from config.c to handle sol-specific configuration. It installs a hook into lanserv_ipmi.c to receive the SOL payload and send the SOL payload. It ties into bmc.c to handle SOL-specific commands.OpenIPMI-2.0.27/lanserv/bmc_chassis.c0000664000175000017500000003276113051576452014222 00000000000000/* * bmc_chassis.c * * MontaVista IPMI code for emulating a MC. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2012 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include "bmc.h" #include #include #include #include #include static extcmd_map_t boot_map[] = { { 0, "none" }, { 1, "pxe" }, { 2, "default" }, { 5, "cdrom" }, { 6, "bios" }, { 0, NULL } }; /* Matches the CHASSIS_CONTROL defines. */ static extcmd_info_t chassis_prog[] = { { "power", extcmd_int, NULL, 0 }, { "reset", extcmd_int, NULL, 0 }, { "boot", extcmd_uchar, boot_map, 0 }, { "boot", extcmd_uchar, boot_map, 0 }, // dup'd for boot info ack { "shutdown", extcmd_int, NULL, 0 }, { "identify", extcmd_ident, NULL, 0 }, }; static int set_power(lmc_data_t *mc, int pval) { int rv = 0; if (mc->power_timer) { mc->sysinfo->stop_timer(mc->power_timer); mc->sysinfo->free_timer(mc->power_timer); mc->power_timer = NULL; } if (mc->chassis_control_set_func) { unsigned char val = !!pval; rv = mc->chassis_control_set_func(mc, CHASSIS_CONTROL_POWER, &val, mc->chassis_control_cb_data); } else if (mc->chassis_control_prog) { int val = !!pval; if (extcmd_setvals(mc->sysinfo, &val, mc->chassis_control_prog, &chassis_prog[CHASSIS_CONTROL_POWER], NULL, 1)) rv = EINVAL; } else if (HW_OP_CAN_POWER(mc->channels[15])) { if (pval) mc->channels[15]->hw_op(mc->channels[15], HW_OP_POWERON); else mc->channels[15]->hw_op(mc->channels[15], HW_OP_POWEROFF); } else return ENOTSUP; return rv; } static void power_timeout(void *cb_data) { lmc_data_t *mc = cb_data; if (ipmi_mc_is_power_on(mc)) { struct timeval tv = { 1, 0 }; mc->sysinfo->start_timer(mc->power_timer, &tv); } else { set_power(mc, 1); } } int start_poweron_timer(lmc_data_t *mc) { int rv; struct timeval tv = { 1, 0 }; if (mc->power_timer) return 0; rv = mc->sysinfo->alloc_timer(mc->sysinfo, power_timeout, mc, &mc->power_timer); if (rv) return rv; mc->sysinfo->start_timer(mc->power_timer, &tv); return 0; } static void handle_get_chassis_capabilities(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { rdata[0] = 0; rdata[1] = 0; rdata[2] = mc->sysinfo->bmc_ipmb; rdata[3] = mc->sysinfo->bmc_ipmb; rdata[4] = mc->sysinfo->bmc_ipmb; rdata[5] = mc->sysinfo->bmc_ipmb; } int ipmi_mc_is_power_on(lmc_data_t *mc) { if (mc->chassis_control_get_func) { unsigned char val; int rv; rv = mc->chassis_control_get_func(mc, CHASSIS_CONTROL_POWER, &val, mc->chassis_control_cb_data); if (rv) return -1; return val; } else if (mc->chassis_control_prog) { int val; if (extcmd_getvals(mc->sysinfo, &val, mc->chassis_control_prog, &chassis_prog[CHASSIS_CONTROL_POWER], 1)) return -1; return val; } else if (mc->startcmd.vmpid) { return 1; } else if (HW_OP_CAN_POWER(mc->channels[15])) { int rv = mc->channels[15]->hw_op(mc->channels[15], HW_OP_CHECK_POWER); return rv > 0; } return 0; /* Assume power is off */ } static void handle_get_chassis_status(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int rv; rdata[0] = 0; rv = ipmi_mc_is_power_on(mc); if (rv < 0) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } else { rdata[1] = !!rv; } rdata[2] = 0; rdata[3] = 0; *rdata_len = 4; } static void handle_chassis_control(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int rv; if (msg->len < 1) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } rdata[0] = 0; *rdata_len = 1; switch(msg->data[0] & 0xf) { case 0: /* power down */ rv = set_power(mc, 0); if (rv == ENOTSUP) goto no_support; else if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } break; case 1: /* power up */ rv = set_power(mc, 1); if (rv == ENOTSUP) goto no_support; else if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } break; case 2: /* power cycle */ rv = set_power(mc, 0); if (rv == ENOTSUP) goto no_support; else if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } rv = start_poweron_timer(mc); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } break; case 3: /* hard reset */ if (mc->chassis_control_set_func) { int rv; unsigned char val = 1; rv = mc->chassis_control_set_func(mc, CHASSIS_CONTROL_RESET, &val, mc->chassis_control_cb_data); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else if (mc->chassis_control_prog) { int val = 1; if (extcmd_setvals(mc->sysinfo, &val, mc->chassis_control_prog, &chassis_prog[CHASSIS_CONTROL_RESET], NULL, 1)) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else if (HW_OP_CAN_RESET(mc->channels[15])) mc->channels[15]->hw_op(mc->channels[15], HW_OP_RESET); else goto no_support; break; case 5: /* initiate soft-shutdown via overtemp */ if (mc->chassis_control_set_func) { int rv; unsigned char val = 1; rv = mc->chassis_control_set_func(mc, CHASSIS_CONTROL_GRACEFUL_SHUTDOWN, &val, mc->chassis_control_cb_data); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else if (mc->chassis_control_prog) { int val = 1; if (extcmd_setvals(mc->sysinfo, &val, mc->chassis_control_prog, &chassis_prog[CHASSIS_CONTROL_GRACEFUL_SHUTDOWN], NULL, 1)) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else if (HW_OP_CAN_GRACEFUL_SHUTDOWN(mc->channels[15])) mc->channels[15]->hw_op(mc->channels[15], HW_OP_GRACEFUL_SHUTDOWN); else goto no_support; break; case 4: /* pulse diag interrupt */ no_support: rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } } static void handle_chassis_identify(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char val[2]; rdata[0] = 0; memset(val, 0, sizeof(val)); if (msg->len == 0) val[0] = 0xf; /* default 15 seconds */ else val[0] = msg->data[0]; /* interval */ if (msg->len > 1) /* force flag is set */ val[1] = msg->data[1] & 0x1; if (mc->chassis_control_set_func) { int rv; rv = mc->chassis_control_set_func(mc, CHASSIS_CONTROL_IDENTIFY, val, mc->chassis_control_cb_data); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else if (mc->chassis_control_prog) { if (extcmd_setvals(mc->sysinfo, val, mc->chassis_control_prog, &chassis_prog[CHASSIS_CONTROL_IDENTIFY], NULL, 1)) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; } } static void set_system_boot_options(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char val; if (msg->len < 1) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } rdata[0] = 0; *rdata_len = 1; switch (msg->data[0] & 0x3f) { case 1: if (msg->len < 2) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } switch (msg->data[2] & 0x3) { case 0: case 1: /* Just ignore this for now. */ break; default: rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; break; } break; case 3: /* BMC boot flag valid bit clearing, just ignore this for now. */ break; case 4: /* Boot Info Ack */ if (msg->len < 3) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (mc->chassis_control_set_func) { int rv; rv = mc->chassis_control_set_func(mc, CHASSIS_CONTROL_BOOT_INFO_ACK, msg->data + 1, mc->chassis_control_cb_data); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else if (mc->chassis_control_prog) { if (extcmd_getvals(mc->sysinfo, &val, mc->chassis_control_prog, &chassis_prog[CHASSIS_CONTROL_BOOT_INFO_ACK], 1)) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; } break; case 5: /* Boot flags */ if (msg->len < 6) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } val = (msg->data[2] >> 2) & 0xf; if (mc->chassis_control_set_func) { int rv; rv = mc->chassis_control_set_func(mc, CHASSIS_CONTROL_BOOT, &val, mc->chassis_control_cb_data); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else if (mc->chassis_control_prog) { if (extcmd_setvals(mc->sysinfo, &val, mc->chassis_control_prog, &chassis_prog[CHASSIS_CONTROL_BOOT], NULL, 1)) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; } break; default: rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; break; } } static void get_system_boot_options(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char val; if (msg->len < 3) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = 1; rdata[2] = msg->data[0] & 0x3f; *rdata_len = 3; switch (msg->data[0] & 0x3f) { case 1: /* Dummy this out for now */ rdata[3] = 0; *rdata_len = 4; break; case 4: /* Boot Info Ack */ if (mc->chassis_control_set_func) { int rv; rv = mc->chassis_control_get_func(mc, CHASSIS_CONTROL_BOOT, rdata + 3, mc->chassis_control_cb_data); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } *rdata_len = 5; } break; case 5: /* Boot flags */ if (mc->chassis_control_set_func) { int rv; rv = mc->chassis_control_get_func(mc, CHASSIS_CONTROL_BOOT, &val, mc->chassis_control_cb_data); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else if (mc->chassis_control_prog) { if (extcmd_getvals(mc->sysinfo, &val, mc->chassis_control_prog, &chassis_prog[CHASSIS_CONTROL_BOOT], 1)) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } else { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[3] = 0; rdata[4] = val << 2; rdata[5] = 0; rdata[6] = 0; rdata[7] = 0; *rdata_len = 8; break; default: rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; break; } } cmd_handler_f chassis_netfn_handlers[256] = { [IPMI_GET_CHASSIS_CAPABILITIES_CMD] = handle_get_chassis_capabilities, [IPMI_GET_CHASSIS_STATUS_CMD] = handle_get_chassis_status, [IPMI_CHASSIS_CONTROL_CMD] = handle_chassis_control, [IPMI_SET_SYSTEM_BOOT_OPTIONS_CMD] = set_system_boot_options, [IPMI_GET_SYSTEM_BOOT_OPTIONS_CMD] = get_system_boot_options, [IPMI_CHASSIS_IDENTIFY_CMD] = handle_chassis_identify }; OpenIPMI-2.0.27/lanserv/priv_table.c0000644000175000017500000005427012002623311014046 00000000000000/* * priv_table.h * * MontaVista IPMI interface, table and associated code for figuring * out priviledge levels for messages. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #define PRIV_ENTRY(c,u,o,a) ((c) | ((u)<<4) | ((o)<<8) | ((a)<<12)) typedef unsigned short priv_val; #define n 0 /* No priviledge (blank entry) */ #define s 1 /* System interface only. */ #define p 2 /* No authentication required. */ #define X 3 /* Permitted */ #define b 4 /* bmc-only */ #define h 5 /* special send-message handling is needed. */ #define i 6 /* Special set system boot options handling. */ #define b2 7 /* bmc-only, can be sent to a serial channel when serial port sharing is used and actvating the SOL payload causes the serial session to be terminated. */ /* An entry marked with a comment at the beginning has special handling. */ /* Chassis netfn (0x00) */ static priv_val chassis_privs[] = { PRIV_ENTRY(n,X,X,X), /* IPMI_GET_CHASSIS_CAPABILITIES_CMD 0x00 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_CHASSIS_STATUS_CMD 0x01 */ PRIV_ENTRY(n,n,X,X), /* IPMI_CHASSIS_CONTROL_CMD 0x02 */ PRIV_ENTRY(n,n,X,X), /* IPMI_CHASSIS_RESET_CMD 0x03 */ PRIV_ENTRY(n,n,X,X), /* IPMI_CHASSIS_IDENTIFY_CMD 0x04 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_CHASSIS_CAPABILITIES_CMD 0x05 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_POWER_RESTORE_POLICY_CMD 0x06 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SYSTEM_RESTART_CAUSE_CMD 0x07 */ /**/PRIV_ENTRY(n,n,X,X), /* IPMI_SET_SYSTEM_BOOT_OPTIONS_CMD 0x08 */ PRIV_ENTRY(n,n,X,X), /* IPMI_GET_SYSTEM_BOOT_OPTIONS_CMD 0x09 */ PRIV_ENTRY(n,n,n,X), /* 0x0a */ PRIV_ENTRY(n,n,n,X), /* 0x0b */ PRIV_ENTRY(n,n,n,X), /* 0x0c */ PRIV_ENTRY(n,n,n,X), /* 0x0d */ PRIV_ENTRY(n,n,n,X), /* 0x0e */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_POH_COUNTER_CMD 0x0f */ }; /* Bridge netfn (0x02) */ static priv_val bridge_privs[] = { PRIV_ENTRY(n,X,X,X), /* IPMI_GET_BRIDGE_STATE_CMD 0x00 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_BRIDGE_STATE_CMD 0x01 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_ICMB_ADDRESS_CMD 0x02 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_ICMB_ADDRESS_CMD 0x03 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_BRIDGE_PROXY_ADDRESS_CMD 0x04 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_BRIDGE_STATISTICS_CMD 0x05 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_ICMB_CAPABILITIES_CMD 0x06 */ PRIV_ENTRY(n,n,n,X), /* 0x07 */ PRIV_ENTRY(n,n,X,X), /* IPMI_CLEAR_BRIDGE_STATISTICS_CMD 0x08 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_BRIDGE_PROXY_ADDRESS_CMD 0x09 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_ICMB_CONNECTOR_INFO_CMD 0x0a */ PRIV_ENTRY(n,X,X,X), /* IPMI_SET_ICMB_CONNECTOR_INFO_CMD 0x0b */ PRIV_ENTRY(n,X,X,X), /* IPMI_SEND_ICMB_CONNECTION_ID_CMD 0x0c */ PRIV_ENTRY(n,n,n,X), /* 0x0d */ PRIV_ENTRY(n,n,n,X), /* 0x0e */ PRIV_ENTRY(n,n,n,X), /* 0x0f */ PRIV_ENTRY(n,n,X,X), /* IPMI_PREPARE_FOR_DISCOVERY_CMD 0x10 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_ADDRESSES_CMD 0x11 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_DISCOVERED_CMD 0x12 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_CHASSIS_DEVICE_ID_CMD 0x13 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_CHASSIS_DEVICE_ID_CMD 0x14 */ PRIV_ENTRY(n,n,n,X), /* 0x15 */ PRIV_ENTRY(n,n,n,X), /* 0x16 */ PRIV_ENTRY(n,n,n,X), /* 0x17 */ PRIV_ENTRY(n,n,n,X), /* 0x18 */ PRIV_ENTRY(n,n,n,X), /* 0x19 */ PRIV_ENTRY(n,n,n,X), /* 0x1a */ PRIV_ENTRY(n,n,n,X), /* 0x1b */ PRIV_ENTRY(n,n,n,X), /* 0x1c */ PRIV_ENTRY(n,n,n,X), /* 0x1d */ PRIV_ENTRY(n,n,n,X), /* 0x1e */ PRIV_ENTRY(n,n,n,X), /* 0x1f */ PRIV_ENTRY(n,n,X,X), /* IPMI_BRIDGE_REQUEST_CMD 0x20 */ PRIV_ENTRY(n,n,X,X), /* IPMI_BRIDGE_MESSAGE_CMD 0x21 */ PRIV_ENTRY(n,n,n,X), /* 0x22 */ PRIV_ENTRY(n,n,n,X), /* 0x23 */ PRIV_ENTRY(n,n,n,X), /* 0x24 */ PRIV_ENTRY(n,n,n,X), /* 0x25 */ PRIV_ENTRY(n,n,n,X), /* 0x26 */ PRIV_ENTRY(n,n,n,X), /* 0x27 */ PRIV_ENTRY(n,n,n,X), /* 0x28 */ PRIV_ENTRY(n,n,n,X), /* 0x29 */ PRIV_ENTRY(n,n,n,X), /* 0x2a */ PRIV_ENTRY(n,n,n,X), /* 0x2b */ PRIV_ENTRY(n,n,n,X), /* 0x2c */ PRIV_ENTRY(n,n,n,X), /* 0x2d */ PRIV_ENTRY(n,n,n,X), /* 0x2e */ PRIV_ENTRY(n,n,n,X), /* 0x2f */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_EVENT_COUNT_CMD 0x30 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_EVENT_DESTINATION_CMD 0x31 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_EVENT_RECEPTION_STATE_CMD 0x32 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SEND_ICMB_EVENT_MESSAGE_CMD 0x33 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_EVENT_DESTIATION_CMD 0x34 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_EVENT_RECEPTION_STATE_CMD 0x35 */ #if 0 /* Handled as administrator by virtue of not being there. */ /**/PRIV_ENTRY(n,n,n,X), /* IPMI_ERROR_REPORT_CMD 0xff */ #endif }; /* Sensor/Event netfn (0x04) */ static priv_val sensor_privs[] = { PRIV_ENTRY(n,n,n,X), /* IPMI_SET_EVENT_RECEIVER_CMD 0x00 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_EVENT_RECEIVER_CMD 0x01 */ PRIV_ENTRY(n,n,X,X), /* IPMI_PLATFORM_EVENT_CMD 0x02 */ PRIV_ENTRY(n,n,n,X), /* 0x03 */ PRIV_ENTRY(n,n,n,X), /* 0x04 */ PRIV_ENTRY(n,n,n,X), /* 0x05 */ PRIV_ENTRY(n,n,n,X), /* 0x06 */ PRIV_ENTRY(n,n,n,X), /* 0x07 */ PRIV_ENTRY(n,n,n,X), /* 0x08 */ PRIV_ENTRY(n,n,n,X), /* 0x09 */ PRIV_ENTRY(n,n,n,X), /* 0x0a */ PRIV_ENTRY(n,n,n,X), /* 0x0b */ PRIV_ENTRY(n,n,n,X), /* 0x0c */ PRIV_ENTRY(n,n,n,X), /* 0x0d */ PRIV_ENTRY(n,n,n,X), /* 0x0e */ PRIV_ENTRY(n,n,n,X), /* 0x0f */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_PEF_CAPABILITIES_CMD 0x10 */ PRIV_ENTRY(n,n,n,X), /* IPMI_ARM_PEF_POSTPONE_TIMER_CMD 0x11 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_PEF_CONFIG_PARMS_CMD 0x12 */ PRIV_ENTRY(n,n,X,X), /* IPMI_GET_PEF_CONFIG_PARMS_CMD 0x13 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_LAST_PROCESSED_EVENT_ID_CMD 0x14 */ PRIV_ENTRY(n,n,n,X), /* IPMI_GET_LAST_PROCESSED_EVENT_ID_CMD 0x15 */ PRIV_ENTRY(n,n,n,X), /* IPMI_ALERT_IMMEDIATE_CMD 0x16 */ PRIV_ENTRY(p,p,p,p), /* IPMI_PET_ACKNOWLEDGE_CMD 0x17 */ PRIV_ENTRY(n,n,n,X), /* 0x18 */ PRIV_ENTRY(n,n,n,X), /* 0x19 */ PRIV_ENTRY(n,n,n,X), /* 0x1a */ PRIV_ENTRY(n,n,n,X), /* 0x1b */ PRIV_ENTRY(n,n,n,X), /* 0x1c */ PRIV_ENTRY(n,n,n,X), /* 0x1d */ PRIV_ENTRY(n,n,n,X), /* 0x1e */ PRIV_ENTRY(n,n,n,X), /* 0x1f */ /* Note, the following are "I I I I" in the table, but I think that's wrong. */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_DEVICE_SDR_INFO_CMD 0x20 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_DEVICE_SDR_CMD 0x21 */ PRIV_ENTRY(n,X,X,X), /* IPMI_RESERVE_DEVICE_SDR_REPOSITORY_CMD 0x22 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SENSOR_READING_FACTORS_CMD 0x23 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_SENSOR_HYSTERESIS_CMD 0x24 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SENSOR_HYSTERESIS_CMD 0x25 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_SENSOR_THRESHOLD_CMD 0x26 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SENSOR_THRESHOLD_CMD 0x27 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_SENSOR_EVENT_ENABLE_CMD 0x28 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SENSOR_EVENT_ENABLE_CMD 0x29 */ PRIV_ENTRY(n,n,X,X), /* IPMI_REARM_SENSOR_EVENTS_CMD 0x2a */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SENSOR_EVENT_STATUS_CMD 0x2b */ PRIV_ENTRY(n,n,n,X), /* 0x2c */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SENSOR_READING_CMD 0x2d */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_SENSOR_TYPE_CMD 0x2e */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SENSOR_TYPE_CMD 0x2f */ }; /* App netfn (0x06) */ static priv_val app_privs[] = { PRIV_ENTRY(n,n,n,X), /* 0x00 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_DEVICE_ID_CMD 0x01 */ PRIV_ENTRY(n,n,n,X), /* IPMI_COLD_RESET_CMD 0x02 */ PRIV_ENTRY(n,n,n,X), /* IPMI_WARM_RESET_CMD 0x03 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SELF_TEST_RESULTS_CMD 0x04 */ PRIV_ENTRY(n,n,n,X), /* IPMI_MANUFACTURING_TEST_ON_CMD 0x05 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_ACPI_POWER_STATE_CMD 0x06 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_ACPI_POWER_STATE_CMD 0x07 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_DEVICE_GUID_CMD 0x08 */ PRIV_ENTRY(n,n,n,X), /* 0x09 */ PRIV_ENTRY(n,n,n,X), /* 0x0a */ PRIV_ENTRY(n,n,n,X), /* 0x0b */ PRIV_ENTRY(n,n,n,X), /* 0x0c */ PRIV_ENTRY(n,n,n,X), /* 0x0d */ PRIV_ENTRY(n,n,n,X), /* 0x0e */ PRIV_ENTRY(n,n,n,X), /* 0x0f */ PRIV_ENTRY(n,n,n,X), /* 0x10 */ PRIV_ENTRY(n,n,n,X), /* 0x11 */ PRIV_ENTRY(n,n,n,X), /* 0x12 */ PRIV_ENTRY(n,n,n,X), /* 0x13 */ PRIV_ENTRY(n,n,n,X), /* 0x14 */ PRIV_ENTRY(n,n,n,X), /* 0x15 */ PRIV_ENTRY(n,n,n,X), /* 0x16 */ PRIV_ENTRY(n,n,n,X), /* 0x17 */ PRIV_ENTRY(n,n,n,X), /* 0x18 */ PRIV_ENTRY(n,n,n,X), /* 0x19 */ PRIV_ENTRY(n,n,n,X), /* 0x1a */ PRIV_ENTRY(n,n,n,X), /* 0x1b */ PRIV_ENTRY(n,n,n,X), /* 0x1c */ PRIV_ENTRY(n,n,n,X), /* 0x1d */ PRIV_ENTRY(n,n,n,X), /* 0x1e */ PRIV_ENTRY(n,n,n,X), /* 0x1f */ PRIV_ENTRY(n,n,n,X), /* 0x20 */ PRIV_ENTRY(n,n,n,X), /* 0x21 */ PRIV_ENTRY(n,n,X,X), /* IPMI_RESET_WATCHDOG_TIMER_CMD 0x22 */ PRIV_ENTRY(n,n,n,X), /* 0x23 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_WATCHDOG_TIMER_CMD 0x24 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_WATCHDOG_TIMER_CMD 0x25 */ PRIV_ENTRY(n,n,n,X), /* 0x26 */ PRIV_ENTRY(n,n,n,X), /* 0x27 */ PRIV_ENTRY(n,n,n,X), /* 0x28 */ PRIV_ENTRY(n,n,n,X), /* 0x29 */ PRIV_ENTRY(n,n,n,X), /* 0x2a */ PRIV_ENTRY(n,n,n,X), /* 0x2b */ PRIV_ENTRY(n,n,n,X), /* 0x2c */ PRIV_ENTRY(n,n,n,X), /* 0x2d */ PRIV_ENTRY(s,s,s,s), /* IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f */ PRIV_ENTRY(s,s,s,s), /* IPMI_CLEAR_MSG_FLAGS_CMD 0x30 */ PRIV_ENTRY(s,s,s,s), /* IPMI_GET_MSG_FLAGS_CMD 0x31 */ PRIV_ENTRY(s,s,s,s), /* IPMI_ENABLE_MESSAGE_CHANNEL_RCV_CMD 0x32 */ PRIV_ENTRY(s,s,s,s), /* IPMI_GET_MSG_CMD 0x33 */ /**/PRIV_ENTRY(n,h,X,X), /* IPMI_SEND_MSG_CMD 0x34 */ PRIV_ENTRY(s,s,s,s), /* IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_BT_INTERFACE_CAPABILITIES_CMD 0x36 */ PRIV_ENTRY(p,p,p,p), /* IPMI_GET_SYSTEM_GUID_CMD 0x37 */ PRIV_ENTRY(p,p,p,p), /* IPMI_GET_CHANNEL_AUTH_CAPABILITIES_CMD 0x38 */ PRIV_ENTRY(p,p,p,p), /* IPMI_GET_SESSION_CHALLENGE_CMD 0x39 */ PRIV_ENTRY(p,p,p,p), /* IPMI_ACTIVATE_SESSION_CMD 0x3a */ PRIV_ENTRY(n,X,X,X), /* IPMI_SET_SESSION_PRIVILEGE_CMD 0x3b */ PRIV_ENTRY(X,X,X,X), /* IPMI_CLOSE_SESSION_CMD 0x3c */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SESSION_INFO_CMD 0x3d */ PRIV_ENTRY(n,n,n,X), /* 0x3e */ PRIV_ENTRY(n,n,X,X), /* IPMI_GET_AUTHCODE_CMD 0x3f */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_CHANNEL_ACCESS_CMD 0x40 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_CHANNEL_ACCESS_CMD 0x41 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_CHANNEL_INFO_CMD 0x42 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_USER_ACCESS_CMD 0x43 */ PRIV_ENTRY(n,n,X,X), /* IPMI_GET_USER_ACCESS_CMD 0x44 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_USER_NAME_CMD 0x45 */ PRIV_ENTRY(n,n,X,X), /* IPMI_GET_USER_NAME_CMD 0x46 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_USER_PASSWORD_CMD 0x47 */ PRIV_ENTRY(X,X,X,X), /* IPMI_ACTIVATE_PAYLOAD_CMD 0x48 */ PRIV_ENTRY(X,X,X,X), /* IPMI_DEACTIVATE_PAYLOAD_CMD 0x49 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_PAYLOAD_ACTIVATION_STATUS_CMD 0x4a */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_PAYLOAD_INSTANCE_INFO_CMD 0x4b */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_USER_PAYLOAD_ACCESS_CMD 0x4c */ PRIV_ENTRY(n,n,X,X), /* IPMI_GET_USER_PAYLOAD_ACCESS_CMD 0x4d */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_CHANNEL_PAYLOAD_SUPPORT_CMD 0x4e */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_CHANNEL_PAYLOAD_VERSION_CMD 0x4f */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_CHANNEL_OEM_PAYLOAD_INFO_CMD 0x50 */ PRIV_ENTRY(n,n,n,X), /* 0x51 */ PRIV_ENTRY(n,n,X,X), /* IPMI_MASTER_READ_WRITE_CMD 0x52 */ PRIV_ENTRY(n,n,n,X), /* 0x53 */ PRIV_ENTRY(p,p,p,p), /* IPMI_GET_CHANNEL_CIPHER_SUITES_CMD 0x54 */ PRIV_ENTRY(n,X,X,X), /* IPMI_SUSPEND_RESUME_PAYLOAD_ENCRYPTION_CMD 0x55 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_CHANNEL_SECURITY_KEY_CMD 0x56 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_CMD 0x57 */ }; /* Firmware netfn (0x08) */ static priv_val firmware_privs[] = { PRIV_ENTRY(n,n,n,X), /* 0x00 */ }; /* Storage netfn (0x0a) */ static priv_val storage_privs[] = { PRIV_ENTRY(n,n,n,X), /* 0x00 */ PRIV_ENTRY(n,n,n,X), /* 0x01 */ PRIV_ENTRY(n,n,n,X), /* 0x02 */ PRIV_ENTRY(n,n,n,X), /* 0x03 */ PRIV_ENTRY(n,n,n,X), /* 0x04 */ PRIV_ENTRY(n,n,n,X), /* 0x05 */ PRIV_ENTRY(n,n,n,X), /* 0x06 */ PRIV_ENTRY(n,n,n,X), /* 0x07 */ PRIV_ENTRY(n,n,n,X), /* 0x08 */ PRIV_ENTRY(n,n,n,X), /* 0x09 */ PRIV_ENTRY(n,n,n,X), /* 0x0a */ PRIV_ENTRY(n,n,n,X), /* 0x0b */ PRIV_ENTRY(n,n,n,X), /* 0x0c */ PRIV_ENTRY(n,n,n,X), /* 0x0d */ PRIV_ENTRY(n,n,n,X), /* 0x0e */ PRIV_ENTRY(n,n,n,X), /* 0x0f */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_FRU_INVENTORY_AREA_INFO_CMD 0x10 */ PRIV_ENTRY(n,X,X,X), /* IPMI_READ_FRU_DATA_CMD 0x11 */ PRIV_ENTRY(n,n,X,X), /* IPMI_WRITE_FRU_DATA_CMD 0x12 */ PRIV_ENTRY(n,n,n,X), /* 0x13 */ PRIV_ENTRY(n,n,n,X), /* 0x14 */ PRIV_ENTRY(n,n,n,X), /* 0x15 */ PRIV_ENTRY(n,n,n,X), /* 0x16 */ PRIV_ENTRY(n,n,n,X), /* 0x17 */ PRIV_ENTRY(n,n,n,X), /* 0x18 */ PRIV_ENTRY(n,n,n,X), /* 0x19 */ PRIV_ENTRY(n,n,n,X), /* 0x1a */ PRIV_ENTRY(n,n,n,X), /* 0x1b */ PRIV_ENTRY(n,n,n,X), /* 0x1c */ PRIV_ENTRY(n,n,n,X), /* 0x1d */ PRIV_ENTRY(n,n,n,X), /* 0x1e */ PRIV_ENTRY(n,n,n,X), /* 0x1f */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SDR_REPOSITORY_INFO_CMD 0x20 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SDR_REPOSITORY_ALLOC_INFO_CMD 0x21 */ PRIV_ENTRY(n,X,X,X), /* IPMI_RESERVE_SDR_REPOSITORY_CMD 0x22 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SDR_CMD 0x23 */ PRIV_ENTRY(n,n,X,X), /* IPMI_ADD_SDR_CMD 0x24 */ PRIV_ENTRY(n,n,X,X), /* IPMI_PARTIAL_ADD_SDR_CMD 0x25 */ PRIV_ENTRY(n,n,X,X), /* IPMI_DELETE_SDR_CMD 0x26 */ PRIV_ENTRY(n,n,X,X), /* IPMI_CLEAR_SDR_REPOSITORY_CMD 0x27 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SDR_REPOSITORY_TIME_CMD 0x28 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_SDR_REPOSITORY_TIME_CMD 0x29 */ PRIV_ENTRY(n,n,X,X), /* IPMI_ENTER_SDR_REPOSITORY_UPDATE_CMD 0x2a */ PRIV_ENTRY(n,n,X,X), /* IPMI_EXIT_SDR_REPOSITORY_UPDATE_CMD 0x2b */ PRIV_ENTRY(n,n,X,X), /* IPMI_RUN_INITIALIZATION_AGENT_CMD 0x2c */ PRIV_ENTRY(n,n,n,X), /* 0x2d */ PRIV_ENTRY(n,n,n,X), /* 0x2e */ PRIV_ENTRY(n,n,n,X), /* 0x2f */ PRIV_ENTRY(n,n,n,X), /* 0x30 */ PRIV_ENTRY(n,n,n,X), /* 0x31 */ PRIV_ENTRY(n,n,n,X), /* 0x32 */ PRIV_ENTRY(n,n,n,X), /* 0x33 */ PRIV_ENTRY(n,n,n,X), /* 0x34 */ PRIV_ENTRY(n,n,n,X), /* 0x35 */ PRIV_ENTRY(n,n,n,X), /* 0x36 */ PRIV_ENTRY(n,n,n,X), /* 0x37 */ PRIV_ENTRY(n,n,n,X), /* 0x38 */ PRIV_ENTRY(n,n,n,X), /* 0x39 */ PRIV_ENTRY(n,n,n,X), /* 0x3a */ PRIV_ENTRY(n,n,n,X), /* 0x4b */ PRIV_ENTRY(n,n,n,X), /* 0x3c */ PRIV_ENTRY(n,n,n,X), /* 0x3d */ PRIV_ENTRY(n,n,n,X), /* 0x3e */ PRIV_ENTRY(n,n,n,X), /* 0x3f */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SEL_INFO_CMD 0x40 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SEL_ALLOCATION_INFO_CMD 0x41 */ PRIV_ENTRY(n,X,X,X), /* IPMI_RESERVE_SEL_CMD 0x42 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SEL_ENTRY_CMD 0x43 */ PRIV_ENTRY(n,n,X,X), /* IPMI_ADD_SEL_ENTRY_CMD 0x44 */ PRIV_ENTRY(n,n,X,X), /* IPMI_PARTIAL_ADD_SEL_ENTRY_CMD 0x45 */ PRIV_ENTRY(n,n,X,X), /* IPMI_DELETE_SEL_ENTRY_CMD 0x46 */ PRIV_ENTRY(n,n,X,X), /* IPMI_CLEAR_SEL_CMD 0x47 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SEL_TIME_CMD 0x48 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_SEL_TIME_CMD 0x49 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_AUXILIARY_LOG_STATUS_CMD 0x5a */ PRIV_ENTRY(n,n,X,X), /* IPMI_SET_AUXILIARY_LOG_STATUS_CMD 0x5b */ }; /* Transport netfn (0x0c) */ static priv_val transport_privs[] = { PRIV_ENTRY(n,n,n,X), /* 0x00 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_LAN_CONFIG_PARMS_CMD 0x01 */ PRIV_ENTRY(n,n,X,X), /* IPMI_GET_LAN_CONFIG_PARMS_CMD 0x02 */ PRIV_ENTRY(n,n,X,X), /* IPMI_SUSPEND_BMC_ARPS_CMD 0x03 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_IP_UDP_RMCP_STATS_CMD 0x04 */ PRIV_ENTRY(n,n,n,X), /* 0x05 */ PRIV_ENTRY(n,n,n,X), /* 0x06 */ PRIV_ENTRY(n,n,n,X), /* 0x07 */ PRIV_ENTRY(n,n,n,X), /* 0x08 */ PRIV_ENTRY(n,n,n,X), /* 0x09 */ PRIV_ENTRY(n,n,n,X), /* 0x0a */ PRIV_ENTRY(n,n,n,X), /* 0x0b */ PRIV_ENTRY(n,n,n,X), /* 0x0c */ PRIV_ENTRY(n,n,n,X), /* 0x0d */ PRIV_ENTRY(n,n,n,X), /* 0x0e */ PRIV_ENTRY(n,n,n,X), /* 0x0f */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_SERIAL_MODEM_CONFIG_CMD 0x10 */ PRIV_ENTRY(n,n,n,X), /* IPMI_GET_SERIAL_MODEM_CONFIG_CMD 0x11 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_SERIAL_MODEM_MUX_CMD 0x12 */ PRIV_ENTRY(n,n,n,X), /* IPMI_GET_TAP_RESPONSE_CODES_CMD 0x13 */ PRIV_ENTRY(s,s,s,s), /* IPMI_SET_PPP_UDP_PROXY_XMIT_DATA_CMD 0x14 */ PRIV_ENTRY(s,s,s,s), /* IPMI_GET_PPP_UDP_PROXY_XMIT_DATA_CMD 0x15 */ PRIV_ENTRY(s,s,s,s), /* IPMI_SEND_PPP_UDP_PROXY_PACKET_CMD 0x16 */ PRIV_ENTRY(s,s,s,s), /* IPMI_GET_PPP_UDP_PROXY_RECV_DATA_CMD 0x17 */ PRIV_ENTRY(b,b,b,b), /* IPMI_SERIAL_MODEM_CONN_ACTIVE_CMD 0x18 */ PRIV_ENTRY(X,n,X,X), /* IPMI_CALLBACK_CMD 0x19 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_USER_CALLBACK_OPTIONS_CMD 0x1a */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_USER_CALLBACK_OPTIONS_CMD 0x1b */ PRIV_ENTRY(n,n,n,X), /* 0x1c */ PRIV_ENTRY(n,n,n,X), /* 0x1d */ PRIV_ENTRY(n,n,n,X), /* 0x1e */ PRIV_ENTRY(n,n,n,X), /* 0x1f */ PRIV_ENTRY(b2,b2,b2,b2), /* IPMI_SOL_ACTIVATING_CMD 0x20 */ PRIV_ENTRY(n,n,n,X), /* IPMI_SET_SOL_CONFIGURATION_PARAMETERS 0x21 */ PRIV_ENTRY(n,X,X,X), /* IPMI_GET_SOL_CONFIGURATION_PARAMETERS 0x22 */ }; static struct { int size; priv_val *vals; } priv_table[7] = { { sizeof(chassis_privs)/sizeof(priv_val), chassis_privs }, { sizeof(bridge_privs)/sizeof(priv_val), bridge_privs }, { sizeof(sensor_privs)/sizeof(priv_val), sensor_privs }, { sizeof(app_privs)/sizeof(priv_val), app_privs }, { sizeof(firmware_privs)/sizeof(priv_val), firmware_privs }, { sizeof(storage_privs)/sizeof(priv_val), storage_privs }, { sizeof(transport_privs)/sizeof(priv_val), transport_privs }, }; int ipmi_cmd_permitted(unsigned char priv, unsigned char netfn, unsigned char cmd) { int perm; /* Priviledges */ if ((priv < IPMI_PRIVILEGE_CALLBACK) || (priv > IPMI_PRIVILEGE_ADMIN)) return IPMI_PRIV_INVALID; if ((netfn > IPMI_TRANSPORT_NETFN) || (cmd >= priv_table[netfn>>1].size)) { /* All things not in the table are assumed to take administrator priviledge. */ if (priv == IPMI_PRIVILEGE_ADMIN) return IPMI_PRIV_PERMITTED; else return IPMI_PRIV_DENIED; } perm = priv_table[netfn>>1].vals[cmd]; /* Extract the permissions for the given privilege from the permission word. The tables are 0-based, but the first valid privilege is 1, thus the (priv - 1) here. */ perm >>= 4 * (priv - 1); perm &= 0xf; switch (perm) { case n: case s: case b: case b2: return 0; case p: case X: return IPMI_PRIV_PERMITTED; case h: return IPMI_PRIV_SEND; case i: return IPMI_PRIV_BOOT; } return IPMI_PRIV_DENIED; } OpenIPMI-2.0.27/lanserv/Makefile.am0000664000175000017500000000445513140621755013627 00000000000000 LIB_VERSION = 0.0.1 LD_VERSION = 0:1:0 PVERSION="1.0.13" BUILD_CC = @BUILD_CC@ SUBDIRS = OpenIPMI sdrcomp @MARVELL_BMC_DIR@ DIST_SUBDIRS = OpenIPMI sdrcomp marvell-bmc AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include -DIPMI_CHECK_LOCKS \ $(OPENSSLINCS) -DPVERSION="\"$(PVERSION)\"" AM_CPPFLAGS = -DSYSCONFDIR='"$(sysconfdir)"' -DSTATEDIR='"$(localstatedir)"' lib_LTLIBRARIES = libIPMIlanserv.la if HAVE_OPENIPMI_SMI IPMILAN_PROG = ipmilan IPMILAN_MAN = ipmilan.8 IPMILAN_NOMAN = else IPMILANPROG = IPMILAN_MAN = IPMILAN_NOMAN = ipmilan.8 endif bin_PROGRAMS = ipmi_sim $(IPMILAN_PROG) noinst_PROGRAMS = ipmi_checksum noinst_HEADERS = emu.h bmc.h libIPMIlanserv_la_SOURCES = lanserv_ipmi.c lanserv_asf.c priv_table.c \ lanserv_oem_force.c lanserv_config.c config.c serv.c serial_ipmi.c \ persist.c extcmd.c libIPMIlanserv_la_LIBADD = $(OPENSSLLIBS) -ldl $(RT_LIB) libIPMIlanserv_la_LDFLAGS = -version-info $(LD_VERSION) \ ../utils/libOpenIPMIutils.la ipmi_checksum_SOURCES = ipmi_checksum.c if HAVE_OPENIPMI_SMI ipmilan_SOURCES = lanserv.c ipmilan_LDADD = $(POPTLIBS) libIPMIlanserv.la -ldl $(RT_LIB) ipmilan_LDFLAGS = -rdynamic ../unix/libOpenIPMIposix.la \ ../utils/libOpenIPMIutils.la endif ipmi_sim_SOURCES = ipmi_sim.c bmc.c emu_cmd.c sol.c \ bmc_storage.c bmc_app.c bmc_chassis.c bmc_transport.c \ bmc_sensor.c bmc_picmg.c ipmi_sim_LDADD = $(POPTLIBS) libIPMIlanserv.la -lpthread $(RT_LIB) ipmi_sim_LDFLAGS = -rdynamic ../unix/libOpenIPMIposix.la \ ../utils/libOpenIPMIutils.la $(SOCKETLIB) man_MANS = $(IPMILAN_MAN) ipmi_lan.5 ipmi_sim.1 ipmi_sim_cmd.5 READMES = README.ipmi_sim README.vm README.design README.yourownbmc EXTRA_DIST = atca.emu lan.conf ipmisim1.emu ipmisim1.sdrs \ $(man_MANS) $(IPMILAN_NOMAN) $(READMES) install-data-local: $(INSTALL) -m 755 -d "$(DESTDIR)$(sysconfdir)/ipmi/"; \ $(INSTALL) -m 644 $(srcdir)/lan.conf "$(DESTDIR)$(sysconfdir)/ipmi/"; $(INSTALL) -m 644 $(srcdir)/ipmisim1.emu "$(DESTDIR)$(sysconfdir)/ipmi/"; noinst_DATA = ipmisim1.bsdr SUFFIXES = .bsdr .sdrs .sdrs.bsdr: sdrcomp/sdrcomp_build -o $@ $< ipmisim1.bsdr: $(top_srcdir)/lanserv/ipmisim1.sdrs sdrcomp/sdrcomp_build uninstall-local: -rm -f "$(DESTDIR)$(sysconfdir)/ipmi/lan.conf" -rm -f "$(DESTDIR)$(sysconfdir)/ipmi/sim.emu" -rmdir "$(DESTDIR)$(sysconfdir)/ipmi" 2>/dev/null CLEANFILES = ipmisim1.bsdr OpenIPMI-2.0.27/lanserv/marvell-bmc/0000755000175000017500000000000013437611466014051 500000000000000OpenIPMI-2.0.27/lanserv/marvell-bmc/marvell.emu0000644000175000017500000000426212141732704016135 00000000000000# # Emulation setup file for the Marvell AXP server # # The BMC is the MC at address 20 mc_setbmc 0x20 # Now add the BMC # IPMB DevID DevSDRs? Rev Maj Min Dev MFG Prod # FW FW Sup ID Id # Rev Rev mc_add 0x20 0 no-device-sdrs 0x00 0x00 0x00 0x9f 0x00500f 0x0001 persist_sdr sel_enable 0x20 1000 0x0a mc_add_fru_data 0x20 0 2048 \ file 0 "/sys/class/i2c-adapter/i2c-0/0-0051/at24c128" # MC LUN Sens# type reading # Switch Temp sensor_add 0x20 0 1 1 1 # Switch CPU Temp sensor_add 0x20 0 2 1 1 # Switch 12V sensor_add 0x20 0 3 2 1 # Switch 3.3V sensor_add 0x20 0 4 2 1 # Switch 1.8V sensor_add 0x20 0 5 2 1 # Chassis fans sensor_add 0x20 0 0x70 4 1 sensor_add 0x20 0 0x71 4 1 sensor_add 0x20 0 0x72 4 1 sensor_add 0x20 0 0x73 4 1 sensor_add 0x20 0 0x74 4 1 sensor_add 0x20 0 0x75 4 1 sensor_add 0x20 0 0x76 4 1 sensor_add 0x20 0 0x77 4 1 # Power supply sensors sensor_add 0x20 0 8 8 0x6f sensor_add 0x20 0 9 8 0x6f sensor_add 0x20 0 10 2 1 poll 2000 \ file "/sys/class/wixpmbus/VOUT_1" mult=8 div=125 sub=10000 \ depends=0x20,0,8,0 sensor_add 0x20 0 11 2 1 poll 2000 \ file "/sys/class/wixpmbus/VOUT_2" mult=8 div=125 sub=10000 \ depends=0x20,0,9,0 sensor_add 0x20 0 12 3 1 poll 2000 \ file "/sys/class/wixpmbus/IOUT_1" div=1000 \ depends=0x20,0,8,0 sensor_add 0x20 0 13 3 1 poll 2000 \ file "/sys/class/wixpmbus/IOUT_2" div=1000 \ depends=0x20,0,9,0 sensor_add 0x20 0 14 3 1 poll 2000 \ file "/sys/class/wixpmbus/POUT_1" div=10000 \ depends=0x20,0,8,0 sensor_add 0x20 0 15 3 1 poll 2000 \ file "/sys/class/wixpmbus/POUT_2" div=10000 \ depends=0x20,0,9,0 define MCNUM "1" include "marvell_node.emu" define MCNUM "2" include "marvell_node.emu" define MCNUM "3" include "marvell_node.emu" define MCNUM "4" include "marvell_node.emu" define MCNUM "5" include "marvell_node.emu" define MCNUM "6" include "marvell_node.emu" # Turn on the BMC mc_enable 0x20 OpenIPMI-2.0.27/lanserv/marvell-bmc/BuildingAndConfiguring.tex0000664000175000017500000000140112256156727021066 00000000000000 The build script build procedure special files (NTP, ast1300...) How to modify the build config How to modify the busybox config The configuration file LAN channels MCs users emu files MCs sensors FRU data SDRs Custom commands Disable network services: raw 2e 01 0f 50 00 [0|1] Enables (1) or disables(0) ssh access to the BMC Reload board FRU raw 2e 02 0f 50 00 Reload the board FRU information for the given board number. Set force all fans duty cycle raw 2e 03 0f 50 00 [0|] Set all fans to the given duty cycle. Allowed values are 30-100. Setting it to zero will disable this feature Get force all fans duty cycle raw 2e 04 0f 50 00 Returns the current fan forced duty cycle setting. OpenIPMI-2.0.27/lanserv/marvell-bmc/Install_Marvell_BMC.sh0000644000175000017500000000660512116456523020077 00000000000000# # Script to install the Marvell BMC. Run from the same directory # you ran Build_Marvell_BMC.sh in. # VERSION=1.0.0 # These are the things you must configure for your setup. In general, # you would set these in an override file AST1300=${HOME}/hhl/marvell/ast1300.ko AXP_BOARD_FRU=${HOME}/hhl/marvell/axpfru-2.0.01.img NTPSERVER=pool.ntp.org MTIMEZONE=GMT #MTIMEZONE=US/Central if [ -e Install_Marvell_Overrides ]; then echo "Reading override file" source ./Install_Marvell_Overrides fi echo AST1300=$AST1300 echo AXP_BOARD_FRU=$AXP_BOARD_FRU echo NTPSERVER=$NTPSERVER echo MTIMEZONE=$MTIMEZONE BUILDROOT=buildroot-2011.05-sdk5.1.2 # General variables we use MBASEDIR=`pwd` BRDIR=${MBASEDIR}/${BUILDROOT} # Install openipmi into the image. Some of this *MUST* be done as root, # thus the sudo on those command. cd ${MBASEDIR} cd ${BRDIR}/output/images sudo rm -rf rootfs sudo mkdir rootfs cd rootfs sudo tar xf ../rootfs.tar cd ${MBASEDIR}/openipmi cd utils sudo cp .libs/libOpenIPMIutils.so.0 ${BRDIR}/output/images/rootfs/usr/lib cd ../unix sudo cp .libs/libOpenIPMIposix.so.0 ${BRDIR}/output/images/rootfs/usr/lib cd ../lanserv sudo cp .libs/libIPMIlanserv.so.0 ${BRDIR}/output/images/rootfs/usr/lib sudo cp .libs/ipmi_sim ${BRDIR}/output/images/rootfs/usr/sbin cd marvell-bmc sudo mkdir -p ${BRDIR}/output/images/rootfs/etc/ipmi sudo cp lan.conf lancontrol marvell.emu marvell_node.emu netsrvc \ ${BRDIR}/output/images/rootfs/etc/ipmi sudo cp interfaces ${BRDIR}/output/images/rootfs/etc/network sudo cp S90ast1300 ${BRDIR}/output/images/rootfs/etc/init.d sudo cp ntp.conf ${BRDIR}/output/images/rootfs/etc sudo mkdir -p ${BRDIR}/output/images/rootfs/usr/lib/ipmi_sim sudo cp .libs/marvell_mod.so ${BRDIR}/output/images/rootfs/usr/lib/ipmi_sim sudo mkdir -p ${BRDIR}/output/images/rootfs/var/ipmi_sim sudo mkdir -p ${BRDIR}/output/images/rootfs/var/ipmi_sim/AXP-SERVER sudo cp sdrs.bin \ ${BRDIR}/output/images/rootfs/var/ipmi_sim/AXP-SERVER/sdr.20.main # Now fix things up in the root filesystem cd ${BRDIR}/output/images/rootfs # Now install the board fru reference file in /etc/ipmi/axp_board_fru sudo cp ${AXP_BOARD_FRU} etc/ipmi/axp_board_fru # Now install ast1300.ko in root sudo mkdir -p root sudo cp ${AST1300} root/ast1300.ko # Add the following to etc/inittab: sudo sh -c 'echo "null::respawn:/usr/sbin/ipmi_sim -f /etc/ipmi/marvell.emu -n"\ >>etc/inittab' # Set the login prompt sudo sh -c "echo \"Welcome to Marvell BMC ${VERSION}\" >etc/issue" # Set the hostname. No '.' allowed in hostname, so translate to '_' sudo sh -c "echo \"BMC-${VERSION}\" | sed 's/\\./_/g' >etc/hostname" # Fix a problem setting the hostname sudo sed -i 's/hostname -F \/etc\/hostname/hostname "`cat \/etc\/hostname`"/' \ etc/inittab # Set the NTP server sudo sed -i 's/NTPDATE=no/NTPDATE=yes/' etc/default/ntpd sudo sed -i "s/pool\.ntp\.org/${NTPSERVER}/" etc/default/ntpd sudo sed -i "s/pool\.ntp\.org/${NTPSERVER}/" etc/ntp.conf # Set the time zone sudo ln -sf /usr/share/zoneinfo/${MTIMEZONE} etc/localtime # Create the event device for the AST1300 sudo mknod dev/event c 10 10 # The redirect for stdout is done so that the file is owned by the user, # not root.sudo sudo tar czf - * >${MBASEDIR}/rootfs-$VERSION.tar.gz cd .. sudo rm -rf rootfs echo "Now you can install rootfs-$VERSION.tar.gz on the chassis." echo "" echo "You will need to edit etc/network/interfaces in the rootfs" echo "to set it properly for your network." OpenIPMI-2.0.27/lanserv/marvell-bmc/board.sdrs0000644000175000017500000003706412116456523015761 00000000000000 sdr type 8 container_entity_id processing_blade container_entity_inst $OWNER_MC entity_1_id processor entity_1_inst $OWNER_MC entity_2_id memory_module entity_2_inst $OWNER_MC entity_3_id front_panel_board entity_3_inst $OWNER_MC endsdr sdr type 18 device_slave_address $OWNER_MC device_channel_number 0 chassis true ipmb_event_gen true fru_inventory true sensor true entity_id processing_blade entity_instance $OWNER_MC id_string "AXP Board "$OWNER_MC endsdr # Board temp sensor sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 1 entity_id processing_blade entity_instance $OWNER_MC init_scanning true init_sensor_type true default_sensor_scan_on true sensor_type Temperature event_reading_type_code 1 analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit degrees_C modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 id_string "MB Node "$OWNER_MC" temp" endsdr # CPU temp sensor sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 2 entity_id processor entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Temperature event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true return_unr true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true assert_unrgh true deassert_unrgh true lc_thrsh_settable true lnc_thrsh_settable true unr_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit degrees_C modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 unr_thresh 105 uc_fthresh 90 unc_fthresh 75 lnc_fthresh 5 lc_fthresh 0 positive_hysteresis 2 negative_hysteresis 2 id_string "CPU Node "$OWNER_MC" temp" endsdr # DIMM temp sensor sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 3 entity_id memory_module entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Temperature event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit degrees_C modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 85 unc_fthresh 75 lnc_fthresh 5 lc_fthresh 0 positive_hysteresis 2 negative_hysteresis 2 id_string "DIMM Node "$OWNER_MC" temp" endsdr # Front panel temp sensor sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 4 entity_id front_panel_board entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Temperature event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit degrees_C modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 45 unc_fthresh 40 lnc_fthresh 5 lc_fthresh 0 positive_hysteresis 2 negative_hysteresis 2 id_string "FP Node "$OWNER_MC" temp" endsdr # V 1.0 Node X # Range 0.9 - 1.1 sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 5 entity_id processing_blade entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 78 tolerance 0 b 9 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -5 b_exp 4 nominal_specified true nominal_freading 1.0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 1.05 unc_fthresh 1.03 lnc_fthresh 0.97 lc_fthresh 0.95 positive_hysteresis 2 negative_hysteresis 2 id_string "1.0V Node "$OWNER_MC endsdr # V 1.8 Node X # Range 1.6 - 2.0 sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 6 entity_id processing_blade entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 156 tolerance 0 b 16 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -5 b_exp 4 nominal_specified true nominal_freading 1.8 sensor_maximum 255 sensor_minimum 0 uc_fthresh 1.89 unc_fthresh 1.854 lnc_fthresh 1.746 lc_fthresh 1.71 positive_hysteresis 2 negative_hysteresis 2 id_string "1.8V Node "$OWNER_MC endsdr # V 2.5 Node X # Range 2.0 - 3.0 sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 7 entity_id processing_blade entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 391 tolerance 0 b 20 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -5 b_exp 4 nominal_specified true nominal_freading 2.5 sensor_maximum 255 sensor_minimum 0 uc_fthresh 2.625 unc_fthresh 2.575 lnc_fthresh 2.425 lc_fthresh 2.375 positive_hysteresis 2 negative_hysteresis 2 id_string "2.5V Node "$OWNER_MC endsdr # V 3.3 Node X # Range 2.9 - 3.7 sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 8 entity_id processing_blade entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 313 tolerance 0 b 29 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -5 b_exp 4 nominal_specified true nominal_freading 3.3 sensor_maximum 255 sensor_minimum 0 uc_fthresh 3.465 unc_fthresh 3.399 lnc_fthresh 3.201 lc_fthresh 3.135 positive_hysteresis 2 negative_hysteresis 2 id_string "3.3V Node "$OWNER_MC endsdr # V 1.05 Node X # Range .80 to 1.2 sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 9 entity_id processing_blade entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 156 tolerance 0 b 8 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -5 b_exp 4 nominal_specified true nominal_freading 1.05 sensor_maximum 255 sensor_minimum 0 uc_fthresh 1.155 unc_fthresh 1.1025 lnc_fthresh 0.9975 lc_fthresh 0.945 positive_hysteresis 2 negative_hysteresis 2 id_string "1.05V Node "$OWNER_MC endsdr # V DIMM Node X # Range 1.2 - 1.5 sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 11 entity_id processing_blade entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 117 tolerance 0 b 12 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -5 b_exp 4 nominal_specified true nominal_freading 1.35 sensor_maximum 255 sensor_minimum 0 uc_fthresh 1.4175 unc_fthresh 1.3905 lnc_fthresh 1.3095 lc_fthresh 1.2825 positive_hysteresis 2 negative_hysteresis 2 id_string "DIMM V Node "$OWNER_MC endsdr # V 0.9 Node X # Range 0.7 - 1.32 sdr type 1 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 12 entity_id processing_blade entity_instance $OWNER_MC init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 243 tolerance 0 b 7 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -5 b_exp 4 nominal_specified true nominal_freading 0.9 sensor_maximum 255 sensor_minimum 0 uc_fthresh 1.20 unc_fthresh 1.10 lnc_fthresh 0.855 lc_fthresh 0.81 positive_hysteresis 2 negative_hysteresis 2 id_string "0.9V Node "$OWNER_MC endsdr # Board CPU status sensor sdr type 2 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 20 entity_id processor entity_instance $OWNER_MC init_scanning true init_events true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm false sensor_type Processor event_reading_type_code 0x6f assert_event0 true deassert_event0 true event0_state_ret true id_string "CPU Status "$OWNER_MC endsdr # Board DIMM status sensor sdr type 2 sensor_owner_id $OWNER_MC sensor_owner_lun 0 channel_number 0 sensor_number 21 entity_id memory_module entity_instance $OWNER_MC init_scanning true init_events true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm false sensor_type Memory event_reading_type_code 0x6f assert_event0 true assert_event1 true assert_event2 true assert_event7 true deassert_event0 true deassert_event1 true deassert_event2 true deassert_event7 true event0_state_ret true event1_state_ret true event2_state_ret true event7_state_ret true id_string "DIMM Status "$OWNER_MC endsdr OpenIPMI-2.0.27/lanserv/marvell-bmc/wiw.h0000644000175000017500000000110512077274675014753 00000000000000enum { WIW_NO_EVENT, WIW_NODE1_IN, WIW_NODE1_OUT, WIW_NODE2_IN, WIW_NODE2_OUT, WIW_NODE3_IN, WIW_NODE3_OUT, WIW_NODE4_IN, WIW_NODE4_OUT, WIW_NODE5_IN, WIW_NODE5_OUT, WIW_NODE6_IN, WIW_NODE6_OUT, WIW_NODE1_PBTN_P, WIW_NODE1_PBTN_R, WIW_NODE2_PBTN_P, WIW_NODE2_PBTN_R, WIW_NODE3_PBTN_P, WIW_NODE3_PBTN_R, WIW_NODE4_PBTN_P, WIW_NODE4_PBTN_R, WIW_NODE5_PBTN_P, WIW_NODE5_PBTN_R, WIW_NODE6_PBTN_P, WIW_NODE6_PBTN_R, }; #define READ_WIW_BLOCKING _IOWR('c', 150, int) #define READ_WIW_NONBLOCKING _IOWR('c', 151, int) OpenIPMI-2.0.27/lanserv/marvell-bmc/SystemInfo0000664000175000017500000000410112151417740016001 00000000000000 The BMC uses the following devices in the kernel: Serial ports: 1: /dev/ttyAS0 2: /dev/ttyAS1 3: /dev/ttyAS2 4: /dev/ttyAS3 5: /dev/ttyAS4 6: /dev/ttyS1 Fan fail LEDs: /sys/class/astgpio/GPIOP0 /sys/class/astgpio/GPIOP1 /sys/class/astgpio/GPIOP2 /sys/class/astgpio/GPIOP3 Power supply status: /sys/class/wixpmbus/STATUS_1 /sys/class/wixpmbus/STATUS_2 Board reset: /sys/class/astgpio/GPIOH[0-5] Board power: /sys/class/astgpio/GPIOD[6-7] /sys/class/astgpio/GPIOB[0-3] Board present: /sys/class/astgpio/GPIOC[0-5] Power off request: /sys/class/astgpio/GPIOA[6-7] /sys/class/astgpio/GPIOI[4-7] Power off ready: /sys/class/astgpio/GPIOA[0-3] /sys/class/astgpio/GPIOG[4-5] System FRU data: /sys/class/i2c-adapter/i2c-0/0-0051/at24c128 Switch sensors: switch temp: /sys/class/i2c-adapter/i2c-0/0-0058/temp2_input switch cpu temp: /sys/class/i2c-adapter/i2c-0/0-0058/temp3_input 12V /sys/class/i2c-adapter/i2c-0/0-0058/in11_input 3.3V /sys/class/i2c-adapter/i2c-0/0-0058/in10_input 1.8V /sys/class/i2c-adapter/i2c-0/0-0058/in2_input Fan 1-8 /sys/class/astfan/fan[1-8]_input Power supply Voltage: /sys/class/wixpmbus/VOUT_[1-2] Current: /sys/class/wixpmbus/IOUT_[1-2] Power /sys/class/wixpmbus/POUT_[1-2] For the rest of these "n" is the board number. Board FRU data /sys/class/i2c-adapter/i2c-n/n-0050/at24c64 Board CPU temp /sys/class/i2c-adapter/i2c-n/n-0064/temp1_input Board DIMM temp /sys/class/i2c-adapter/i2c-n/n-001e/temp1_input Board motherboard temp /sys/class/i2c-adapter/i2c-n/n-004a/temp1_input Board front temp /sys/class/i2c-adapter/i2c-n/n-004c/temp1_input 1V /sys/class/i2c-adapter/i2c-n/n-0048/in3_input 1.8V /sys/class/i2c-adapter/i2c-n/n-0048/in2_input 2.5V /sys/class/i2c-adapter/i2c-n/n-0048/in1_input 3.3V /sys/class/i2c-adapter/i2c-n/n-0048/in0_input 1.05V /sys/class/i2c-adapter/i2c-n/n-0049/in2_input DIMM V /sys/class/i2c-adapter/i2c-n/n-0049/in1_input .9V /sys/class/i2c-adapter/i2c-n/n-0049/in0_input OpenIPMI-2.0.27/lanserv/marvell-bmc/marvell_mod.c0000664000175000017500000024511713136646214016445 00000000000000/* * marvel_mod.c * * Marvell specific modules for handling BMC and MC functions. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2012,2013 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "wiw.h" #define PVERSION "2.0.12" #define NUM_BOARDS 6 #define CHASSIS_FRU_SIZE 1024 #define BOARD_FRU_SIZE 2048 #define BOARD_TEMP_SHUTDOWN 105 #define SWITCH_TEMP_SHUTDOWN 115 #define FRONT_TEMP_SHUTDOWN 50 #define MARVELL_SEMI_ISREAL_IANA 20495 #define DISABLE_NETWORK_SRVC_CMD 1 #define RELOAD_BOARD_FRU_CMD 2 #define SET_ALL_FANS_DUTY_CMD 3 #define GET_ALL_FANS_DUTY_CMD 4 #define BOARD_FRU_FILE "/etc/ipmi/axp_board_fru" #define COLD_POWER_FILE "/var/lib/ipmi_sim_coldpower" #define RESET_REASON_FILE "/var/lib/reset_reason" #define RESET_REASON_UNKNOWN 0 #define RESET_REASON_COLD_BOOT 1 #define RESET_REASON_WARM_BOOT 2 static int init_complete; #define GPIODIR "/sys/class/astgpio/GPIO" #define COLD_POWER_UP_IO "/sys/class/astgpio/ColdBoot" static unsigned int cold_power_up = 1; /* * Set debugging with bits: * bit 0 - power * bit 1 - sensor reading * bit 2 - sensor writing * bit 3 - fan */ static unsigned int debug; /* 1 second poll time */ static unsigned int poll_time = 2000000; static lmc_data_t *bmc_mc; /* Set the file to "0" to enable reset */ #define BOARD_RESET_ON 0 #define BOARD_RESET_OFF 1 static const char *trg_reset[NUM_BOARDS] = { GPIODIR "H0", GPIODIR "H1", GPIODIR "H2", GPIODIR "H3", GPIODIR "H4", GPIODIR "H5" }; /* Set the file to "1" to power on, "0" to power off. */ #define BOARD_POWER_ON 1 #define BOARD_POWER_OFF 0 static const char *trg_power[NUM_BOARDS] = { GPIODIR "D6", GPIODIR "D7", GPIODIR "B0", GPIODIR "B1", GPIODIR "B2", GPIODIR "B3" }; /* Will contain "0" if present, "1" if not present. */ #define BOARD_PRESENT 0 #define BOARD_ABSENT 1 static const char *trg_present[NUM_BOARDS] = { GPIODIR "C0", GPIODIR "C1", GPIODIR "C2", GPIODIR "C3", GPIODIR "C4", GPIODIR "C5", }; static int simulate_board_absent[NUM_BOARDS]; /* Set this to zero to request that the board power off. */ #define BOARD_OFF_REQUEST_ON 0 #define BOARD_OFF_REQUEST_OFF 1 static const char *pow_off_request[NUM_BOARDS] = { GPIODIR "A6", GPIODIR "A7", GPIODIR "I4", GPIODIR "I5", GPIODIR "I6", GPIODIR "I7" }; /* The board will set the value to 0 when it is ready to power off. */ #define BOARD_OFF_READY 0 #define BOARD_OFF_NOT_READY 1 static const char *pow_off_ready[NUM_BOARDS] = { GPIODIR "A0", GPIODIR "A1", GPIODIR "A2", GPIODIR "A3", GPIODIR "G4", GPIODIR "G5" }; #define I2CDIR "/sys/class/i2c-adapter/i2c-" struct eeprom { unsigned char addr; const char *part; const char *dev; unsigned int size; }; static struct board_i2c_info { const char *add_dev; struct eeprom fru; } const board_i2c[NUM_BOARDS] = { { .add_dev = I2CDIR "1/new_device", .fru = { .addr = 0x50, .part = "24c64", .dev = I2CDIR "1/1-0050/at24c64", .size = BOARD_FRU_SIZE }, }, { .add_dev = I2CDIR "2/new_device", .fru = { .addr = 0x50, .part = "24c64", .dev = I2CDIR "2/2-0050/at24c64", .size = BOARD_FRU_SIZE }, }, { .add_dev = I2CDIR "3/new_device", .fru = { .addr = 0x50, .part = "24c64", .dev = I2CDIR "3/3-0050/at24c64", .size = BOARD_FRU_SIZE }, }, { .add_dev = I2CDIR "4/new_device", .fru = { .addr = 0x50, .part = "24c64", .dev = I2CDIR "4/4-0050/at24c64", .size = BOARD_FRU_SIZE }, }, { .add_dev = I2CDIR "5/new_device", .fru = { .addr = 0x50, .part = "24c64", .dev = I2CDIR "5/5-0050/at24c64", .size = BOARD_FRU_SIZE }, }, { .add_dev = I2CDIR "6/new_device", .fru = { .addr = 0x50, .part = "24c64", .dev = I2CDIR "6/6-0050/at24c64", .size = BOARD_FRU_SIZE }, }, }; static struct board_i2c_info *chassis_i2c; /* For older systems (before DVT2) */ static struct board_i2c_info chassis_i2c_old = { .add_dev = I2CDIR "7/new_device", .fru = { .addr = 0x54, .part = "24c128", .dev = I2CDIR "7/7-0054/at24c128", .size = CHASSIS_FRU_SIZE } }; /* For newer systems (DVT2 and later) */ static struct board_i2c_info chassis_i2c_new = { .add_dev = I2CDIR "0/new_device", .fru = { .addr = 0x54, .part = "24c128", .dev = I2CDIR "0/0-0051/at24c128", .size = CHASSIS_FRU_SIZE } }; static struct board_info { sys_data_t *sys; lmc_data_t *mc; unsigned char num; char present; char fru_good; unsigned char fru[BOARD_FRU_SIZE]; struct timeval button_press_time; unsigned int power_off_countdown; char button_pressed; char waiting_power_off; volatile char fru_data_ready_for_handling; /* * Tracks the state of the power request line, request happens * on a 1->0 transition. */ char last_power_request; } boards[NUM_BOARDS]; struct timeval last_board_power_on; static unsigned char chassis_fru[CHASSIS_FRU_SIZE]; static unsigned int chassis_iuse; static unsigned int chassis_iuse_len; static unsigned int chassis_chinfo; static unsigned int chassis_chinfo_len; static unsigned int chassis_brdinfo; static unsigned int chassis_brdinfo_len; /* Offset from beginning of chassis info area */ static unsigned int sernum_offset; static unsigned int sernum_offset2; static unsigned int sernum_len; static unsigned int sysmac_offset; /* Pieces of the serial number and MAC we need for generating board info */ static unsigned char sernum[10]; static unsigned char sysmac[17]; static const unsigned char board_ipmb[NUM_BOARDS] = { 1, 2, 3, 4, 5, 6 }; static int disable_wdt; static int wdt_fd; static ipmi_timer_t *wdt_test_timer; static volatile int wdt_test_timer_ran; static void add_to_timeval(struct timeval *tv, unsigned int usecs) { while (usecs >= 1000000) { tv->tv_sec += 1; usecs -= 1000000; } tv->tv_usec += usecs; while (tv->tv_usec >= 1000000) { tv->tv_sec += 1; tv->tv_usec -= 1000000; } } static void diff_timeval(struct timeval *result, struct timeval *tv1, struct timeval *tv2) { result->tv_sec = tv1->tv_sec - tv2->tv_sec; result->tv_usec = tv1->tv_usec - tv2->tv_usec; while (result->tv_usec < 0) { result->tv_usec += 1000000; result->tv_sec -= 1; } } static long diff_timeval_ms(struct timeval *tv1, struct timeval *tv2) { struct timeval tv; diff_timeval(&tv, tv1, tv2); if (tv.tv_sec > 1000) return 1000000; if (tv.tv_sec < -1000) return -1000000; return (tv.tv_sec * 1000) + ((tv.tv_usec + 500) / 1000); } /************************************************************************** * EEPROM handling *************************************************************************/ static unsigned char checksum(unsigned char *data, int size) { unsigned char csum = 0; for (; size > 0; size--, data++) csum += *data; return csum; } /* * Validate that the eeprom device exists and can be opened. */ static int check_eeprom(sys_data_t *sys, const struct eeprom *e) { int fd; fd = open(e->dev, O_RDONLY); if (fd == -1) return errno; close(fd); return 0; } /* * Write to the sysfs file to create the eeprom device. Sometimes it * doesn't get automatically created, so create it here. */ static int create_eeprom(sys_data_t *sys, const char *add_dev, const struct eeprom *e) { int fd; fd = open(e->dev, O_RDONLY); if (fd == -1) { FILE *f; f = fopen(add_dev, "w"); if (!f) return errno; fprintf(f, "%s %d\n", e->part, e->addr); fclose(f); fd = open(e->dev, O_RDONLY); if (fd == -1) return errno; } close(fd); return 0; } /* Note: Data must be at least e->size */ static int read_eeprom(const struct eeprom *e, unsigned char *data, unsigned int offset, int size) { int rv; int err = 0; int fd; if (offset + size > e->size) return EINVAL; fd = open(e->dev, O_RDONLY); if (fd == -1) return errno; if (lseek(fd, offset, SEEK_SET) == -1) { err = errno; close(fd); return err; } rv = read(fd, data, size); if (rv == -1) err = errno; else if (rv < size) err = EIO; close(fd); return err; } /* Note: Data must be at least e->size */ static int write_eeprom(const struct eeprom *e, unsigned char *data, unsigned int offset, unsigned int size) { int rv; int err = 0; int fd; if (size + offset > e->size) return EINVAL; fd = open(e->dev, O_WRONLY); if (fd == -1) return errno; if (lseek(fd, offset, SEEK_SET) == -1) { close(fd); return errno; } rv = write(fd, data, size); if (rv == -1) err = errno; else if (rv < size) err = EIO; close(fd); return err; } /************************************************************************** * General file handling. These are functions that read and write * sysfs files, generally. *************************************************************************/ /* * Convert an integer value to a string and write it to the device. */ static int set_intval(const char *fname, unsigned int val) { FILE *f; f = fopen(fname, "w"); if (!f) return errno; fprintf(f, "%u\n", val); fclose(f); return 0; } /* * Fetch an unsigned integer ASCII value from a file an convert it. */ static int get_uintval(const char *fname, unsigned int *val) { FILE *f; char line[80]; size_t rv; f = fopen(fname, "r"); if (!f) return errno; rv = fread(line, 1, sizeof(line), f); if (rv == 0) { int retval = 0; if (ferror(f)) { retval = errno; } fclose(f); return retval; } fclose(f); *val = strtoul(line, NULL, 0); return 0; } /* * Fetch a signed integer ASCII value from a file an convert it. */ static int get_intval(const char *fname, int *val) { FILE *f; char line[80]; size_t rv; f = fopen(fname, "r"); if (!f) return errno; rv = fread(line, 1, sizeof(line), f); if (rv == 0) { int retval = 0; if (ferror(f)) { retval = errno; } fclose(f); return retval; } fclose(f); *val = strtol(line, NULL, 0); return 0; } /************************************************************************** * Board power handling. * * This is kept as a list of boards waiting to power on. Only one * board may be waiting at a time, and the first thing in * boards_waiting_power_on will be the next thing to power on. *************************************************************************/ static ipmi_timer_t *power_timer; static unsigned int boards_waiting_power_on[NUM_BOARDS]; static unsigned int num_boards_waiting_power_on; static enum { PT_NOT_RUNNING, PT_RUNNING, PT_WAITING_RESET } power_timer_running; /* * Return true if the board is on, false if not. */ static int board_power_state(sys_data_t *sys, unsigned int num) { int rv; unsigned int rval; rv = get_uintval(trg_power[num], &rval); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to read board %u power state: %s", num + 1, strerror(rv)); return 0; } return rval == BOARD_POWER_ON; } /* * Return true if the given board number is waiting to power on. */ static int board_waiting_power_on(unsigned int num) { unsigned int i; for (i = 0; i < num_boards_waiting_power_on; i++) { if (boards_waiting_power_on[i] == num) return 1; } return 0; } /* * Start the timer to power on the board. The time will be * mintime + rand[1-6]. */ static void start_power_timer(sys_data_t *sys, unsigned int mintime) { struct timeval tv; unsigned int to_add; sys->gen_rand(sys, &to_add, sizeof(to_add)); to_add %= 5; to_add += 1 + mintime; tv.tv_sec = to_add; tv.tv_usec = 0; if (debug & 1) sys->log(sys, DEBUG, NULL, "Starting power timer on board %u for" " %u seconds", boards_waiting_power_on[0] + 1, to_add); sys->start_timer(power_timer, &tv); power_timer_running = PT_RUNNING; } /* * Set the given board number waiting to power up. */ static void board_add_power_wait(sys_data_t *sys, unsigned int num) { boards_waiting_power_on[num_boards_waiting_power_on] = num; num_boards_waiting_power_on++; if (num_boards_waiting_power_on == 1) start_power_timer(sys, 0); } /* * Remove the board from the power up wait list and start the next * board, if there is one. */ static void board_remove_power_wait(sys_data_t *sys, unsigned int num) { unsigned int i; for (i = 0; i < num_boards_waiting_power_on; i++) { if (boards_waiting_power_on[i] == num) break; } if (i == num_boards_waiting_power_on) /* Not found */ return; for (; i < num_boards_waiting_power_on - 1; i++) boards_waiting_power_on[i] = boards_waiting_power_on[i + 1]; num_boards_waiting_power_on--; if (num_boards_waiting_power_on == 0) { sys->stop_timer(power_timer); if (!init_complete) { set_intval(COLD_POWER_FILE, 0); init_complete = 1; } } else if (power_timer_running == PT_NOT_RUNNING) start_power_timer(sys, 5); } static int set_chassis_control(lmc_data_t *mc, int op, unsigned char *val, void *cb_data) { struct board_info *board = cb_data; sys_data_t *sys = board->sys; unsigned int num = board->num; int wval; int rv, err; switch (op) { case CHASSIS_CONTROL_POWER: if (debug & 1) { struct timeval now; board->sys->get_real_time(board->sys, &now); sys->log(sys, DEBUG, NULL, "Power request for board %d," " val=%d, wait=%d last=%ld.%ld, now=%ld.%ld", board->num + 1, *val, board->waiting_power_off, last_board_power_on.tv_sec, last_board_power_on.tv_sec, now.tv_sec, now.tv_sec); } if (debug & 1 && board->waiting_power_off) sys->log(sys, DEBUG, NULL, "Canceling power off wait on" "board power request for board %d", board->num + 1); /* It's going to be forced on or off soon, just disable this. */ board->waiting_power_off = 0; set_intval(pow_off_request[num], BOARD_OFF_REQUEST_OFF); if (*val) { if (!board->present) { if (debug & 1) sys->log(sys, DEBUG, NULL, "Power on request while board" " not present on %d", num + 1); return EAGAIN; } if (!board_power_state(sys, num) && !board_waiting_power_on(num)) board_add_power_wait(sys, num); else if (debug & 1) sys->log(sys, DEBUG, NULL, "Power on request, but board was" " alread on or waiting power up on board %d", num + 1); /* We always delay for a power on. */ break; } /* We are powering off. */ if (board_waiting_power_on(num)) { /* Don't power on later. */ if (debug & 1) sys->log(sys, DEBUG, NULL, "Stopping board power timer" " on %d", num + 1); board_remove_power_wait(sys, num); } if (debug & 1) sys->log(sys, DEBUG, NULL, "Setting board power off on %d", num + 1); rv = set_intval(trg_power[num], BOARD_POWER_OFF); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Unable to set power off" " for board %d: %s", board->num, strerror(rv)); return rv; } /* * We require a 0->1 transition for the power request to be * honored, so start at 1 for the next time to avoid board * insertion or startup issues. */ board->last_power_request = BOARD_OFF_READY; break; case CHASSIS_CONTROL_RESET: if (debug & 1) sys->log(sys, DEBUG, NULL, "Resetting board %d", board->num + 1); set_intval(trg_reset[num], BOARD_RESET_ON); set_intval(trg_reset[num], BOARD_RESET_OFF); break; case CHASSIS_CONTROL_BOOT_INFO_ACK: /* Just ignore this for now */ break; case CHASSIS_CONTROL_BOOT: if (debug & 1) sys->log(sys, DEBUG, NULL, "Chassis control on %d present=%d, " "fru_good=%d, val=%d", board->num + 1, boards[num].present, boards[num].fru_good, *val); if (!boards[num].present) return EAGAIN; if (!boards[num].fru_good) return EBADFD; switch (*val) { case 0: /* none */ return 0; case 1: /* pxe */ wval = 1; break; case 2: /* default */ wval = 0; break; default: return EINVAL; } rv = ipmi_mc_fru_sem_trywait(boards[num].mc, 0); if (rv) return rv; boards[num].fru[11] = wval; rv = write_eeprom(&board_i2c[num].fru, boards[num].fru + 11, 11, 1); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Error writing board %d" " PXE boot: %s", num + 1, strerror(rv)); } else { boards[num].fru[79] = -checksum(boards[num].fru + 8, 71); rv = write_eeprom(&board_i2c[num].fru, boards[num].fru + 79, 79, 1); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Error writing" " board %d" " PXE boot checksum: %s", num + 1, strerror(rv)); rv = 0; } } err = ipmi_mc_fru_sem_post(board->mc, 0); if (err) sys->log(sys, OS_ERROR, NULL, "Error posting board %d semaphore: %s", num + 1, strerror(err)); return rv; case CHASSIS_CONTROL_GRACEFUL_SHUTDOWN: if (board_waiting_power_on(num)) { if (debug & 1) sys->log(sys, DEBUG, NULL, "Graceful shutdown requested on %d," " shutting down power on timer", board->num + 1); board_remove_power_wait(sys, num); } else if (board->waiting_power_off) { /* Nothing to do, already waiting. */ } else if (board_power_state(sys, num)) { if (debug & 1) sys->log(sys, DEBUG, NULL, "Graceful shutdown requested on %d," " requesting board power off", board->num + 1); board->waiting_power_off = 1; board->power_off_countdown = 30; set_intval(pow_off_request[num], BOARD_OFF_REQUEST_ON); } break; default: return EINVAL; } return 0; } static int get_chassis_control(lmc_data_t *mc, int op, unsigned char *val, void *cb_data) { struct board_info *board = cb_data; sys_data_t *sys = board->sys; unsigned int num = board->num; unsigned char cval; int rv, err; switch (op) { case CHASSIS_CONTROL_POWER: *val = (board_power_state(board->sys, num) || board_waiting_power_on(num)); break; case CHASSIS_CONTROL_BOOT_INFO_ACK: val[0] = 0; val[1] = 0; break; case CHASSIS_CONTROL_BOOT: rv = ipmi_mc_fru_sem_trywait(boards[num].mc, 0); if (rv) return rv; rv = read_eeprom(&board_i2c[num].fru, &cval, 11, 1); if (rv) goto out_post; switch(cval) { case 0: *val = 2; /* default disk */ break; case 1: *val = 1; /* pxe */ break; default: *val = 0; /* Shouldn't happen */ break; } out_post: err = ipmi_mc_fru_sem_post(board->mc, 0); if (err) sys->log(sys, OS_ERROR, NULL, "Error posting board %d semaphore: %s", num + 1, strerror(err)); return rv; default: return EINVAL; } return 0; } /* * Chassis control for the chassis. This will perform the operation on * all boards. */ static int bmc_set_chassis_control(lmc_data_t *mc, int op, unsigned char *val, void *cb_data) { sys_data_t *sys = cb_data; unsigned int i; switch (op) { case CHASSIS_CONTROL_POWER: case CHASSIS_CONTROL_RESET: case CHASSIS_CONTROL_BOOT_INFO_ACK: case CHASSIS_CONTROL_BOOT: case CHASSIS_CONTROL_GRACEFUL_SHUTDOWN: break; default: return EINVAL; } if (debug & 1) { struct timeval now; sys->get_real_time(sys, &now); sys->log(sys, DEBUG, NULL, "Power request for all boards," " val=%d, now=%ld.%ld", *val, now.tv_sec, now.tv_sec); } for (i = 0; i < NUM_BOARDS; i++) set_chassis_control(NULL, op, val, &boards[i]); return 0; } /* * Chassis control get for the chassis. This only works for the power * control, and will return on if any board in the chassis is on, and * off otherwise. */ static int bmc_get_chassis_control(lmc_data_t *mc, int op, unsigned char *val, void *cb_data) { unsigned int i; if (op == CHASSIS_CONTROL_POWER) { unsigned char rval = 0, tval; /* If any board is on, report power as on. */ for (i = 0; i < NUM_BOARDS; i++) { get_chassis_control(NULL, op, &tval, &boards[i]); if (tval) rval = 1; } *val = rval; return 0; } /* This doesn't make sense for anything else. */ return EINVAL; } static void board_power_timeout(void *cb_data) { sys_data_t *sys = cb_data; unsigned int num = boards_waiting_power_on[0]; struct board_info *board = &boards[num]; int rv; if (num_boards_waiting_power_on == 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: power timer went off" " but no board waiting"); return; } if (power_timer_running == PT_RUNNING) { struct timeval tv; if (debug & 1) sys->log(sys, DEBUG, NULL, "Powering on board %d", num + 1); /* Hold the reset on the board for 100ms while it powers on. */ set_intval(trg_reset[num], BOARD_RESET_ON); rv = set_intval(trg_power[num], BOARD_POWER_ON); if (rv) sys->log(sys, OS_ERROR, NULL, "Warning: Unable to set power on" " for board %d: %s", num, strerror(rv)); /* Start the 100ms reset timer */ if (debug & 1) sys->log(sys, DEBUG, NULL, "Starting reset timer on board %u", num + 1); power_timer_running = PT_WAITING_RESET; tv.tv_sec = 0; tv.tv_usec = 100000; sys->start_timer(power_timer, &tv); } else { /* Take the board out of reset. */ set_intval(trg_reset[num], BOARD_RESET_OFF); power_timer_running = PT_NOT_RUNNING; /* Starts the next one if something is waiting. */ board_remove_power_wait(sys, num); } } static void power_down_system(sys_data_t *sys) { unsigned int i; unsigned char val = 0; for (i = 0; i < NUM_BOARDS; i++) set_chassis_control(NULL, CHASSIS_CONTROL_POWER, &val, &boards[i]); } /* * Called at init time to make sure the board state is sane. */ static void check_chassis_state(sys_data_t *sys) { unsigned int i; /* * Make sure the reset is off on all boards. The power state will * be set later. */ for (i = 0; i < NUM_BOARDS; i++) set_intval(trg_reset[i], BOARD_RESET_OFF); } /************************************************************************** * Sensor handling *************************************************************************/ /* * The DIMM and CPU error sensors will remain set until rearmed. This * is the rearm handling to clear those bits. */ struct eesense_rearm { unsigned int num; unsigned int offset; unsigned char mask; }; static int rearm_eesense_sensor(void *cb_data, uint16_t assert, uint16_t deassert) { struct eesense_rearm *info = cb_data; unsigned int num = info->num; unsigned int off = info->offset; unsigned char mask = info->mask; struct board_info *board = &boards[num]; sys_data_t *sys = board->sys; unsigned char data[72]; unsigned int i; int rv, err; if (!(assert & mask)) return 0; rv = ipmi_mc_fru_sem_trywait(boards[num].mc, 0); if (rv) return rv; rv = read_eeprom(&board_i2c[num].fru, data, 8, 72); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Error reading board %d fru: %s", num + 1, strerror(rv)); goto out_post; } if (!(data[off] & mask)) goto out_post; data[off] &= ~mask; data[71] = -checksum(data, 71); rv = write_eeprom(&board_i2c[num].fru, data + off, 8 + off, 1); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Error writing board %d" " sensor data: %s", num + 1, strerror(rv)); goto out_post; } for (i = 0; i < 8; i++) ipmi_mc_sensor_set_bit(boards[num].mc, 0, 19 + off, i, ((data[off] >> i) & 1), 0); rv = write_eeprom(&board_i2c[num].fru, data + 71, 79, 1); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Error writing board %d" " internal use checksum: %s", num + 1, strerror(rv)); rv = 0; } out_post: err = ipmi_mc_fru_sem_post(board->mc, 0); if (err) sys->log(sys, OS_ERROR, NULL, "Error posting board %d semaphore: %s", num + 1, strerror(err)); return rv; } /* * The rearm for the power supply sensor will set the clear fault flag * for the power supply, just to be sure it is clear. */ static int rearm_power_supply_sensor(void *cb_data, uint16_t assert, uint16_t deassert) { unsigned int num = (unsigned long) cb_data; sys_data_t *sys = boards[0].sys; int rv; char fname[100]; if (!(assert & 2)) return 0; sprintf(fname, "/sys/class/wixpmbus/CLEAR_FAULT_%d", num); rv = set_intval(fname, 1); if (rv) { sys->log(sys, OS_ERROR, NULL, "Error writing ps %d clear file: %s", num, strerror(rv)); return rv; } return 0; } /************************************************************************** * Board handling *************************************************************************/ /* * Read the board's FRU and update anything that needs to be updated, * like the chassis information, the board's external MAC address, etc. */ static int handle_board_fru(sys_data_t *sys, int num) { int rv; unsigned int iuse; unsigned int iuse_len; unsigned int chinfo; unsigned int chinfo_len; unsigned int brdinfo; unsigned int brdinfo_len; unsigned int mac_offset; unsigned int brdchsernum_offset; unsigned int brdsernum_offset; int modified = 0; int fruversion2 = 0; unsigned char *fru; if (debug & 1) sys->log(sys, DEBUG, NULL, "Checking board FRU on board %d", num + 1); /* Guilty until proven innocent */ boards[num].fru_good = 0; rv = read_eeprom(&board_i2c[num].fru, boards[num].fru, 0, board_i2c[num].fru.size); if (rv) { sys->log(sys, SETUP_ERROR, NULL, "Can't read board %d eeprom: %s", num + 1, strerror(rv)); return 0; } fru = boards[num].fru; if (fru[0] != 1) { sys->log(sys, SETUP_ERROR, NULL, "Invalid board %d FRU version: 0x%x", num + 1, fru[0]); return 0; } if (checksum(fru + 0, 8) != 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Board %d FRU header" " checksum fail", num + 1); } iuse = fru[1] * 8; iuse_len = 80 - 8; chinfo = fru[2] * 8; chinfo_len = 256 - 80; brdinfo = fru[3] * 8; brdinfo_len = 2048 - 256; brdchsernum_offset = 42; brdsernum_offset = 74; mac_offset = 95; if (iuse != 8) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Board %d FRU internal use" "area is not at offset 8", num + 1); return 0; } if (chinfo != 80) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Board %d FRU chassis info" "area is not at offset 80", num + 1); return 0; } if (brdinfo != 256) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Board %d FRU board info" "area is not at offset 256", num + 1); return 0; } if (checksum(fru + iuse, iuse_len) != 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Board %d FRU internal use" " checksum fail", num + 1); return 0; } if (checksum(fru + chinfo, chinfo_len) != 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Board %d FRU chassis info" " checksum fail", num + 1); return 0; } if (checksum(fru + brdinfo, brdinfo_len) != 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Board %d FRU board info" " checksum fail", num + 1); return 0; } boards[num].fru_good = 1; /* Set the chassis information if it is not correct. */ if (chassis_fru[chinfo + brdchsernum_offset] != 0xd4) { /* Try the version 2.0 of the FRU data */ brdchsernum_offset = 17; } if (sernum_len == 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: FRU chassis serial number" " invalid, not setting board %d data", num + 1); } else if (chassis_chinfo == 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis chassis info FRU" "invalid, not checking board %d FRU chassis data", num + 1); } else { /* * If we have a different FRU version, or if the serial * numbers don't match, then update the chassis info area. */ if ((brdchsernum_offset != sernum_offset) || memcmp(fru + chinfo + brdchsernum_offset, chassis_fru + chassis_chinfo + sernum_offset, sernum_len) != 0) { /* The chassis serial number has changed. */ sys->log(sys, INFO, NULL, "Info: Updating board %d" " chassis info area", num + 1); memcpy(fru + chinfo, chassis_fru + chassis_chinfo, chassis_chinfo_len); rv = write_eeprom(&board_i2c[num].fru, fru + chinfo, chinfo, chassis_chinfo_len); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Error writing board %d" " chassis info: %s", num + 1, strerror(rv)); } } } /* Set the board system serial number if it is not correct. */ if (fru[brdinfo + brdsernum_offset] != 0xd4) { /* FRU version 2.0 */ brdsernum_offset = 34; fruversion2 = 1; } if (fru[brdinfo + brdsernum_offset] != 0xd4) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Board %d FRU serial num" " data invalid", num + 1); } else if (!sernum[0]) { sys->log(sys, SETUP_ERROR, NULL, "Warning: System serial num invalid," " not checking board %d ser num", num + 1); } else { char mysernum[21]; if (fruversion2) { int len; len = sprintf(mysernum, "%s-%c", sernum, num + 'A'); memset(mysernum + len, ' ', 20 - len); mysernum[20] = '\0'; } else { memset(mysernum, 0, 21); sprintf(mysernum, "System SN %s-%c", sernum, num + 'A'); } if (memcmp(mysernum, fru + brdinfo + brdsernum_offset + 1, 20) != 0) { sys->log(sys, INFO, NULL, "Info: Updating board %d" " serial number", num + 1); memcpy(fru + brdinfo + brdsernum_offset + 1, mysernum, 20); rv = write_eeprom(&board_i2c[num].fru, fru + brdinfo + brdsernum_offset + 1, brdinfo + brdsernum_offset + 1, 20); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Error writing board %d" " serial num: %s", num + 1, strerror(rv)); } modified = 1; } } /* Set the board MAC address if it is not correct. */ if (fru[brdinfo + mac_offset] != 0xdc) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Board %d FRU external MAC" " data invalid", num + 1); } else if (!sysmac[0]) { sys->log(sys, SETUP_ERROR, NULL, "Warning: System MAC invalid, not" " checking board %d MAC", num + 1); } else { char mac[29]; memset(mac, 0, 29); sprintf(mac, "System MAC %s%d", sysmac, num + 1); if (memcmp(mac, fru + brdinfo + mac_offset + 1, 28) != 0) { sys->log(sys, INFO, NULL, "Info: Updating board %d" " MAC address", num + 1); memcpy(fru + brdinfo + mac_offset + 1, mac, 28); rv = write_eeprom(&board_i2c[num].fru, fru + brdinfo + mac_offset + 1, brdinfo + mac_offset + 1, 28); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Error writing board %d" " MAC address: %s", num + 1, strerror(rv)); } modified = 1; } } if (modified) { /* Recalculate the board checksum */ fru[brdinfo + brdinfo_len - 1] = -checksum(fru + brdinfo, brdinfo_len - 1); rv = write_eeprom(&board_i2c[num].fru, fru + brdinfo + brdinfo_len - 1, brdinfo + brdinfo_len - 1, 1); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: Error writing board %d" " board info checksum: %s", num + 1, strerror(rv)); } } return 0; } /* * Check that the board has not changed states, and if it has then * handle the change. Called on insertion/removal events and * periodically by a timer. */ static int check_board(sys_data_t *sys, int num, unsigned int since_last, int power_up_new_board) { int rv; unsigned int present; unsigned int rval; unsigned char val; struct board_info *board = &boards[num]; if (board->present && board_power_state(sys, num)) { rv = get_uintval(pow_off_ready[num], &rval); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to read board %u power off ready: %s", num, strerror(rv)); } else { if (board->last_power_request == BOARD_OFF_NOT_READY && rval == BOARD_OFF_READY) { if (debug & 1) { if (board->waiting_power_off) sys->log(sys, DEBUG, NULL, "Graceful power of finished" " on %d, setting power off", board->num + 1); else sys->log(sys, DEBUG, NULL, "Board %d requested power" " off, setting power off", board->num + 1); } val = 0; set_chassis_control(NULL, CHASSIS_CONTROL_POWER, &val, board); } board->last_power_request = rval; } } if (board->waiting_power_off && since_last) { if (board->power_off_countdown == 0) { unsigned char val; if (debug & 1) sys->log(sys, DEBUG, NULL, "Graceful power off timeout" " on %d, forcing power off", board->num + 1); val = 0; set_chassis_control(NULL, CHASSIS_CONTROL_POWER, &val, board); } else { board->power_off_countdown--; } } rv = get_uintval(trg_present[num], &present); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to read board %d presence: %s", num + 1, strerror(rv)); return rv; } present = (present == BOARD_PRESENT) && !simulate_board_absent[num]; if (board->present == present) return 0; board->present = present; if (!present) { sys->log(sys, INFO, NULL, "Info: board %d has been removed", num + 1); board->fru_good = 0; /* * Turn off board power when not present, that way we can hold * off power on until we are done with messing with the board FRU * data. */ val = 0; set_chassis_control(NULL, CHASSIS_CONTROL_POWER, &val, board); return 0; } sys->log(sys, INFO, NULL, "Info: board %d is now present", num + 1); rv = create_eeprom(sys, board_i2c[num].add_dev, &board_i2c[num].fru); if (rv) { /* Force a retry, perhaps the device hasn't been created yet */ board->present = 0; sys->log(sys, SETUP_ERROR, NULL, "Can't create board %d eeprom: %s." " Will retry in a second", num + 1, strerror(rv)); return 0; } rv = handle_board_fru(sys, num); if (rv) return rv; if (power_up_new_board) { /* If the board was not present and now it is, power it on. */ val = 1; set_chassis_control(NULL, CHASSIS_CONTROL_POWER, &val, board); } return 0; } /* * If the board front-panel button is pressed, record the time, the * button will be handled on release. */ static void handle_button_press(sys_data_t *sys, unsigned int brdnum) { struct board_info *board = &boards[brdnum]; if (debug & 1) sys->log(sys, DEBUG, NULL, "Button press on %d", board->num + 1); board->button_pressed = 1; board->sys->get_monotonic_time(board->sys, &board->button_press_time); } /* * Handle the board's front-panel button. */ static void handle_button_release(sys_data_t *sys, unsigned int num) { struct timeval now; unsigned char val; struct board_info *board = &boards[num]; int power_state = board_power_state(sys, num); if (!board->button_pressed) return; if (debug & 1) sys->log(sys, DEBUG, NULL, "Button release on %d", num + 1); board->button_pressed = 0; board->sys->get_monotonic_time(board->sys, &now); /* * If the button is pressed more than 4 seconds, start a graceful * shutdown. */ if (power_state && (diff_timeval_ms(&now, &board->button_press_time) > 4000)) { if (board_waiting_power_on(num)) { if (debug & 1) sys->log(sys, DEBUG, NULL, "Button press on %d >4sec, stop" " power on timer", board->num + 1); board_remove_power_wait(sys, num); } else { if (debug & 1) sys->log(sys, DEBUG, NULL, "Button press on %d >4sec, start" " graceful shutdown", board->num + 1); val = 0; set_chassis_control(NULL, CHASSIS_CONTROL_GRACEFUL_SHUTDOWN, &val, board); } } /* * If the button is pressed less than 4 seconds, start a power up * if the board is not already on. */ if (!power_state && (diff_timeval_ms(&now, &board->button_press_time) <= 4000)) { if (debug & 1) sys->log(sys, DEBUG, NULL, "Button press on %d <4sec, power on", board->num + 1); val = 1; set_chassis_control(NULL, CHASSIS_CONTROL_POWER, &val, board); } } /* * Read data from the chassis FRU. */ static int init_chassis(sys_data_t *sys) { int rv; if (debug & 1) sys->log(sys, DEBUG, NULL, "Reading chassis eeprom info"); /* Detect which I2C channel to use for the chassis I2C. */ rv = check_eeprom(sys, &chassis_i2c_new.fru); if (rv) { rv = check_eeprom(sys, &chassis_i2c_old.fru); if (rv) { sys->log(sys, SETUP_ERROR, NULL, "Can't find chassis eeprom: %s", strerror(rv)); return rv; } chassis_i2c = &chassis_i2c_old; } else { chassis_i2c = &chassis_i2c_new; } rv = read_eeprom(&chassis_i2c->fru, chassis_fru, 0, chassis_i2c->fru.size); if (rv) { sys->log(sys, SETUP_ERROR, NULL, "Can't read chassis eeprom: %s", strerror(rv)); return rv; } if (chassis_fru[0] != 1) { sys->log(sys, SETUP_ERROR, NULL, "Invalid Chassis FRU version: 0x%x", chassis_fru[0]); return EINVAL; } if (checksum(chassis_fru + 0, 8) != 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis FRU header" " checksum fail"); } chassis_iuse = chassis_fru[1] * 8; chassis_iuse_len = 80 - 8; chassis_chinfo = chassis_fru[2] * 8; chassis_chinfo_len = 256 - 80; chassis_brdinfo = chassis_fru[3] * 8; chassis_brdinfo_len = 1024 - 256; sernum_offset = 42; sernum_offset2 = 11; sernum_len = 20; sysmac_offset = 74; if (chassis_iuse != 8) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis FRU internal use" "area is not at offset 8"); } if (chassis_chinfo != 80) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis FRU chassis info" "area is not at offset 80"); } if (chassis_brdinfo != 256) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis FRU board info" "area is not at offset 256"); } if (checksum(chassis_fru + chassis_iuse, chassis_iuse_len) != 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis FRU internal use" " checksum fail"); } if (checksum(chassis_fru + chassis_chinfo, chassis_chinfo_len) != 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis FRU chassis info" " checksum fail"); } if (checksum(chassis_fru + chassis_brdinfo, chassis_brdinfo_len) != 0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis FRU board info" " checksum fail"); } if (chassis_fru[chassis_chinfo + sernum_offset] != 0xd4) { /* Try the version 2.0 of the FRU data */ sernum_offset = 17; sernum_offset2 = 1; } if (chassis_fru[chassis_chinfo + sernum_offset] != 0xd4) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis FRU system serial" " number data invalid"); sernum_len = 0; } else { memcpy(sernum, chassis_fru + chassis_chinfo + sernum_offset + sernum_offset2, 8); sernum[9] = '\0'; } if (chassis_fru[chassis_brdinfo + sysmac_offset] != 0xe0) { sys->log(sys, SETUP_ERROR, NULL, "Warning: Chassis FRU system MAC" " data invalid"); } else { /* Don't copy the last byte, we use that for the boards. */ memcpy(sysmac, chassis_fru + chassis_brdinfo + sysmac_offset + 14, 16); sysmac[16] = '\0'; } return 0; } /************************************************************************** * Event/timer handling *************************************************************************/ static int ast_fd; static ipmi_io_t *ast_fd_id; static int fork_event_wait = 0; static void ast_evt(int fd, void *cb_data) { int rv; int event; sys_data_t *sys = cb_data; if (!fork_event_wait) { rv = ioctl(fd, READ_WIW_NONBLOCKING, &event); if (rv == -1) { sys->log(sys, OS_ERROR, NULL, "Warning: MV: Error reading" " AST event: %s", strerror(errno)); return; } } else { unsigned char c; rv = read(fd, &c, 1); if (rv != 1) { sys->log(sys, OS_ERROR, NULL, "Warning: MV: AST1300 shim" " failed: %s", strerror(errno)); exit(1); } event = c; } if (debug & 1) sys->log(sys, DEBUG, NULL, "Got event %d", event); switch (event) { case WIW_NO_EVENT: break; case WIW_NODE1_IN: case WIW_NODE1_OUT: if (debug & 1) sys->log(sys, DEBUG, NULL, "Board %s on 1", event == WIW_NODE1_IN ? "insertion" : "removal"); check_board(sys, 0, 0, 1); break; case WIW_NODE2_IN: case WIW_NODE2_OUT: if (debug & 1) sys->log(sys, DEBUG, NULL, "Board %s on 2", event == WIW_NODE2_IN ? "insertion" : "removal"); check_board(sys, 1, 0, 1); break; case WIW_NODE3_IN: case WIW_NODE3_OUT: if (debug & 1) sys->log(sys, DEBUG, NULL, "Board %s on 3", event == WIW_NODE3_IN ? "insertion" : "removal"); check_board(sys, 2, 0, 1); break; case WIW_NODE4_IN: case WIW_NODE4_OUT: if (debug & 1) sys->log(sys, DEBUG, NULL, "Board %s on 4", event == WIW_NODE4_IN ? "insertion" : "removal"); check_board(sys, 3, 0, 1); break; case WIW_NODE5_IN: case WIW_NODE5_OUT: if (debug & 1) sys->log(sys, DEBUG, NULL, "Board %s on 5", event == WIW_NODE5_IN ? "insertion" : "removal"); check_board(sys, 4, 0, 1); break; case WIW_NODE6_IN: case WIW_NODE6_OUT: if (debug & 1) sys->log(sys, DEBUG, NULL, "Board %s on 6", event == WIW_NODE6_IN ? "insertion" : "removal"); check_board(sys, 5, 0, 1); break; case WIW_NODE1_PBTN_P: handle_button_press(sys, 0); break; case WIW_NODE1_PBTN_R: handle_button_release(sys, 0); break; case WIW_NODE2_PBTN_P: handle_button_press(sys, 1); break; case WIW_NODE2_PBTN_R: handle_button_release(sys, 1); break; case WIW_NODE3_PBTN_P: handle_button_press(sys, 2); break; case WIW_NODE3_PBTN_R: handle_button_release(sys, 2); break; case WIW_NODE4_PBTN_P: handle_button_press(sys, 3); break; case WIW_NODE4_PBTN_R: handle_button_release(sys, 3); break; case WIW_NODE5_PBTN_P: handle_button_press(sys, 4); break; case WIW_NODE5_PBTN_R: handle_button_release(sys, 4); break; case WIW_NODE6_PBTN_P: handle_button_press(sys, 5); break; case WIW_NODE6_PBTN_R: handle_button_release(sys, 5); break; default: break; } } /* * This timer is called periodically to check the boards. */ static ipmi_timer_t *mv_timer; static void mv_timeout(void *cb_data) { int i; struct timeval tv; sys_data_t *sys = cb_data; for (i = 0; i < NUM_BOARDS; i++) check_board(sys, i, 1, 1); tv.tv_sec = 1; tv.tv_usec = 0; sys->start_timer(mv_timer, &tv); } static void shim_sig(int signr) { exit(1); } /* * The ast1300 device doesn't support select() in older * implementations. So add a small program that will wait for it * blocking and then feed it to the program through a pipe, which will * work as a select() device. */ static void ast1300_shim(sys_data_t *sys, int ast_fd, int writefd, int pid) { unsigned char c; int rv; int event; struct sigaction act; /* * Make sure to terminate if the main program goes away. */ memset(&act, 0, sizeof(act)); act.sa_handler = shim_sig; rv = sigaction(SIGCHLD, &act, NULL); if (rv == -1) { sys->log(sys, OS_ERROR, NULL, "Warning: MV: Error settint up" " signal: %s", strerror(errno)); exit(1); } for (;;) { rv = ioctl(ast_fd, READ_WIW_BLOCKING, &event); if (rv == -1) { sys->log(sys, OS_ERROR, NULL, "Warning: MV: Error reading" " AST event: %s", strerror(errno)); exit(1); } c = event; rv = write(writefd, &c, 1); if (rv != 1) { /* Other end of the pipe went away, just shut down. */ exit(0); } } } /************************************************************************** * General sensor handling *************************************************************************/ struct sensor_info { char *filename; unsigned char sensor_number; char *create_file; char *create_data; int invalid_if_off; int mult; int div; int sub; }; static struct sensor_info empty_sensors[] = { { NULL } }; static int all_fans_duty = 0; struct fan_duty_table { int reading; int setting; }; struct sensor_handling { struct sensor_info *switch_s; char *switch_valids; int *switch_last_values; struct sensor_info *board; char (*board_valids)[NUM_BOARDS]; int (*board_last_values)[NUM_BOARDS]; struct fan_duty_table *fan_duty; /* Modify the duty tables by this much. */ int duty_offset; }; static struct sensor_info switch_temp_sensors[] = { /* Switch Temp */ { "/sys/class/i2c-adapter/i2c-0/0-0058/temp2_input", 1, .div = 1000 }, /* Switch CPU Temp */ { "/sys/class/i2c-adapter/i2c-0/0-0058/temp3_input", 2, .div = 1000 }, { NULL } }; static char switch_temp_sensor_valids[2]; static int switch_temp_sensor_last_values[2]; static struct sensor_info board_temp_sensors[] = { /* Board CPU Temp */ { "/sys/class/i2c-adapter/i2c-%d/%d-0064/temp1_input", 2, .div = 1000, .invalid_if_off = 1, .create_file = "/sys/class/i2c-adapter/i2c-%d/new_device", .create_data = "axp 0x64" }, /* Board DIMM Temp */ { "/sys/class/i2c-adapter/i2c-%d/%d-001e/temp1_input", 3, .div = 1000, .invalid_if_off = 1, .create_file = "/sys/class/i2c-adapter/i2c-%d/new_device", .create_data = "dimm 0x1e" }, { NULL } }; static char board_temp_sensor_last_oor[NUM_BOARDS]; static char board_temp_sensor_valids[2][NUM_BOARDS]; static int board_temp_sensor_last_values[2][NUM_BOARDS]; static struct fan_duty_table main_fan_duty_table[] = { { 0, 42 }, { 60, 45 }, { 65, 48 }, { 70, 51 }, { 75, 54 }, { 80, 57 }, { 85, 60 }, { 95, 70 }, { 100, 85 }, { 105, 100 }, { -1 } }; static struct sensor_handling main_temp = { .switch_s = switch_temp_sensors, .switch_valids = switch_temp_sensor_valids, .switch_last_values = switch_temp_sensor_last_values, .board = board_temp_sensors, .board_valids = board_temp_sensor_valids, .board_last_values = board_temp_sensor_last_values, .fan_duty = main_fan_duty_table, .duty_offset = 10 }; static struct sensor_info board_mb_sensors[] = { /* Board MB Temp */ { "/sys/class/i2c-adapter/i2c-%d/%d-004a/temp1_input", 1, .div = 1000 }, { NULL } }; static char board_mb_sensor_valids[1][NUM_BOARDS]; static int board_mb_sensor_last_values[1][NUM_BOARDS]; static struct fan_duty_table mb_fan_duty_table[] = { { 0, 42 }, { 50, 45 }, { 52, 48 }, { 54, 51 }, { 56, 54 }, { 58, 57 }, { 60, 60 }, { -1 } }; static struct sensor_handling mb_temp = { .switch_s = empty_sensors, .board = board_mb_sensors, .board_valids = board_mb_sensor_valids, .board_last_values = board_mb_sensor_last_values, .fan_duty = mb_fan_duty_table, .duty_offset = 0 }; static struct sensor_info board_front_sensors[] = { /* Board Front Temp */ { "/sys/class/i2c-adapter/i2c-%d/%d-004c/temp1_input", 4, .div = 1000 }, { NULL } }; static char board_front_sensor_valids[1][NUM_BOARDS]; static int board_front_sensor_last_values[1][NUM_BOARDS]; static struct fan_duty_table front_fan_duty_table[] = { { 0, 42 }, { 37, 65 }, { 39, 70 }, { 41, 75 }, { 43, 80 }, { 45, 85 }, { -1 } }; static struct sensor_handling front_temp = { .switch_s = empty_sensors, .board = board_front_sensors, .board_valids = board_front_sensor_valids, .board_last_values = board_front_sensor_last_values, .fan_duty = front_fan_duty_table, .duty_offset = 0 }; static struct sensor_info switch_sensors[] = { /* Switch 12v */ { "/sys/class/i2c-adapter/i2c-0/0-0058/in11_input", 3, .mult=8, .div=125, .sub=10000 }, /* Switch 3.3v */ { "/sys/class/i2c-adapter/i2c-0/0-0058/in10_input", 4, .mult=8, .div=25, .sub=2900 }, /* Switch 1.8v */ { "/sys/class/i2c-adapter/i2c-0/0-0058/in2_input", 5, .mult=16, .div=25, .sub=1600 }, /* Fans */ { "/sys/class/astfan/fan1_input", 0x70, .mult = 10, .div = 392 }, { "/sys/class/astfan/fan2_input", 0x71, .mult = 10, .div = 392 }, { "/sys/class/astfan/fan3_input", 0x72, .mult = 10, .div = 392 }, { "/sys/class/astfan/fan4_input", 0x73, .mult = 10, .div = 392 }, { "/sys/class/astfan/fan5_input", 0x74, .mult = 10, .div = 392 }, { "/sys/class/astfan/fan6_input", 0x75, .mult = 10, .div = 392 }, { "/sys/class/astfan/fan7_input", 0x76, .mult = 10, .div = 392 }, { "/sys/class/astfan/fan8_input", 0x77, .mult = 10, .div = 392 }, { NULL } }; static char switch_sensor_valids[11]; static int switch_sensor_last_values[11]; static struct sensor_info board_sensors[] = { /* Board 1.0v */ { "/sys/class/i2c-adapter/i2c-%d/%d-0048/in3_input", 5, .mult=32, .div=25, .sub=900, .invalid_if_off = 1 }, /* Board 1.8v */ { "/sys/class/i2c-adapter/i2c-%d/%d-0048/in2_input", 6, .mult=16, .div=25, .sub=1600, .invalid_if_off = 1 }, /* Board 2.5v */ { "/sys/class/i2c-adapter/i2c-%d/%d-0048/in1_input", 7, .mult=32, .div=125, .sub=2000, .invalid_if_off = 1 }, /* Board 3.3v */ { "/sys/class/i2c-adapter/i2c-%d/%d-0048/in0_input", 8, .mult=8, .div=25, .sub=2900, .invalid_if_off = 1 }, /* Board 1.05v */ { "/sys/class/i2c-adapter/i2c-%d/%d-0049/in2_input", 9, .mult=16, .div=25, .sub=800, .invalid_if_off = 1 }, /* Board DIMMv */ { "/sys/class/i2c-adapter/i2c-%d/%d-0049/in1_input", 11, .mult=64, .div=75, .sub=1200, .invalid_if_off = 1 }, /* Board 0.9v */ { "/sys/class/i2c-adapter/i2c-%d/%d-0049/in0_input", 12, .mult=21, .div=50, .sub=700, .invalid_if_off = 1 }, { NULL } }; static char board_sensor_valids[8][NUM_BOARDS]; static int board_sensor_last_values[8][NUM_BOARDS]; static struct sensor_handling system_sensors = { .switch_s = switch_sensors, .switch_valids = switch_sensor_valids, .switch_last_values = switch_sensor_last_values, .board = board_sensors, .board_valids = board_sensor_valids, .board_last_values = board_sensor_last_values, }; static int get_readings(sys_data_t *sys, struct sensor_handling *h, int *rmax) { int err; int success = 0; int max = 0; unsigned int i, j; for (i = 0; h->switch_s[i].filename; i++) { int value; err = get_intval(h->switch_s[i].filename, &value); if (debug & 2) sys->log(sys, DEBUG, NULL, "Read value %s: %d %d", h->switch_s[i].filename, err, value); if (err) { h->switch_valids[i] = 0; } else { success = 1; h->switch_valids[i] = 1; h->switch_last_values[i] = value; if (value > max) max = value; } } for (i = 0; h->board[i].filename; i++) { for (j = 0; j < NUM_BOARDS; j++) { int value; char filename[100]; if (!boards[j].present || (h->board[i].invalid_if_off && !board_power_state(sys, j))) { h->board_valids[i][j] = 0; continue; } sprintf(filename, h->board[i].filename, j + 1, j + 1); err = get_intval(filename, &value); if ( err && h->board[i].create_file) { /* The sysfs file doesn't exist, create it. */ char cfilename[100]; FILE *f; sprintf(cfilename, h->board[i].create_file, j + 1); f = fopen(cfilename, "w"); if (!f) { sys->log(sys, OS_ERROR, NULL, "Unable to create %s", filename); } else { fprintf(f, "%s\n", h->board[i].create_data); fclose(f); } err = get_intval(filename, &value); } if (debug & 2) sys->log(sys, DEBUG, NULL, "Read value %s: %d %d", filename, err, value); if (err) { sys->log(sys, OS_ERROR, NULL, "Sensor read error of %s: %s", filename, strerror(err)); h->board_valids[i][j] = 0; } else { success = 1; h->board_valids[i][j] = 1; h->board_last_values[i][j] = value; if (value > max) max = value; } } } if (rmax) *rmax = max; return !success; } static int calc_duty(struct fan_duty_table *t, int duty_offset, int v, int *last_v, int *last_duty) { unsigned int i; int duty = 0; /* Hysteresis when going down, and is two degress C. */ if (v < *last_v) v += 2000; /* Convert to degrees, rounding */ v = (v + 500) / 1000; for (i = 1; t[i].reading != -1; i++) { if (v < t[i].reading) break; } duty = t[i - 1].setting + duty_offset; if (duty > 100) duty = 100; if (duty < 42) duty = 42; if (duty != *last_duty) { *last_duty = duty; *last_v = v; } else if (v > *last_v) { /* * This is subtle, but is required to correctly implement * hysteresis. We don't want to get in a situation where the * temperature goes down, but is still in the hysteresis area, * then goes back up a little bit. So we only set last_v when * going up. */ *last_v = v; } return duty; } static int last_main_v, last_mb_v, last_front_v; static int last_main_duty, last_mb_duty, last_front_duty; static int last_duty; static int scan_pipe[2]; static pthread_mutex_t scan_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t scan_cond = PTHREAD_COND_INITIALIZER; static pthread_t scan_thread; static ipmi_io_t *scan_fd_id; static int eesense_data_ready[NUM_BOARDS]; static unsigned char cpu_errors[NUM_BOARDS]; static uint16_t dimm_errors[NUM_BOARDS]; static int ps_status_good[2]; static unsigned int ps_status_word[2]; static void scan_eeprom_sensors(sys_data_t *sys) { int rv; unsigned int i; for (i = 0; i < NUM_BOARDS; i++) { if (!boards[i].present) { eesense_data_ready[i] = 0; } else { unsigned char data[2]; rv = ipmi_mc_fru_sem_trywait(boards[i].mc, 0); if (rv) continue; rv = read_eeprom(&board_i2c[i].fru, data, 9, 2); if (rv) { eesense_data_ready[i] = 0; sys->log(sys, OS_ERROR, NULL, "Error reading eeprom sensors for %d: %s", i + 1, strerror(rv)); } else { eesense_data_ready[i] = 1; cpu_errors[i] = data[0]; dimm_errors[i] = data[1]; } rv = ipmi_mc_fru_sem_post(boards[i].mc, 0); if (rv) sys->log(sys, OS_ERROR, NULL, "Error posting board %d semaphore: %s", i + 1, strerror(rv)); } } } static void scan_ps_sensors(sys_data_t *sys) { int rv; unsigned int i; rv = get_uintval("/sys/class/wixpmbus/STATUS_1", &i); if (rv) { /* Not present */ ps_status_good[0] = 0; } else { ps_status_good[0] = 1; ps_status_word[0] = i; } rv = get_uintval("/sys/class/wixpmbus/STATUS_2", &i); if (rv) { /* Not present */ ps_status_good[1] = 0; } else { ps_status_good[1] = 1; ps_status_word[1] = i; } } static char *fan_fail_led[4] = { "/sys/class/astgpio/GPIOP0", "/sys/class/astgpio/GPIOP1", "/sys/class/astgpio/GPIOP2", "/sys/class/astgpio/GPIOP3", }; static void * scan_sensors(void *cb_data) { sys_data_t *sys = cb_data; int err; int duty; int max_temp = 0; int max_duty = 0; char dummy = 0; struct timeval next, now, wait; unsigned int i; char fan_fail[8]; for (;;) { sys->get_monotonic_time(sys, &next); add_to_timeval(&next, poll_time); err = get_readings(sys, &main_temp, &max_temp); if (!err) { max_duty = calc_duty(main_temp.fan_duty, main_temp.duty_offset, max_temp, &last_main_v, &last_main_duty); } err = get_readings(sys, &mb_temp, &max_temp); if (!err) { duty = calc_duty(mb_temp.fan_duty, mb_temp.duty_offset, max_temp, &last_mb_v, &last_mb_duty); if (duty > max_duty) max_duty = duty; } err = get_readings(sys, &front_temp, &max_temp); if (!err) { duty = calc_duty(front_temp.fan_duty, front_temp.duty_offset, max_temp, &last_front_v, &last_front_duty); if (duty > max_duty) max_duty = duty; } duty = 0; for (i = 1; i < 9; i++) { char filename[50]; int val; sprintf(filename, "/sys/class/astfan/fan%u_input", i); err = get_intval(filename, &val); if (err) { sys->log(sys, OS_ERROR, NULL, "Can't read fan speed for %s: %s", filename, strerror(err)); /* Can't read fan, better safe than sorry. */ duty = 90; fan_fail[i - 1] = 1; } else { /* A fan is failing. */ if (val < 1000) { fan_fail[i - 1] = 1; duty = 90; } else fan_fail[i - 1] = 0; } } for (i = 0; i < 4; i++) { if (fan_fail[i * 2] || fan_fail[i * 2 + 1]) set_intval(fan_fail_led[i], 1); else set_intval(fan_fail_led[i], 0); } if (duty > max_duty) max_duty = duty; if (all_fans_duty) max_duty = all_fans_duty; if (max_duty != last_duty) { if (debug & 8) sys->log(sys, DEBUG, NULL, "Setting fan duty to %d", max_duty); for (i = 1; i < 5; i++) { char filename[50]; sprintf(filename, "/sys/class/astfan/pwm%u", i); err = set_intval(filename, max_duty * 256 / 100); if (err) sys->log(sys, OS_ERROR, NULL, "Can't set fan duty %s to %d: %s", filename, max_duty, strerror(err)); } } get_readings(sys, &system_sensors, NULL); scan_eeprom_sensors(sys); scan_ps_sensors(sys); pthread_mutex_lock(&scan_mutex); write(scan_pipe[1], &dummy, 1); pthread_cond_wait(&scan_cond, &scan_mutex); pthread_mutex_unlock(&scan_mutex); if (wdt_test_timer_ran) { unsigned char data = 1; err = write(wdt_fd, &data, 1); if (err == -1) { sys->log(sys, OS_ERROR, NULL, "Unable to write to watchdog timer: %s", strerror(err)); } wdt_test_timer_ran = 0; } /* Wait until poll_time seconds after the last scan started */ sys->get_monotonic_time(sys, &now); diff_timeval(&wait, &next, &now); select(0, NULL, NULL, NULL, &wait); } return NULL; } static unsigned char conv_value(struct sensor_info *info, int value) { value -= info->sub; if (info->mult) value *= info->mult; if (info->div) { value += info->div / 2; value /= info->div; } if (value < 0) return 0; if (value > 255) return 255; return value; } static void set_sensors_from_table(sys_data_t *sys, struct sensor_handling *h) { unsigned int i, j; for (i = 0; h->switch_s[i].filename; i++) { if (debug & 4) sys->log(sys, DEBUG, NULL, "process value %s: %d %d (%u)", h->switch_s[i].filename, h->switch_valids[i], h->switch_last_values[i], conv_value(&h->switch_s[i], h->switch_last_values[i])); ipmi_mc_sensor_set_enabled(bmc_mc, 0, h->switch_s[i].sensor_number, h->switch_valids[i]); if (h->switch_valids[i]) { ipmi_mc_sensor_set_value(bmc_mc, 0, h->switch_s[i].sensor_number, conv_value(&h->switch_s[i], h->switch_last_values[i]), 1); } } for (i = 0; h->board[i].filename; i++) { for (j = 0; j < NUM_BOARDS; j++) { if (debug & 4) sys->log(sys, DEBUG, NULL, "process value %s (%d): %d %d (%u)", h->board[i].filename, j + 1, h->board_valids[i][j], h->board_last_values[i][j], conv_value(&h->board[i], h->board_last_values[i][j])); ipmi_mc_sensor_set_enabled(boards[j].mc, 0, h->board[i].sensor_number, h->board_valids[i][j]); if (h->board_valids[i][j]) ipmi_mc_sensor_set_value(boards[j].mc, 0, h->board[i].sensor_number, conv_value(&h->board[i], h->board_last_values[i][j]), 1); } } } static void handle_eesense_data(sys_data_t *sys) { unsigned int i, j; for (i = 0; i < NUM_BOARDS; i++) { ipmi_mc_sensor_set_enabled(boards[i].mc, 0, 20, eesense_data_ready[i]); ipmi_mc_sensor_set_enabled(boards[i].mc, 0, 21, eesense_data_ready[i]); if (!eesense_data_ready[i]) continue; for (j = 0; j < 1; j++) ipmi_mc_sensor_set_bit(boards[i].mc, 0, 20, j, ((cpu_errors[i] >> j) & 1), 1); for (j = 0; j < 8; j++) ipmi_mc_sensor_set_bit(boards[i].mc, 0, 21, j, ((dimm_errors[i] >> j) & 1), 1); } } #define PMBUS_NONE_BIT (1 << 0) #define PMBUS_CML_BIT (1 << 1) #define PMBUS_TEMP_BIT (1 << 2) #define PMBUS_VIN_UV_BIT (1 << 3) #define PMBUS_IOUT_OC_BIT (1 << 4) #define PMBUS_VOUT_OV_BIT (1 << 5) #define PMBUS_OFF_BIT (1 << 6) #define PMBUS_BUSY_BIT (1 << 7) #define PMBUS_UNKNOWN_BIT (1 << 8) #define PMBUS_OTHER_BIT (1 << 9) #define PMBUS_FANS_BIT (1 << 10) #define PMBUS_NOT_POWER_GOOD_BIT (1 << 11) #define PMBUS_MRF_BIT (1 << 12) #define PMBUS_INPUT_BIT (1 << 13) #define PMBUS_I_P_OUT_BIT (1 << 14) #define PMBUS_VOUT_BIT (1 << 15) /* * This is a mask to convert the PMBus status work to the IPMI power * supply status bitmask. Each entry in this array has a set of bits; * if one of those bits is set in the status work then the index of * the entry is a bit that should be set in the IPMI sensor. */ static uint16_t pm_word_to_ipmi[7] = { 0, /* presence is handled separately */ 0xffff, /* If anything is set we declare a fault */ PMBUS_TEMP_BIT | PMBUS_FANS_BIT, /* Predictive failure */ 0, /* Input lost, nothing for this, only have "lost or out of range" */ PMBUS_INPUT_BIT, /* Input lost or out of range */ 0, /* Out of range but present. No bit for this, just previous. */ 0, /* Configuration error */ }; static void handle_ps_status(int num) { uint16_t val; unsigned int i; if (ps_status_good[num]) { val = 1; /* Present */ for (i = 1; i < 7; i++) val |= (!!(ps_status_word[num] & pm_word_to_ipmi[i])) << i; } else { val = 0; /* Not present */ } for (i = 0; i < 7; i++) ipmi_mc_sensor_set_bit(bmc_mc, 0, 8 + num, i, (val >> i) & 1, 1); } static void set_sensors_from_tables(int fd, void *cb_data) { sys_data_t *sys = cb_data; unsigned int i; int temp = 0; unsigned char dummy; int rv; read(fd, &dummy, 1); set_sensors_from_table(sys, &main_temp); set_sensors_from_table(sys, &mb_temp); set_sensors_from_table(sys, &front_temp); set_sensors_from_table(sys, &system_sensors); handle_eesense_data(sys); handle_ps_status(0); handle_ps_status(1); /* Check for shutdown thresholds */ if (switch_temp_sensor_valids[0]) temp = switch_temp_sensor_last_values[0]; if (switch_temp_sensor_valids[1] && temp < switch_temp_sensor_last_values[1]) temp = switch_temp_sensor_last_values[1]; if (temp >= SWITCH_TEMP_SHUTDOWN * 1000) { sys->log(sys, INFO, NULL, "CRITICAL: Switch has exceeded temperature" " threshold, powering down system"); power_down_system(sys); } temp = 0; for (i = 0; i < NUM_BOARDS; i++) { if (board_front_sensor_valids[0][i] && board_front_sensor_last_values[0][i] > temp) temp = board_front_sensor_last_values[0][i]; } if (temp >= FRONT_TEMP_SHUTDOWN * 1000) { sys->log(sys, INFO, NULL, "CRITICAL: External environment exceeded" " temperature threshold, raw value is %d, powering down" " system", temp); power_down_system(sys); } for (i = 0; i < NUM_BOARDS; i++) { temp = 0; if (board_temp_sensor_valids[0][i]) temp = board_temp_sensor_last_values[0][i]; if (board_temp_sensor_valids[1][i] && temp < board_temp_sensor_last_values[1][i]) temp = board_temp_sensor_last_values[1][i]; if (temp >= BOARD_TEMP_SHUTDOWN * 1000) { unsigned char val = 0; if (board_temp_sensor_last_oor[i]) { sys->log(sys, INFO, NULL, "CRITICAL: Board %d has exceeded" " temperature threshold, raw value is %d," " powering down", i + 1, temp); set_chassis_control(NULL, CHASSIS_CONTROL_POWER, &val, &boards[i]); } else { sys->log(sys, INFO, NULL, "WARNING: Board %d has exceeded" " temperature threshold, raw value is %d," " will check again before shutdown", i + 1, temp); board_temp_sensor_last_oor[i]++; } } else board_temp_sensor_last_oor[i] = 0; if (boards[i].fru_data_ready_for_handling) { boards[i].fru_data_ready_for_handling = 0; handle_board_fru(sys, i); rv = ipmi_mc_fru_sem_post(boards[i].mc, 0); if (rv) sys->log(sys, OS_ERROR, NULL, "Error posting board %d semaphore: %s", i + 1, strerror(rv)); } } pthread_mutex_lock(&scan_mutex); pthread_cond_signal(&scan_cond); pthread_mutex_unlock(&scan_mutex); } /************************************************************************** * Marvell OEM commands. *************************************************************************/ struct fru_write_data { sys_data_t *sys; unsigned int num; }; /* * Writing FRU data is too slow to do in the main thread, so do it in * another thread. */ static void * fru_write_thread(void *cb_data) { struct fru_write_data *info = cb_data; sys_data_t *sys = info->sys; unsigned int num = info->num; unsigned char board_fru_data[2048]; int fd, rv; pthread_detach(pthread_self()); free(info); fd = open(BOARD_FRU_FILE, O_RDONLY); if (fd == -1) { sys->log(sys, OS_ERROR, NULL, "Unable to read board FRU file %s: %s", BOARD_FRU_FILE, strerror(errno)); } rv = read(fd, board_fru_data, sizeof(board_fru_data)); if (rv == -1) { sys->log(sys, OS_ERROR, NULL, "Unable to read board FRU file %s: %s", BOARD_FRU_FILE, strerror(errno)); goto out_err; } else if (rv != sizeof(board_fru_data)) { sys->log(sys, OS_ERROR, NULL, "board FRU file too small %s: %d", BOARD_FRU_FILE, rv); goto out_err; } rv = write_eeprom(&board_i2c[num].fru, board_fru_data, 0, sizeof(board_fru_data)); if (rv) { sys->log(sys, OS_ERROR, NULL, "Error writing board %d fru: %d", num, rv); goto out_err; } boards[num].fru_data_ready_for_handling = 1; return NULL; out_err: rv = ipmi_mc_fru_sem_post(boards[num].mc, 0); if (rv) sys->log(sys, OS_ERROR, NULL, "Error posting board %d semaphore: %s", num + 1, strerror(rv)); return NULL; } static void handle_marvell_cmd(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { sys_data_t *sys = cb_data; char cmd[100]; int rv; /* * Note that the calling function remove the IANA from the message * and inserts the IANA in the return message, we handle this like * a normal command. * * Start assuming success. */ rdata[0] = 0; *rdata_len = 1; switch (msg->cmd) { case DISABLE_NETWORK_SRVC_CMD: if (check_msg_length(msg, 1, rdata, rdata_len)) break; snprintf(cmd, sizeof(cmd), "/etc/ipmi/netsrvc %d\n", msg->data[0]); rv = system(cmd); if (rv == -1) { rdata[0] = 0xff; rdata[1] = errno; rdata[2] = 0; *rdata_len = 3; } else if (rv) { rdata[0] = 0xff; rdata[1] = 0; rdata[2] = rv; *rdata_len = 3; } break; case RELOAD_BOARD_FRU_CMD: { struct fru_write_data *info; pthread_t tid; unsigned int num; if (check_msg_length(msg, 1, rdata, rdata_len)) return; num = msg->data[0] - 1; if (num >= NUM_BOARDS) goto out_err; if (!boards[num].present) goto out_err; rv = ipmi_mc_fru_sem_trywait(boards[num].mc, 0); if (rv) { if (errno == EAGAIN) /* Already in progress. */ goto out_good; sys->log(sys, OS_ERROR, NULL, "Unable to claim board %d FRU semaphore: %s", num + 1, strerror(errno)); goto out_err; } info = malloc(sizeof(*info)); if (!info) goto out_err; info->sys = sys; info->num = num; rv = pthread_create(&tid, NULL, fru_write_thread, info); if (rv) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Unable to create fru write thread: %s", strerror(rv)); free(info); goto out_err; } } break; case SET_ALL_FANS_DUTY_CMD: { int duty; if (check_msg_length(msg, 1, rdata, rdata_len)) break; duty = msg->data[0]; if (duty == 0) ; /* Disable the duty by setting to zero */ else if (duty < 30) duty = 30; /* Minimum allowed fan duty */ else if (duty > 100) duty = 100; all_fans_duty = duty; } break; case GET_ALL_FANS_DUTY_CMD: rdata[1] = all_fans_duty; *rdata_len = 2; break; default: handle_invalid_cmd(mc, rdata, rdata_len); break; } out_good: return; out_err: rdata[0] = 0xff; } int ipmi_sim_module_print_version(sys_data_t *sys, char *initstr) { printf("IPMI Simulator Marvell AXP module version %s\n", PVERSION); return 0; } /* * An emulator command for simulating a change in the board's presence. */ static int simulate_board_presence(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned int board, present; const char *err; rv = get_uint(toks, &board, &err); if (!rv && ((board == 0 || board > NUM_BOARDS))) { err = "board number out of range"; rv = EINVAL; } if (rv) { out->printf(out, "Invalid board number: %s\n", err); return EINVAL; } board--; rv = get_bool(toks, &present, &err); if (rv) { out->printf(out, "Invalid board presence value: %s\n", err); return EINVAL; } simulate_board_absent[board] = !present; } /************************************************************************** * BMC reset handling *************************************************************************/ static void handle_cold_reset(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { sys_data_t *sys = cb_data; int rv; rv = set_intval(RESET_REASON_FILE, RESET_REASON_COLD_BOOT); if (rv) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Unable to write cold reset reason: %s", strerror(rv)); } system("reboot"); } static void handle_warm_reset(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { sys_data_t *sys = cb_data; int rv; rv = set_intval(RESET_REASON_FILE, RESET_REASON_WARM_BOOT); if (rv) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Unable to write warm reset reason: %s", strerror(rv)); } exit(1); } /* * This is a timer that is periodically called from the main thread, * it is basically used to tell if the main thread is running. */ static void wdt_test_timeout(void *cb_data) { struct timeval tv; sys_data_t *sys = cb_data; if (wdt_test_timer_ran) sys->log(sys, OS_ERROR, NULL, "MVMOD: WDT test timer not cleared"); wdt_test_timer_ran = 1; tv.tv_sec = 4; tv.tv_usec = 0; sys->start_timer(wdt_test_timer, &tv); } /************************************************************************** * Module initialization *************************************************************************/ int ipmi_sim_module_init(sys_data_t *sys, const char *initstr_i) { unsigned int num; int rv; const char *c; char *next; int use_events = 1; struct timeval tv; int power_up_force = 0; char *initstr = strdup(initstr_i); int val; printf("IPMI Simulator Marvell AXP module version %s\n", PVERSION); if (!initstr) { sys->log(sys, SETUP_ERROR, NULL, "Error: MV: Out of memory"); return ENOMEM; } c = mystrtok(initstr, " \t\n", &next); while (c) { if (strcmp(c, "noevents") == 0) { use_events = 0; } else if (strcmp(c, "fork") == 0) { fork_event_wait = 1; } else if (strncmp(c, "debug=", 6) == 0) { debug = strtoul(c + 6, NULL, 0); } else if (strcmp(c, "forcecold") == 0) { power_up_force = 1; } else if (strcmp(c, "forcewarm") == 0) { power_up_force = 1; cold_power_up = 0; } else if (strcmp(c, "disablewdt") == 0) { disable_wdt = 1; } else if (strncmp(c, "poll_time=", 10) == 0) { poll_time = strtoul(c + 10, NULL, 0); } else { sys->log(sys, SETUP_ERROR, NULL, "Warning: MV: Unknown init" " string: %s", c); } c = mystrtok(NULL, " \t\n", &next); } free(initstr); check_chassis_state(sys); rv = init_chassis(sys); if (rv) return rv; rv = pipe(scan_pipe); if (rv == -1) { int errval = errno; sys->log(sys, SETUP_ERROR, NULL, "MVMOD: Unable to open pipe"); return errval; } rv = sys->add_io_hnd(sys, scan_pipe[0], set_sensors_from_tables, sys, &scan_fd_id); if (rv) { int errval = errno; sys->log(sys, SETUP_ERROR, NULL, "MVMOD: Unable to add I/O handler"); close(scan_pipe[0]); close(scan_pipe[1]); return errval; } if (use_events) { ast_fd = open("/dev/event", O_RDWR); if (ast_fd == -1) { int errval = errno; sys->log(sys, SETUP_ERROR, NULL, "Unable to open /dev/event"); return errval; } if (fork_event_wait) { int pipefds[2]; rv = pipe(pipefds); if (rv == -1) { int errval = errno; close(ast_fd); sys->log(sys, SETUP_ERROR, NULL, "Unable to open pipe"); return errval; } rv = fork(); if (rv == -1) { int errval = errno; close(ast_fd); close(pipefds[0]); close(pipefds[1]); sys->log(sys, SETUP_ERROR, NULL, "Unable to fork"); return errval; } else if (rv != 0) { /* * Note that the main program runs as the child and * the shim program runs as the parent. This allows * the shim program to catch the SIGCHLD and terminate * if the main program goes away. Otherwise the shim * would be stuck waiting on an event and not * terminate properly. */ close(pipefds[0]); ast1300_shim(sys, ast_fd, pipefds[1], rv); } close(ast_fd); close(pipefds[1]); ast_fd = pipefds[0]; } rv = sys->add_io_hnd(sys, ast_fd, ast_evt, sys, &ast_fd_id); if (rv) { int errval = errno; sys->log(sys, SETUP_ERROR, NULL, "MVMOD: Unable to add I/O handler"); close(ast_fd); return errval; } } rv = sys->alloc_timer(sys, mv_timeout, sys, &mv_timer); if (rv) { int errval = errno; sys->log(sys, SETUP_ERROR, NULL, "MVMOD: Unable to create timer"); return errval; } else { tv.tv_sec = 1; tv.tv_usec = 0; sys->start_timer(mv_timer, &tv); } rv = sys->alloc_timer(sys, board_power_timeout, sys, &power_timer); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to allocate board power timer: %s", strerror(rv)); return rv; } if (!power_up_force) { rv = get_uintval(COLD_POWER_UP_IO, &cold_power_up); if (rv) { sys->log(sys, OS_ERROR, NULL, "Warning: MV: Could not read %s" " so assuming cold power up: %s", COLD_POWER_UP_IO, strerror(errno)); cold_power_up = 1; } else if (cold_power_up) { /* Save the setting in case we fail in startup */ set_intval(COLD_POWER_FILE, 1); } else { /* * Get the setting from the last startup. If it's not * there, no big deal. */ get_uintval(COLD_POWER_FILE, &cold_power_up); } } rv = ipmi_mc_alloc_unconfigured(sys, 0x20, &bmc_mc); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to allocate an mc: %s", strerror(rv)); return rv; } for (num = 0; num < NUM_BOARDS; num++) { lmc_data_t *mc; unsigned int rval = 0; struct board_info *board = &boards[num]; board->num = num; board->sys = sys; board->last_power_request = BOARD_OFF_READY; if (!cold_power_up) { /* * On a cold power up, we bring everything up that is * present. Otherwise we run this code to read the * current status and retain that. */ rv = get_uintval(trg_present[num], &rval); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to read board %u presence state: %s", num, strerror(rv)); return rv; } if (rval != BOARD_PRESENT) { unsigned char val = 0; set_chassis_control(NULL, CHASSIS_CONTROL_POWER, &val, board); } else if (board_power_state(sys, num)) { /* * This looks a bit unusual, so I will explain. The * board power request is only handled on a off-to-on * transition, the raw values is not used directly. * But this presents an issue at startup: what if the * board requested a power off while this code wasn't * running? To solve that, if it is not a cold power * up, assume that the request is off and then we will * power down if the request is asserted. */ board->last_power_request = BOARD_OFF_NOT_READY; } } rv = ipmi_mc_alloc_unconfigured(sys, board_ipmb[num], &mc); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to allocate an mc: %s", strerror(rv)); return rv; } boards[num].mc = mc; ipmi_mc_set_chassis_control_func(mc, set_chassis_control, get_chassis_control, board); rv = check_board(sys, num, 0, cold_power_up); if (rv) { if (ast_fd_id) sys->remove_io_hnd(ast_fd_id); if (mv_timer) sys->free_timer(mv_timer); return rv; } } ipmi_mc_set_chassis_control_func(bmc_mc, bmc_set_chassis_control, bmc_get_chassis_control, sys); rv = ipmi_emu_register_iana_handler(MARVELL_SEMI_ISREAL_IANA, handle_marvell_cmd, sys); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to register Marvell IANA handler: %s", strerror(rv)); } rv = ipmi_emu_register_cmd_handler(IPMI_APP_NETFN, IPMI_COLD_RESET_CMD, handle_cold_reset, sys); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to register cold reset handler: %s", strerror(rv)); } rv = ipmi_emu_register_cmd_handler(IPMI_APP_NETFN, IPMI_WARM_RESET_CMD, handle_warm_reset, sys); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to register cold reset handler: %s", strerror(rv)); } if (!disable_wdt) { wdt_fd = open("/dev/watchdog", O_WRONLY); if (wdt_fd == -1) { sys->log(sys, OS_ERROR, NULL, "Unable to open wdt: %s", strerror(errno)); return rv; } rv = sys->alloc_timer(sys, wdt_test_timeout, sys, &wdt_test_timer); if (rv) { sys->log(sys, OS_ERROR, NULL, "Unable to allocate wdt test timer: %s", strerror(rv)); return rv; } tv.tv_sec = 4; tv.tv_usec = 0; sys->start_timer(wdt_test_timer, &tv); } if (!cold_power_up) init_complete = 1; ipmi_emu_add_cmd("simulate_board_presence", NOMC, simulate_board_presence); return 0; } int ipmi_sim_module_post_init(sys_data_t *sys) { int rv; const char *ver = get_lanserv_version(); unsigned char lver[4]; unsigned char omajor, ominor, orel; unsigned int i; int val; sscanf(ver, "%hhu.%hhu.%hhu", lver + 0, lver + 1, lver + 2); lver[3] = 0; sscanf(PVERSION, "%hhu.%hhu.%hhu", &omajor, &ominor, &orel); for (i = 0; i < NUM_BOARDS; i++) { ipmi_mc_set_fw_revision(boards[i].mc, omajor, ominor << 4 | orel); ipmi_mc_set_aux_fw_revision(boards[i].mc, lver); } ipmi_mc_set_fw_revision(bmc_mc, omajor, ominor << 4 | orel); ipmi_mc_set_aux_fw_revision(bmc_mc, lver); /* * Set the rearm handler for the CPU and DIMM sensors to clear * them on rearm. */ for (i = 0; i < NUM_BOARDS; i++) { struct eesense_rearm *info; info = malloc(sizeof(*info)); if (!info) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Unable to allocate eesense handler for board %d: " "Out of memory", i + 1); continue; } info->num = i; info->offset = 1; info->mask = 0x01; rv = ipmi_mc_sensor_add_rearm_handler(boards[i].mc, 0, 20, rearm_eesense_sensor, info); if (rv) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Error adding eesense CPU rearm on %d: %s", i + 1, strerror(rv)); continue; } info = malloc(sizeof(*info)); if (!info) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Unable to allocate eesense handler for board %d: " "Out of memory", i + 1); continue; } info->num = i; info->offset = 2; info->mask = 0x87; rv = ipmi_mc_sensor_add_rearm_handler(boards[i].mc, 0, 21, rearm_eesense_sensor, info); if (rv) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Error adding eesense DIMM rearm on %d: %s", i + 1, strerror(rv)); } } rv = ipmi_mc_sensor_add_rearm_handler(bmc_mc, 0, 8, rearm_power_supply_sensor, (void *) 1); if (rv) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Error adding power supply %d rearm: %s", 1, strerror(rv)); } rv = ipmi_mc_sensor_add_rearm_handler(bmc_mc, 0, 9, rearm_power_supply_sensor, (void *) 2); if (rv) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Error adding power supply %d rearm: %s", 2, strerror(rv)); } /* Initial state of the PSU sensor is with the present bit set */ ipmi_mc_sensor_set_bit(bmc_mc, 0, 8, 0, 1, 0); ipmi_mc_sensor_set_bit(bmc_mc, 0, 9, 0, 1, 0); rv = pthread_create(&scan_thread, NULL, scan_sensors, sys); if (rv) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Unable to start scan thread: %s", strerror(rv)); } rv = get_intval(RESET_REASON_FILE, &val); if (rv || cold_power_up) { val = 0x00; /* Initiated by power up */ } else if (val == RESET_REASON_COLD_BOOT || rv || val == RESET_REASON_UNKNOWN) { val = 0x01; /* Initiated by hard reset */ } else if (val == RESET_REASON_WARM_BOOT) { val = 0x02; /* Initiated by warm reset */ } else { sys->log(sys, OS_ERROR, NULL, "MVMOD: known reset reason: %d", val); val = 0x01; /* Assume hard reset */ } { /* * We don't have an actual sensor for this, since it is * event-only, just send the event. */ unsigned char data[13]; memset(data, 0, sizeof(data)); data[4] = ipmi_mc_get_ipmb(bmc_mc); data[5] = 0; /* LUN */ data[6] = 0x04; /* Event message revision for IPMI 1.5. */ data[7] = 0x1d; /* System boot initiated. */ data[8] = 20; /* Sensor num */ data[9] = (IPMI_ASSERTION << 7) | 0x6f; data[10] = val; rv = mc_new_event(bmc_mc, 0x02, data); if (rv) sys->log(sys, OS_ERROR, NULL, "MVMOD: Unable to add reboot cause event: %s, " "event queue is probably full", strerror(rv)); } rv = set_intval(RESET_REASON_FILE, 0); if (rv) { sys->log(sys, OS_ERROR, NULL, "MVMOD: Unable to clear reset reason: %s", strerror(rv)); } return rv; } OpenIPMI-2.0.27/lanserv/marvell-bmc/Makefile.am0000644000175000017500000000117412511037351016013 00000000000000 AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/lanserv pkglib_LTLIBRARIES = marvell_mod.la marvell_mod_la_SOURCES = marvell_mod.c marvell_mod_la_LDFLAGS = -module sdrs.bin: main.sdrs board.sdrs fan.sdrs \ $(top_builddir)/lanserv/sdrcomp/sdrcomp $(top_builddir)/lanserv/sdrcomp/sdrcomp main.sdrs >sdrs.bin noinst_DATA = sdrs.bin noinst_HEADERS = wiw.h EXTRA_DIST = main.sdrs board.sdrs fan.sdrs lan.conf netsrvc lancontrol \ busybox-1.18.4.config interfaces ntp.conf marvell_bmc.config \ S90ast1300 SystemInfo TODO BuildingAndConfiguring.tex \ Build_Marvell_BMC.sh Install_Marvell_BMC.sh marvell_node.emu \ marvell.emu OpenIPMI-2.0.27/lanserv/marvell-bmc/ntp.conf0000644000175000017500000000204612116456523015435 00000000000000# /etc/ntp.conf, configuration for ntpd driftfile /var/lib/ntp/ntp.drift statsdir /var/log/ntpstats/ statistics loopstats peerstats clockstats filegen loopstats file loopstats type day enable filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable # You do need to talk to an NTP server or two (or three). server pool.ntp.org # By default, ignore everything # See /usr/share/doc/ntp-doc/html/accopt.html for details. restrict -4 default ignore restrict -6 default ignore # Local users may interrogate the ntp server more closely. restrict 127.0.0.1 restrict ::1 # Clients from this subnet have access to time, but not configuration restrict 192.168.1.0 mask 255.255.255.0 kod notrap nomodify nopeer noquery # Clients from this (example!) subnet have unlimited access, # but only if cryptographically authenticated #restrict 172.23.9.0 mask 255.255.255.0 notrust # If you want to provide time to your local subnet, change the next line. # (Again, the address is an example only.) #broadcast 192.168.123.255 OpenIPMI-2.0.27/lanserv/marvell-bmc/main.sdrs0000644000175000017500000004161112116456523015607 00000000000000# # # # chassis 23 1 # board 1-n 41 n # CPU 3 n # DIMM 8 n # PSUs 1-n 10 n # Fans 1-n 29 n # Switch 42 1 # CPU 3 n+1 sdr type 18 device_slave_address 0x20 device_channel_number 0 chassis true ipmb_event_gen true ipmb_event_recv true fru_inventory true sel true sdr true sensor true entity_id connectivity_switch entity_instance 1 id_string "AXP switch" endsdr sdr type 8 container_entity_id system_chassis container_entity_inst 1 entity_1_id power_supply entity_1_inst 1 entity_2_id power_supply entity_2_inst 2 entity_3_id connectivity_switch entity_3_inst 1 endsdr sdr type 8 container_entity_id system_chassis container_entity_inst 1 entity_1_id fan_cooling_device entity_1_inst 1 entity_2_id fan_cooling_device entity_2_inst 2 entity_3_id fan_cooling_device entity_3_inst 3 entity_4_id fan_cooling_device entity_4_inst 4 endsdr sdr type 8 container_entity_id system_chassis container_entity_inst 1 entity_1_id fan_cooling_device entity_1_inst 5 entity_2_id fan_cooling_device entity_2_inst 6 entity_3_id fan_cooling_device entity_3_inst 7 entity_4_id fan_cooling_device entity_4_inst 8 endsdr sdr type 8 container_entity_id system_chassis container_entity_inst 1 entity_1_id processing_blade entity_1_inst 1 entity_2_id processing_blade entity_2_inst 2 entity_3_id processing_blade entity_3_inst 3 entity_4_id processing_blade entity_4_inst 4 endsdr sdr type 8 container_entity_id system_chassis container_entity_inst 1 entity_1_id processing_blade entity_1_inst 5 entity_2_id processing_blade entity_2_inst 6 endsdr sdr type 8 container_entity_id connectivity_switch container_entity_inst 1 entity_1_id processor entity_1_inst 7 endsdr # Switch reset reason sdr type 3 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 20 entity_id connectivity_switch entity_instance 1 sensor_type System_Boot_Initiated event_reading_type_code 0x6f id_string "reset reason" endsdr # Switch temp sensor sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 1 entity_id connectivity_switch entity_instance 1 init_scanning true init_sensor_type true default_sensor_scan_on true sensor_type Temperature event_reading_type_code 1 analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit degrees_C modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 id_string "switch temp" endsdr # Switch CPU temp sensor sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 2 entity_id processor entity_instance 7 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Temperature event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true return_unr true assert_lncgl true deassert_lncgl true assert_lcgl true deassert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true assert_unrgh true deassert_unrgh true lc_thrsh_settable true lnc_thrsh_settable true unr_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit degrees_C modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 unr_thresh 115 uc_thresh 90 unc_thresh 75 lnc_thresh 5 lc_thresh 0 positive_hysteresis 2 negative_hysteresis 2 id_string "switch CPU temp" endsdr # Switch 12V sensor # Range from 10-14 sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 3 entity_id connectivity_switch entity_instance 1 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 16 tolerance 0 b 10 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -3 b_exp 3 nominal_specified true nominal_freading 12.0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 12.6 unc_fthresh 12.36 lnc_fthresh 11.64 lc_fthresh 11.4 positive_hysteresis 2 negative_hysteresis 2 id_string "12V Switch" endsdr # Switch 3.3 sensor # Range 2.9 - 3.7 sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 4 entity_id connectivity_switch entity_instance 1 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 313 tolerance 0 b 29 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -5 b_exp 4 nominal_specified true nominal_freading 3.3 sensor_maximum 255 sensor_minimum 0 uc_fthresh 3.465 unc_fthresh 3.399 lnc_fthresh 3.201 lc_fthresh 3.135 positive_hysteresis 2 negative_hysteresis 2 id_string "3.3V Switch" endsdr # Switch 1.8V sensor # Range 1.6-1.8 sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 5 entity_id connectivity_switch entity_instance 1 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 156 tolerance 0 b 16 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -5 b_exp 4 nominal_specified true nominal_freading 1.8 sensor_maximum 255 sensor_minimum 0 uc_fthresh 1.89 unc_fthresh 1.854 lnc_fthresh 1.746 lc_fthresh 1.71 positive_hysteresis 2 negative_hysteresis 2 id_string "1.8V Switch" endsdr # PSU status sensors sdr type 2 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 8 entity_id power_supply entity_instance 1 init_scanning true init_events true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm false sensor_type Power_Supply event_reading_type_code 0x6f assert_event0 true assert_event1 true assert_event2 true assert_event3 true assert_event4 true assert_event5 true assert_event6 true deassert_event0 true deassert_event1 true deassert_event2 true deassert_event3 true deassert_event4 true deassert_event5 true deassert_event6 true event0_state_ret true event1_state_ret true event2_state_ret true event3_state_ret true event4_state_ret true event5_state_ret true event6_state_ret true id_string "PSU1 status" endsdr sdr type 2 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 9 entity_id power_supply entity_instance 2 init_scanning true init_events true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm false sensor_type Power_Supply event_reading_type_code 0x6f assert_event0 true assert_event1 true assert_event2 true assert_event3 true assert_event4 true assert_event5 true assert_event6 true deassert_event0 true deassert_event1 true deassert_event2 true deassert_event3 true deassert_event4 true deassert_event5 true deassert_event6 true event0_state_ret true event1_state_ret true event2_state_ret true event3_state_ret true event4_state_ret true event5_state_ret true event6_state_ret true id_string "PSU2 status" endsdr # PSU voltage sensors (12v) # Range 10-14 sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 10 entity_id power_supply entity_instance 1 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 16 tolerance 0 b 10 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -3 b_exp 3 nominal_specified true nominal_freading 12.0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 12.6 unc_fthresh 12.36 lnc_fthresh 11.64 lc_fthresh 11.4 positive_hysteresis 2 negative_hysteresis 2 id_string "PSU1 voltage" endsdr sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 11 entity_id power_supply entity_instance 2 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Voltage event_reading_type_code 1 return_lnc true return_lc true return_unc true return_uc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true lc_thrsh_settable true lnc_thrsh_settable true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Volts modifier_unit_code unspecified linearization linear m 16 tolerance 0 b 10 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -3 b_exp 3 nominal_specified true nominal_freading 12.0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 12.6 unc_fthresh 12.36 lnc_fthresh 11.64 lc_fthresh 11.4 positive_hysteresis 2 negative_hysteresis 2 id_string "PSU2 voltage" endsdr # PSU current sensors # Range 0-63 sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 12 entity_id power_supply entity_instance 1 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Current event_reading_type_code 1 return_unc true return_uc true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Amps modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 60 unc_fthresh 55 positive_hysteresis 2 negative_hysteresis 2 id_string "PSU1 current" endsdr sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 13 entity_id power_supply entity_instance 2 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Current event_reading_type_code 1 return_unc true return_uc true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Amps modifier_unit_code unspecified linearization linear m 1 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 60 unc_fthresh 55 positive_hysteresis 2 negative_hysteresis 2 id_string "PSU2 current" endsdr # PSU power sensors # Range 0-2550 sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 14 entity_id power_supply entity_instance 1 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Current event_reading_type_code 1 return_unc true return_uc true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Watts modifier_unit_code unspecified linearization linear m 10 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 480 unc_fthresh 440 positive_hysteresis 2 negative_hysteresis 2 id_string "PSU1 power" endsdr sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 15 entity_id power_supply entity_instance 2 init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Current event_reading_type_code 1 return_unc true return_uc true assert_uncgh true deassert_uncgh true assert_ucgh true deassert_ucgh true uc_thrsh_settable true unc_thrsh_settable true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit Watts modifier_unit_code unspecified linearization linear m 10 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp 0 b_exp 0 sensor_maximum 255 sensor_minimum 0 uc_fthresh 480 unc_fthresh 440 positive_hysteresis 2 negative_hysteresis 2 id_string "PSU2 power" endsdr define FAN "1" include "fan.sdrs" define FAN "2" include "fan.sdrs" define FAN "3" include "fan.sdrs" define FAN "4" include "fan.sdrs" define FAN "5" include "fan.sdrs" define FAN "6" include "fan.sdrs" define FAN "7" include "fan.sdrs" define FAN "8" include "fan.sdrs" define OWNER_MC "1" include "board.sdrs" define OWNER_MC "2" include "board.sdrs" define OWNER_MC "3" include "board.sdrs" define OWNER_MC "4" include "board.sdrs" define OWNER_MC "5" include "board.sdrs" define OWNER_MC "6" include "board.sdrs" OpenIPMI-2.0.27/lanserv/marvell-bmc/fan.sdrs0000644000175000017500000000174212116456523015430 00000000000000# Fan # Range 0-10000 sdr type 1 sensor_owner_id 0x20 sensor_owner_lun 0 channel_number 0 sensor_number 0x6f + $FAN entity_id fan_cooling_device entity_instance $FAN init_scanning true init_events true init_thresholds true init_hysteresis true init_sensor_type true default_event_gen_on true default_sensor_scan_on true sensor_auto_rearm true sensor_hysteresis settable sensor_threshold_access settable sensor_event_msg_ctrl per_state sensor_type Fan event_reading_type_code 1 return_lnc true return_lc true deassert_lncgl true assert_lncgl true deassert_lcgl true assert_lcgl true analog_data_format unsigned rate_unit none modifier_unit none percentage false base_unit RPM modifier_unit_code unspecified linearization linear m 392 tolerance 0 b 0 accuracy 1 accuracy_exp 0 sensor_direction input r_exp -1 b_exp 0 sensor_maximum 255 sensor_minimum 0 lnc_fthresh 1500 lc_fthresh 1000 id_string "fan "$FAN endsdr OpenIPMI-2.0.27/lanserv/marvell-bmc/Build_Marvell_BMC.sh0000664000175000017500000000301512206672403017517 00000000000000# # Script to build the Marvell BMC. # # Copy this script and the Install_Marvell_BMC.sh to the place where you # want to do the build and cd to there. # # Then you must get the software in the current directory: # # armv5-marvell-linux-gnueabi-soft_i686.tar.bz2 # buildroot-2011.05-sdk5.1.2.tar.bz2 # # then execute this script. This only builds the software, use # Install_Marvell_BMC.sh to isntall it into a rootfs. # TOOLCHAIN=armv5-marvell-linux-gnueabi-soft_i686 BUILDROOT=buildroot-2011.05-sdk5.1.2 # General variables we use MBASEDIR=`pwd` BRDIR=${MBASEDIR}/${BUILDROOT} # Untar the toolchain and build system and get openipmi tar xjf ${TOOLCHAIN}.tar.bz2 tar xjf ${BUILDROOT}.tar.bz2 git clone git://git.code.sf.net/p/openipmi/code openipmi # Install the busybox config and set the toolchain path cp openipmi/lanserv/marvell-bmc/marvell_bmc.config ${BRDIR}/.config sed -i "s%BR2_TOOLCHAIN_EXTERNAL_PATH=.*\$%BR2_TOOLCHAIN_EXTERNAL_PATH=\"${MBASEDIR}/${TOOLCHAIN}\"%" ${BRDIR}/.config cp openipmi/lanserv/marvell-bmc/busybox-1.18.4.config ${BRDIR} cd ${BRDIR} make # this will take a while # Now check out and build openipmi cd ${MBASEDIR} export PATH=${MBASEDIR}/${TOOLCHAIN}/bin:$PATH cd openipmi libtoolize aclocal autoconf automake -a autoreconf ./configure --host=arm-mv5sft-linux-gnueabi --prefix=/usr --sysconfdir=/etc \ --localstatedir=/var --with-glib=no --with-python=no --with-perl=no \ host_alias=arm-mv5sft-linux-gnueabi --with-marvell-bmc \ CC="arm-marvell-linux-gnueabi-gcc --sysroot=${BRDIR}/output/staging" make OpenIPMI-2.0.27/lanserv/marvell-bmc/marvell_node.emu0000644000175000017500000000231112077274675017153 00000000000000# Add target n mc_add $MCNUM 1 no-device-sdrs 00 00 00 0xc9 0x00500f 0x0002 mc_enable $MCNUM # Now the FRU data mc_add_fru_data $MCNUM 0 2048 \ file 0 "/sys/class/i2c-adapter/i2c-"$MCNUM"/"$MCNUM"-0050/at24c64" # Board temp sensor sensor_add $MCNUM 0 1 1 1 # Board CPU temp sensor sensor_add $MCNUM 0 2 1 1 # DIMM temp sensor sensor_add $MCNUM 0 3 1 1 # Front panel temp sensor sensor_add $MCNUM 0 4 1 1 # V 1.0 Node X sensor_add $MCNUM 0 5 2 1 # V 1.8 Node X sensor_add $MCNUM 0 6 2 1 # V 2.5 Node X sensor_add $MCNUM 0 7 2 1 # V 3.3 Node X sensor_add $MCNUM 0 8 2 1 # V 1.05 Node X sensor_add $MCNUM 0 9 2 1 # V DIMM Node X sensor_add $MCNUM 0 10 2 1 # V DIMML Node X sensor_add $MCNUM 0 11 2 1 # V 0.9 Node X sensor_add $MCNUM 0 12 2 1 # CPU status sensor_add $MCNUM 0 20 7 0x6f # poll 1000 \ # file "/sys/class/i2c-adapter/i2c-"$MCNUM"/"$MCNUM"-0050/at24c64" \ # raw offset=9 length=1 # DIMM status sensor_add $MCNUM 0 21 12 0x6f # poll 1000 \ # file "/sys/class/i2c-adapter/i2c-"$MCNUM"/"$MCNUM"-0050/at24c64" \ # raw offset=10 length=1OpenIPMI-2.0.27/lanserv/marvell-bmc/marvell_bmc.config0000644000175000017500000004477112116456523017452 00000000000000# # Automatically generated make config: don't edit # Buildroot 2011.05 Configuration # Thu Feb 21 15:42:35 2013 # BR2_HAVE_DOT_CONFIG=y BR2_arm=y # BR2_armeb is not set # BR2_avr32 is not set # BR2_bfin is not set # BR2_i386 is not set # BR2_mips is not set # BR2_mipsel is not set # BR2_powerpc is not set # BR2_sh is not set # BR2_sh64 is not set # BR2_sparc is not set # BR2_x86_64 is not set # BR2_xtensa is not set # BR2_generic_arm is not set # BR2_arm7tdmi is not set # BR2_arm610 is not set # BR2_arm710 is not set # BR2_arm720t is not set # BR2_arm920t is not set # BR2_arm922t is not set # BR2_arm926t is not set # BR2_arm10t is not set # BR2_arm1136jf_s is not set # BR2_arm1176jz_s is not set # BR2_arm1176jzf_s is not set # # cortex-A8/A9 needs gcc >= 4.4.x # # BR2_cortex_a8 is not set # BR2_cortex_a9 is not set # BR2_sa110 is not set # BR2_sa1100 is not set # BR2_xscale is not set # BR2_iwmmxt is not set # # marvell-fv requires Marvell compiler # BR2_marvell_armv5te=y # BR2_marvell_fv7 is not set BR2_ARM_TYPE="ARM_MARVELLFV5TE" BR2_ARM_EABI=y # BR2_ARM_OABI is not set BR2_ARCH="arm" BR2_ENDIAN="LITTLE" BR2_GCC_TARGET_ARCH="armv5te" BR2_GCC_TARGET_ABI="aapcs-linux" # # Build options # # # Commands # BR2_WGET="wget --passive-ftp -nd -t 3" BR2_SVN="svn" BR2_BZR="bzr" BR2_GIT="git" BR2_ZCAT="gzip -d -c" BR2_BZCAT="bzcat" BR2_XZCAT="xzcat" BR2_TAR_OPTIONS="" BR2_DL_DIR="$(TOPDIR)/dl" BR2_HOST_DIR="$(BASE_DIR)/host" # # Mirrors and Download locations # BR2_PRIMARY_SITE="" BR2_BACKUP_SITE="http://sources.buildroot.net/" BR2_SOURCEFORGE_MIRROR="kent" BR2_KERNEL_MIRROR="http://www.kernel.org/pub/" BR2_GNU_MIRROR="http://ftp.gnu.org/pub/gnu" BR2_DEBIAN_MIRROR="http://ftp.debian.org" BR2_JLEVEL=8 # BR2_CCACHE is not set # BR2_DEPRECATED is not set # BR2_ENABLE_DEBUG is not set BR2_STRIP_strip=y # BR2_STRIP_sstrip is not set # BR2_STRIP_none is not set # BR2_OPTIMIZE_0 is not set # BR2_OPTIMIZE_1 is not set # BR2_OPTIMIZE_2 is not set # BR2_OPTIMIZE_3 is not set BR2_OPTIMIZE_S=y # BR2_PREFER_STATIC_LIB is not set # BR2_HAVE_DOCUMENTATION is not set # BR2_HAVE_DEVFILES is not set # # Toolchain # # BR2_TOOLCHAIN_BUILDROOT is not set BR2_TOOLCHAIN_EXTERNAL=y # BR2_TOOLCHAIN_CTNG is not set BR2_PTHREAD_DEBUG=y # BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201103 is not set # BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201009 is not set # BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM2010Q1 is not set # BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM2009Q3 is not set # BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM2009Q1 is not set BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y BR2_TOOLCHAIN_EXTERNAL_PATH="/work64/marvell/armv5-marvell-linux-gnueabi-soft_i686" BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-marvell-linux-gnueabi" BR2_TOOLCHAIN_EXTERNAL_PREFIX="arm-marvell-linux-gnueabi" BR2_TOOLCHAIN_EXTERNAL_GLIBC=y # BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC is not set BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y BR2_TOOLCHAIN_EXTERNAL_CXX=y # # Gdb Options # BR2_PACKAGE_GDB=y BR2_PACKAGE_GDB_SERVER=y # BR2_GDB_VERSION_6_7_1 is not set # BR2_GDB_VERSION_6_8 is not set # BR2_GDB_VERSION_7_0_1 is not set BR2_GDB_VERSION_7_1=y BR2_GDB_VERSION="7.1" BR2_LARGEFILE=y BR2_INET_IPV6=y BR2_INET_RPC=y BR2_USE_WCHAR=y BR2_ENABLE_LOCALE=y BR2_PROGRAM_INVOCATION=y BR2_INSTALL_LIBSTDCPP=y BR2_TOOLCHAIN_HAS_THREADS=y BR2_ENABLE_LOCALE_PURGE=y BR2_ENABLE_LOCALE_WHITELIST="C en_US" BR2_USE_MMU=y BR2_SOFT_FLOAT=y # BR2_VFP_FLOAT_ARMV5 is not set # BR2_VFP_FLOAT_ARMV7 is not set BR2_TARGET_OPTIMIZATION="-pipe " # # System configuration # BR2_TARGET_GENERIC_HOSTNAME="buildroot" BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot" BR2_TARGET_GENERIC_STORE_CONFIG=y # BR2_ROOTFS_DEVICE_CREATION_STATIC is not set # BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS is not set # BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV is not set BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV=y BR2_ROOTFS_DEVICE_TABLE="target/generic/device_table.txt target/generic/device_table_dev.txt" BR2_ROOTFS_SKELETON_DEFAULT=y # BR2_ROOTFS_SKELETON_CUSTOM is not set BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" # BR2_TARGET_GENERIC_GETTY_BAUDRATE_KEEP is not set # BR2_TARGET_GENERIC_GETTY_BAUDRATE_9600 is not set # BR2_TARGET_GENERIC_GETTY_BAUDRATE_19200 is not set # BR2_TARGET_GENERIC_GETTY_BAUDRATE_38400 is not set # BR2_TARGET_GENERIC_GETTY_BAUDRATE_57600 is not set BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y BR2_TARGET_GENERIC_GETTY_BAUDRATE="115200" BR2_ROOTFS_POST_BUILD_SCRIPT="" # # Package Selection for the target # BR2_PACKAGE_BUSYBOX=y # BR2_BUSYBOX_VERSION_1_16_X is not set # BR2_BUSYBOX_VERSION_1_17_X is not set BR2_BUSYBOX_VERSION_1_18_X=y # BR2_PACKAGE_BUSYBOX_SNAPSHOT is not set BR2_BUSYBOX_VERSION="1.18.4" BR2_PACKAGE_BUSYBOX_CONFIG="busybox-1.18.4.config" BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y BR2_PACKAGE_BUSYBOX_PREFER_OTHERS=y # BR2_PACKAGE_CUSTOMIZE is not set # # Audio and video libraries and applications # # BR2_PACKAGE_ALSA_LIB is not set # BR2_PACKAGE_ALSA_UTILS is not set # BR2_PACKAGE_AUMIX is not set # BR2_PACKAGE_FAAD2 is not set # BR2_PACKAGE_FLAC is not set # BR2_PACKAGE_FFMPEG is not set # BR2_PACKAGE_GSTREAMER is not set # BR2_PACKAGE_LAME is not set # BR2_PACKAGE_LIBAO is not set # BR2_PACKAGE_LIBCDAUDIO is not set # BR2_PACKAGE_LIBCUE is not set # BR2_PACKAGE_LIBCUEFILE is not set # BR2_PACKAGE_LIBDVDREAD is not set # BR2_PACKAGE_LIBDVDNAV is not set # BR2_PACKAGE_LIBID3TAG is not set # BR2_PACKAGE_LIBMAD is not set # BR2_PACKAGE_LIBMMS is not set # BR2_PACKAGE_LIBMPD is not set # BR2_PACKAGE_LIBMPEG2 is not set # BR2_PACKAGE_LIBOGG is not set # BR2_PACKAGE_LIBREPLAYGAIN is not set # BR2_PACKAGE_LIBSAMPLERATE is not set # BR2_PACKAGE_LIBSNDFILE is not set # BR2_PACKAGE_LIBTHEORA is not set # BR2_PACKAGE_LIBVORBIS is not set # BR2_PACKAGE_MADPLAY is not set # BR2_PACKAGE_MPD is not set # BR2_PACKAGE_MPG123 is not set # BR2_PACKAGE_MPLAYER is not set # BR2_PACKAGE_MUSEPACK is not set # BR2_PACKAGE_SPEEX is not set # BR2_PACKAGE_SWFDEC is not set # BR2_PACKAGE_TAGLIB is not set # BR2_PACKAGE_TREMOR is not set # BR2_PACKAGE_VORBIS_TOOLS is not set # BR2_PACKAGE_WAVPACK is not set # # Compressors and decompressors # BR2_PACKAGE_BZIP2=y BR2_PACKAGE_GZIP=y BR2_PACKAGE_LZOP=y BR2_PACKAGE_XZ=y # # Debugging, profiling and benchmark # # BR2_PACKAGE_BONNIE is not set # BR2_PACKAGE_DHRYSTONE is not set # BR2_PACKAGE_DMALLOC is not set # BR2_PACKAGE_DT is not set # BR2_PACKAGE_KEXEC is not set # BR2_PACKAGE_LMBENCH is not set BR2_PACKAGE_LSOF=y # BR2_PACKAGE_LTP_TESTSUITE is not set BR2_PACKAGE_LTRACE=y # BR2_PACKAGE_MEMSTAT is not set BR2_PACKAGE_NETPERF=y BR2_PACKAGE_STRACE=y # BR2_PACKAGE_WHETSTONE is not set # # Development tools # # BR2_PACKAGE_AUTOCONF is not set # BR2_PACKAGE_AUTOMAKE is not set # BR2_PACKAGE_BISON is not set # BR2_PACKAGE_BSDIFF is not set # BR2_PACKAGE_CCACHE is not set BR2_PACKAGE_COREUTILS=y # BR2_PACKAGE_CVS is not set # BR2_PACKAGE_DIFFUTILS is not set # BR2_PACKAGE_DISTCC is not set BR2_PACKAGE_FINDUTILS=y # BR2_PACKAGE_FLEX is not set BR2_PACKAGE_GAWK=y # BR2_PACKAGE_GMP is not set # BR2_PACKAGE_GPERF is not set BR2_PACKAGE_GREP=y # BR2_PACKAGE_MAKE is not set # BR2_PACKAGE_MPC is not set # BR2_PACKAGE_MPFR is not set # BR2_PACKAGE_LIBTOOL is not set # BR2_PACKAGE_M4 is not set # BR2_PACKAGE_PATCH is not set # BR2_PACKAGE_PKG_CONFIG is not set BR2_PACKAGE_SED=y # BR2_PACKAGE_SSTRIP is not set BR2_PACKAGE_TAR=y # # Games # # BR2_PACKAGE_GNUCHESS is not set # BR2_PACKAGE_PRBOOM is not set # # Graphic libraries and applications (graphic/text) # # # Graphic applications # # BR2_PACKAGE_RRDTOOL is not set # # graphic libraries # # BR2_PACKAGE_DIRECTFB is not set # BR2_PACKAGE_FBDUMP is not set # BR2_PACKAGE_FBGRAB is not set # BR2_PACKAGE_FBSET is not set # BR2_PACKAGE_FBV is not set # BR2_PACKAGE_IMAGEMAGICK is not set # BR2_PACKAGE_SDL is not set # # other GUIs # # BR2_PACKAGE_QT is not set # BR2_PACKAGE_XORG7 is not set # # X libraries and helper libraries # # BR2_PACKAGE_LIBERATION is not set # # X Window managers # # # X applications # # BR2_PACKAGE_GOB2 is not set # # midori requires C++, WCHAR in toolchain and libgtk2 # # # Hardware handling # # BR2_PACKAGE_CDRKIT is not set # BR2_PACKAGE_CRAMFS is not set # # dbus not available (need expat or libxml2) # # BR2_PACKAGE_DMRAID is not set BR2_PACKAGE_DOSFSTOOLS=y BR2_PACKAGE_DOSFSTOOLS_MKDOSFS=y BR2_PACKAGE_DOSFSTOOLS_DOSFSCK=y # BR2_PACKAGE_DOSFSTOOLS_DOSFSLABEL is not set BR2_PACKAGE_E2FSPROGS=y # BR2_PACKAGE_E2FSPROGS_UTILS is not set # # e2fsprogs libraries # BR2_PACKAGE_E2FSPROGS_LIBUUID=y # BR2_PACKAGE_E2FSPROGS_LIBBLKID is not set # BR2_PACKAGE_EEPROG is not set # BR2_PACKAGE_FCONFIG is not set # BR2_PACKAGE_FIS is not set # BR2_PACKAGE_GADGETFS_TEST is not set # BR2_PACKAGE_GDISK is not set # BR2_PACKAGE_GENEXT2FS is not set # BR2_PACKAGE_GENROMFS is not set # BR2_PACKAGE_GPSD is not set # BR2_PACKAGE_GVFS is not set # BR2_PACKAGE_HAL is not set # BR2_PACKAGE_HDPARM is not set # BR2_PACKAGE_HWDATA is not set # BR2_PACKAGE_I2C_TOOLS is not set # BR2_PACKAGE_INPUT_EVENT_DAEMON is not set # BR2_PACKAGE_INPUT_TOOLS is not set BR2_PACKAGE_IOSTAT=y # BR2_PACKAGE_IRDA_UTILS is not set # BR2_PACKAGE_KBD is not set # BR2_PACKAGE_LIBV4L is not set # BR2_PACKAGE_LM_SENSORS is not set # BR2_PACKAGE_LSUIO is not set # BR2_PACKAGE_LVM2 is not set BR2_PACKAGE_MAKEDEVS=y # BR2_PACKAGE_MDADM is not set # BR2_PACKAGE_MEMTESTER is not set BR2_PACKAGE_MTD=y # # MTD tools selection # # BR2_PACKAGE_MTD_DOCFDISK is not set # BR2_PACKAGE_MTD_DOC_LOADBIOS is not set BR2_PACKAGE_MTD_FLASHCP=y BR2_PACKAGE_MTD_FLASH_ERASE=y BR2_PACKAGE_MTD_FLASH_ERASEALL=y BR2_PACKAGE_MTD_FLASH_INFO=y BR2_PACKAGE_MTD_FLASH_LOCK=y # BR2_PACKAGE_MTD_FLASH_OTP_DUMP is not set # BR2_PACKAGE_MTD_FLASH_OTP_INFO is not set BR2_PACKAGE_MTD_FLASH_UNLOCK=y # BR2_PACKAGE_MTD_FTL_CHECK is not set # BR2_PACKAGE_MTD_FTL_FORMAT is not set # BR2_PACKAGE_MTD_JFFS2DUMP is not set BR2_PACKAGE_MTD_MKFSJFFS2=y BR2_PACKAGE_MTD_MTD_DEBUG=y BR2_PACKAGE_MTD_NANDDUMP=y BR2_PACKAGE_MTD_NANDTEST=y BR2_PACKAGE_MTD_NANDWRITE=y # BR2_PACKAGE_MTD_NFTLDUMP is not set # BR2_PACKAGE_MTD_NFTL_FORMAT is not set # BR2_PACKAGE_MTD_RECV_IMAGE is not set # BR2_PACKAGE_MTD_RFDDUMP is not set # BR2_PACKAGE_MTD_RFDFORMAT is not set # BR2_PACKAGE_MTD_SERVE_IMAGE is not set # BR2_PACKAGE_MTD_SUMTOOL is not set BR2_PACKAGE_MTD_MTDINFO=y BR2_PACKAGE_MTD_UBIATTACH=y BR2_PACKAGE_MTD_UBICRC32=y BR2_PACKAGE_MTD_UBIDETACH=y BR2_PACKAGE_MTD_UBIFORMAT=y BR2_PACKAGE_MTD_UBIMKVOL=y BR2_PACKAGE_MTD_UBINFO=y BR2_PACKAGE_MTD_UBINIZE=y BR2_PACKAGE_MTD_UBIRENAME=y BR2_PACKAGE_MTD_UBIRMVOL=y BR2_PACKAGE_MTD_UBIRSVOL=y BR2_PACKAGE_MTD_UBIUPDATEVOL=y # BR2_PACKAGE_NTFS_3G is not set # BR2_PACKAGE_NTFSPROGS is not set # BR2_PACKAGE_PCIUTILS is not set # BR2_PACKAGE_RNG_TOOLS is not set # BR2_PACKAGE_SDPARM is not set # BR2_PACKAGE_SETSERIAL is not set # BR2_PACKAGE_SMARTMONTOOLS is not set # BR2_PACKAGE_SQUASHFS is not set # BR2_PACKAGE_SSHFS is not set BR2_PACKAGE_SYSSTAT=y BR2_PACKAGE_UDEV=y BR2_PACKAGE_UDEV_UTILS=y # # Extra udev tools # # BR2_PACKAGE_UDEV_VOLUME_ID is not set # BR2_PACKAGE_USB_MODESWITCH is not set # BR2_PACKAGE_USBMOUNT is not set # BR2_PACKAGE_USBUTILS is not set # BR2_PACKAGE_WIPE is not set # BR2_PACKAGE_XFSPROGS is not set # # Interpreter languages and scripting # # BR2_PACKAGE_HASERL is not set # BR2_PACKAGE_LUA is not set # BR2_PACKAGE_MICROPERL is not set # BR2_PACKAGE_PHP is not set # BR2_PACKAGE_PYTHON is not set # BR2_PACKAGE_RUBY is not set # BR2_PACKAGE_TCL is not set # # Libraries # # # Compression and decompression # # BR2_PACKAGE_LIBARCHIVE is not set BR2_PACKAGE_LZO=y BR2_PACKAGE_ZLIB=y # # Crypto # # BR2_PACKAGE_BEECRYPT is not set # BR2_PACKAGE_LIBGCRYPT is not set # BR2_PACKAGE_LIBGPG_ERROR is not set BR2_PACKAGE_OPENSSL=y # BR2_PACKAGE_OPENSSL_BIN is not set BR2_PACKAGE_OPENSSL_ENGINES=y # BR2_PACKAGE_OPENSSL_OCF is not set # # Database # # BR2_PACKAGE_BERKELEYDB is not set # BR2_PACKAGE_MYSQL_CLIENT is not set # BR2_PACKAGE_SQLITE is not set # # Filesystem # # BR2_PACKAGE_GAMIN is not set # BR2_PACKAGE_LIBCONFIG is not set # BR2_PACKAGE_LIBCONFUSE is not set # BR2_PACKAGE_LIBFUSE is not set # BR2_PACKAGE_LIBLOCKFILE is not set # BR2_PACKAGE_LIBSYSFS is not set # # Graphics # # BR2_PACKAGE_ATK is not set # BR2_PACKAGE_CAIRO is not set # BR2_PACKAGE_FONTCONFIG is not set # BR2_PACKAGE_FREETYPE is not set # BR2_PACKAGE_JPEG is not set # BR2_PACKAGE_LIBART is not set # BR2_PACKAGE_LIBEXIF is not set # BR2_PACKAGE_GDK_PIXBUF is not set # BR2_PACKAGE_LIBPNG is not set # BR2_PACKAGE_LIBRAW is not set # BR2_PACKAGE_LIBSVGTINY is not set # BR2_PACKAGE_LIBUNGIF is not set # BR2_PACKAGE_PANGO is not set # BR2_PACKAGE_PIXMAN is not set # BR2_PACKAGE_TIFF is not set # # webkit requires C++, WCHAR in toolchain and libgtk2 # # # Hardware handling # # BR2_PACKAGE_LIBAIO is not set # BR2_PACKAGE_LIBRAW1394 is not set # BR2_PACKAGE_TSLIB is not set # BR2_PACKAGE_LIBHID is not set # BR2_PACKAGE_LIBUSB is not set # # Networking # # BR2_PACKAGE_LIBCGI is not set # BR2_PACKAGE_LIBCGICC is not set # BR2_PACKAGE_LIBCURL is not set # BR2_PACKAGE_LIBDNET is not set # BR2_PACKAGE_LIBEXOSIP2 is not set # BR2_PACKAGE_LIBIDN is not set # BR2_PACKAGE_LIBMICROHTTPD is not set # BR2_PACKAGE_NEON is not set BR2_PACKAGE_LIBNL=y BR2_PACKAGE_LIBPCAP=y # BR2_PACKAGE_LIBOSIP2 is not set # BR2_PACKAGE_LIBRSYNC is not set # BR2_PACKAGE_LIBSOUP is not set # BR2_PACKAGE_LIBUPNP is not set # # Other # # BR2_PACKAGE_ARGP_STANDALONE is not set # BR2_PACKAGE_LIBATOMIC_OPS is not set # BR2_PACKAGE_LIBCAP is not set # BR2_PACKAGE_LIBDAEMON is not set BR2_PACKAGE_LIBELF=y # BR2_PACKAGE_LIBEVENT is not set # BR2_PACKAGE_LIBFFI is not set # BR2_PACKAGE_LIBGLIB2 is not set # BR2_PACKAGE_LIBOIL is not set # BR2_PACKAGE_LIBSIGC is not set # # Text and terminal handling # # BR2_PACKAGE_ENCHANT is not set # BR2_PACKAGE_ICU is not set BR2_PACKAGE_NCURSES=y # BR2_PACKAGE_NCURSES_TARGET_PANEL is not set # BR2_PACKAGE_NCURSES_TARGET_FORM is not set # BR2_PACKAGE_NCURSES_TARGET_MENU is not set # BR2_PACKAGE_NEWT is not set # BR2_PACKAGE_PCRE is not set BR2_PACKAGE_POPT=y # BR2_PACKAGE_READLINE is not set # BR2_PACKAGE_SLANG is not set # # XML # # BR2_PACKAGE_EXPAT is not set # BR2_PACKAGE_EZXML is not set # BR2_PACKAGE_LIBXML2 is not set # BR2_PACKAGE_LIBXSLT is not set # BR2_PACKAGE_XERCES is not set # # Miscellaneous # # BR2_PACKAGE_SHARED_MIME_INFO is not set # # Networking applications # # BR2_PACKAGE_ARGUS is not set # BR2_PACKAGE_AVAHI is not set # BR2_PACKAGE_AXEL is not set # BR2_PACKAGE_BOA is not set # BR2_PACKAGE_BIND is not set # BR2_PACKAGE_BMON is not set # BR2_PACKAGE_BRIDGE is not set # BR2_PACKAGE_BWM_NG is not set # BR2_PACKAGE_CAN_UTILS is not set # BR2_PACKAGE_CTORRENT is not set # BR2_PACKAGE_CUPS is not set # BR2_PACKAGE_DHCP is not set # BR2_PACKAGE_DHCPDUMP is not set # BR2_PACKAGE_DNSMASQ is not set BR2_PACKAGE_DROPBEAR=y # BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS is not set BR2_PACKAGE_DROPBEAR_SMALL=y BR2_PACKAGE_ETHTOOL=y # BR2_PACKAGE_HOSTAPD is not set # BR2_PACKAGE_IFPLUGD is not set # BR2_PACKAGE_IPERF is not set # BR2_PACKAGE_IPROUTE2 is not set # BR2_PACKAGE_IPSEC_TOOLS is not set BR2_PACKAGE_IPTABLES=y # BR2_PACKAGE_IW is not set # BR2_PACKAGE_KISMET is not set # BR2_PACKAGE_XL2TP is not set # BR2_PACKAGE_LIGHTTPD is not set # BR2_PACKAGE_LINKS is not set # BR2_PACKAGE_LRZSZ is not set # BR2_PACKAGE_MII_DIAG is not set # BR2_PACKAGE_MROUTED is not set # BR2_PACKAGE_MUTT is not set # BR2_PACKAGE_NBD is not set # BR2_PACKAGE_NCFTP is not set # BR2_PACKAGE_NETCAT is not set # BR2_PACKAGE_NETKITBASE is not set # BR2_PACKAGE_NETKITTELNET is not set # BR2_PACKAGE_NETPLUG is not set # BR2_PACKAGE_NETSNMP is not set # BR2_PACKAGE_NETSTAT_NAT is not set BR2_PACKAGE_NFS_UTILS=y # # NFS utilities selection # # BR2_PACKAGE_NFS_UTILS_RPCDEBUG is not set # BR2_PACKAGE_NFS_UTILS_RPC_LOCKD is not set # BR2_PACKAGE_NFS_UTILS_RPC_RQUOTAD is not set # BR2_PACKAGE_NGIRCD is not set BR2_PACKAGE_NTP=y # BR2_PACKAGE_NTP_SNTP is not set BR2_PACKAGE_NTP_NTP_KEYGEN=y BR2_PACKAGE_NTP_NTPD=y BR2_PACKAGE_NTP_NTPDATE=y BR2_PACKAGE_NTP_NTPDC=y BR2_PACKAGE_NTP_NTPQ=y # BR2_PACKAGE_NTP_TICKADJ is not set # BR2_PACKAGE_NUTTCP is not set # BR2_PACKAGE_OLSR is not set # BR2_PACKAGE_OPENNTPD is not set # BR2_PACKAGE_OPENSSH is not set # BR2_PACKAGE_OPENVPN is not set # BR2_PACKAGE_OPENSWAN is not set # BR2_PACKAGE_PORTMAP is not set # BR2_PACKAGE_PPPD is not set # BR2_PACKAGE_RADVD is not set # BR2_PACKAGE_PPTP_LINUX is not set # BR2_PACKAGE_PROFTPD is not set # BR2_PACKAGE_QUAGGA is not set # BR2_PACKAGE_RSH_REDONE is not set # BR2_PACKAGE_RSYNC is not set # BR2_PACKAGE_SAMBA is not set # BR2_PACKAGE_SER2NET is not set # BR2_PACKAGE_SOCAT is not set # BR2_PACKAGE_SPAWN_FCGI is not set # BR2_PACKAGE_SQUID is not set BR2_PACKAGE_TCPDUMP=y BR2_PACKAGE_TCPDUMP_SMB=y # BR2_PACKAGE_TCPREPLAY is not set # BR2_PACKAGE_TFTPD is not set # BR2_PACKAGE_THTTPD is not set # BR2_PACKAGE_TINYHTTPD is not set # BR2_PACKAGE_TN5250 is not set # BR2_PACKAGE_TTCP is not set # BR2_PACKAGE_UDPCAST is not set # BR2_PACKAGE_VPNC is not set # BR2_PACKAGE_VSFTPD is not set # BR2_PACKAGE_VTUN is not set # BR2_PACKAGE_WGET is not set # BR2_PACKAGE_WIRELESS_TOOLS is not set # BR2_PACKAGE_WPA_SUPPLICANT is not set # # Package managers # # BR2_PACKAGE_IPKG is not set # # rpm requires libneon with SSL, XML and ZLIB support # # # Shell and utilities # # BR2_PACKAGE_AT is not set BR2_PACKAGE_BASH=y # BR2_PACKAGE_DASH is not set # BR2_PACKAGE_DIALOG is not set BR2_PACKAGE_FILE=y # BR2_PACKAGE_LOCKFILE_PROGS is not set # BR2_PACKAGE_LOGROTATE is not set # BR2_PACKAGE_SCREEN is not set # BR2_PACKAGE_SUDO is not set BR2_PACKAGE_WHICH=y # BR2_PACKAGE_XMLSTARLET is not set # # System tools # # BR2_PACKAGE_BOOTUTILS is not set BR2_PACKAGE_HTOP=y BR2_PACKAGE_MODULE_INIT_TOOLS=y BR2_PACKAGE_PROCPS=y BR2_PACKAGE_PSMISC=y # BR2_PACKAGE_SYSKLOGD is not set # BR2_PACKAGE_SYSVINIT is not set BR2_PACKAGE_UTIL-LINUX=y # # Text editors and viewers # # BR2_PACKAGE_ED is not set # BR2_PACKAGE_LESS is not set BR2_PACKAGE_NANO=y # BR2_PACKAGE_UEMACS is not set # BR2_PACKAGE_VIM is not set # # Filesystem images # # BR2_TARGET_ROOTFS_CRAMFS is not set # BR2_TARGET_ROOTFS_CLOOP is not set # BR2_TARGET_ROOTFS_EXT2 is not set # BR2_TARGET_ROOTFS_JFFS2 is not set # BR2_TARGET_ROOTFS_UBIFS is not set # BR2_TARGET_ROOTFS_SQUASHFS is not set BR2_TARGET_ROOTFS_TAR=y BR2_TARGET_ROOTFS_TAR_NONE=y # BR2_TARGET_ROOTFS_TAR_GZIP is not set # BR2_TARGET_ROOTFS_TAR_BZIP2 is not set # BR2_TARGET_ROOTFS_TAR_LZMA is not set BR2_TARGET_ROOTFS_TAR_OPTIONS="" # BR2_TARGET_ROOTFS_CPIO is not set # # initramfs requires a Linux kernel to be built # # BR2_TARGET_ROOTFS_ROMFS is not set # # Bootloaders # # BR2_TARGET_BAREBOX is not set # BR2_TARGET_UBOOT is not set # BR2_TARGET_AT91BOOTSTRAP is not set # BR2_TARGET_DATAFLASHBOOT is not set # # Kernel # # BR2_LINUX_KERNEL is not set OpenIPMI-2.0.27/lanserv/marvell-bmc/lancontrol0000755000175000017500000002210412116456523016063 00000000000000#!/bin/sh # # An example script for handling external LAN configuration from the # IPMI simulator. This command is generally invoked by the IPMI # simulator to get and set external LAN configuration parameters. # # It's parameters are: # # ipmi_sim_lancontrol get [parm [parm ...]] # ipmi_sim_lancontrol set|check [parm val [parm val ...]] # # where is a network device (eth0, etc.) and parm is one of: # ip_addr # ip_addr_src # mac_addr # subnet_mask # default_gw_ip_addr # default_gw_mac_addr # backup_gw_ip_addr # backup_gw_mac_addr # These are config values out of the IPMI LAN config table that are # not IPMI-exclusive, they require setting external things. # # The output of the "get" is ":" for each listed parm. # The output of the "set" is empty on success. Error output goes to # standard out (so it can be captured in the simulator) and the program # returns an error. # # The IP address values are standard IP addresses in the form a.b.c.d. # The MAC addresses ar standard 6 octet xx:xx:xx:xx:xx:xx values. The # only special one is ip_addr_src, which can be "dhcp" or "static". # # The "check" operation checks to see if a value is valid without # committing it. # need_ip_addr=0 need_ip_addr_src=0 need_mac_addr=0 need_subnet_mask=0 need_default_gw_ip_addr=0 ip_addr="0.0.0.0" ip_addr_src="dhcp" mac_addr="00:00:00:00:00:00" subnet_mask="255.255.255.255" default_gw_ip_addr="0.0.0.0" prog=$0 device=$1 if [ "x$device" = "x" ]; then echo "No device given" exit 1; fi shift op=$1 if [ "x$op" = "x" ]; then echo "No operation given" exit 1 fi shift do_get() { while [ "x$1" != "x" ]; do case $1 in ip_addr) val=`ifconfig $device | grep '^ *inet addr:' | tr ':' ' ' | sed 's/.*inet addr \([0-9.]*\).*$/\1/'` if [ "x$val" = "x" ]; then val="0.0.0.0" fi ;; ip_addr_src) val=`grep "iface $device inet" /etc/network/interfaces | tr ' ' '\t' | tr -s '\t' '\t' | cut -f 4` case "x$val" in xstatic) ;; xdhcp) ;; *) val="unknown" ;; esac ;; mac_addr) val=`ifconfig $device | grep 'HWaddr' | sed 's/.*HWaddr \([0-9a-fA-F:]*\).*$/\1/'` if [ "x$val" = "x" ]; then val="00:00:00:00:00:00" fi ;; subnet_mask) val=`ifconfig $device | grep '^ *inet addr:' | tr ':' ' ' | sed 's/.*Mask \([0-9.]*\).*$/\1/'` if [ "x$val" = "x" ]; then val="0.0.0.0" fi ;; default_gw_ip_addr) val=`route -n | grep '^0\.0\.0\.0' | grep "$device\$" | tr ' ' '\t' | tr -s '\t' '\t' | cut -f 2` if [ "x$val" = "x" ]; then val="0.0.0.0" fi ;; default_gw_mac_addr) val=`route -n | grep '^0\.0\.0\.0' | grep "$device\$" | tr ' ' '\t' | tr -s '\t' '\t' | cut -s -f 2` if [ "x$val" = "x" ]; then val="00:00:00:00:00:00" else ping -W 1 -c 1 $val >/dev/null 2>&1 val=`arp -n $val | grep "($val)" | tr ' ' '\t' | tr -s '\t' '\t' | cut -f 4` if [ "x$val" = "x" -o "x$val" = 'x' ]; then val="00:00:00:00:00:00" fi fi ;; backup_gw_ip_addr) val="0.0.0.0" ;; backup_gw_mac_addr) val="00:00:00:00:00:00" ;; *) echo "Invalid parameter: $1" exit 1 ;; esac echo "$1:$val" shift done } do_check() { case $1 in ip_addr_src) # We only support static and dhcp IP address sources case $2 in static) ;; dhcp) ;; *) echo "Invalid ip_addr_src: $2" exit 1 ;; esac ;; ip_addr | subnet_mask | default_gw_ip_addr) if [ "$2" != "`echo $2 | grep -E [0-9]\{1,3\}[.][0-9]\{1,3\}[.][0-9]\{1,3\}[.][0-9]\{1,3\}`" ]; then echo "Invalid value $2 for parameter $1" exit 1 fi ;; mac_addr) if [ "$2" != "`echo $2 | grep -E [[:xdigit:]]\{1,2\}[:][[:xdigit:]]\{1,2\}[:][[:xdigit:]]\{1,2\}[:][[:xdigit:]]\{1,2\}[:][[:xdigit:]]\{1,2\}[:][[:xdigit:]]\{1,2\}`" ]; then echo "Invalid value $2 for parameter $1" exit 1 fi ;; *) echo "Invalid parameter: $parm" exit 1 ;; esac } do_create_stanza() { if [ $need_ip_addr_src != 1 ] then echo "ip_addr_src required for new interface stanza - fail" exit 1 fi case $ip_addr_src in dhcp) echo "iface $device inet dhcp" >/tmp/ipmi_ifaces_stanza if [ $need_mac_addr = 1 ] then echo " hwaddress $mac_addr" >>/tmp/ipmi_ifaces_stanza fi echo " " >>/tmp/ipmi_ifaces_stanza ;; static) echo "iface $device inet static" >/tmp/ipmi_ifaces_stanza if [ $need_ip_addr = 1 ] then echo " address $ip_addr" >>/tmp/ipmi_ifaces_stanza else echo "static configuration requires ip_addr - fail" exit 1 fi if [ $need_subnet_mask = 1 ] then echo " netmask $subnet_mask" >>/tmp/ipmi_ifaces_stanza else echo "static configuration requires subnet_mask - fail" exit 1 fi if [ $need_default_gw_ip_addr = 1 ] then echo " gateway $default_gw_ip_addr" >>/tmp/ipmi_ifaces_stanza fi if [ $need_mac_addr = 1 ] then echo " hwaddress ether $mac_addr" >>/tmp/ipmi_ifaces_stanza fi echo " " >>/tmp/ipmi_ifaces_stanza ;; esac } do_split_interfaces() { # separate the stanza for our device from the other stanzas sed "/^[ \t]*iface[ \t][ \t]*$device[ \t]/,/^\t$/d" /etc/network/interfaces >/tmp/ipmi_interfaces_unchanged sed -n "/^[ \t]*iface[ \t][ \t]*$device[ \t]/,/^\t$/p" /etc/network/interfaces >/tmp/ipmi_old_stanza } do_modify_stanza() { # fixup the previous stanza for our device, keeping parts that are unmodified if [ -s /tmp/ipmi_old_stanza ] then # now we need to modify the file that is there to update any new settings # For every new parameter, remove the old corresponding line cp /tmp/ipmi_old_stanza /tmp/ipmi_old_stanza_src if [ $need_ip_addr_src = 1 ] then sed '/^[ \t]*iface/d' /tmp/ipmi_old_stanza_src >/tmp/ipmi_old_stanza_dst.1 echo "iface $device inet $ip_addr_src" >/tmp/ipmi_ifaces_stanza cp /tmp/ipmi_old_stanza_dst.1 /tmp/ipmi_old_stanza_src else sed -n "1p" /tmp/ipmi_old_stanza_src >/tmp/ipmi_ifaces_stanza sed '/^[ \t]*iface/d' /tmp/ipmi_old_stanza_src >/tmp/ipmi_old_stanza_dst.1 cp /tmp/ipmi_old_stanza_dst.1 /tmp/ipmi_old_stanza_src fi if [ $need_ip_addr = 1 ] then sed '/^[ \t]*address/d' /tmp/ipmi_old_stanza_src >/tmp/ipmi_old_stanza_dst.2 echo " address $ip_addr" >>/tmp/ipmi_ifaces_stanza cp /tmp/ipmi_old_stanza_dst.2 /tmp/ipmi_old_stanza_src fi if [ $need_subnet_mask = 1 ] then sed '/^[ \t]*netmask/d' /tmp/ipmi_old_stanza_src >/tmp/ipmi_old_stanza_dst.3 echo " netmask $subnet_mask" >>/tmp/ipmi_ifaces_stanza cp /tmp/ipmi_old_stanza_dst.3 /tmp/ipmi_old_stanza_src fi if [ $need_default_gw_ip_addr = 1 ] then sed '/^[ \t]*gateway/d' /tmp/ipmi_old_stanza_src >/tmp/ipmi_old_stanza_dst.4 echo " gateway $default_gw_ip_addr" >>/tmp/ipmi_ifaces_stanza cp /tmp/ipmi_old_stanza_dst.4 /tmp/ipmi_old_stanza_src fi if [ $need_mac_addr = 1 ] then sed '/^[ \t]*hwaddress/d' /tmp/ipmi_old_stanza_src >/tmp/ipmi_old_stanza_dst.5 echo " hwaddress ether $mac_addr" >>/tmp/ipmi_ifaces_stanza cp /tmp/ipmi_old_stanza_dst.5 /tmp/ipmi_old_stanza_src fi cat /tmp/ipmi_old_stanza_src >>/tmp/ipmi_ifaces_stanza else # if /tmp/ipmi_old_stanza is empty, then we just need to create a new stanza # as this is adding an interface to the configuration do_create_stanza fi } # Parse existing interfaces file - # if there is an existing iface stanza for $device # then extract it for update with new parameters # We keep any parameters that are not set on the # command line for this script. # # Be careful - you may render your connection to the management # system unusable. Upon successful creation of a new interfaces # file, the interface is taken down and restarted to do_interfaces() { if [ -d /etc/network ] then if [ -f /etc/network/interfaces ] then if [ -w /etc/network/interfaces ] then do_split_interfaces do_modify_stanza cat /tmp/ipmi_interfaces_unchanged /tmp/ipmi_ifaces_stanza >/tmp/impi_new_interfaces mv /etc/network/interfaces /etc/network/interfaces.old cp /tmp/impi_new_interfaces /etc/network/interfaces else echo "/etc/network/interfaces exists and is not writable -fail" exit 1 fi else do_create_stanza cp /tmp/ipmi_ifaces_stanza /etc/network/interfaces fi else echo "No /etc/network directory found - failing" exit 1 fi } do_set() { if [ "x$1" = "x" ] then echo "no parameters given for set command - fail" exit 1 fi while [ "x$1" != "x" ]; do parm="$1" shift if [ "x$1" = "x" ]; then echo "No value present for parameter $parm" exit 1 fi val="$1" shift do_check $parm $val case $parm in ip_addr) need_ip_addr=1 ip_addr=$val ;; ip_addr_src) need_ip_addr_src=1 ip_addr_src=$val ;; mac_addr) need_mac_addr=1 mac_addr=$val ;; subnet_mask) need_subnet_mask=1 subnet_mask=$val ;; default_gw_ip_addr) need_default_gw_ip_addr=1 default_gw_ip_addr=$val ;; *) echo "Invalid parameter: $1" exit 1 ;; esac done do_interfaces ifdown $device ifup $device } case $op in get) do_get $@ ;; set) do_set $@ ;; check) do_check $@ ;; *) echo "Unknown operation: $op" exit 1 esac OpenIPMI-2.0.27/lanserv/marvell-bmc/busybox-1.18.4.config0000644000175000017500000006347412116456523017412 00000000000000# # Automatically generated make config: don't edit # Busybox version: 1.18.4 # Thu Jan 10 21:53:35 2013 # CONFIG_HAVE_DOT_CONFIG=y # # Busybox Settings # # # General Configuration # CONFIG_DESKTOP=y # CONFIG_EXTRA_COMPAT is not set CONFIG_INCLUDE_SUSv2=y # CONFIG_USE_PORTABLE_CODE is not set CONFIG_PLATFORM_LINUX=y CONFIG_FEATURE_BUFFERS_USE_MALLOC=y # CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set # CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set CONFIG_SHOW_USAGE=y CONFIG_FEATURE_VERBOSE_USAGE=y # CONFIG_FEATURE_COMPRESS_USAGE is not set CONFIG_FEATURE_INSTALLER=y # CONFIG_INSTALL_NO_USR is not set # CONFIG_LOCALE_SUPPORT is not set # CONFIG_UNICODE_SUPPORT is not set # CONFIG_UNICODE_USING_LOCALE is not set # CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set CONFIG_SUBST_WCHAR=0 CONFIG_LAST_SUPPORTED_WCHAR=0 # CONFIG_UNICODE_COMBINING_WCHARS is not set # CONFIG_UNICODE_WIDE_WCHARS is not set # CONFIG_UNICODE_BIDI_SUPPORT is not set # CONFIG_UNICODE_NEUTRAL_TABLE is not set # CONFIG_UNICODE_PRESERVE_BROKEN is not set CONFIG_LONG_OPTS=y CONFIG_FEATURE_DEVPTS=y CONFIG_FEATURE_CLEAN_UP=y CONFIG_FEATURE_WTMP=y CONFIG_FEATURE_UTMP=y # CONFIG_FEATURE_PIDFILE is not set CONFIG_FEATURE_SUID=y # CONFIG_FEATURE_SUID_CONFIG is not set # CONFIG_FEATURE_SUID_CONFIG_QUIET is not set # CONFIG_SELINUX is not set # CONFIG_FEATURE_PREFER_APPLETS is not set CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" CONFIG_FEATURE_SYSLOG=y CONFIG_FEATURE_HAVE_RPC=y # # Build Options # # CONFIG_STATIC is not set # CONFIG_PIE is not set # CONFIG_NOMMU is not set # CONFIG_BUILD_LIBBUSYBOX is not set # CONFIG_FEATURE_INDIVIDUAL is not set # CONFIG_FEATURE_SHARED_BUSYBOX is not set CONFIG_LFS=y CONFIG_CROSS_COMPILER_PREFIX="" CONFIG_EXTRA_CFLAGS="" # # Debugging Options # # CONFIG_DEBUG is not set # CONFIG_DEBUG_PESSIMIZE is not set # CONFIG_WERROR is not set CONFIG_NO_DEBUG_LIB=y # CONFIG_DMALLOC is not set # CONFIG_EFENCE is not set # # Installation Options ("make install" behavior) # CONFIG_INSTALL_APPLET_SYMLINKS=y # CONFIG_INSTALL_APPLET_HARDLINKS is not set # CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set # CONFIG_INSTALL_APPLET_DONT is not set # CONFIG_INSTALL_SH_APPLET_SYMLINK is not set # CONFIG_INSTALL_SH_APPLET_HARDLINK is not set # CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set CONFIG_PREFIX="./_install" # # Busybox Library Tuning # CONFIG_PASSWORD_MINLEN=6 CONFIG_MD5_SIZE_VS_SPEED=2 # CONFIG_FEATURE_FAST_TOP is not set # CONFIG_FEATURE_ETC_NETWORKS is not set CONFIG_FEATURE_USE_TERMIOS=y CONFIG_FEATURE_EDITING=y CONFIG_FEATURE_EDITING_MAX_LEN=1024 CONFIG_FEATURE_EDITING_VI=y CONFIG_FEATURE_EDITING_HISTORY=999 CONFIG_FEATURE_EDITING_SAVEHISTORY=y CONFIG_FEATURE_TAB_COMPLETION=y # CONFIG_FEATURE_USERNAME_COMPLETION is not set CONFIG_FEATURE_EDITING_FANCY_PROMPT=y # CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set CONFIG_FEATURE_NON_POSIX_CP=y # CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set CONFIG_FEATURE_COPYBUF_KB=4 CONFIG_MONOTONIC_SYSCALL=y CONFIG_IOCTL_HEX2STR_ERROR=y CONFIG_FEATURE_HWIB=y # # Applets # # # Archival Utilities # # CONFIG_FEATURE_SEAMLESS_XZ is not set # CONFIG_FEATURE_SEAMLESS_LZMA is not set # CONFIG_FEATURE_SEAMLESS_BZ2 is not set # CONFIG_FEATURE_SEAMLESS_GZ is not set # CONFIG_FEATURE_SEAMLESS_Z is not set CONFIG_AR=y # CONFIG_FEATURE_AR_LONG_FILENAMES is not set CONFIG_FEATURE_AR_CREATE=y CONFIG_BUNZIP2=y # CONFIG_BZIP2 is not set CONFIG_CPIO=y # CONFIG_FEATURE_CPIO_O is not set # CONFIG_FEATURE_CPIO_P is not set # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set # CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GUNZIP=y CONFIG_GZIP=y # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set # CONFIG_LZOP is not set # CONFIG_LZOP_COMPR_HIGH is not set # CONFIG_RPM2CPIO is not set # CONFIG_RPM is not set CONFIG_TAR=y CONFIG_FEATURE_TAR_CREATE=y # CONFIG_FEATURE_TAR_AUTODETECT is not set CONFIG_FEATURE_TAR_FROM=y # CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set # CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y CONFIG_FEATURE_TAR_LONG_OPTIONS=y CONFIG_FEATURE_TAR_TO_COMMAND=y # CONFIG_FEATURE_TAR_UNAME_GNAME is not set # CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set # CONFIG_FEATURE_TAR_SELINUX is not set # CONFIG_UNCOMPRESS is not set CONFIG_UNLZMA=y # CONFIG_FEATURE_LZMA_FAST is not set CONFIG_LZMA=y CONFIG_UNXZ=y CONFIG_XZ=y CONFIG_UNZIP=y # # Coreutils # CONFIG_BASENAME=y CONFIG_CAT=y CONFIG_DATE=y CONFIG_FEATURE_DATE_ISOFMT=y # CONFIG_FEATURE_DATE_NANO is not set CONFIG_FEATURE_DATE_COMPAT=y CONFIG_TEST=y CONFIG_FEATURE_TEST_64=y CONFIG_TR=y CONFIG_FEATURE_TR_CLASSES=y CONFIG_FEATURE_TR_EQUIV=y # CONFIG_BASE64 is not set # CONFIG_CAL is not set CONFIG_CATV=y CONFIG_CHGRP=y CONFIG_CHMOD=y CONFIG_CHOWN=y # CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set CONFIG_CHROOT=y CONFIG_CKSUM=y # CONFIG_COMM is not set CONFIG_CP=y # CONFIG_FEATURE_CP_LONG_OPTIONS is not set CONFIG_CUT=y CONFIG_DD=y CONFIG_FEATURE_DD_SIGNAL_HANDLING=y # CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set CONFIG_FEATURE_DD_IBS_OBS=y CONFIG_DF=y # CONFIG_FEATURE_DF_FANCY is not set CONFIG_DIRNAME=y CONFIG_DOS2UNIX=y CONFIG_UNIX2DOS=y CONFIG_DU=y CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y CONFIG_ECHO=y CONFIG_FEATURE_FANCY_ECHO=y CONFIG_ENV=y # CONFIG_FEATURE_ENV_LONG_OPTIONS is not set # CONFIG_EXPAND is not set # CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set CONFIG_EXPR=y CONFIG_EXPR_MATH_SUPPORT_64=y CONFIG_FALSE=y CONFIG_FOLD=y # CONFIG_FSYNC is not set CONFIG_HEAD=y CONFIG_FEATURE_FANCY_HEAD=y CONFIG_HOSTID=y CONFIG_ID=y CONFIG_INSTALL=y CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y CONFIG_LENGTH=y CONFIG_LN=y CONFIG_LOGNAME=y CONFIG_LS=y CONFIG_FEATURE_LS_FILETYPES=y CONFIG_FEATURE_LS_FOLLOWLINKS=y CONFIG_FEATURE_LS_RECURSIVE=y CONFIG_FEATURE_LS_SORTFILES=y CONFIG_FEATURE_LS_TIMESTAMPS=y CONFIG_FEATURE_LS_USERNAME=y CONFIG_FEATURE_LS_COLOR=y CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y CONFIG_MD5SUM=y CONFIG_MKDIR=y CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y CONFIG_MKFIFO=y CONFIG_MKNOD=y CONFIG_MV=y CONFIG_FEATURE_MV_LONG_OPTIONS=y CONFIG_NICE=y CONFIG_NOHUP=y CONFIG_OD=y CONFIG_PRINTENV=y CONFIG_PRINTF=y CONFIG_PWD=y CONFIG_READLINK=y CONFIG_FEATURE_READLINK_FOLLOW=y CONFIG_REALPATH=y CONFIG_RM=y CONFIG_RMDIR=y # CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set CONFIG_SEQ=y CONFIG_SHA1SUM=y CONFIG_SHA256SUM=y CONFIG_SHA512SUM=y CONFIG_SLEEP=y # CONFIG_FEATURE_FANCY_SLEEP is not set # CONFIG_FEATURE_FLOAT_SLEEP is not set CONFIG_SORT=y CONFIG_FEATURE_SORT_BIG=y # CONFIG_SPLIT is not set # CONFIG_FEATURE_SPLIT_FANCY is not set # CONFIG_STAT is not set # CONFIG_FEATURE_STAT_FORMAT is not set CONFIG_STTY=y # CONFIG_SUM is not set CONFIG_SYNC=y # CONFIG_TAC is not set CONFIG_TAIL=y CONFIG_FEATURE_FANCY_TAIL=y CONFIG_TEE=y CONFIG_FEATURE_TEE_USE_BLOCK_IO=y CONFIG_TOUCH=y CONFIG_TRUE=y CONFIG_TTY=y CONFIG_UNAME=y # CONFIG_UNEXPAND is not set # CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set CONFIG_UNIQ=y CONFIG_USLEEP=y CONFIG_UUDECODE=y CONFIG_UUENCODE=y CONFIG_WC=y # CONFIG_FEATURE_WC_LARGE is not set CONFIG_WHO=y CONFIG_WHOAMI=y CONFIG_YES=y # # Common options for cp and mv # CONFIG_FEATURE_PRESERVE_HARDLINKS=y # # Common options for ls, more and telnet # CONFIG_FEATURE_AUTOWIDTH=y # # Common options for df, du, ls # CONFIG_FEATURE_HUMAN_READABLE=y # # Common options for md5sum, sha1sum, sha256sum, sha512sum # CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y # # Console Utilities # CONFIG_CHVT=y # CONFIG_FGCONSOLE is not set CONFIG_CLEAR=y CONFIG_DEALLOCVT=y CONFIG_DUMPKMAP=y # CONFIG_KBD_MODE is not set CONFIG_LOADFONT=y CONFIG_LOADKMAP=y CONFIG_OPENVT=y CONFIG_RESET=y CONFIG_RESIZE=y CONFIG_FEATURE_RESIZE_PRINT=y CONFIG_SETCONSOLE=y # CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set # CONFIG_SETFONT is not set # CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set CONFIG_DEFAULT_SETFONT_DIR="" CONFIG_SETKEYCODES=y CONFIG_SETLOGCONS=y # CONFIG_SHOWKEY is not set # # Common options for loadfont and setfont # CONFIG_FEATURE_LOADFONT_PSF2=y CONFIG_FEATURE_LOADFONT_RAW=y # # Debian Utilities # CONFIG_MKTEMP=y CONFIG_PIPE_PROGRESS=y CONFIG_RUN_PARTS=y CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y # CONFIG_FEATURE_RUN_PARTS_FANCY is not set CONFIG_START_STOP_DAEMON=y CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y CONFIG_WHICH=y # # Editors # CONFIG_PATCH=y CONFIG_AWK=y # CONFIG_FEATURE_AWK_LIBM is not set CONFIG_CMP=y CONFIG_DIFF=y # CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set CONFIG_FEATURE_DIFF_DIR=y # CONFIG_ED is not set CONFIG_SED=y CONFIG_VI=y CONFIG_FEATURE_VI_MAX_LEN=4096 CONFIG_FEATURE_VI_8BIT=y CONFIG_FEATURE_VI_COLON=y CONFIG_FEATURE_VI_YANKMARK=y CONFIG_FEATURE_VI_SEARCH=y CONFIG_FEATURE_VI_USE_SIGNALS=y CONFIG_FEATURE_VI_DOT_CMD=y CONFIG_FEATURE_VI_READONLY=y CONFIG_FEATURE_VI_SETOPTS=y CONFIG_FEATURE_VI_SET=y CONFIG_FEATURE_VI_WIN_RESIZE=y CONFIG_FEATURE_VI_ASK_TERMINAL=y CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y CONFIG_FEATURE_ALLOW_EXEC=y # # Finding Utilities # CONFIG_FIND=y CONFIG_FEATURE_FIND_PRINT0=y CONFIG_FEATURE_FIND_MTIME=y CONFIG_FEATURE_FIND_MMIN=y CONFIG_FEATURE_FIND_PERM=y CONFIG_FEATURE_FIND_TYPE=y CONFIG_FEATURE_FIND_XDEV=y CONFIG_FEATURE_FIND_MAXDEPTH=y CONFIG_FEATURE_FIND_NEWER=y # CONFIG_FEATURE_FIND_INUM is not set CONFIG_FEATURE_FIND_EXEC=y CONFIG_FEATURE_FIND_USER=y CONFIG_FEATURE_FIND_GROUP=y CONFIG_FEATURE_FIND_NOT=y CONFIG_FEATURE_FIND_DEPTH=y CONFIG_FEATURE_FIND_PAREN=y CONFIG_FEATURE_FIND_SIZE=y CONFIG_FEATURE_FIND_PRUNE=y # CONFIG_FEATURE_FIND_DELETE is not set CONFIG_FEATURE_FIND_PATH=y CONFIG_FEATURE_FIND_REGEX=y # CONFIG_FEATURE_FIND_CONTEXT is not set # CONFIG_FEATURE_FIND_LINKS is not set CONFIG_GREP=y CONFIG_FEATURE_GREP_EGREP_ALIAS=y CONFIG_FEATURE_GREP_FGREP_ALIAS=y CONFIG_FEATURE_GREP_CONTEXT=y CONFIG_XARGS=y # CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y # # Init Utilities # # CONFIG_BOOTCHARTD is not set # CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set # CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set CONFIG_HALT=y # CONFIG_FEATURE_CALL_TELINIT is not set CONFIG_TELINIT_PATH="" CONFIG_INIT=y CONFIG_FEATURE_USE_INITTAB=y CONFIG_FEATURE_KILL_REMOVED=y CONFIG_FEATURE_KILL_DELAY=0 CONFIG_FEATURE_INIT_SCTTY=y CONFIG_FEATURE_INIT_SYSLOG=y CONFIG_FEATURE_EXTRA_QUIET=y # CONFIG_FEATURE_INIT_COREDUMPS is not set CONFIG_FEATURE_INITRD=y CONFIG_INIT_TERMINAL_TYPE="linux" CONFIG_MESG=y # # Login/Password Management Utilities # # CONFIG_ADD_SHELL is not set # CONFIG_REMOVE_SHELL is not set CONFIG_FEATURE_SHADOWPASSWDS=y # CONFIG_USE_BB_PWD_GRP is not set # CONFIG_USE_BB_SHADOW is not set CONFIG_USE_BB_CRYPT=y # CONFIG_USE_BB_CRYPT_SHA is not set CONFIG_ADDUSER=y # CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set # CONFIG_FEATURE_CHECK_NAMES is not set CONFIG_FIRST_SYSTEM_ID=100 CONFIG_LAST_SYSTEM_ID=999 CONFIG_ADDGROUP=y # CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set # CONFIG_FEATURE_ADDUSER_TO_GROUP is not set CONFIG_DELUSER=y CONFIG_DELGROUP=y # CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set CONFIG_GETTY=y CONFIG_LOGIN=y # CONFIG_PAM is not set # CONFIG_LOGIN_SCRIPTS is not set CONFIG_FEATURE_NOLOGIN=y CONFIG_FEATURE_SECURETTY=y CONFIG_PASSWD=y CONFIG_FEATURE_PASSWD_WEAK_CHECK=y # CONFIG_CRYPTPW is not set # CONFIG_CHPASSWD is not set CONFIG_SU=y CONFIG_FEATURE_SU_SYSLOG=y CONFIG_FEATURE_SU_CHECKS_SHELLS=y CONFIG_SULOGIN=y CONFIG_VLOCK=y # # Linux Ext2 FS Progs # CONFIG_CHATTR=y CONFIG_FSCK=y CONFIG_LSATTR=y # CONFIG_TUNE2FS is not set # # Linux Module Utilities # # CONFIG_MODINFO is not set # CONFIG_MODPROBE_SMALL is not set # CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set # CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set CONFIG_INSMOD=y CONFIG_RMMOD=y CONFIG_LSMOD=y CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y CONFIG_MODPROBE=y # CONFIG_FEATURE_MODPROBE_BLACKLIST is not set # CONFIG_DEPMOD is not set # # Options common to multiple modutils # # CONFIG_FEATURE_2_4_MODULES is not set # CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set CONFIG_FEATURE_CHECK_TAINTED_MODULE=y CONFIG_FEATURE_MODUTILS_ALIAS=y CONFIG_FEATURE_MODUTILS_SYMBOLS=y CONFIG_DEFAULT_MODULES_DIR="/lib/modules" CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" # # Linux System Utilities # # CONFIG_BLOCKDEV is not set # CONFIG_REV is not set # CONFIG_ACPID is not set # CONFIG_FEATURE_ACPID_COMPAT is not set # CONFIG_BLKID is not set CONFIG_DMESG=y CONFIG_FEATURE_DMESG_PRETTY=y # CONFIG_FBSET is not set # CONFIG_FEATURE_FBSET_FANCY is not set # CONFIG_FEATURE_FBSET_READMODE is not set CONFIG_FDFLUSH=y CONFIG_FDFORMAT=y # CONFIG_FDISK is not set CONFIG_FDISK_SUPPORT_LARGE_DISKS=y # CONFIG_FEATURE_FDISK_WRITABLE is not set # CONFIG_FEATURE_AIX_LABEL is not set # CONFIG_FEATURE_SGI_LABEL is not set # CONFIG_FEATURE_SUN_LABEL is not set # CONFIG_FEATURE_OSF_LABEL is not set # CONFIG_FEATURE_GPT_LABEL is not set # CONFIG_FEATURE_FDISK_ADVANCED is not set # CONFIG_FINDFS is not set # CONFIG_FLOCK is not set CONFIG_FREERAMDISK=y # CONFIG_FSCK_MINIX is not set # CONFIG_MKFS_EXT2 is not set # CONFIG_MKFS_MINIX is not set # CONFIG_FEATURE_MINIX2 is not set # CONFIG_MKFS_REISER is not set # CONFIG_MKFS_VFAT is not set CONFIG_GETOPT=y CONFIG_FEATURE_GETOPT_LONG=y CONFIG_HEXDUMP=y # CONFIG_FEATURE_HEXDUMP_REVERSE is not set # CONFIG_HD is not set CONFIG_HWCLOCK=y CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y CONFIG_IPCRM=y CONFIG_IPCS=y CONFIG_LOSETUP=y CONFIG_LSPCI=y CONFIG_LSUSB=y CONFIG_MDEV=y CONFIG_FEATURE_MDEV_CONF=y # CONFIG_FEATURE_MDEV_RENAME is not set # CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set CONFIG_FEATURE_MDEV_EXEC=y # CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set CONFIG_MKSWAP=y # CONFIG_FEATURE_MKSWAP_UUID is not set CONFIG_MORE=y CONFIG_MOUNT=y # CONFIG_FEATURE_MOUNT_FAKE is not set # CONFIG_FEATURE_MOUNT_VERBOSE is not set # CONFIG_FEATURE_MOUNT_HELPERS is not set # CONFIG_FEATURE_MOUNT_LABEL is not set CONFIG_FEATURE_MOUNT_NFS=y CONFIG_FEATURE_MOUNT_CIFS=y CONFIG_FEATURE_MOUNT_FLAGS=y CONFIG_FEATURE_MOUNT_FSTAB=y CONFIG_PIVOT_ROOT=y CONFIG_RDATE=y # CONFIG_RDEV is not set CONFIG_READPROFILE=y # CONFIG_RTCWAKE is not set # CONFIG_SCRIPT is not set # CONFIG_SCRIPTREPLAY is not set CONFIG_SETARCH=y CONFIG_SWAPONOFF=y # CONFIG_FEATURE_SWAPON_PRI is not set CONFIG_SWITCH_ROOT=y CONFIG_UMOUNT=y CONFIG_FEATURE_UMOUNT_ALL=y # # Common options for mount/umount # CONFIG_FEATURE_MOUNT_LOOP=y CONFIG_FEATURE_MOUNT_LOOP_CREATE=y # CONFIG_FEATURE_MTAB_SUPPORT is not set # CONFIG_VOLUMEID is not set # CONFIG_FEATURE_VOLUMEID_EXT is not set # CONFIG_FEATURE_VOLUMEID_BTRFS is not set # CONFIG_FEATURE_VOLUMEID_REISERFS is not set # CONFIG_FEATURE_VOLUMEID_FAT is not set # CONFIG_FEATURE_VOLUMEID_HFS is not set # CONFIG_FEATURE_VOLUMEID_JFS is not set # CONFIG_FEATURE_VOLUMEID_XFS is not set # CONFIG_FEATURE_VOLUMEID_NTFS is not set # CONFIG_FEATURE_VOLUMEID_ISO9660 is not set # CONFIG_FEATURE_VOLUMEID_UDF is not set # CONFIG_FEATURE_VOLUMEID_LUKS is not set # CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set # CONFIG_FEATURE_VOLUMEID_CRAMFS is not set # CONFIG_FEATURE_VOLUMEID_ROMFS is not set # CONFIG_FEATURE_VOLUMEID_SYSV is not set # CONFIG_FEATURE_VOLUMEID_OCFS2 is not set # CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set # # Miscellaneous Utilities # # CONFIG_CONSPY is not set # CONFIG_NANDWRITE is not set # CONFIG_NANDDUMP is not set # CONFIG_UBIATTACH is not set # CONFIG_UBIDETACH is not set # CONFIG_ADJTIMEX is not set # CONFIG_BBCONFIG is not set # CONFIG_FEATURE_COMPRESS_BBCONFIG is not set # CONFIG_BEEP is not set CONFIG_FEATURE_BEEP_FREQ=0 CONFIG_FEATURE_BEEP_LENGTH_MS=0 # CONFIG_CHAT is not set # CONFIG_FEATURE_CHAT_NOFAIL is not set # CONFIG_FEATURE_CHAT_TTY_HIFI is not set # CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set # CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set # CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set # CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set # CONFIG_FEATURE_CHAT_CLR_ABORT is not set CONFIG_CHRT=y CONFIG_CROND=y # CONFIG_FEATURE_CROND_D is not set # CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set CONFIG_FEATURE_CROND_DIR="/var/spool/cron" CONFIG_CRONTAB=y CONFIG_DC=y # CONFIG_FEATURE_DC_LIBM is not set # CONFIG_DEVFSD is not set # CONFIG_DEVFSD_MODLOAD is not set # CONFIG_DEVFSD_FG_NP is not set # CONFIG_DEVFSD_VERBOSE is not set # CONFIG_FEATURE_DEVFS is not set CONFIG_DEVMEM=y CONFIG_EJECT=y # CONFIG_FEATURE_EJECT_SCSI is not set # CONFIG_FBSPLASH is not set # CONFIG_FLASHCP is not set # CONFIG_FLASH_LOCK is not set # CONFIG_FLASH_UNLOCK is not set # CONFIG_FLASH_ERASEALL is not set # CONFIG_IONICE is not set # CONFIG_INOTIFYD is not set CONFIG_LAST=y CONFIG_FEATURE_LAST_SMALL=y # CONFIG_FEATURE_LAST_FANCY is not set CONFIG_LESS=y CONFIG_FEATURE_LESS_MAXLINES=9999999 CONFIG_FEATURE_LESS_BRACKETS=y CONFIG_FEATURE_LESS_FLAGS=y # CONFIG_FEATURE_LESS_MARKS is not set CONFIG_FEATURE_LESS_REGEXP=y # CONFIG_FEATURE_LESS_WINCH is not set # CONFIG_FEATURE_LESS_DASHCMD is not set # CONFIG_FEATURE_LESS_LINENUMS is not set CONFIG_HDPARM=y CONFIG_FEATURE_HDPARM_GET_IDENTITY=y # CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set # CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set CONFIG_MAKEDEVS=y # CONFIG_FEATURE_MAKEDEVS_LEAF is not set CONFIG_FEATURE_MAKEDEVS_TABLE=y # CONFIG_MAN is not set CONFIG_MICROCOM=y CONFIG_MOUNTPOINT=y CONFIG_MT=y # CONFIG_RAIDAUTORUN is not set # CONFIG_READAHEAD is not set # CONFIG_RFKILL is not set CONFIG_RUNLEVEL=y # CONFIG_RX is not set CONFIG_SETSID=y CONFIG_STRINGS=y # CONFIG_TASKSET is not set # CONFIG_FEATURE_TASKSET_FANCY is not set CONFIG_TIME=y # CONFIG_TIMEOUT is not set # CONFIG_TTYSIZE is not set # CONFIG_VOLNAME is not set # CONFIG_WALL is not set CONFIG_WATCHDOG=y # # Networking Utilities # # CONFIG_NBDCLIENT is not set # CONFIG_NC is not set # CONFIG_NC_SERVER is not set # CONFIG_NC_EXTRA is not set # CONFIG_NC_110_COMPAT is not set CONFIG_FEATURE_IPV6=y # CONFIG_FEATURE_UNIX_LOCAL is not set # CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set # CONFIG_VERBOSE_RESOLUTION_ERRORS is not set CONFIG_ARP=y CONFIG_ARPING=y # CONFIG_BRCTL is not set # CONFIG_FEATURE_BRCTL_FANCY is not set # CONFIG_FEATURE_BRCTL_SHOW is not set CONFIG_DNSD=y CONFIG_ETHER_WAKE=y # CONFIG_FAKEIDENTD is not set # CONFIG_FTPD is not set # CONFIG_FEATURE_FTP_WRITE is not set # CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set # CONFIG_FTPGET is not set # CONFIG_FTPPUT is not set # CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set CONFIG_HOSTNAME=y # CONFIG_HTTPD is not set # CONFIG_FEATURE_HTTPD_RANGES is not set # CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set # CONFIG_FEATURE_HTTPD_SETUID is not set # CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set # CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set # CONFIG_FEATURE_HTTPD_CGI is not set # CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set # CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set # CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set # CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set # CONFIG_FEATURE_HTTPD_PROXY is not set # CONFIG_FEATURE_HTTPD_GZIP is not set CONFIG_IFCONFIG=y CONFIG_FEATURE_IFCONFIG_STATUS=y CONFIG_FEATURE_IFCONFIG_SLIP=y CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y CONFIG_FEATURE_IFCONFIG_HW=y # CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set # CONFIG_IFENSLAVE is not set # CONFIG_IFPLUGD is not set CONFIG_IFUPDOWN=y CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" CONFIG_FEATURE_IFUPDOWN_IP=y # CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set # CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set CONFIG_FEATURE_IFUPDOWN_IPV4=y CONFIG_FEATURE_IFUPDOWN_IPV6=y CONFIG_FEATURE_IFUPDOWN_MAPPING=y # CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set CONFIG_INETD=y CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y # CONFIG_FEATURE_INETD_RPC is not set CONFIG_IP=y CONFIG_FEATURE_IP_ADDRESS=y CONFIG_FEATURE_IP_LINK=y CONFIG_FEATURE_IP_ROUTE=y CONFIG_FEATURE_IP_TUNNEL=y CONFIG_FEATURE_IP_RULE=y CONFIG_FEATURE_IP_SHORT_FORMS=y # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set CONFIG_IPADDR=y CONFIG_IPLINK=y CONFIG_IPROUTE=y CONFIG_IPTUNNEL=y CONFIG_IPRULE=y # CONFIG_IPCALC is not set # CONFIG_FEATURE_IPCALC_FANCY is not set # CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set CONFIG_NAMEIF=y # CONFIG_FEATURE_NAMEIF_EXTENDED is not set CONFIG_NETSTAT=y # CONFIG_FEATURE_NETSTAT_WIDE is not set # CONFIG_FEATURE_NETSTAT_PRG is not set CONFIG_NSLOOKUP=y # CONFIG_NTPD is not set # CONFIG_FEATURE_NTPD_SERVER is not set CONFIG_PING=y # CONFIG_PING6 is not set CONFIG_FEATURE_FANCY_PING=y # CONFIG_PSCAN is not set CONFIG_ROUTE=y # CONFIG_SLATTACH is not set # CONFIG_TCPSVD is not set CONFIG_TELNET=y CONFIG_FEATURE_TELNET_TTYPE=y CONFIG_FEATURE_TELNET_AUTOLOGIN=y # CONFIG_TELNETD is not set # CONFIG_FEATURE_TELNETD_STANDALONE is not set # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set CONFIG_TFTP=y # CONFIG_TFTPD is not set # # Common options for tftp/tftpd # CONFIG_FEATURE_TFTP_GET=y CONFIG_FEATURE_TFTP_PUT=y CONFIG_FEATURE_TFTP_BLOCKSIZE=y # CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set # CONFIG_TFTP_DEBUG is not set CONFIG_TRACEROUTE=y # CONFIG_TRACEROUTE6 is not set # CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set # CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set # CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set # CONFIG_TUNCTL is not set # CONFIG_FEATURE_TUNCTL_UG is not set # CONFIG_UDHCPD is not set # CONFIG_DHCPRELAY is not set # CONFIG_DUMPLEASES is not set # CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set CONFIG_DHCPD_LEASES_FILE="" CONFIG_UDHCPC=y CONFIG_FEATURE_UDHCPC_ARPING=y # CONFIG_FEATURE_UDHCP_PORT is not set CONFIG_UDHCP_DEBUG=0 # CONFIG_FEATURE_UDHCP_RFC3397 is not set CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script" CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n" # CONFIG_UDPSVD is not set CONFIG_VCONFIG=y CONFIG_WGET=y CONFIG_FEATURE_WGET_STATUSBAR=y CONFIG_FEATURE_WGET_AUTHENTICATION=y CONFIG_FEATURE_WGET_LONG_OPTIONS=y CONFIG_FEATURE_WGET_TIMEOUT=y # CONFIG_ZCIP is not set # # Print Utilities # # CONFIG_LPD is not set # CONFIG_LPR is not set # CONFIG_LPQ is not set # # Mail Utilities # # CONFIG_MAKEMIME is not set CONFIG_FEATURE_MIME_CHARSET="" # CONFIG_POPMAILDIR is not set # CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set # CONFIG_REFORMIME is not set # CONFIG_FEATURE_REFORMIME_COMPAT is not set # CONFIG_SENDMAIL is not set # # Process Utilities # # CONFIG_IOSTAT is not set # CONFIG_MPSTAT is not set # CONFIG_PMAP is not set # CONFIG_POWERTOP is not set # CONFIG_SMEMCAP is not set CONFIG_FREE=y CONFIG_FUSER=y CONFIG_KILL=y CONFIG_KILLALL=y CONFIG_KILLALL5=y # CONFIG_NMETER is not set # CONFIG_PGREP is not set CONFIG_PIDOF=y CONFIG_FEATURE_PIDOF_SINGLE=y CONFIG_FEATURE_PIDOF_OMIT=y # CONFIG_PKILL is not set CONFIG_PS=y CONFIG_FEATURE_PS_WIDE=y # CONFIG_FEATURE_PS_TIME is not set # CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set # CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set CONFIG_RENICE=y CONFIG_BB_SYSCTL=y CONFIG_TOP=y CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y # CONFIG_FEATURE_TOP_SMP_CPU is not set # CONFIG_FEATURE_TOP_DECIMALS is not set # CONFIG_FEATURE_TOP_SMP_PROCESS is not set # CONFIG_FEATURE_TOPMEM is not set # CONFIG_FEATURE_SHOW_THREADS is not set CONFIG_UPTIME=y CONFIG_WATCH=y # # Runit Utilities # # CONFIG_RUNSV is not set # CONFIG_RUNSVDIR is not set # CONFIG_FEATURE_RUNSVDIR_LOG is not set # CONFIG_SV is not set CONFIG_SV_DEFAULT_SERVICE_DIR="" # CONFIG_SVLOGD is not set # CONFIG_CHPST is not set # CONFIG_SETUIDGID is not set # CONFIG_ENVUIDGID is not set # CONFIG_ENVDIR is not set # CONFIG_SOFTLIMIT is not set # CONFIG_CHCON is not set # CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set # CONFIG_GETENFORCE is not set # CONFIG_GETSEBOOL is not set # CONFIG_LOAD_POLICY is not set # CONFIG_MATCHPATHCON is not set # CONFIG_RESTORECON is not set # CONFIG_RUNCON is not set # CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set # CONFIG_SELINUXENABLED is not set # CONFIG_SETENFORCE is not set # CONFIG_SETFILES is not set # CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set # CONFIG_SETSEBOOL is not set # CONFIG_SESTATUS is not set # # Shells # CONFIG_ASH=y CONFIG_ASH_BASH_COMPAT=y CONFIG_ASH_JOB_CONTROL=y CONFIG_ASH_ALIAS=y # CONFIG_ASH_GETOPTS is not set CONFIG_ASH_BUILTIN_ECHO=y CONFIG_ASH_BUILTIN_PRINTF=y CONFIG_ASH_BUILTIN_TEST=y CONFIG_ASH_CMDCMD=y # CONFIG_ASH_MAIL is not set CONFIG_ASH_OPTIMIZE_FOR_SIZE=y CONFIG_ASH_RANDOM_SUPPORT=y CONFIG_ASH_EXPAND_PRMT=y # CONFIG_CTTYHACK is not set # CONFIG_HUSH is not set # CONFIG_HUSH_BASH_COMPAT is not set # CONFIG_HUSH_BRACE_EXPANSION is not set # CONFIG_HUSH_HELP is not set # CONFIG_HUSH_INTERACTIVE is not set # CONFIG_HUSH_SAVEHISTORY is not set # CONFIG_HUSH_JOB is not set # CONFIG_HUSH_TICK is not set # CONFIG_HUSH_IF is not set # CONFIG_HUSH_LOOPS is not set # CONFIG_HUSH_CASE is not set # CONFIG_HUSH_FUNCTIONS is not set # CONFIG_HUSH_LOCAL is not set # CONFIG_HUSH_RANDOM_SUPPORT is not set # CONFIG_HUSH_EXPORT_N is not set # CONFIG_HUSH_MODE_X is not set # CONFIG_MSH is not set CONFIG_FEATURE_SH_IS_ASH=y # CONFIG_FEATURE_SH_IS_HUSH is not set # CONFIG_FEATURE_SH_IS_NONE is not set # CONFIG_FEATURE_BASH_IS_ASH is not set # CONFIG_FEATURE_BASH_IS_HUSH is not set CONFIG_FEATURE_BASH_IS_NONE=y CONFIG_SH_MATH_SUPPORT=y # CONFIG_SH_MATH_SUPPORT_64 is not set CONFIG_FEATURE_SH_EXTRA_QUIET=y # CONFIG_FEATURE_SH_STANDALONE is not set # CONFIG_FEATURE_SH_NOFORK is not set # # System Logging Utilities # CONFIG_SYSLOGD=y CONFIG_FEATURE_ROTATE_LOGFILE=y CONFIG_FEATURE_REMOTE_LOG=y # CONFIG_FEATURE_SYSLOGD_DUP is not set CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 # CONFIG_FEATURE_IPC_SYSLOG is not set CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0 # CONFIG_LOGREAD is not set # CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set CONFIG_KLOGD=y CONFIG_FEATURE_KLOGD_KLOGCTL=y CONFIG_LOGGER=y OpenIPMI-2.0.27/lanserv/marvell-bmc/lan.conf0000644000175000017500000000760012116456523015407 00000000000000# lan.conf # A configuration file for lanserv or ipmi_sim to configure the various # communication parameters for the device. # This is a name used to identify this instance, and used to create # the default name of the emulator startup command file and eventually # the storage facility for permanent storage. name "AXP-SERVER" # # Work on the BMC first set_working_mc 0x20 # Define a LAN channel on channel 1 (eth1) startlan 1 # Define an IP address and port to listen on. You can define more # than one address/port to listen on multiple addresses. The :: # listens on all addresses. addr 0.0.0.0 623 # Maximum privilege limit on the channel. priv_limit admin # Allowed IPMI 1.5 authorization types #allowed_auths_callback none md2 md5 straight #allowed_auths_user none md2 md5 straight #allowed_auths_operator none md2 md5 straight #allowed_auths_admin none md2 md5 straight # guid for IPMI 2.0 authorization You can also use a string #guid a123456789abcdefa123456789abcdef guid "vos92Gk2Ols901ls" # You can specify a BMC key for IPMI 2.0 authorization. See the # spec for details. #bmc_key "abcdefghijklmnopqrst" # A program to get and set the LAN configuration of the interface. lan_config_program "/etc/ipmi/lancontrol eth1" endlan # Define a LAN channel on channel 2 (eth0) startlan 2 # We don't define a listen address, as it is not necessary, the # one from channel 1 covers everything. # Maximum privilege limit on the channel. priv_limit admin # Allowed IPMI 1.5 authorization types #allowed_auths_callback none md2 md5 straight #allowed_auths_user none md2 md5 straight #allowed_auths_operator none md2 md5 straight #allowed_auths_admin none md2 md5 straight # guid for IPMI 2.0 authorization You can also use a string #guid a123456789abcdefa123456789abcdef guid "vos92Gk2Ols901ls" # You can specify a BMC key for IPMI 2.0 authorization. See the # spec for details. #bmc_key "abcdefghijklmnopqrst" # A program to get and set the LAN configuration of the interface. lan_config_program "/etc/ipmi/lancontrol eth0" endlan # Now add some users. User 0 is invalid, user 1 is the special "anonymous" # user and cannot take a username. Note that the users here are only # used if the persistent user config doesn't exist. # # valid name passw priv-lim max-sess allowed-auths user 1 false "" "test" user 10 none md2 md5 straight user 2 true "ADMIN" "ADMIN" admin 10 none md2 md5 straight # # Target board 1 # set_working_mc 1 sol "/dev/ttyAS0" 115200 history=65535,backupfile=/var/ipmi_sim/solhist1 historyfru=10 nortscts # # Target board 2 # set_working_mc 2 sol "/dev/ttyAS1" 115200 history=65535,backupfile=/var/ipmi_sim/solhist2 historyfru=10 nortscts # # Target board 3 # set_working_mc 3 sol "/dev/ttyAS2" 115200 history=65535,backupfile=/var/ipmi_sim/solhist3 historyfru=10 nortscts # # Target board 4 # set_working_mc 4 sol "/dev/ttyAS3" 115200 history=65535,backupfile=/var/ipmi_sim/solhist4 historyfru=10 nortscts # # Target board 5 # set_working_mc 5 sol "/dev/ttyAS4" 115200 history=65535,backupfile=/var/ipmi_sim/solhist5 historyfru=10 nortscts # # Target board 6 # set_working_mc 6 sol "/dev/ttyS1" 115200 history=65535,backupfile=/var/ipmi_sim/solhist6 historyfru=10 nortscts # Allow a console connection to perform emulation commands. #console localhost 9000 # Dynamically load a module to extend the simulator. After the module is # loaded, if the function "ipmi_sim_module_init" is defined in the module, # it will be called with the following parameters: # int ipmi_sim_module_init(sys_data_t *sys, char *initstr); # where initstr is the init string passed on the module load line. # It should return 0 on success or an errno no failure. loadlib "/usr/lib/ipmi_sim/marvell_mod.so" "" OpenIPMI-2.0.27/lanserv/marvell-bmc/netsrvc0000755000175000017500000000062112116456523015374 00000000000000#! /bin/sh # Driven from marvell_mod, command to enable or disable network access. # Access with: # ipmitool -I lanplus -U ipmiusr -P test -H 10.70.0.106 raw 0x2e 1 0x0f 0x50 0x00 0 # to disable network services. Change the last value to "1" to enable it. # The last value is passed to this script as is. case $1 in 0) /etc/init.d/S50dropbear stop ;; 1) /etc/init.d/S50dropbear start ;; esac OpenIPMI-2.0.27/lanserv/marvell-bmc/Makefile.in0000644000175000017500000005511013437611454016035 00000000000000# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lanserv/marvell-bmc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/ax_config_feature.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_python_version.m4 \ $(top_srcdir)/m4/ax_python_devel.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) marvell_mod_la_LIBADD = am_marvell_mod_la_OBJECTS = marvell_mod.lo marvell_mod_la_OBJECTS = $(am_marvell_mod_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = marvell_mod_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(marvell_mod_la_LDFLAGS) $(LDFLAGS) -o \ $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(marvell_mod_la_SOURCES) DIST_SOURCES = $(marvell_mod_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(noinst_DATA) HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp TODO DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIBTEX = @BIBTEX@ BUILD_CC = @BUILD_CC@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIA = @DIA@ DIA_FILTER_NAME = @DIA_FILTER_NAME@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DVIPDF = @DVIPDF@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GDBM_LIB = @GDBM_LIB@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_DIR = @GLIB_DIR@ GLIB_LIB = @GLIB_LIB@ GLIB_LIBS = @GLIB_LIBS@ GLIB_PKGCONF = @GLIB_PKGCONF@ GLIB_SO = @GLIB_SO@ GLIB_TARGET = @GLIB_TARGET@ GLIB_VERSION = @GLIB_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MARVELL_BMC_DIR = @MARVELL_BMC_DIR@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENIPMI_SWIG_LIBS = @OPENIPMI_SWIG_LIBS@ OPENIPMI_SWIG_SO = @OPENIPMI_SWIG_SO@ OPENIPMI_VERSION_EXTRA = @OPENIPMI_VERSION_EXTRA@ OPENIPMI_VERSION_MAJOR = @OPENIPMI_VERSION_MAJOR@ OPENIPMI_VERSION_MINOR = @OPENIPMI_VERSION_MINOR@ OPENIPMI_VERSION_RELEASE = @OPENIPMI_VERSION_RELEASE@ OPENSSLINCS = @OPENSSLINCS@ OPENSSLLIBS = @OPENSSLLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_DIR = @PERL_DIR@ PERL_HAS_POSIX_THREADS = @PERL_HAS_POSIX_THREADS@ PERL_INSTALL_DIR = @PERL_INSTALL_DIR@ PERL_POSIX_LIB = @PERL_POSIX_LIB@ PERL_POSIX_SO = @PERL_POSIX_SO@ POPTLIBS = @POPTLIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_DIR = @PYTHON_DIR@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_GUI_DIR = @PYTHON_GUI_DIR@ PYTHON_HAS_POSIX_THREADS = @PYTHON_HAS_POSIX_THREADS@ PYTHON_INSTALL_DIR = @PYTHON_INSTALL_DIR@ PYTHON_INSTALL_LIB_DIR = @PYTHON_INSTALL_LIB_DIR@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_POSIX_LIB = @PYTHON_POSIX_LIB@ PYTHON_POSIX_SO = @PYTHON_POSIX_SO@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_SWIG_FLAGS = @PYTHON_SWIG_FLAGS@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RT_LIB = @RT_LIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNMPLIBS = @SNMPLIBS@ SOCKETLIB = @SOCKETLIB@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_DIR = @SWIG_DIR@ SWIG_LIB = @SWIG_LIB@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_DIR = @TCL_DIR@ TCL_LIB = @TCL_LIB@ TCL_LIBS = @TCL_LIBS@ TCL_PKGCONF = @TCL_PKGCONF@ TCL_SO = @TCL_SO@ TCL_TARGET = @TCL_TARGET@ TERM_LIBS = @TERM_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ diaprog = @diaprog@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlprog = @perlprog@ pkgprog = @pkgprog@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/lanserv pkglib_LTLIBRARIES = marvell_mod.la marvell_mod_la_SOURCES = marvell_mod.c marvell_mod_la_LDFLAGS = -module noinst_DATA = sdrs.bin noinst_HEADERS = wiw.h EXTRA_DIST = main.sdrs board.sdrs fan.sdrs lan.conf netsrvc lancontrol \ busybox-1.18.4.config interfaces ntp.conf marvell_bmc.config \ S90ast1300 SystemInfo TODO BuildingAndConfiguring.tex \ Build_Marvell_BMC.sh Install_Marvell_BMC.sh marvell_node.emu \ marvell.emu all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lanserv/marvell-bmc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lanserv/marvell-bmc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } marvell_mod.la: $(marvell_mod_la_OBJECTS) $(marvell_mod_la_DEPENDENCIES) $(EXTRA_marvell_mod_la_DEPENDENCIES) $(AM_V_CCLD)$(marvell_mod_la_LINK) -rpath $(pkglibdir) $(marvell_mod_la_OBJECTS) $(marvell_mod_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/marvell_mod.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-pkglibLTLIBRARIES install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-pkglibLTLIBRARIES .PRECIOUS: Makefile sdrs.bin: main.sdrs board.sdrs fan.sdrs \ $(top_builddir)/lanserv/sdrcomp/sdrcomp $(top_builddir)/lanserv/sdrcomp/sdrcomp main.sdrs >sdrs.bin # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: OpenIPMI-2.0.27/lanserv/marvell-bmc/S90ast13000000755000175000017500000000010112116456523015270 00000000000000#!/bin/sh echo "Insert ast1300 module" insmod /root/ast1300.ko OpenIPMI-2.0.27/lanserv/marvell-bmc/TODO0000644000175000017500000000263212100350447014445 00000000000000 * I really need to find a way to set the time and date on the system. Is there some hardware clock on this system? I didn't find one on schematics, but perhaps it is buried in some chip someplace. Otherwise, we need to define a way to get the time from outside the system using NTP. * I need to write documentation for the full system. I have a few more hours left than I thought, so I should be able to do a pretty good job of this. * I need to define the procedures for building the entire system. Include busybox mods for arp to work. * I need to find the memory usage for ipmi_sim. * Automatically clear the IERR and DIMM errors from the board. * Save SOL history data on receiving a shutdown signal. * Power/reset all boards on a chassis operation. Done: * I need to do some more testing on board, fan and power supply removal, to make sure that the sensors all change states properly and the fans behave properly under different circumstances. I've done some testing by dummy-ing things out, but I need to drive over to the lab and test it for real. * Check that board power cannot be enabled if board is not present. * Fix syslog * I need to integrate the Marvell-specific code into a subdirectory of lanserv so it can be built along with the standard OpenIPMI code. * Fan fail LEDS. * This all needs to go up to the public OpenIPMI repository. OpenIPMI-2.0.27/lanserv/marvell-bmc/interfaces0000644000175000017500000000047512116456624016041 00000000000000# /etc/network/interfaces for the BMC # Configure Loopback auto lo iface lo inet loopback auto eth0 eth1 eth1:1 iface eth0 inet dhcp iface eth1 inet static gateway 192.168.0.254 address 192.168.0.10 netmask 255.255.255.0 # Internal network iface eth1:1 inet static address 192.168.1.7 netmask 255.255.255.0 OpenIPMI-2.0.27/lanserv/bmc_transport.c0000644000175000017500000001615513042446666014621 00000000000000/* * bmc_transport.c * * MontaVista IPMI code for emulating a MC. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2012 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include "bmc.h" #include #include #include #include static void handle_ipmi_set_lan_config_parms(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char lchan; channel_t *chan; if (msg->len < 3) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } lchan = msg->data[0]; if (lchan == 0xe) lchan = msg->channel; else if (lchan >= IPMI_MAX_CHANNELS) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (!mc->channels[lchan]) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } chan = mc->channels[lchan]; if (!chan->set_lan_parms) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } chan->set_lan_parms(chan, msg, rdata, rdata_len); } static void handle_ipmi_get_lan_config_parms(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char lchan; channel_t *chan; if (msg->len < 4) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } lchan = msg->data[0]; if (lchan == 0xe) lchan = msg->channel; else if (lchan >= IPMI_MAX_CHANNELS) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (!mc->channels[lchan]) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } chan = mc->channels[lchan]; if (!chan->get_lan_parms) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } chan->get_lan_parms(chan, msg, rdata, rdata_len); } static void handle_set_sol_config_parms(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char err = 0; unsigned char val; int write_config = 0; ipmi_sol_t *sol = &mc->sol; if (!mc->sol.configured) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (msg->len < 3) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } /* * There is a channel in this message, but as far as I can tell, * it is completely without point. The data is generic to the * management controller. So just ignore it. */ switch (msg->data[1]) { case 0: switch (msg->data[2] & 0x3) { case 0: if (sol->set_in_progress) { /* Rollback */ memcpy(&mc->sol.solparm, &mc->sol.solparm_rollback, sizeof(solparm_t)); write_config = 1; } break; case 1: if (sol->set_in_progress) err = 0x81; /* Another user is writing. */ else { /* Save rollback data */ memcpy(&mc->sol.solparm_rollback, &mc->sol.solparm, sizeof(solparm_t)); sol->set_in_progress = 1; } break; case 2: sol->set_in_progress = 0; break; case 3: err = IPMI_INVALID_DATA_FIELD_CC; } break; case 1: sol->solparm.enabled = msg->data[2] & 1; write_config = 1; break; case 5: val = msg->data[2] & 0xf; if ((val < 6) || (val > 0xa)) { err = IPMI_INVALID_DATA_FIELD_CC; } else { sol->solparm.bitrate_nonv = val; write_config = 1; } break; case 6: val = msg->data[2] & 0xf; if ((val < 6) || (val > 0xa)) { err = IPMI_INVALID_DATA_FIELD_CC; } else { sol->solparm.bitrate = val; if (sol->update_bitrate) sol->update_bitrate(mc); } break; default: err = 0x80; /* Parm not supported */ } if (write_config) write_sol_config(mc); rdata[0] = err; *rdata_len = 1; } static void handle_get_sol_config_parms(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { ipmi_sol_t *sol = &mc->sol; unsigned char databyte = 0; if (!mc->sol.configured) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (msg->len < 4) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } /* * There is a channel in this message, but as far as I can tell, * it is completely without point. The data is generic to the * management controller. So just ignore it. */ switch (msg->data[1]) { case 0: databyte = sol->set_in_progress; break; case 1: databyte = sol->solparm.enabled; break; case 5: databyte = sol->solparm.bitrate_nonv; break; case 6: databyte = sol->solparm.bitrate; break; default: rdata[0] = 0x80; /* Parm not supported */ *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = 0x11; rdata[2] = databyte; *rdata_len = 3; } cmd_handler_f transport_netfn_handlers[256] = { [IPMI_SET_LAN_CONFIG_PARMS_CMD] = handle_ipmi_set_lan_config_parms, [IPMI_GET_LAN_CONFIG_PARMS_CMD] = handle_ipmi_get_lan_config_parms, [IPMI_SET_SOL_CONFIGURATION_PARAMETERS] = handle_set_sol_config_parms, [IPMI_GET_SOL_CONFIGURATION_PARAMETERS] = handle_get_sol_config_parms }; OpenIPMI-2.0.27/lanserv/lanserv_ipmi.c0000664000175000017500000023305213414037412014417 00000000000000/* * lanserv_ipmi.c * * MontaVista IPMI IPMI LAN interface protocol engine * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #ifdef HAVE_OPENSSL #include #endif #include #include #include #include #include #include #include #include #include static int is_authval_null(uint8_t *val) { int i; for (i=0; i<16; i++) if (val[i] != 0) return 0; return 1; } static user_t * find_user(lanserv_data_t *lan, uint8_t *user, int name_only_lookup, int priv) { int i; user_t *rv = NULL; for (i=1; i<=MAX_USERS; i++) { if (lan->users[i].valid && (memcmp(user, lan->users[i].username, 16) == 0)) { if (name_only_lookup || (lan->users[i].privilege == priv)) { rv = &(lan->users[i]); break; } } } return rv; } static session_t * sid_to_session(lanserv_data_t *lan, unsigned int sid) { int idx; session_t *session; if (sid & 1) return NULL; idx = (sid >> 1) & SESSION_MASK; if (idx > MAX_SESSIONS) return NULL; session = lan->sessions + idx; if (!session->active) return NULL; if (session->sid != sid) return NULL; return session; } static void close_session(lanserv_data_t *lan, session_t *session) { unsigned int i; for (i = 0; i < LANSERV_NUM_CLOSERS; i++) { if (session->closers[i].close_cb) { session->closers[i].close_cb( session->closers[i].mc, session->sid, session->closers[i].close_cb_data); session->closers[i].close_cb = NULL; session->closers[i].mc = NULL; } } session->active = 0; if (session->authtype <= 4) ipmi_auths[session->authtype].authcode_cleanup(session->authdata); if (session->integh) session->integh->cleanup(lan, session); if (session->confh) session->confh->cleanup(lan, session); lan->channel.active_sessions--; if (session->src_addr) { lan->channel.free(&lan->channel, session->src_addr); session->src_addr = NULL; } } static int auth_gen(session_t *ses, uint8_t *out, uint8_t *sid, uint8_t *seq, uint8_t *data1, int data1_len, uint8_t *data2, int data2_len, uint8_t *data3, int data3_len) { int rv; ipmi_auth_sg_t l[] = { { sid, 4 }, { data1, data1_len }, { data2, data2_len }, { data3, data3_len }, { seq, 4 }, { NULL, 0 }}; rv = ipmi_auths[ses->authtype].authcode_gen(ses->authdata, l, out); return rv; } static int auth_check(session_t *ses, uint8_t *sid, uint8_t *seq, uint8_t *data, int data_len, uint8_t *code) { int rv; ipmi_auth_sg_t l[] = { { sid, 4 }, { data, data_len }, { seq, 4 }, { NULL, 0 }}; rv = ipmi_auths[ses->authtype].authcode_check(ses->authdata, l, code); return rv; } static int gen_challenge(lanserv_data_t *lan, uint8_t *out, uint32_t sid) { int rv; ipmi_auth_sg_t l[] = { { &sid, 4 }, { NULL, 0 }}; rv = ipmi_md5_authcode_gen(lan->challenge_auth, l, out); return rv; } static int check_challenge(lanserv_data_t *lan, uint32_t sid, uint8_t *code) { int rv; ipmi_auth_sg_t l[] = { { &sid, 4 }, { NULL, 0 }}; rv = ipmi_md5_authcode_check(lan->challenge_auth, l, code); return rv; } #define IPMI_LAN_MAX_HEADER_SIZE 64 #define IPMI_LAN_MAX_TRAILER_SIZE 960 static void raw_send(lanserv_data_t *lan, struct iovec *vec, unsigned int vecs, void *addr, int addr_len) { if (lan->sysinfo->debug & DEBUG_RAW_MSG) { char *str; int slen; int pos; #define format "Raw LAN msg:" char dummy; unsigned int i, j; unsigned int len = 0; debug_log_raw_msg(lan->sysinfo, addr, addr_len, "Raw LAN send to:"); for (i = 0; i < vecs; i++) len += vec[i].iov_len; slen = snprintf(&dummy, 1, format); slen += len * 3 + 3; str = malloc(slen); if (!str) goto send; pos = sprintf(str, format); #undef format str[pos++] = '\n'; str[pos++] = '\0'; for (i = 0; i < vecs; i++) { for (j = 0; j < vec[i].iov_len; j++) pos += sprintf(str + pos, " %2.2x", ((unsigned char *) vec[i].iov_base)[j]); } lan->sysinfo->log(lan->sysinfo, DEBUG, NULL, "%s", str); free(str); } send: lan->send_out(lan, vec, vecs, addr, addr_len); } static void return_rmcpp_rsp(lanserv_data_t *lan, session_t *session, msg_t *msg, unsigned int payload, unsigned char *data, unsigned int len, unsigned char iana[3], unsigned int payload_id) { uint8_t d[IPMI_LAN_MAX_HEADER_SIZE+IPMI_LAN_MAX_HEADER_SIZE +IPMI_LAN_MAX_TRAILER_SIZE+1]; uint8_t *pos = d + IPMI_LAN_MAX_HEADER_SIZE; uint8_t *tpos; unsigned int hdr_left = IPMI_LAN_MAX_HEADER_SIZE; unsigned int dlen = IPMI_LAN_MAX_HEADER_SIZE + IPMI_LAN_MAX_TRAILER_SIZE; unsigned int mlen; struct iovec vec[3]; uint32_t sid, seq, *seqp; int rv; unsigned int s; if (!session) session = sid_to_session(lan, msg->sid); if (len > dlen) return; memcpy(pos, data, len); if (payload == 0) { /* Add the IPMI header - fixme -cheap hack */ if (hdr_left < 6) return; hdr_left -= 6; pos -= 6; dlen += 6; /* Adding header, increase total length */ len += 6; pos[0] = msg->rq_addr; pos[1] = ((msg->netfn | 1) << 2) | msg->rq_lun; pos[2] = -ipmb_checksum(pos, 2, 0); pos[3] = msg->rs_addr; pos[4] = (msg->rq_seq << 2) | msg->rs_lun; pos[5] = msg->cmd; pos[len] = -ipmb_checksum(pos+3, len-3, 0); len++; dlen++; } if (session && !session->in_startup) { if (session->conf) { rv = session->confh->encrypt(lan, session, &pos, &hdr_left, &len, &dlen); if (rv) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Message failure:" " encryption failed: 0x%x", rv); return; } } } mlen = len; if (session && !session->in_startup && session->integ) { unsigned int count; /* Pad to the next multiple of 4, including the pad length and next header. */ count = 0; while ((mlen+2) % 4) { if (mlen == dlen) return; pos[mlen] = 0xff; count++; mlen++; } if (mlen == dlen) return; pos[mlen] = count; mlen++; if (mlen == dlen) return; pos[mlen] = 0x07; /* Next header */ mlen++; } if (payload == 2) s = 22; else s = 16; if (hdr_left < s) return; hdr_left -= s; pos -= s; dlen += s; /* Adding header, increase total length */ mlen += s; pos[0] = 0x06; pos[1] = 0; pos[2] = 0xff; pos[3] = 0x07; pos[4] = IPMI_AUTHTYPE_RMCP_PLUS; pos[5] = payload; if (!session || session->in_startup) { sid = 0; seq = 0; seqp = NULL; } else { sid = session->rem_sid; if (session->integ != 0) { seq = session->xmit_seq; seqp = &session->xmit_seq; pos[5] |= 0x40; } else { seq = session->unauth_xmit_seq; seqp = &session->unauth_xmit_seq; } if (session->conf != 0) pos[5] |= 0x80; } tpos = pos + 6; if (payload == 2) { memcpy(tpos, iana, 3); tpos[3] = 0; ipmi_set_uint16(tpos+4, payload_id); tpos += 6; } ipmi_set_uint32(tpos, sid); tpos += 4; ipmi_set_uint32(tpos, seq); tpos += 4; ipmi_set_uint16(tpos, seq); ipmi_set_uint16(tpos, len); if (session && !session->in_startup && session->integ) { rv = session->integh->add(lan, session, pos, &mlen, dlen); if (rv) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Message failure:" " encryption failed: 0x%x", rv); return; } } if (seqp) { (*seqp)++; if (*seqp == 0) *seqp = 1; } vec[0].iov_base = pos; vec[0].iov_len = mlen; raw_send(lan, vec, 1, msg->src_addr, msg->src_len); } static void return_rsp(lanserv_data_t *lan, msg_t *msg, session_t *session, rsp_msg_t *rsp) { uint8_t data[IPMI_LAN_MAX_HEADER_SIZE]; struct iovec vec[3]; uint8_t csum; session_t dummy_session; uint8_t *pos; int len; int rv; if (!session) session = sid_to_session(lan, msg->sid); if (session && session->rmcpplus) { return_rmcpp_rsp(lan, session, msg, msg->rmcpp.payload, rsp->data, rsp->data_len, NULL, 0); return; } else if (msg->sid == 0) { session = &dummy_session; session->active = 1; session->authtype = IPMI_AUTHTYPE_NONE; session->xmit_seq = 0; session->sid = 0; } if (!session) return; data[0] = 6; /* RMCP version. */ data[1] = 0; data[2] = 0xff; /* No seq num */ data[3] = 7; /* IPMI msg class */ data[4] = session->authtype; ipmi_set_uint32(data+5, session->xmit_seq); session->xmit_seq++; if (session->xmit_seq == 0) session->xmit_seq++; ipmi_set_uint32(data+9, session->sid); if (session->authtype == IPMI_AUTHTYPE_NONE) pos = data+13; else pos = data+29; len = rsp->data_len + 7; *pos = len; pos++; pos[0] = msg->rq_addr; pos[1] = (rsp->netfn << 2) | msg->rq_lun; pos[2] = -ipmb_checksum(pos, 2, 0); pos[3] = msg->rs_addr; pos[4] = (msg->rq_seq << 2) | msg->rs_lun; pos[5] = rsp->cmd; csum = ipmb_checksum(pos+3, 3, 0); csum = -ipmb_checksum(rsp->data, rsp->data_len, csum); vec[0].iov_base = data; if (session->authtype == IPMI_AUTHTYPE_NONE) vec[0].iov_len = 14 + 6; else { rv = auth_gen(session, data+13, data+9, data+5, pos, 6, rsp->data, rsp->data_len, &csum, 1); if (rv) { /* FIXME - what to do? */ return; } vec[0].iov_len = 30 + 6; } vec[1].iov_base = rsp->data; vec[1].iov_len = rsp->data_len; vec[2].iov_base = &csum; vec[2].iov_len = 1; raw_send(lan, vec, 3, msg->src_addr, msg->src_len); } static void lan_return_rsp(channel_t *chan, msg_t *msg, rsp_msg_t *rsp) { lanserv_data_t *lan = chan->chan_info; rsp_msg_t rrsp; return_rsp(lan, msg, NULL, rsp); msg = ipmi_mc_get_next_recv_q(chan); if (!msg) return; while (msg) { /* Extract relevant header information and remove the header and checksum. */ msg->rq_addr = msg->data[0]; msg->rq_lun = msg->data[1] & 0x3; msg->rs_addr = msg->data[3]; msg->rs_lun = msg->data[4] & 0x3; rrsp.netfn = msg->netfn | 1; rrsp.cmd = msg->data[5]; rrsp.data = msg->data + 6; rrsp.data_len = msg->len - 7; return_rsp(lan, msg, NULL, &rrsp); chan->free(chan, msg); msg = ipmi_mc_get_next_recv_q(chan); } if (chan->recv_in_q) chan->recv_in_q(chan, 0); } static void return_rsp_data(lanserv_data_t *lan, msg_t *msg, session_t *session, uint8_t *data, int len) { rsp_msg_t rsp; rsp.netfn = msg->netfn | 1; rsp.cmd = msg->cmd; rsp.data = data; rsp.data_len = len; return_rsp(lan, msg, session, &rsp); } static void return_err(lanserv_data_t *lan, msg_t *msg, session_t *session, uint8_t err) { rsp_msg_t rsp; rsp.netfn = msg->netfn | 1; rsp.cmd = msg->cmd; rsp.data = &err; rsp.data_len = 1; return_rsp(lan, msg, session, &rsp); } static void handle_get_system_guid(lanserv_data_t *lan, session_t *session, msg_t *msg) { unsigned char rdata[17]; unsigned int rdata_len = sizeof(rdata); if (lan->guid) { if (rdata_len < 17) { rdata[0] = IPMI_REQUESTED_DATA_LENGTH_EXCEEDED_CC; rdata_len = 1; goto out; } rdata[0] = 0; memcpy(rdata + 1, lan->guid, 16); rdata_len = 17; } else { rdata[0] = IPMI_INVALID_CMD_CC; rdata_len = 1; } out: return_rsp_data(lan, msg, session, rdata, rdata_len); } static void handle_get_channel_auth_capabilities(lanserv_data_t *lan, msg_t *msg) { uint8_t data[9]; uint8_t chan; uint8_t priv; int do_rmcpp; if (msg->len < 2) { return_err(lan, msg, NULL, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } do_rmcpp = (msg->data[0] >> 7) & 1; chan = msg->data[0] & 0xf; priv = msg->data[1] & 0xf; if (chan == 0xe) chan = lan->channel.channel_num; if (chan != lan->channel.channel_num) { return_err(lan, msg, NULL, IPMI_INVALID_DATA_FIELD_CC); } else if (priv > lan->channel.privilege_limit) { return_err(lan, msg, NULL, IPMI_INVALID_DATA_FIELD_CC); } else { if (! lan->guid) do_rmcpp = 0; /* Must have a GUID to do RMCP+ */ data[0] = 0; data[1] = chan; data[2] = lan->channel.priv_info[priv-1].allowed_auths; if (do_rmcpp) data[2] |= 0x80; data[3] = 0x04; /* per-message authentication is on, user-level authenitcation is on, non-null user names disabled, no anonymous support. */ if (lan->users[1].valid) { if (is_authval_null(lan->users[1].pw)) data[3] |= 0x01; /* Anonymous login. */ else data[3] |= 0x02; /* Null user supported. */ } if (lan->bmc_key) data[3] |= 0x20; data[4] = 0; if (do_rmcpp) data[4] |= 0x3; /* Support RMCP and RMCP+ */ data[5] = lan->channel.manufacturer_id & 0xff; data[6] = (lan->channel.manufacturer_id >> 8) & 0xff; data[7] = (lan->channel.manufacturer_id >> 16) & 0xff; data[8] = 0; return_rsp_data(lan, msg, NULL, data, 9); } } static void handle_get_session_challenge(lanserv_data_t *lan, msg_t *msg) { uint8_t data[21]; user_t *user; uint32_t sid; int rv; if (msg->len < 17) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Session challenge failed: message too short"); return_err(lan, msg, NULL, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } user = find_user(lan, msg->data+1, 1, 0); if (!user) { lan->sysinfo->log(lan->sysinfo, SESSION_CHALLENGE_FAILED, msg, "Session challenge failed: Invalid user"); if (is_authval_null(msg->data+1)) return_err(lan, msg, NULL, 0x82); /* no null user */ else return_err(lan, msg, NULL, 0x81); /* no user */ return; } if (lan->channel.active_sessions >= MAX_SESSIONS) { lan->sysinfo->log(lan->sysinfo, SESSION_CHALLENGE_FAILED, msg, "Session challenge failed: To many open sessions"); return_err(lan, msg, NULL, IPMI_OUT_OF_SPACE_CC); return; } data[0] = 0; sid = (lan->next_challenge_seq << (USER_BITS_REQ+1)) | (user->idx << 1) | 1; lan->next_challenge_seq++; ipmi_set_uint32(data+1, sid); rv = gen_challenge(lan, data+5, sid); if (rv) { lan->sysinfo->log(lan->sysinfo, SESSION_CHALLENGE_FAILED, msg, "Session challenge failed: Error generating challenge"); return_err(lan, msg, NULL, IPMI_UNKNOWN_ERR_CC); } else { return_rsp_data(lan, msg, NULL, data, 21); } } static unsigned char cipher_suites[] = { 0xc0, 0x00, 0x00, 0x40, 0x80, 0xc0, 0x01, 0x01, 0x40, 0x80, 0xc0, 0x02, 0x01, 0x41, 0x80, 0xc0, 0x03, 0x01, 0x41, 0x81, 0xc0, 0x04, 0x01, 0x41, 0x82, 0xc0, 0x05, 0x01, 0x41, 0x83, 0xc0, 0x06, 0x02, 0x40, 0x80, 0xc0, 0x07, 0x02, 0x42, 0x80, 0xc0, 0x08, 0x02, 0x42, 0x81, 0xc0, 0x09, 0x02, 0x42, 0x82, 0xc0, 0x0a, 0x02, 0x42, 0x83, 0xc0, 0x0b, 0x02, 0x43, 0x80, 0xc0, 0x0c, 0x02, 0x43, 0x81, 0xc0, 0x0d, 0x02, 0x43, 0x82, 0xc0, 0x0e, 0x02, 0x43, 0x83 }; static unsigned char cipher_algos[] = { 0x00, 0x01, 0x02, 0x40, 0x41, 0x42, 0x43, 0x80, 0x81, 0x82, 0x83 }; static void handle_get_channel_cipher_suites(lanserv_data_t *lan, msg_t *msg) { unsigned int chan; channel_t **channels, *channel; unsigned char *adata, data[18]; unsigned int start, size; if (msg->len < 3) { return_err(lan, msg, NULL, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } chan = msg->data[0] & 0xf; if (chan == 0xe) chan = lan->channel.channel_num; channels = ipmi_mc_get_channelset(lan->channel.mc); channel = channels[chan]; if (!channel) { return_err(lan, msg, NULL, IPMI_NOT_PRESENT_CC); return; } if (channel->medium_type != IPMI_CHANNEL_MEDIUM_8023_LAN) { return_err(lan, msg, NULL, IPMI_INVALID_DATA_FIELD_CC); return; } /* * The cipher suites are all fixed, so just need to validate the * channel and return our hard-coded info. */ if (msg->data[2] & 0x80) { adata = cipher_suites; size = sizeof(cipher_suites); } else { adata = cipher_algos; size = sizeof(cipher_algos); } start = (msg->data[2] & 0x1f) * 16; if (start >= size) { start = 0; size = 0; } else { size = size - start; } if (size > 16) size = 16; data[0] = 0; data[1] = chan; memcpy(data + 2, adata + start, size); return_rsp_data(lan, msg, NULL, data, size + 2); } static void handle_no_session(lanserv_data_t *lan, msg_t *msg) { /* Should be a session challenge, validate everything else. */ if (msg->seq != 0) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "No session message failed: Invalid seq"); return; } if (msg->authtype != IPMI_AUTHTYPE_NONE) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "No session message failed: Invalid authtype: %d", msg->authtype); return; } switch (msg->cmd) { case IPMI_GET_SYSTEM_GUID_CMD: handle_get_system_guid(lan, NULL, msg); break; case IPMI_GET_CHANNEL_AUTH_CAPABILITIES_CMD: handle_get_channel_auth_capabilities(lan, msg); break; case IPMI_GET_SESSION_CHALLENGE_CMD: handle_get_session_challenge(lan, msg); break; case IPMI_GET_CHANNEL_CIPHER_SUITES_CMD: handle_get_channel_cipher_suites(lan, msg); break; default: lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "No session message failed: Invalid command: 0x%x", msg->cmd); return_err(lan, msg, NULL, IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC); break; } } static void * ialloc(void *info, int size) { lanserv_data_t *lan = info; return lan->channel.alloc(&lan->channel, size); } static void ifree(void *info, void *data) { lanserv_data_t *lan = info; lan->channel.free(&lan->channel, data); } static session_t * find_free_session(lanserv_data_t *lan) { int i; /* Find a free session. Session 0 is invalid. */ for (i=1; i<=MAX_SESSIONS; i++) { if (! lan->sessions[i].active) return &(lan->sessions[i]); } return NULL; } static void handle_temp_session(lanserv_data_t *lan, msg_t *msg) { uint8_t seq_data[4]; int user_idx; user_t *user; uint8_t auth, priv; session_t *session = NULL; session_t dummy_session; int rv; uint32_t xmit_seq; uint8_t data[11]; unsigned char tsid[4]; unsigned char tseq[4]; if (msg->cmd != IPMI_ACTIVATE_SESSION_CMD) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, " message failed: Invalid command: 0x%x", msg->cmd); return; } if (msg->len < 22) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Activate session failed: message too short"); return; } rv = check_challenge(lan, msg->sid, msg->data+2); if (rv) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: challenge failed"); return; } user_idx = (msg->sid >> 1) & USER_MASK; if ((user_idx > MAX_USERS) || (user_idx == 0)) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: Invalid sid: 0x%x", msg->sid); return; } auth = msg->data[0] & 0xf; user = &(lan->users[user_idx]); if (! (user->valid)) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: Invalid user idx: 0x%x", user_idx); return; } if (lan->channel.active_sessions >= MAX_SESSIONS) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Session challenge failed: To many open sessions"); return; } xmit_seq = ipmi_get_uint32(msg->data+18); memset(&dummy_session, 0, sizeof(dummy_session)); dummy_session.active = 1; dummy_session.authtype = msg->authtype; dummy_session.xmit_seq = xmit_seq; dummy_session.sid = msg->sid; rv = ipmi_auths[msg->authtype].authcode_init(user->pw, &dummy_session.authdata, lan, ialloc, ifree); if (rv) { lan->sysinfo->log(lan->sysinfo, AUTH_FAILED, msg, "Activate session failed: Message auth init failed"); return; } /* The "-6, +7" is cheating a little, but we need the last checksum to correctly calculate the code. */ ipmi_set_uint32(tsid, msg->sid); ipmi_set_uint32(tseq, msg->seq); rv = auth_check(&dummy_session, tsid, tseq, msg->data-6, msg->len+7, msg->rmcp.authcode); if (rv) { lan->sysinfo->log(lan->sysinfo, AUTH_FAILED, msg, "Activate session failed: Message auth failed"); goto out_free; } /* Note that before this point, we cannot return an error, there's no way to generate an authcode for it. */ if (xmit_seq == 0) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: Invalid sequence number"); return_err(lan, msg, &dummy_session, 0x85); /* Invalid seq id */ goto out_free; } priv = msg->data[1] & 0xf; if ((user->privilege == 0xf) || (priv > user->privilege) || (priv > lan->channel.privilege_limit)) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: Privilege %d for user 0x%d failed", priv, user_idx); return_err(lan, msg, &dummy_session, 0x86); /* Privilege error */ goto out_free; } if (! (lan->channel.priv_info[priv-1].allowed_auths & (1 << auth))) { /* Authentication level not permitted for this privilege */ lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: Auth level %d invalid for" " privilege %d", auth, priv); return_err(lan, msg, &dummy_session, IPMI_INVALID_DATA_FIELD_CC); goto out_free; } session = find_free_session(lan); if (!session) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: out of free sessions"); return_err(lan, msg, &dummy_session, 0x81); /* No session slot */ goto out_free; } session->src_addr = lan->channel.alloc(&lan->channel, msg->src_len); if (!session->src_addr) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: out of memory"); return_err(lan, msg, &dummy_session, IPMI_UNKNOWN_ERR_CC); goto out_free; } memcpy(session->src_addr, msg->src_addr, msg->src_len); session->src_len = msg->src_len; session->active = 1; session->rmcpplus = 0; session->authtype = auth; session->authdata = dummy_session.authdata; rv = lan->gen_rand(lan, seq_data, 4); if (rv) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: Could not generate random number"); return_err(lan, msg, &dummy_session, IPMI_UNKNOWN_ERR_CC); goto out_free; } session->recv_seq = ipmi_get_uint32(seq_data) & ~1; if (!session->recv_seq) session->recv_seq = 2; session->xmit_seq = xmit_seq; session->max_priv = priv; session->priv = IPMI_PRIVILEGE_USER; /* Start at user privilege. */ session->userid = user->idx; session->time_left = lan->default_session_timeout; lan->channel.active_sessions++; lan->sysinfo->log(lan->sysinfo, NEW_SESSION, msg, "Activate session: Session opened for user 0x%x, max priv %d", user_idx, priv); if (lan->sid_seq == 0) lan->sid_seq++; session->sid = ((lan->sid_seq << (SESSION_BITS_REQ+1)) | (session->handle << 1)); lan->sid_seq++; data[0] = 0; data[1] = auth; ipmi_set_uint32(data+2, session->sid); ipmi_set_uint32(data+6, session->recv_seq); data[10] = session->max_priv; return_rsp_data(lan, msg, &dummy_session, data, 11); return; out_free: ipmi_auths[msg->authtype].authcode_cleanup(dummy_session.authdata); } /* The command handling below is for active sessions. */ static void handle_smi_msg(lanserv_data_t *lan, session_t *session, msg_t *msg) { int rv; rv = channel_smi_send(&lan->channel, msg); if (rv == ENOMEM) return_err(lan, msg, NULL, IPMI_UNKNOWN_ERR_CC); else if (rv == EMSGSIZE) return_err(lan, msg, session, IPMI_REQUESTED_DATA_LENGTH_EXCEEDED_CC); else if (rv) return_err(lan, msg, session, IPMI_UNKNOWN_ERR_CC); } static void handle_activate_session_cmd(lanserv_data_t *lan, session_t *session, msg_t *msg) { uint8_t data[11]; if (msg->len < 22) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Activate session failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } /* We are already connected, we ignore everything but the outbound sequence number. */ session->xmit_seq = ipmi_get_uint32(msg->data+18); data[0] = 0; data[1] = session->authtype; ipmi_set_uint32(data+2, session->sid); ipmi_set_uint32(data+6, session->recv_seq); data[10] = session->max_priv; return_rsp_data(lan, msg, session, data, 11); } static void handle_set_session_privilege(lanserv_data_t *lan, session_t *session, msg_t *msg) { uint8_t data[2]; uint8_t priv; if (msg->len < 1) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Set session priv failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } priv = msg->data[0] & 0xf; if (priv == 0) priv = session->priv; if (priv == IPMI_PRIVILEGE_CALLBACK) { return_err(lan, msg, session, 0x80); /* Can't drop below user priv. */ return; } if (priv > session->max_priv) { return_err(lan, msg, session, 0x81); /* Cannot set the priv this high. */ return; } session->priv = priv; data[0] = 0; data[1] = priv; return_rsp_data(lan, msg, session, data, 2); } static void handle_close_session(lanserv_data_t *lan, session_t *session, msg_t *msg) { uint32_t sid; session_t *nses = session; if (msg->len < 4) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Close session failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } sid = ipmi_get_uint32(msg->data); if (sid != session->sid) { if (session->priv != IPMI_PRIVILEGE_ADMIN) { /* Only admins can close other people's sessions. */ return_err(lan, msg, session, IPMI_INSUFFICIENT_PRIVILEGE_CC); return; } nses = sid_to_session(lan, sid); if (!nses) { return_err(lan, msg, session, 0x87); /* session not found */ return; } } lan->sysinfo->log(lan->sysinfo, SESSION_CLOSED, msg, "Session closed: Closed due to request"); return_err(lan, msg, session, 0); close_session(lan, nses); } static void handle_get_session_info(lanserv_data_t *lan, session_t *session, msg_t *msg) { uint8_t idx; session_t *nses = NULL; uint8_t data[19]; if (msg->len < 1) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Get session failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } idx = msg->data[0]; if (idx == 0xff) { unsigned int sid; if (msg->len < 5) { return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } sid = ipmi_get_uint32(msg->data+1); nses = sid_to_session(lan, sid); } else if (idx == 0xfe) { int handle; if (msg->len < 2) { return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } handle = msg->data[1]; if (handle >= MAX_SESSIONS) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } if (lan->sessions[handle].active) nses = &lan->sessions[handle]; } else if (idx == 0) { nses = session; } else { int i; if (idx <= lan->channel.active_sessions) { for (i=0; i<=MAX_SESSIONS; i++) { if (lan->sessions[i].active) { idx--; if (idx == 0) { nses = &lan->sessions[i]; break; } } } } } data[0] = 0; data[2] = MAX_SESSIONS; data[3] = lan->channel.active_sessions; if (nses) { data[1] = nses->handle; data[4] = nses->userid; data[5] = nses->priv; data[6] = lan->channel.channel_num | (session->rmcpplus << 4); return_rsp_data(lan, msg, session, data, 7); } else { data[1] = 0; return_rsp_data(lan, msg, session, data, 4); } /* FIXME - We don't currently return the IP information, because it's hard to get. Maybe later. */ } static extcmd_map_t ip_src_map[] = { { 0, "unknown" }, { 1, "static" }, { 2, "dhcp" }, { 3, "bios" }, { 4, "other" }, { 0, NULL } }; #define BASETYPE lanparm_data_t static extcmd_info_t lanread_vals[] = { EXTCMD_MEMB(ip_addr, extcmd_ip), EXTCMD_MEMB_MAPUCHAR(ip_addr_src, ip_src_map), EXTCMD_MEMB(mac_addr, extcmd_mac), EXTCMD_MEMB(subnet_mask, extcmd_ip), EXTCMD_MEMB(default_gw_ip_addr, extcmd_ip), EXTCMD_MEMB(default_gw_mac_addr, extcmd_mac), EXTCMD_MEMB(backup_gw_ip_addr, extcmd_ip), EXTCMD_MEMB(backup_gw_mac_addr, extcmd_mac) }; #undef BASETYPE static void write_lan_config(lanserv_data_t *lan) { if (lan->persist_changed) { persist_t *p; p = alloc_persist("lanparm.mc%2.2x.%d", ipmi_mc_get_ipmb(lan->channel.mc), lan->channel.channel_num); if (!p) return; add_persist_data(p, lan->lanparm.max_priv_for_cipher_suite, 9, "max_priv_for_cipher"); add_persist_int(p, lan->channel.privilege_limit, "privilege_limit"); write_persist(p); free_persist(p); lan->persist_changed = 0; } if (extcmd_setvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals, lan->lanparm_changed, lanread_len)) { lan->sysinfo->log(lan->sysinfo, OS_ERROR, NULL, "Error writing external LANPARM values"); } else { memset(lan->lanparm_changed, 0, sizeof(lan->lanparm_changed)); } } static void set_channel_access(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len) { uint8_t upd1, upd2; int write_nonv = 0; uint8_t newv; lanserv_data_t *lan = chan->chan_info; upd1 = (msg->data[1] >> 6) & 0x3; if ((upd1 == 1) || (upd1 == 2)) { newv = (msg->data[1] >> 4) & 1; if (newv) { /* Don't support per-msg authentication */ rdata[0] = 0x83; *rdata_len = 1; return; } newv = (msg->data[1] >> 3) & 1; if (newv) { /* Don't support unauthenticated user-level access */ rdata[0] = 0x83; *rdata_len = 1; return; } newv = (msg->data[1] >> 0) & 7; if (newv != 0x2) { /* Only support "always available" channel */ rdata[0] = 0x83; *rdata_len = 1; return; } #if 0 if (upd1 == 1) { lan->channel.PEF_alerting = (msg->data[1] >> 5) & 1; } else { lan->channel.PEF_alerting_nonv = (msg->data[1] >> 5) & 1; write_nonv = 1; } #endif } else if (upd1 != 0) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } upd2 = (msg->data[2] >> 6) & 0x3; if ((upd2 == 1) || (upd2 == 2)) { newv = (msg->data[2] >> 0) & 0xf; if ((newv == 0) || (newv > 4)) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (upd2 == 1) { lan->channel.privilege_limit_nonv = newv; write_nonv = 1; } else { lan->channel.privilege_limit = newv; } } else if (upd2 != 0) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (write_nonv) { lan->persist_changed = 1; write_lan_config(lan); } rdata[0] = 0; *rdata_len = 1; } static void set_lan_config_parms(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len) { unsigned char err = 0; lanserv_data_t *lan = chan->chan_info; int rv; unsigned char oldval; /* * Note that in all of these, if a set is in progress and the data * value has been modified (but not committed), it will return the * modified value, not the one from the external command. */ switch (msg->data[1]) { case 0: switch (msg->data[2] & 0x3) { case 0: if (lan->lanparm.set_in_progress) { /* rollback */ memcpy(&lan->lanparm, &lan->lanparm_rollback, sizeof(lan->lanparm)); lan->lanparm.set_in_progress = 0; } /* No effect otherwise */ break; case 1: if (lan->lanparm.set_in_progress) err = 0x81; /* Another user is writing. */ else { /* Save rollback data */ memcpy(&lan->lanparm_rollback, &lan->lanparm, sizeof(lan->lanparm)); lan->lanparm.set_in_progress = 1; } break; case 2: if (!lan->lanparm.set_in_progress) { err = 0x81; /* Not in proper state. */ } else { /* Re-save rollback data */ memcpy(&lan->lanparm_rollback, &lan->lanparm, sizeof(lan->lanparm)); write_lan_config(lan); } break; case 3: err = IPMI_INVALID_DATA_FIELD_CC; } break; case 1: case 2: case 17: case 22: case 23: err = 0x82; /* Read-only data */ break; case 3: if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.ip_addr, msg->data+2, 4); lan->lanparm_changed[ip_addr_o] = 1; } break; case 4: oldval = lan->lanparm.ip_addr_src; lan->lanparm.ip_addr_src = msg->data[2]; /* Check to see if the system supports this value */ rv = extcmd_checkvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals + ip_addr_src_o, 1); if (rv) { lan->lanparm.ip_addr_src = oldval; rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } lan->lanparm_changed[ip_addr_src_o] = 1; break; case 5: if (msg->len < 8) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.mac_addr, msg->data+2, 6); lan->lanparm_changed[mac_addr_o] = 1; } break; case 6: if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.subnet_mask, msg->data+2, 4); lan->lanparm_changed[subnet_mask_o] = 1; } break; case 7: if (msg->len < 5) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.ipv4_hdr_parms, msg->data+2, 3); } break; case 12: if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.default_gw_ip_addr, msg->data+2, 4); lan->lanparm_changed[default_gw_ip_addr_o] = 1; } break; case 13: if (msg->len < 8) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.default_gw_mac_addr, msg->data+2, 6); lan->lanparm_changed[default_gw_mac_addr_o] = 1; } break; case 14: if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.backup_gw_ip_addr, msg->data+2, 4); lan->lanparm_changed[backup_gw_ip_addr_o] = 1; } break; case 15: if (msg->len < 8) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.backup_gw_mac_addr, msg->data+2, 6); lan->lanparm_changed[backup_gw_mac_addr_o] = 1; } break; case 16: /* Just ignore this. */ break; case 20: if (msg->len < 4) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.vlan_id, msg->data+2, 2); } break; case 21: lan->lanparm.vlan_priority = msg->data[2]; break; case 24: if (msg->len < 11) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.max_priv_for_cipher_suite, msg->data+2, 9); lan->persist_changed = 1; } break; default: err = 0x80; /* Parm not supported */ } rdata[0] = err; *rdata_len = 1; } static void get_lan_config_parms(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len) { unsigned char databyte = 0; unsigned char databytes[5]; unsigned char *data = NULL; unsigned int length = 0; lanserv_data_t *lan = chan->chan_info; int rv; switch (msg->data[1]) { case 0: databyte = lan->lanparm.set_in_progress; break; case 1: databyte = 0x1f; /* We support all authentications. */ break; case 2: data = databytes; data[0] = chan->priv_info[0].allowed_auths; data[1] = chan->priv_info[1].allowed_auths; data[2] = chan->priv_info[2].allowed_auths; data[3] = chan->priv_info[3].allowed_auths; data[4] = 0; length = 5; break; case 17: databyte = lan->lanparm.num_destinations; break; case 3: if (!lan->lanparm.set_in_progress || !lan->lanparm_changed[ip_addr_o]) { rv = extcmd_getvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals + ip_addr_o, 1); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } data = lan->lanparm.ip_addr; length = 4; break; case 4: if (!lan->lanparm.set_in_progress || !lan->lanparm_changed[ip_addr_src_o]) { rv = extcmd_getvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals + ip_addr_src_o, 1); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } databyte = lan->lanparm.ip_addr_src; break; case 5: if (!lan->lanparm.set_in_progress || !lan->lanparm_changed[mac_addr_o]) { rv = extcmd_getvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals + mac_addr_o, 1); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } data = lan->lanparm.mac_addr; length = 6; break; case 6: if (!lan->lanparm.set_in_progress || !lan->lanparm_changed[subnet_mask_o]) { rv = extcmd_getvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals + subnet_mask_o, 1); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } data = lan->lanparm.subnet_mask; length = 4; break; case 7: /* FIXME - this is not handled */ data = lan->lanparm.ipv4_hdr_parms; length = 3; break; case 12: if (!lan->lanparm.set_in_progress || !lan->lanparm_changed[default_gw_ip_addr_o]) { rv = extcmd_getvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals + default_gw_ip_addr_o, 1); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } data = lan->lanparm.default_gw_ip_addr; length = 4; break; case 13: if (!lan->lanparm.set_in_progress || !lan->lanparm_changed[default_gw_mac_addr_o]) { rv = extcmd_getvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals + default_gw_mac_addr_o, 1); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } data = lan->lanparm.default_gw_mac_addr; length = 6; break; case 14: if (!lan->lanparm.set_in_progress || !lan->lanparm_changed[backup_gw_ip_addr_o]) { rv = extcmd_getvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals + backup_gw_ip_addr_o, 1); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } data = lan->lanparm.backup_gw_ip_addr; length = 4; break; case 15: if (!lan->lanparm.set_in_progress || !lan->lanparm_changed[backup_gw_mac_addr_o]) { rv = extcmd_getvals(lan->sysinfo, &lan->lanparm, lan->config_prog, lanread_vals + backup_gw_mac_addr_o, 1); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } } data = lan->lanparm.backup_gw_mac_addr; length = 6; break; case 16: /* Dummy value, we don't support this. */ data = (unsigned char *) "public\0\0\0\0\0\0\0\0\0\0\0\0"; length = 18; break; case 20: /* FIXME - no VLAN support */ data = lan->lanparm.vlan_id; length = 2; break; case 21: /* FIXME - no VLAN support */ databyte = lan->lanparm.vlan_priority; break; case 22: databyte = lan->lanparm.num_cipher_suites; break; case 23: data = lan->lanparm.cipher_suite_entry; length = 17; break; case 24: data = lan->lanparm.max_priv_for_cipher_suite; length = 9; break; default: rdata[0] = 0x80; /* Parm not supported */ *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = 0x11; *rdata_len = 2; if (msg->data[0] & 0x80) return; if (data) { memcpy(rdata + 2, data, length); *rdata_len += length; } else { rdata[2] = databyte; *rdata_len = 3; } } static void handle_normal_session(lanserv_data_t *lan, msg_t *msg) { session_t *session = sid_to_session(lan, msg->sid); int rv; if (session == NULL) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Normal session message failure: Invalid SID"); return; } session->time_left = lan->default_session_timeout; if (lan->channel.oem.oem_handle_msg && lan->channel.oem.oem_handle_msg(&lan->channel, msg)) /* OEM code handled the message. */ return; rv = IPMI_PRIV_INVALID; if (lan->channel.oem.oem_check_permitted) rv = lan->channel.oem.oem_check_permitted(session->priv, msg->netfn, msg->cmd); if (rv == IPMI_PRIV_INVALID) rv = ipmi_cmd_permitted(session->priv, msg->netfn, msg->cmd); switch (rv) { case IPMI_PRIV_PERMITTED: break; case IPMI_PRIV_SEND: /* The spec says that operator privilege is require to send on other channels, but that doesn't make any sense. Instead, we look at the message to tell if the operation is permitted. */ rv = ipmi_cmd_permitted(session->priv, msg->data[2]>>2, /* netfn */ msg->data[6]); /* cmd */ if (rv == IPMI_PRIV_PERMITTED) break; /* fallthrough */ case IPMI_PRIV_DENIED: case IPMI_PRIV_BOOT: /* FIXME - this can sometimes be permitted. */ lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Normal session message failure: no privilege"); return_err(lan, msg, session, IPMI_INSUFFICIENT_PRIVILEGE_CC); return; case IPMI_PRIV_INVALID: default: lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Normal session message failure: Internal error 1"); return_err(lan, msg, session, IPMI_UNKNOWN_ERR_CC); return; } if (msg->netfn == IPMI_APP_NETFN) { switch (msg->cmd) { case IPMI_GET_SYSTEM_GUID_CMD: handle_get_system_guid(lan, session, msg); break; case IPMI_GET_CHANNEL_CIPHER_SUITES_CMD: handle_get_channel_cipher_suites(lan, msg); break; case IPMI_GET_CHANNEL_AUTH_CAPABILITIES_CMD: case IPMI_GET_SESSION_CHALLENGE_CMD: return_err(lan, msg, session, IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC); break; case IPMI_ACTIVATE_SESSION_CMD: handle_activate_session_cmd(lan, session, msg); break; case IPMI_SET_SESSION_PRIVILEGE_CMD: handle_set_session_privilege(lan, session, msg); break; case IPMI_CLOSE_SESSION_CMD: handle_close_session(lan, session, msg); break; case IPMI_GET_SESSION_INFO_CMD: handle_get_session_info(lan, session, msg); break; default: goto normal_msg; } } else { normal_msg: handle_smi_msg(lan, session, msg); } } static void handle_ipmi_payload(lanserv_data_t *lan, msg_t *msg) { if (msg->len < 7) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure: Length field too short"); return; } if (ipmb_checksum(msg->data, 3, 0) != 0) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure: Checksum 1 failed"); return; } if (ipmb_checksum(msg->data+3, msg->len-3, 0) != 0) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure: Checksum 2 failed"); return; } msg->len--; /* Remove the final checksum */ msg->rs_addr = msg->data[0]; msg->netfn = msg->data[1] >> 2; msg->rs_lun = msg->data[1] & 0x3; msg->rq_addr = msg->data[3]; msg->rq_seq = msg->data[4] >> 2; msg->rq_lun = msg->data[4] & 0x3; msg->cmd = msg->data[5]; msg->data += 6; msg->len -= 6; if (msg->sid == 0) { handle_no_session(lan, msg); } else if (msg->sid & 1) { /* We use odd SIDs for temporary ones. */ /* Temp sessions have to be set up before the auth is done, so we can't do that here. */ handle_temp_session(lan, msg); } else { handle_normal_session(lan, msg); } } #ifdef HAVE_OPENSSL static int rakp_hmac_sha1_init(lanserv_data_t *lan, session_t *session) { session->auth_data.akey = EVP_sha1(); session->auth_data.akey_len = 20; session->auth_data.integ_len = 12; return 0; } static int rakp_hmac_md5_init(lanserv_data_t *lan, session_t *session) { session->auth_data.akey = EVP_md5(); session->auth_data.akey_len = 16; session->auth_data.integ_len = 16; return 0; } static int rakp_hmac_set2(lanserv_data_t *lan, session_t *session, unsigned char *data, unsigned int *data_len, unsigned int max_len) { unsigned char idata[74]; unsigned int ilen; const unsigned char *p; user_t *user; auth_data_t *a = &session->auth_data; if (((*data_len) + a->akey_len) > max_len) return E2BIG; ipmi_set_uint32(idata+0, session->rem_sid); ipmi_set_uint32(idata+4, session->sid); memcpy(idata+8, a->rem_rand, 16); memcpy(idata+24, a->rand, 16); memcpy(idata+40, lan->guid, 16); idata[56] = a->role; idata[57] = a->username_len; memcpy(idata+58, a->username, idata[57]); user = &(lan->users[session->userid]); HMAC(a->akey, user->pw, a->akey_len, idata, 58+idata[57], data + *data_len, &ilen); *data_len += a->akey_len; /* Now generate the SIK */ memcpy(idata+0, a->rem_rand, 16); memcpy(idata+16, a->rand, 16); idata[32] = a->role; idata[33] = a->username_len; memcpy(idata+34, a->username, idata[33]); if (lan->bmc_key) p = lan->bmc_key; else p = user->pw; HMAC(a->akey, p, a->akey_len, idata, 34+idata[33], a->sik, &ilen); /* Now generate k1 and k2. */ memset(idata, 1, a->akey_len); HMAC(a->akey, a->sik, a->akey_len, idata, a->akey_len, a->k1, &ilen); memset(idata, 2, a->akey_len); HMAC(a->akey, a->sik, a->akey_len, idata, a->akey_len, a->k2, &ilen); return 0; } static int rakp_hmac_check3(lanserv_data_t *lan, session_t *session, unsigned char *data, unsigned int *data_len) { unsigned char idata[38]; unsigned int ilen; unsigned char integ[20]; user_t *user = &(lan->users[session->userid]); auth_data_t *a = &session->auth_data; if (((*data_len) - a->akey_len) < 8) return E2BIG; memcpy(idata+0, a->rand, 16); ipmi_set_uint32(idata+16, session->rem_sid); idata[20] = a->role; idata[21] = a->username_len; memcpy(idata+22, a->username, idata[21]); HMAC(a->akey, user->pw, a->akey_len, idata, 22+idata[21], integ, &ilen); if (memcmp(integ, data+(*data_len)-a->akey_len, a->akey_len) != 0) return EINVAL; *data_len -= a->akey_len; return 0; } static int rakp_hmac_set4(lanserv_data_t *lan, session_t *session, unsigned char *data, unsigned int *data_len, unsigned int max_len) { unsigned char idata[36]; unsigned int ilen; auth_data_t *a = &session->auth_data; unsigned char integ[20]; if (((*data_len) + a->akey_len) > max_len) return E2BIG; memcpy(idata+0, a->rem_rand, 16); ipmi_set_uint32(idata+16, session->sid); memcpy(idata+20, lan->guid, 16); HMAC(a->akey, a->sik, a->akey_len, idata, 36, integ, &ilen); memcpy(data+*data_len, integ, a->integ_len); *data_len += a->integ_len; return 0; } static auth_handlers_t rakp_hmac_sha1 = { .init = rakp_hmac_sha1_init, .set2 = rakp_hmac_set2, .check3 = rakp_hmac_check3, .set4 = rakp_hmac_set4 }; static auth_handlers_t rakp_hmac_md5 = { .init = rakp_hmac_md5_init, .set2 = rakp_hmac_set2, .check3 = rakp_hmac_check3, .set4 = rakp_hmac_set4 }; #define RAKP_INIT , &rakp_hmac_sha1, &rakp_hmac_md5 static int hmac_sha1_init(lanserv_data_t *lan, session_t *session) { session->auth_data.ikey2 = EVP_sha1(); session->auth_data.ikey = session->auth_data.k1; session->auth_data.ikey_len = 20; session->auth_data.integ_len = 12; return 0; } static int hmac_md5_init(lanserv_data_t *lan, session_t *session) { user_t *user = &(lan->users[session->userid]); session->auth_data.ikey2 = EVP_md5(); session->auth_data.ikey = user->pw; session->auth_data.ikey_len = 16; session->auth_data.integ_len = 16; return 0; } static void hmac_cleanup(lanserv_data_t *lan, session_t *session) { } static int hmac_add(lanserv_data_t *lan, session_t *session, unsigned char *pos, unsigned int *data_len, unsigned int data_size) { auth_data_t *a = &session->auth_data; unsigned int ilen; unsigned char integ[20]; if (((*data_len) + a->ikey_len) > data_size) return E2BIG; HMAC(a->ikey2, a->ikey, a->ikey_len, pos+4, (*data_len)-4, integ, &ilen); memcpy(pos+(*data_len), integ, a->integ_len); *data_len += a->integ_len; return 0; } static int hmac_check(lanserv_data_t *lan, session_t *session, msg_t *msg) { unsigned char integ[20]; auth_data_t *a = &session->auth_data; unsigned int ilen; if ((msg->len-5) < a->integ_len) return E2BIG; HMAC(a->ikey2, a->ikey, a->ikey_len, msg->data, msg->len-a->integ_len, integ, &ilen); if (memcmp(msg->data+msg->len-a->integ_len, integ, a->integ_len) != 0) return EINVAL; return 0; } static void * auth_alloc(void *info, int size) { return malloc(size); } static void auth_free(void *info, void *data) { free(data); } static int md5_init(lanserv_data_t *lan, session_t *session) { user_t *user = &(lan->users[session->userid]); int rv; ipmi_authdata_t idata; rv = ipmi_md5_authcode_initl(user->pw, 20, &idata, NULL, auth_alloc, auth_free); if (rv) return rv; session->auth_data.idata = idata; session->auth_data.ikey_len = 16; return 0; } static void md5_cleanup(lanserv_data_t *lan, session_t *session) { ipmi_md5_authcode_cleanup(session->auth_data.idata); session->auth_data.idata = NULL; } static int md5_add(lanserv_data_t *lan, session_t *session, unsigned char *pos, unsigned int *data_len, unsigned int data_size) { auth_data_t *a = &session->auth_data; ipmi_auth_sg_t data[2]; int rv; if (((*data_len) + a->ikey_len) > data_size) return E2BIG; data[0].data = pos+4; data[0].len = (*data_len)-4; data[1].data = NULL; rv = ipmi_md5_authcode_gen(a->idata, data, pos+(*data_len)); if (rv) return rv; *data_len += a->ikey_len; return 0; } static int md5_check(lanserv_data_t *lan, session_t *session, msg_t *msg) { auth_data_t *a = &session->auth_data; ipmi_auth_sg_t data[2]; int rv; if ((msg->len-5) < a->ikey_len) return E2BIG; data[0].data = msg->data; data[0].len = msg->len - a->ikey_len; data[1].data = NULL; rv = ipmi_md5_authcode_check(a->idata, data, msg->data + msg->len - a->ikey_len); return rv; } static integ_handlers_t hmac_sha1_integ = { hmac_sha1_init, hmac_cleanup, hmac_add, hmac_check }; static integ_handlers_t hmac_md5_integ = { hmac_md5_init, hmac_cleanup, hmac_add, hmac_check }; static integ_handlers_t md5_integ = { md5_init, md5_cleanup, md5_add, md5_check }; #define HMAC_INIT , &hmac_sha1_integ, &hmac_md5_integ #define MD5_INIT , &md5_integ static int aes_cbc_init(lanserv_data_t *lan, session_t *session) { session->auth_data.ckey = session->auth_data.k2; session->auth_data.ckey_len = 16; return 0; } static void aes_cbc_cleanup(lanserv_data_t *lan, session_t *session) { } static int aes_cbc_encrypt(lanserv_data_t *lan, session_t *session, unsigned char **pos, unsigned int *hdr_left, unsigned int *data_len, unsigned int *data_size) { auth_data_t *a = &session->auth_data; unsigned int l = *data_len; unsigned char *d; unsigned char *iv; unsigned int i; EVP_CIPHER_CTX *ctx; int rv; int outlen; int tmplen; unsigned char *padpos; unsigned char padval; unsigned int padlen; if (*hdr_left < 16) return E2BIG; /* Calculate the number of padding bytes -> e. Note that the pad length byte is included, thus the +1. We don't add the pad, AES does, but we need to know what it is. */ /* Calculate the number of padding bytes -> e. Note that the pad length byte is included, thus the +1. We then do the padding. */ padlen = 15 - (l % 16); l += padlen + 1; if (l > *data_size) return E2BIG; /* We store the unencrypted data here, then crypt into the real data. */ d = malloc(l); if (!d) return ENOMEM; memcpy(d, *pos, *data_len); /* Now add the padding. */ padpos = d + *data_len; padval = 1; for (i=0; igen_rand(lan, iv, 16); if (rv) { free(d); return rv; } *hdr_left -= 16; *data_size += 16; /* Ok, we're set to do the crypt operation. */ ctx = EVP_CIPHER_CTX_new(); if (!ctx) { rv = ENOMEM; goto out_cleanup; } EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, a->ckey, iv); EVP_CIPHER_CTX_set_padding(ctx, 0); if (!EVP_EncryptUpdate(ctx, *pos, &outlen, d, l)) { rv = ENOMEM; goto out_cleanup; } if (!EVP_EncryptFinal_ex(ctx, (*pos) + outlen, &tmplen)) { rv = ENOMEM; /* right? */ goto out_cleanup; } outlen += tmplen; *pos = iv; *data_len = outlen + 16; out_cleanup: EVP_CIPHER_CTX_free(ctx); free(d); return rv; } static int aes_cbc_decrypt(lanserv_data_t *lan, session_t *session, msg_t *msg) { auth_data_t *a = &session->auth_data; unsigned int l = msg->len; unsigned char *d; EVP_CIPHER_CTX *ctx; int outlen; unsigned char *pad; int padlen; int rv = 0; if (l < 32) /* Not possible with this algorithm. */ return EINVAL; l -= 16; /* We store the encrypted data here, then decrypt into the real data. */ d = malloc(l); if (!d) return ENOMEM; memcpy(d, msg->data+16, l); /* Ok, we're set to do the decrypt operation. */ ctx = EVP_CIPHER_CTX_new(); if (!ctx) { rv = ENOMEM; goto out_cleanup; } EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, a->k2, msg->data); EVP_CIPHER_CTX_set_padding(ctx, 0); if (!EVP_DecryptUpdate(ctx, msg->data+16, &outlen, d, l)) { rv = EINVAL; goto out_cleanup; } if (outlen < 16) { rv = EINVAL; goto out_cleanup; } /* Now remove the padding */ pad = msg->data + 16 + outlen - 1; padlen = *pad; if (padlen >= 16) { rv = EINVAL; goto out_cleanup; } outlen--; pad--; while (padlen) { if (*pad != padlen) { rv = EINVAL; goto out_cleanup; } outlen--; pad--; padlen--; } msg->data += 16; /* Remove the init vector */ msg->len = outlen; out_cleanup: EVP_CIPHER_CTX_free(ctx); free(d); return rv; } static conf_handlers_t aes_cbc_conf = { aes_cbc_init, aes_cbc_cleanup, aes_cbc_encrypt, aes_cbc_decrypt }; #define AES_CBC_INIT , &aes_cbc_conf unsigned int default_auth = 1; /* RAKP-HMAC-SHA1 */ unsigned int default_integ = 1; /* HMAC-SHA1-96 */ unsigned int default_conf = 1; /* AES-CBC-128 */ #else #define RAKP_INIT , NULL, NULL #define MD5_INIT , NULL #define HMAC_INIT , NULL #define AES_CBC_INIT , NULL unsigned int default_auth = 0; unsigned int default_integ = 0; unsigned int default_conf = 0; #endif integ_handlers_t *integs[64] = { NULL HMAC_INIT MD5_INIT }; conf_handlers_t *confs[64] = { NULL AES_CBC_INIT }; auth_handlers_t *auths[64] = { NULL RAKP_INIT }; struct valid_cypher_suites_s { int auth, integ, conf; } valid_cipher_suites[] = { { 0, 0, 0 }, { 1, 0, 0 }, { 1, 1, 0 }, { 1, 1, 1 }, { 1, 1, 2 }, { 1, 1, 3 }, { 2, 0, 0 }, { 2, 2, 0 }, { 2, 2, 1 }, { 2, 2, 2 }, { 2, 2, 3 }, { 2, 3, 0 }, { 2, 3, 1 }, { 2, 3, 2 }, { 2, 3, 3 }, { -1, -1. -1 } }; static void handle_open_session_payload(lanserv_data_t *lan, msg_t *msg) { unsigned char data[36]; unsigned char priv, max_priv; unsigned char auth; unsigned char integ; unsigned char conf; session_t *session = NULL; uint32_t rem_sid; unsigned char err; int i; int rv; if (msg->sid != 0) { err = IPMI_RMCPP_INVALID_SESSION_ID; goto out_err; } if (msg->len < 32) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } priv = msg->data[1] & 0xf; if (priv > 4) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } rem_sid = ipmi_get_uint32(msg->data+4); if (rem_sid == 0) { err = IPMI_RMCPP_INVALID_SESSION_ID; goto out_err; } if (msg->data[8] != 0) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } if (msg->data[11] == 0) auth = default_auth; else if (msg->data[11] != 8) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } else auth = msg->data[12] & 0x3f; if (auth && !auths[auth]) { err = IPMI_RMCPP_INVALID_AUTHENTICATION_ALGORITHM; goto out_err; } if (msg->data[16] != 1) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } if (msg->data[19] == 0) integ = default_integ; else if (msg->data[19] != 8) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } else integ = msg->data[20] & 0x3f; if (integ && !integs[integ]) { err = IPMI_RMCPP_INVALID_INTEGRITY_ALGORITHM; goto out_err; } if (msg->data[24] != 2) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } if (msg->data[27] == 0) conf = default_conf; else if (msg->data[27] != 8) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } else conf = msg->data[28] & 0x3f; if (conf && !confs[conf]) { err = IPMI_RMCPP_INVALID_CONFIDENTIALITY_ALGORITHM; goto out_err; } for (i=0; ; i++) { if (valid_cipher_suites[i].auth == -1) break; if ((valid_cipher_suites[i].auth == auth) && (valid_cipher_suites[i].integ == integ) && (valid_cipher_suites[i].conf == conf)) break; } if (valid_cipher_suites[i].auth == -1) { err = IPMI_RMCPP_NO_CIPHER_SUITE_MATCHES; goto out_err; } max_priv = lan->lanparm.max_priv_for_cipher_suite[priv >> 1]; if (max_priv & 1) max_priv >>= 4; max_priv &= 0xf; if (priv > max_priv) { err = IPMI_RMCPP_UNAUTHORIZED_ROLE_OR_PRIVILEGE; goto out_err; } session = find_free_session(lan); if (!session) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: out of free sessions"); err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } session->src_addr = lan->channel.alloc(&lan->channel, msg->src_len); if (!session->src_addr) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: out of memory"); err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } memcpy(session->src_addr, msg->src_addr, msg->src_len); session->src_len = msg->src_len; session->active = 1; session->in_startup = 1; session->rmcpplus = 1; session->authtype = IPMI_AUTHTYPE_RMCP_PLUS; rv = lan->gen_rand(lan, session->auth_data.rand, 16); if (rv) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "Activate session failed: Could not generate random number"); err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } session->recv_seq = 1; session->xmit_seq = 1; session->unauth_recv_seq = 1; session->unauth_xmit_seq = 1; session->rem_sid = rem_sid; session->auth = auth; session->authh = auths[auth]; if (session->authh) session->authh->init(lan, session); session->integ = integ; session->integh = integs[integ]; session->conf = conf; session->confh = confs[conf]; session->userid = 0; session->time_left = lan->default_session_timeout; session->sid = ((lan->sid_seq << (SESSION_BITS_REQ+1)) | (session->handle << 1)); lan->sid_seq++; lan->sysinfo->log(lan->sysinfo, NEW_SESSION, msg, "Activate session: Session started, max priv %d", priv); memset(data, 0, sizeof(data)); data[0] = msg->data[0]; data[1] = 0; data[2] = priv; ipmi_set_uint32(data+4, session->rem_sid); ipmi_set_uint32(data+8, session->sid); data[12] = 0; data[15] = 8; data[16] = auth; data[20] = 1; data[23] = 8; data[24] = integ; data[28] = 2; data[31] = 8; data[32] = conf; lan->channel.active_sessions++; return_rmcpp_rsp(lan, session, msg, 0x11, data, 36, NULL, 0); return; out_err: data[0] = msg->data[0]; data[1] = err; return_rmcpp_rsp(lan, session, msg, 0x11, data, 2, NULL, 0); if (session) close_session(lan, session); } static void handle_rakp1_payload(lanserv_data_t *lan, msg_t *msg) { unsigned char data[64]; unsigned char priv; session_t *session = NULL; uint32_t sid; unsigned char err = 0; unsigned char username[17]; int name_only_lookup; unsigned char name_len; user_t *user; unsigned int len; if (msg->sid != 0) return; if (msg->len < 28) return; sid = ipmi_get_uint32(msg->data+4); if (sid == 0) return; session = sid_to_session(lan, sid); if (!session) return; memcpy(session->auth_data.rem_rand, msg->data+8, 16); session->auth_data.role = msg->data[24]; priv = msg->data[24] & 0xf; if (priv > 4) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } name_only_lookup = (msg->data[24] >> 4) & 1; name_len = msg->data[27]; if (name_len > 16) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "RAKP msg: name length too long: %d", name_len); err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } if ((unsigned int) (28+name_len) > msg->len) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "RAKP msg: name length doesn't match: %d", name_len); err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } session->max_priv = priv; session->priv = IPMI_PRIVILEGE_USER; /* Start at user privilege. */ memset(username, 0, sizeof(username)); memcpy(username, msg->data+28, name_len); user = find_user(lan, username, name_only_lookup, priv); if (!user) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "RAKP msg: invalid user: %s", username); err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } session->userid = user->idx; session->auth_data.username_len = name_len; memcpy(session->auth_data.username, username, 16); if (session->integh) { int rv = session->integh->init(lan, session); if (rv) { err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } } if (session->confh) { int rv = session->confh->init(lan, session); if (rv) { err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } } out_err: memset(data, 0, sizeof(data)); data[0] = msg->data[0]; data[1] = err; ipmi_set_uint32(data+4, session->rem_sid); memcpy(data+8, session->auth_data.rand, 16); memcpy(data+24, lan->guid, 16); len = 40; if (session->authh) { int rv; rv = session->authh->set2(lan, session, data, &len, sizeof(data)); if (rv) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "RAKP msg: set2 failed: 0x%x", rv); return; } } return_rmcpp_rsp(lan, session, msg, 0x13, data, len, NULL, 0); if (err) close_session(lan, session); } static void handle_rakp3_payload(lanserv_data_t *lan, msg_t *msg) { unsigned char data[32]; session_t *session = NULL; uint32_t sid; unsigned char err = 0; unsigned int len; if (msg->sid != 0) return; if (msg->len < 8) return; sid = ipmi_get_uint32(msg->data+4); if (sid == 0) return; session = sid_to_session(lan, sid); if (!session) return; if (session->authh) { int rv; rv = session->authh->check3(lan, session, msg->data, &msg->len); if (rv) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "RAKP msg: check3 failed: 0x%x", rv); err = 0x0f; /* Invalid integrity check */ goto out_err; } } if (msg->data[1]) { /* Other end reported an error, shut down. */ close_session(lan, session); return; } out_err: memset(data, 0, sizeof(data)); data[0] = msg->data[0]; data[1] = err; ipmi_set_uint32(data+4, session->rem_sid); len = 8; if (session->authh) { int rv; rv = session->authh->set4(lan, session, data, &len, sizeof(data)); if (rv) { lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg, "RAKP msg: set4 failed: 0x%x", rv); } } return_rmcpp_rsp(lan, session, msg, 0x15, data, len, NULL, 0); if (err) close_session(lan, session); else session->in_startup = 0; } ipmi_payload_handler_cb payload_handlers[64] = { [0] = handle_ipmi_payload, [0x10] = handle_open_session_payload, [0x12] = handle_rakp1_payload, [0x14] = handle_rakp3_payload, }; int ipmi_register_payload(unsigned int payload_id, ipmi_payload_handler_cb handler) { if (payload_id >= 64) return EINVAL; if (payload_handlers[payload_id]) return EBUSY; payload_handlers[payload_id] = handler; return 0; } static int decrypt_message(lanserv_data_t *lan, session_t *session, msg_t *msg) { if (!msg->rmcpp.encrypted) { if (session->conf != 0) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Message failure:" " Unencrypted msg on encrypted session"); return EINVAL; } return 0; } return session->confh->decrypt(lan, session, msg); } static int check_message_integrity(lanserv_data_t *lan, session_t *session, msg_t *msg) { if (!msg->rmcpp.authenticated) { if (session->integ != 0) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Message failure:" " Unauthenticated msg on authenticated session"); return EINVAL; } return 0; } else if (session->integ == 0) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Message failure:" " Authenticated msg on unauthenticated session"); return EINVAL; } return session->integh->check(lan, session, msg); } static void ipmi_handle_rmcpp_msg(lanserv_data_t *lan, msg_t *msg) { unsigned int len; uint32_t *seq; msg_t imsg; imsg.data = msg->data-1; imsg.len = msg->len+1; if (msg->len < 11) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure: message too short"); return; } msg->rmcpp.payload = msg->data[0] & 0x3f; msg->rmcpp.encrypted = (msg->data[0] >> 7) & 1; msg->rmcpp.authenticated = (msg->data[0] >> 6) & 1; msg->data++; if (msg->rmcpp.payload == 2) { if (msg->len < 17) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure: message too short"); return; } memcpy(msg->rmcpp.iana, msg->data + 1, 3); msg->data += 4; msg->rmcpp.payload_id = ipmi_get_uint16(msg->data); msg->data += 2; } msg->sid = ipmi_get_uint32(msg->data); msg->data += 4; msg->seq = ipmi_get_uint32(msg->data); msg->data += 4; len = ipmi_get_uint16(msg->data); msg->data += 2; if (len > msg->len) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure: Length field invalid: %d, %d", len, msg->len); return; /* The length field is not valid. We allow extra bytes, but reject if not enough. */ } msg->rmcpp.authdata_len = msg->len - len; msg->rmcpp.authdata = msg->data + len; msg->len = len; if (msg->sid == 0) { if (msg->rmcpp.authenticated || msg->rmcpp.encrypted) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure:" " Got encrypted or authenticated SID 0 msg"); return; } } else { session_t *session = sid_to_session(lan, msg->sid); int rv; int diff; if (session == NULL) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Normal session message failure: Invalid SID"); return; } if (!session->rmcpplus) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Normal session message failure:" " RMCP+ msg on RMCP session"); return; } imsg.rmcpp.encrypted = msg->rmcpp.encrypted; imsg.rmcpp.authenticated = msg->rmcpp.authenticated; rv = check_message_integrity(lan, session, &imsg); if (rv) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure:" " Message integrity failed"); return; } rv = decrypt_message(lan, session, msg); if (rv) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure:" " Message decryption failed"); return; } /* Check that the session sequence number is valid. We make sure it is within 8 of the last highest received sequence number, per the spec. */ if (msg->rmcpp.authenticated) seq = &session->recv_seq; else seq = &session->unauth_recv_seq; diff = msg->seq - *seq; if ((diff < -16) || (diff > 15)) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Normal session message failure: SEQ out of range"); return; } /* We wait until after the message is authenticated to set the sequence number, to prevent spoofing. */ if (msg->seq > *seq) *seq = msg->seq; } if (payload_handlers[msg->rmcpp.payload]) payload_handlers[msg->rmcpp.payload](lan, msg); } static void ipmi_handle_rmcp_msg(lanserv_data_t *lan, msg_t *msg) { unsigned char *tsid; unsigned char *tseq; if (msg->len < 9) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure: message too short"); return; } tseq = msg->data+0; msg->seq = ipmi_get_uint32(msg->data+0); tsid = msg->data+4; msg->sid = ipmi_get_uint32(msg->data+4); if (msg->authtype != IPMI_AUTHTYPE_NONE) { if (msg->len < 25) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure: message too short"); return; } memcpy(msg->rmcp.authcode_data, msg->data + 8, 16); msg->rmcp.authcode = msg->rmcp.authcode_data; msg->data += 24; msg->len -= 24; } else { msg->rmcp.authcode = NULL; msg->data += 8; msg->len -= 8; } if (msg->len < msg->data[0]) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, msg, "LAN msg failure: Length field invalid"); return; /* The length field is not valid. We allow extra bytes, but reject if not enough. */ } msg->len = msg->data[0]; msg->data++; /* Validate even, non-zero sids here. The odd sids are temporary sessions and get authenticated in that handling. */ if ((msg->sid > 0) && ((msg->sid & 1) == 0)) { /* The "-6, +7" is cheating a little, but we need the last checksum to correctly calculate the code. */ session_t *session = sid_to_session(lan, msg->sid); int rv; int diff; if (session == NULL) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Normal session message failure: Invalid SID"); return; } if (session->rmcpplus) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Normal session message failure:" " RMCP msg on RMCP+ session"); return; } rv = auth_check(session, tsid, tseq, msg->data, msg->len, msg->rmcp.authcode); if (rv) { lan->sysinfo->log(lan->sysinfo, AUTH_FAILED, msg, "Normal session message failure: auth failure"); return; } /* Check that the session sequence number is valid. We make sure it is within 8 of the last highest received sequence number, per the spec. */ diff = msg->seq - session->recv_seq; if ((diff < -8) || (diff > 8)) { lan->sysinfo->log(lan->sysinfo, INVALID_MSG, msg, "Normal session message failure: SEQ out of range"); return; } /* We wait until after the message is authenticated to set the sequence number, to prevent spoofing. */ if (msg->seq > session->recv_seq) session->recv_seq = msg->seq; } handle_ipmi_payload(lan, msg); } void ipmi_handle_lan_msg(lanserv_data_t *lan, uint8_t *data, int len, void *from_addr, int from_len) { msg_t msg; msg.src_addr = from_addr; msg.src_len = from_len; msg.oem_data = 0; if (len < 5) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, &msg, "LAN msg failure: message too short"); return; } if (data[2] != 0xff) { lan->sysinfo->log(lan->sysinfo, LAN_ERR, &msg, "LAN msg failure: seq not ff"); return; /* Sequence # must be ff (no ack) */ } msg.authtype = data[4]; msg.data = data+5; msg.len = len - 5; msg.channel = lan->channel.channel_num; msg.orig_channel = &lan->channel; if (msg.authtype == IPMI_AUTHTYPE_RMCP_PLUS) { ipmi_handle_rmcpp_msg(lan, &msg); } else { ipmi_handle_rmcp_msg(lan, &msg); } } static void ipmi_lan_tick(void *info, unsigned int time_since_last) { lanserv_data_t *lan = info; int i; for (i=1; i<=MAX_SESSIONS; i++) { if (lan->sessions[i].active) { if (lan->sessions[i].time_left <= time_since_last) { msg_t msg = { 0 }; /* A fake message to hold the address. */ msg.src_addr = lan->sessions[i].src_addr; msg.src_len = lan->sessions[i].src_len; lan->sysinfo->log(lan->sysinfo, SESSION_CLOSED, &msg, "Session closed: Closed due to timeout"); close_session(lan, &(lan->sessions[i])); } else { lan->sessions[i].time_left -= time_since_last; } } } } static int read_lan_config(lanserv_data_t *lan) { unsigned int i; persist_t *p; void *data; unsigned int len; long iv; p = read_persist("lanparm.mc%2.2x.%d", ipmi_mc_get_ipmb(lan->channel.mc), lan->channel.channel_num); if (p && !read_persist_data(p, &data, &len, "max_priv_for_cipher")) { if (len > 9) len = 9; memcpy(lan->lanparm.max_priv_for_cipher_suite, data, len); free_persist_data(data); } else { for (i = 0; i < 9; i++) lan->lanparm.max_priv_for_cipher_suite[i] = IPMI_PRIVILEGE_ADMIN | (IPMI_PRIVILEGE_ADMIN << 4); } if (p && !read_persist_int(p, &iv, "privilege_limit")) { lan->channel.privilege_limit_nonv = iv; lan->channel.privilege_limit = iv; } else { lan->channel.privilege_limit_nonv = IPMI_PRIVILEGE_ADMIN; lan->channel.privilege_limit = IPMI_PRIVILEGE_ADMIN; } if (p) free_persist(p); return 0; } static int set_associated_mc(channel_t *chan, uint32_t session_id, unsigned int payload, lmc_data_t *mc, uint16_t *port, void (*close)(lmc_data_t *mc, uint32_t session_id, void *cb_data), void *cb_data) { lanserv_data_t *lan = chan->chan_info; session_t *session = sid_to_session(lan, session_id); lmc_data_t *emc; if (payload >= LANSERV_NUM_CLOSERS) return EINVAL; if (!session) return EINVAL; emc = session->closers[payload].mc; if (emc && mc && (mc != emc)) return EBUSY; session->closers[payload].close_cb = close; session->closers[payload].close_cb_data = cb_data; session->closers[payload].mc = mc; if (port) *port = lan->port; return 0; } static lmc_data_t * get_associated_mc(channel_t *chan, uint32_t session_id, unsigned int payload) { lanserv_data_t *lan = chan->chan_info; session_t *session = sid_to_session(lan, session_id); if (payload >= LANSERV_NUM_CLOSERS) return NULL; return session->closers[payload].mc; } int ipmi_lan_init(lanserv_data_t *lan) { unsigned int i; int rv; uint8_t challenge_data[16]; for (i=0; i<=MAX_SESSIONS; i++) { lan->sessions[i].handle = i; } rv = read_lan_config(lan); if (rv) return rv; lan->lanparm.num_destinations = 0; /* LAN alerts not supported */ lan->lanparm.num_cipher_suites = 15; for (i=0; i<17; i++) lan->lanparm.cipher_suite_entry[i] = i; lan->channel.return_rsp = lan_return_rsp; lan->channel.get_lan_parms = get_lan_config_parms; lan->channel.set_lan_parms = set_lan_config_parms; lan->channel.set_chan_access = set_channel_access; lan->channel.set_associated_mc = set_associated_mc; lan->channel.get_associated_mc = get_associated_mc; lan->channel.has_recv_q = 1; /* Force user 1 to be a null user. */ memset(lan->users[1].username, 0, 16); rv = lan->gen_rand(lan, challenge_data, 16); if (rv) goto out; rv = ipmi_md5_authcode_init(challenge_data, &(lan->challenge_auth), lan, ialloc, ifree); if (rv) goto out; lan->sid_seq = 0; lan->next_challenge_seq = 0; /* Default the timeout to 30 seconds. */ if (lan->default_session_timeout == 0) lan->default_session_timeout = 30; chan_init(&lan->channel); lan->tick_handler.handler = ipmi_lan_tick; lan->tick_handler.info = lan; ipmi_register_tick_handler(&lan->tick_handler); out: return rv; } OpenIPMI-2.0.27/lanserv/OpenIPMI/0000755000175000017500000000000013437611466013230 500000000000000OpenIPMI-2.0.27/lanserv/OpenIPMI/Makefile.am0000644000175000017500000000012612077274675015211 00000000000000 pkginclude_HEADERS = lanserv.h serserv.h serv.h extcmd.h persist.h msg.h \ mcserv.h OpenIPMI-2.0.27/lanserv/OpenIPMI/mcserv.h0000664000175000017500000003264013160276323014617 00000000000000/* * mcserv.h * * MontaVista IPMI LAN server include file * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #ifndef __MCSERV_H #define __MCSERV_H #include #include typedef struct lmc_data_s lmc_data_t; typedef struct solparm_s { int enabled; int bitrate; int bitrate_nonv; int default_bitrate; } solparm_t; typedef struct soldata_s soldata_t; typedef struct ipmi_sol_s { int configured; char *device; /* TCP-specific information. */ const char *tcpdest; const char *tcpport; int do_telnet; int set_in_progress; solparm_t solparm; solparm_t solparm_rollback; void (*update_bitrate)(lmc_data_t *mc); int active; uint32_t session_id; /* A history buffer, hooking to instance 2 will dump it, if it's non-zero */ unsigned int history_size; int history_active; uint32_t history_session_id; /* History is stored in this file is the program fails. */ char *backupfile; int use_rtscts; int readclear; soldata_t *soldata; } ipmi_sol_t; int ipmi_mc_alloc_unconfigured(sys_data_t *sys, unsigned char ipmb, lmc_data_t **rmc); unsigned char ipmi_mc_get_ipmb(lmc_data_t *mc); channel_t **ipmi_mc_get_channelset(lmc_data_t *mc); ipmi_sol_t *ipmi_mc_get_sol(lmc_data_t *mc); startcmd_t *ipmi_mc_get_startcmdinfo(lmc_data_t *mc); user_t *ipmi_mc_get_users(lmc_data_t *mc); pef_data_t *ipmi_mc_get_pef(lmc_data_t *mc); int ipmi_mc_is_power_on(lmc_data_t *mc); void ipmi_mc_destroy(lmc_data_t *mc); void ipmi_mc_disable(lmc_data_t *mc); void ipmi_mc_enable(lmc_data_t *mc); void ipmi_resend_atn(channel_t *chan); msg_t *ipmi_mc_get_next_recv_q(channel_t *chan); int ipmi_emu_set_mc_guid(lmc_data_t *mc, unsigned char guid[16], int force); int ipmi_mc_enable_sel(lmc_data_t *emu, int max_entries, unsigned char flags); int ipmi_mc_add_to_sel(lmc_data_t *emu, unsigned char record_type, unsigned char event[13], unsigned int *recid); int ipmi_mc_add_main_sdr(lmc_data_t *mc, unsigned char *data, unsigned int data_len); int ipmi_mc_add_device_sdr(lmc_data_t *mc, unsigned char lun, unsigned char *data, unsigned int data_len); enum fru_io_cb_op { FRU_IO_READ, FRU_IO_WRITE }; typedef int (*fru_io_cb)(void *cb_data, enum fru_io_cb_op op, unsigned char *data, unsigned int offset, unsigned int length); /* * Add a fru inventory device to the MC. If fru_io_cb is NULL, the data * and length is the initial data for the FRU. Otherwise, fru_io_cb is * called for reads and writes, and the data is the callback data for * fru_io_cb. */ int ipmi_mc_add_fru_data(lmc_data_t *mc, unsigned char device_id, unsigned int length, fru_io_cb fru_io_cb, void *data); /* * Add a fru inventory device to the MC, mapping it to a file at the * given filename, starting in the file at the given offset. */ int ipmi_mc_add_fru_file(lmc_data_t *mc, unsigned char device_id, unsigned int length, unsigned int file_offset, const char *filename); int ipmi_mc_get_fru_data_len(lmc_data_t *mc, unsigned char device_id, unsigned int *length); int ipmi_mc_get_fru_data(lmc_data_t *mc, unsigned char device_id, unsigned int length, unsigned char *data); /* * FRUs have a semaphore that can be use to grant exclusive access. * The semaphore is attempted to get before read and write operations, * if it fails then an error is returned. If something else reads or * writes the FRU, then it should claim the semaphore before posting. */ int ipmi_mc_fru_sem_wait(lmc_data_t *mc, unsigned char device_id); int ipmi_mc_fru_sem_trywait(lmc_data_t *mc, unsigned char device_id); int ipmi_mc_fru_sem_post(lmc_data_t *mc, unsigned char device_id); int ipmi_mc_sensor_set_bit(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char bit, unsigned char value, int gen_event); int ipmi_mc_sensor_set_bit_clr_rest(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char bit, int gen_event); int ipmi_mc_sensor_set_enabled(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char enabled); int ipmi_mc_sensor_set_value(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char value, int gen_event); int ipmi_mc_sensor_set_hysteresis(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char support, unsigned char positive, unsigned char negative); int ipmi_mc_sensor_set_threshold(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char support, uint16_t supported, int set_values, unsigned char values[6]); int ipmi_mc_sensor_add_rearm_handler(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, int (*handler)(void *cb_data, uint16_t assert, uint16_t deassert), void *cb_data); int ipmi_mc_sensor_set_event_support(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char init_events, unsigned char events_enable, unsigned char init_scanning, unsigned char scanning_enable, unsigned char support, uint16_t assert_supported, uint16_t deassert_supported, uint16_t assert_enabled, uint16_t deassert_enabled); struct ipmi_sensor_handler_s { char *name; int (*poll)(void *cb_data, unsigned int *val, const char **errstr); int (*init)(lmc_data_t *mc, unsigned char lun, unsigned char sensor_num, char **toks, void *cb_data, void **rcb_data, const char **errstr); int (*postinit)(void *cb_data, const char **errstr); void *cb_data; struct ipmi_sensor_handler_s *next; }; typedef struct ipmi_sensor_handler_s ipmi_sensor_handler_t; int ipmi_sensor_add_handler(ipmi_sensor_handler_t *handler); ipmi_sensor_handler_t *ipmi_sensor_find_handler(const char *name); int ipmi_mc_add_sensor(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char type, unsigned char event_reading_code, int event_only); int ipmi_mc_add_polled_sensor(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char type, unsigned char event_reading_code, unsigned int poll_rate, int (*poll)(void *cb_data, unsigned int *val, const char **errstr), void *cb_data); int ipmi_mc_set_power(lmc_data_t *mc, unsigned char power, int gen_int); int ipmi_mc_set_num_leds(lmc_data_t *mc, unsigned int count); void ipmi_emu_set_device_id(lmc_data_t *emu, unsigned char device_id); unsigned char ipmi_emu_get_device_id(lmc_data_t *emu); void ipmi_set_has_device_sdrs(lmc_data_t *emu, unsigned char has_device_sdrs); unsigned char ipmi_get_has_device_sdrs(lmc_data_t *emu); void ipmi_set_device_revision(lmc_data_t *emu, unsigned char device_revision); unsigned char ipmi_get_device_revision(lmc_data_t *emu); void ipmi_set_major_fw_rev(lmc_data_t *emu, unsigned char major_fw_rev); unsigned char ipmi_get_major_fw_rev(lmc_data_t *emu); void ipmi_set_minor_fw_rev(lmc_data_t *emu, unsigned char minor_fw_rev); unsigned char ipmi_get_minor_fw_rev(lmc_data_t *emu); void ipmi_set_device_support(lmc_data_t *emu, unsigned char device_support); unsigned char ipmi_get_device_support(lmc_data_t *emu); void ipmi_set_mfg_id(lmc_data_t *emu, unsigned char mfg_id[3]); void ipmi_get_mfg_id(lmc_data_t *emu, unsigned char mfg_id[3]); void ipmi_set_product_id(lmc_data_t *emu, unsigned char product_id[3]); void ipmi_get_product_id(lmc_data_t *emu, unsigned char product_id[3]); void ipmi_set_chassis_control_prog(lmc_data_t *mc, const char *prog); void read_persist_users(sys_data_t *sys); int write_persist_users(sys_data_t *sys); int read_sol_config(sys_data_t *sys); int write_sol_config(lmc_data_t *mc); int sol_read_config(char **tokptr, sys_data_t *sys, const char **err); int ipmi_mc_users_changed(lmc_data_t *mc); /* * Types and functions for registering handlers with the MC emulator. */ typedef void (*cmd_handler_f)(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data); int ipmi_emu_register_cmd_handler(unsigned char netfn, unsigned char cmd, cmd_handler_f handler, void *cb_data); /* * Note that for IANA command handlers the IANA is stripped (and put into * msg->iana) before being passed to the handler, and inserted into the * response message automatically. So the handler should handle this * like a normal message, setting the data and length as if the IANA was * not there. This way standard handling functions will work properly, * and it simplifies the handling of IANA messages. */ int ipmi_emu_register_iana_handler(uint32_t iana, cmd_handler_f handler, void *cb_data); int ipmi_emu_register_oi_iana_handler(uint8_t cmd, cmd_handler_f handler, void *cb_data); #define OPENIPMI_IANA_CMD_SET_HISTORY_RETURN_SIZE 1 #define OPENIPMI_IANA_CMD_GET_HISTORY_RETURN_SIZE 2 /* * SOL handling */ void ipmi_sol_activate(lmc_data_t *mc, channel_t *channel, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len); void ipmi_sol_deactivate(lmc_data_t *mc, channel_t *channel, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len); int sol_init_mc(sys_data_t *sys, lmc_data_t *mc); int sol_init(sys_data_t *sys); unsigned char *sol_set_frudata(lmc_data_t *mc, unsigned int *size); void sol_free_frudata(lmc_data_t *mc, unsigned char *data); typedef unsigned char *(*get_frudata_f)(lmc_data_t *mc, unsigned int *size); typedef void (*free_frudata_f)(lmc_data_t *mc, unsigned char *data); int ipmi_mc_set_frudata_handler(lmc_data_t *mc, unsigned int fru, get_frudata_f handler, free_frudata_f freefunc); #define CHASSIS_CONTROL_POWER 0 #define CHASSIS_CONTROL_RESET 1 #define CHASSIS_CONTROL_BOOT 2 #define CHASSIS_CONTROL_BOOT_INFO_ACK 3 #define CHASSIS_CONTROL_GRACEFUL_SHUTDOWN 4 #define CHASSIS_CONTROL_IDENTIFY 5 void ipmi_mc_set_chassis_control_func(lmc_data_t *mc, int (*set)(lmc_data_t *mc, int op, unsigned char *val, void *cb_data), int (*get)(lmc_data_t *mc, int op, unsigned char *val, void *cb_data), void *cb_data); /* * Message handling. */ void handle_invalid_cmd(lmc_data_t *mc, unsigned char *rdata, unsigned int *rdata_len); int check_msg_length(msg_t *msg, unsigned int len, unsigned char *rdata, unsigned int *rdata_len); void ipmi_mc_set_dev_revision(lmc_data_t *mc, unsigned char dev_revision); void ipmi_mc_set_fw_revision(lmc_data_t *mc, unsigned char fw_revision_major, unsigned char fw_revision_minor); void ipmi_mc_set_aux_fw_revision(lmc_data_t *mc, unsigned char aux_fw_revision[4]); const char *get_lanserv_version(void); #endif /* __MCSERV_H */ OpenIPMI-2.0.27/lanserv/OpenIPMI/extcmd.h0000664000175000017500000000702612516267655014620 00000000000000/* * extcmd.h * * MontaVista IPMI IPMI LAN interface extern command handler * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #ifndef _EXTCMD_H_ #define _EXTCMD_H_ #include #include enum extcmd_info_type_e { extcmd_ip, extcmd_mac, extcmd_uchar, extcmd_int, extcmd_ident, }; typedef struct extcmd_map_s { int value; char *name; } extcmd_map_t; #define extcmdglue(a, b) a ## b #define EXTCMD_MEMB(name, type) \ [extcmdglue(name, _o)] = { #name, type, NULL, offsetof(BASETYPE, name) } #define EXTCMD_MEMB_MAPUCHAR(name, map) \ [extcmdglue(name, _o)] = { #name, extcmd_uchar, map, \ offsetof(BASETYPE, name) } typedef struct extcmd_info_s { const char *name; enum extcmd_info_type_e type; extcmd_map_t *map; size_t offset; } extcmd_info_t; int extcmd_getvals(sys_data_t *sys, void *baseloc, const char *cmd, extcmd_info_t *ts, unsigned int count); int extcmd_setvals(sys_data_t *sys, void *baseloc, const char *cmd, extcmd_info_t *ts, unsigned char *setit, unsigned int count); int extcmd_checkvals(sys_data_t *sys, void *baseloc, const char *cmd, extcmd_info_t *ts, unsigned int count); #endif /* _EXTCMD_H_ */ OpenIPMI-2.0.27/lanserv/OpenIPMI/msg.h0000644000175000017500000000763313364062612014110 00000000000000/* * serv.h * * MontaVista IPMI server include file * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005,2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #ifndef __MSG_H_ #define __MSG_H_ #include typedef struct channel_s channel_t; typedef struct msg_s { void *src_addr; int src_len; long oem_data; /* For use by OEM handlers. This will be set to zero by the calling code. */ unsigned char channel; /* The channel the message originally came in on. */ channel_t *orig_channel; unsigned char authtype; uint32_t seq; uint32_t sid; union { struct { /* RMCP parms */ unsigned char *authcode; unsigned char authcode_data[16]; } rmcp; struct { /* RMCP+ parms */ unsigned char payload; unsigned char encrypted; unsigned char authenticated; unsigned char iana[3]; uint16_t payload_id; unsigned char *authdata; unsigned int authdata_len; } rmcpp; }; unsigned char netfn; unsigned char rs_addr; unsigned char rs_lun; unsigned char rq_addr; unsigned char rq_lun; unsigned char rq_seq; unsigned char cmd; unsigned char *data; unsigned int len; uint32_t iana; /* Set for IANA commands */ struct msg_s *next; } msg_t; #define IPMI_SIM_MAX_MSG_LENGTH 255 typedef struct rsp_msg { uint8_t netfn; uint8_t cmd; unsigned short data_len; uint8_t *data; } rsp_msg_t; typedef struct sys_data_s sys_data_t; typedef struct startcmd_s startcmd_t; typedef struct user_s user_t; typedef struct pef_data_s pef_data_t; #endif /* __MSG_H_ */ OpenIPMI-2.0.27/lanserv/OpenIPMI/serserv.h0000644000175000017500000000770212077274675015026 00000000000000/* * serserv.h * * MontaVista IPMI serial server include file * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #ifndef __SERSERV_H #define __SERSERV_H #include #include typedef struct serserv_data_s serserv_data_t; typedef struct ser_codec_s { const char *name; void (*handle_char)(unsigned char ch, serserv_data_t *si); void (*send)(msg_t *msg, serserv_data_t *si); int (*setup)(serserv_data_t *si); void (*connected)(serserv_data_t *si); void (*disconnected)(serserv_data_t *si); } ser_codec_t; typedef struct ser_oem_handler_s { const char *name; int (*handler)(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len); void (*init)(serserv_data_t *si); } ser_oem_handler_t; struct serserv_data_s { lan_addr_t addr; channel_t channel; os_handler_t *os_hnd; sys_data_t *sysinfo; void *user_info; int bind_fd; int con_fd; int connected; void (*send_out)(serserv_data_t *si, unsigned char *data, unsigned int data_len); ser_codec_t *codec; void *codec_info; ser_oem_handler_t *oem; void *oem_info; /* Settings */ int debug; unsigned int do_connect : 1; unsigned int echo : 1; unsigned int do_attn : 1; unsigned char my_ipmb; unsigned char global_enables; unsigned char attn_chars[8]; unsigned int attn_chars_len; }; int serserv_read_config(char **tokptr, sys_data_t *sys, const char **errstr); int serserv_init(serserv_data_t *ser); void serserv_handle_data(serserv_data_t *ser, uint8_t *data, unsigned int len); #endif /* __SERSERV_H */ OpenIPMI-2.0.27/lanserv/OpenIPMI/serv.h0000664000175000017500000004117513160051266014277 00000000000000/* * serv.h * * MontaVista IPMI server include file * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005,2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #ifndef __SERV_H_ #define __SERV_H_ #include #include #include /* for iovec */ #include #include #include #include #include #include #include #include #ifndef __GNUC__ # ifndef __attribute__ # define __attribute__(x) /*NOTHING*/ # endif #endif typedef void (*handle_oem_cb)(channel_t *chan, void *cb_data); typedef struct oem_handler_s { unsigned int manufacturer_id; unsigned int product_id; handle_oem_cb handler; void *cb_data; struct oem_handler_s *next; } oem_handler_t; /* Register a new OEM handler. */ void ipmi_register_oem(oem_handler_t *handler); typedef struct oem_handlers_s { void *oem_data; void *user_data; /* IPMB address changed. Can be called by OEM code if it detects an IPMB address change. It should be ignored if NULL. */ void (*ipmb_addr_change)(channel_t *chan, unsigned char addr); /* Do OEM message handling; this is called after the message is authenticated. Should return 0 if the standard handling should continue, or non-zero if the message should not go through normal handling. This field may be NULL, and it will be ignored. */ int (*oem_handle_msg)(channel_t *chan, msg_t *msg); /* Called before a response is sent. Should return 0 if the standard handling should continue, or non-zero if the OEM handled the response itself. */ int (*oem_handle_rsp)(channel_t *chan, msg_t *msg, rsp_msg_t *rsp); /* Check the privilege of a command to see if it is permitted. */ int (*oem_check_permitted)(unsigned char priv, unsigned char netfn, unsigned char cmd); } oem_handlers_t; #define IPMI_MAX_CHANNELS 16 #define NUM_PRIV_LEVEL 4 struct channel_s { lmc_data_t *mc; unsigned char medium_type; unsigned char protocol_type; unsigned char session_support; unsigned int PEF_alerting : 1; unsigned int PEF_alerting_nonv : 1; unsigned int per_msg_auth : 1; /* We don't support user-level authentication disable, and access mode is always available and cannot be set. */ unsigned int privilege_limit : 4; unsigned int privilege_limit_nonv : 4; #define MAX_SESSIONS 63 unsigned int active_sessions : 6; struct { unsigned char allowed_auths; } priv_info[NUM_PRIV_LEVEL]; /* Information about the MC we are hooked to. */ unsigned int manufacturer_id; unsigned int product_id; unsigned int channel_num; int has_recv_q; msg_t *recv_q_head; msg_t *recv_q_tail; /* Used by channel code. */ void (*log)(channel_t *chan, int logtype, msg_t *msg, const char *format, ...) __attribute__ ((__format__ (__printf__, 4, 5))); int (*smi_send)(channel_t *chan, msg_t *msg); void *(*alloc)(channel_t *chan, int size); void (*free)(channel_t *chan, void *data); /* Set by channel code */ void (*return_rsp)(channel_t *chan, msg_t *msg, rsp_msg_t *rsp); /* Available for the specific channel code. */ void *chan_info; /* Set or clear the attn flag. If irq is set, set/clear the irq. */ void (*set_atn)(channel_t *chan, int val, int irq); /* Something is about to be added to the receive queue. If this returns true, then this function consumed the message and it shouldn't be queued. */ int (*recv_in_q)(channel_t *chan, msg_t *msg); void (*start_cmd)(channel_t *chan); void (*stop_cmd)(channel_t *chan, int do_it_now); /* Perform some hardware operations. */ #define HW_OP_RESET 0 #define HW_OP_POWERON 1 #define HW_OP_POWEROFF 2 #define HW_OP_SEND_NMI 3 #define HW_OP_IRQ_ENABLE 4 #define HW_OP_IRQ_DISABLE 5 #define HW_OP_GRACEFUL_SHUTDOWN 6 #define HW_OP_CHECK_POWER 7 unsigned int hw_capabilities; /* Bitmask of above bits for capabilities. */ #define HW_OP_CAN_RESET(chan) ((chan)->hw_capabilities & (1 << HW_OP_RESET)) #define HW_OP_CAN_POWER(chan) ((chan)->hw_capabilities & (1 << HW_OP_POWERON)) #define HW_OP_CAN_NMI(chan) ((chan)->hw_capabilities & (1 << HW_OP_SEND_NMI)) #define HW_OP_CAN_IRQ(chan) ((chan)->hw_capabilities & (1 << HW_OP_IRQ_ENABLE)) #define HW_OP_CAN_GRACEFUL_SHUTDOWN(chan) ((chan)->hw_capabilities & \ (1 << HW_OP_GRACEFUL_SHUTDOWN)) int (*hw_op)(channel_t *chan, unsigned int op); /* Special command handlers. */ void (*set_lan_parms)(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len); void (*get_lan_parms)(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len); void (*set_chan_access)(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len); int (*set_associated_mc)(channel_t *chan, uint32_t session_id, unsigned int payload, lmc_data_t *mc, uint16_t *port, void (*close)(lmc_data_t *mc, uint32_t session_id, void *cb_data), void *cb_data); lmc_data_t *(*get_associated_mc)(channel_t *chan, uint32_t session_id, unsigned int payload); oem_handlers_t oem; /* * Set by the low-level interface code if it needs to handle * received messages specially. */ int (*oem_intf_recv_handler)(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len); }; struct user_s { unsigned char valid; unsigned char link_auth; unsigned char cb_only; unsigned char username[16]; unsigned char pw[20]; unsigned char privilege; unsigned char max_sessions; unsigned char curr_sessions; /* Set by the user code. */ int idx; /* My idx in the table. */ }; /* * Restrictions: <=64 users (per spec, 6 bits) */ #define MAX_USERS 63 #define USER_BITS_REQ 6 /* Bits required to hold a user. */ #define USER_MASK 0x3f #define MAX_EVENT_FILTERS 16 #define MAX_ALERT_POLICIES 16 #define MAX_ALERT_STRINGS 16 #define MAX_ALERT_STRING_LEN 64 struct pef_data_s { unsigned int set_in_progress : 2; void (*commit)(sys_data_t *sys); /* Called when the commit occurs. */ unsigned char pef_control; unsigned char pef_action_global_control; unsigned char pef_startup_delay; unsigned char pef_alert_startup_delay; unsigned char num_event_filters; unsigned char event_filter_table[MAX_EVENT_FILTERS][21]; unsigned char event_filter_data1[MAX_EVENT_FILTERS][2]; unsigned char num_alert_policies; unsigned char alert_policy_table[MAX_ALERT_POLICIES][4]; unsigned char system_guid[17]; unsigned char num_alert_strings; unsigned char alert_string_keys[MAX_ALERT_STRINGS][3]; unsigned char alert_strings[MAX_ALERT_STRINGS][MAX_ALERT_STRING_LEN]; /* Tells what has changed, so the commit can do something about it. */ struct { unsigned int pef_control : 1; unsigned int pef_action_global_control : 1; unsigned int pef_startup_delay : 1; unsigned int pef_alert_startup_delay : 1; unsigned int system_guid : 1; unsigned char event_filter_table[MAX_EVENT_FILTERS]; unsigned char event_filter_data1[MAX_EVENT_FILTERS]; unsigned char alert_policy_table[MAX_ALERT_POLICIES]; unsigned int alert_string_keys[MAX_ALERT_STRINGS]; unsigned int alert_strings[MAX_ALERT_STRINGS]; } changed; }; typedef struct ipmi_timer_s ipmi_timer_t; typedef struct ipmi_io_s ipmi_io_t; typedef struct sockaddr_ip_s { union { struct sockaddr s_addr0; struct sockaddr_in s_addr4; #ifdef PF_INET6 struct sockaddr_in6 s_addr6; #endif } s_ipsock; /* socklen_t addr_len;*/ } sockaddr_ip_t; typedef struct lan_addr_s { sockaddr_ip_t addr; socklen_t addr_len; } lan_addr_t; struct startcmd_s { /* Command to start a VM */ char *startcmd; unsigned int startnow; /* Start startcmd at simulator startup? */ unsigned int poweroff_wait_time; unsigned int kill_wait_time; int vmpid; /* Process id of the VM, 0 if not running. */ int wait_poweroff; }; /* * Note that we keep odd addresses, too. In some cases that's useful * in virtual systems that don't have I2C restrictions. */ #define IPMI_MAX_MCS 256 /* * Generic data about the system that is global for the whole system and * required for all server types. */ struct sys_data_s { char *name; /* The MCs in the system */ lmc_data_t *ipmb_addrs[IPMI_MAX_MCS]; #define DEBUG_RAW_MSG (1 << 0) #define DEBUG_MSG (1 << 1) #define DEBUG_SOL (1 << 2) unsigned int debug; #define NEW_SESSION 1 #define NEW_SESSION_FAILED 2 #define SESSION_CLOSED 3 #define SESSION_CHALLENGE 4 #define SESSION_CHALLENGE_FAILED 5 #define AUTH_FAILED 6 #define INVALID_MSG 7 #define OS_ERROR 8 #define LAN_ERR 9 #define INFO 10 #define DEBUG 11 #define SETUP_ERROR 12 void (*log)(sys_data_t *sys, int type, msg_t *msg, const char *format, ...) __attribute__ ((__format__ (__printf__, 4, 5))); /* Console port. Length is zero if not set. */ sockaddr_ip_t console_addr; socklen_t console_addr_len; int console_fd; unsigned char bmc_ipmb; int sol_present; void *info; /* * When reading in config, this tracks which information we are * working on. This is initialized to the MC at 0x20, setting * the working MC changes these to the new MC. */ channel_t **chan_set; startcmd_t *startcmd; user_t *cusers; pef_data_t *cpef; ipmi_sol_t *sol; lmc_data_t *mc; void *(*alloc)(sys_data_t *sys, int size); void (*free)(sys_data_t *sys, void *data); int (*get_monotonic_time)(sys_data_t *sys, struct timeval *tv); int (*get_real_time)(sys_data_t *sys, struct timeval *tv); int (*alloc_timer)(sys_data_t *sys, void (*cb)(void *cb_data), void *cb_data, ipmi_timer_t **timer); int (*start_timer)(ipmi_timer_t *timer, struct timeval *timeout); int (*stop_timer)(ipmi_timer_t *timer); void (*free_timer)(ipmi_timer_t *timer); int (*add_io_hnd)(sys_data_t *sys, int fd, void (*read_hnd)(int fd, void *cb_data), void *cb_data, ipmi_io_t **io); void (*remove_io_hnd)(ipmi_io_t *io); void (*io_set_hnds)(ipmi_io_t *io, void (*write_hnd)(int fd, void *cb_data), void (*except_hnd)(int fd, void *cb_data)); void (*io_set_enables)(ipmi_io_t *io, int read, int write, int except); int (*gen_rand)(sys_data_t *sys, void *data, int len); /* Called by interface code to report that the target did a reset. */ /* FIXME - move */ void (*target_reset)(sys_data_t *sys); /* * These are a hack so the channel code in the MCs can pick up * these functions. */ void (*clog)(channel_t *chan, int logtype, msg_t *msg, const char *format, ...); int (*csmi_send)(channel_t *chan, msg_t *msg); void *(*calloc)(channel_t *chan, int size); void (*cfree)(channel_t *chan, void *data); int (*lan_channel_init)(void *info, channel_t *chan); int (*ser_channel_init)(void *info, channel_t *chan); }; static inline void zero_extend_ascii(uint8_t *c, unsigned int len) { unsigned int i; i = 0; while ((i < len) && (*c != 0)) { c++; i++; } while (i < len) { *c = 0; c++; i++; } } typedef struct ipmi_tick_handler_s { void (*handler)(void *info, unsigned int seconds); void *info; struct ipmi_tick_handler_s *next; } ipmi_tick_handler_t; void ipmi_register_tick_handler(ipmi_tick_handler_t *handler); typedef struct ipmi_child_quit_s { void (*handler)(void *info, pid_t pid); void *info; struct ipmi_child_quit_s *next; } ipmi_child_quit_t; void ipmi_register_child_quit_handler(ipmi_child_quit_t *handler); typedef struct ipmi_shutdown_s { void (*handler)(void *info, int sig); void *info; struct ipmi_shutdown_s *next; } ipmi_shutdown_t; void ipmi_register_shutdown_handler(ipmi_shutdown_t *handler); /* A helper function to allow OEM code to send messages. */ int ipmi_oem_send_msg(channel_t *chan, unsigned char netfn, unsigned char cmd, unsigned char *data, unsigned int len, long oem_data); void ipmi_handle_smi_rsp(channel_t *chan, msg_t *msg, unsigned char *rsp, int rsp_len); int channel_smi_send(channel_t *chan, msg_t *msg); /* * Start the "startcmd" specified in the configuration file. */ void ipmi_do_start_cmd(startcmd_t *startcmd); void ipmi_do_kill(startcmd_t *startcmd, int noblock); int chan_init(channel_t *chan); void sysinfo_init(sys_data_t *sys); #define MAX_CONFIG_LINE 1024 const char *mystrtok(char *str, const char *delim, char **next); /* * Note that "value" must be dynamically allocated. "name" does not have * to be. */ int add_variable(const char *name, char *value); const char *find_bvariable(const char *name); int get_delim_str(char **rtokptr, char **rval, const char **err); int get_bool(char **tokptr, unsigned int *rval, const char **err); int get_uint(char **tokptr, unsigned int *rval, const char **err); int get_int(char **tokptr, int *rval, const char **err); int get_priv(char **tokptr, unsigned int *rval, const char **err); int get_auths(char **tokptr, unsigned int *rval, const char **err); int read_bytes(char **tokptr, unsigned char *data, const char **err, unsigned int len); int get_sock_addr(char **tokptr, sockaddr_ip_t *addr, socklen_t *len, char *def_port, int socktype, const char **err); int read_config(sys_data_t *sys, char *config_file, int print_version); int load_dynamic_libs(sys_data_t *sys, int print_version); void post_init_dynamic_libs(sys_data_t *sys); void debug_log_raw_msg(sys_data_t *sys, unsigned char *data, unsigned int len, const char *format, ...); unsigned int ipmi_get_uint16(uint8_t *data); void ipmi_set_uint16(uint8_t *data, int val); unsigned int ipmi_get_uint32(uint8_t *data); void ipmi_set_uint32(uint8_t *data, int val); uint8_t ipmb_checksum(uint8_t *data, int size, uint8_t start); /* * Command handler interface. */ typedef struct emu_data_s emu_data_t; typedef struct emu_out_s { void (*eprintf)(struct emu_out_s *out, char *format, ...); void *data; } emu_out_t; #define MC 1 #define NOMC 0 typedef int (*ipmi_emu_cmd_handler)(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks); int ipmi_emu_add_cmd(const char *name, unsigned int flags, ipmi_emu_cmd_handler handler); #endif /* __SERV_H_ */ OpenIPMI-2.0.27/lanserv/OpenIPMI/Makefile.in0000644000175000017500000004443313437611454015222 00000000000000# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lanserv/OpenIPMI ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/ax_config_feature.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_python_version.m4 \ $(top_srcdir)/m4/ax_python_devel.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIBTEX = @BIBTEX@ BUILD_CC = @BUILD_CC@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIA = @DIA@ DIA_FILTER_NAME = @DIA_FILTER_NAME@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DVIPDF = @DVIPDF@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GDBM_LIB = @GDBM_LIB@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_DIR = @GLIB_DIR@ GLIB_LIB = @GLIB_LIB@ GLIB_LIBS = @GLIB_LIBS@ GLIB_PKGCONF = @GLIB_PKGCONF@ GLIB_SO = @GLIB_SO@ GLIB_TARGET = @GLIB_TARGET@ GLIB_VERSION = @GLIB_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MARVELL_BMC_DIR = @MARVELL_BMC_DIR@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENIPMI_SWIG_LIBS = @OPENIPMI_SWIG_LIBS@ OPENIPMI_SWIG_SO = @OPENIPMI_SWIG_SO@ OPENIPMI_VERSION_EXTRA = @OPENIPMI_VERSION_EXTRA@ OPENIPMI_VERSION_MAJOR = @OPENIPMI_VERSION_MAJOR@ OPENIPMI_VERSION_MINOR = @OPENIPMI_VERSION_MINOR@ OPENIPMI_VERSION_RELEASE = @OPENIPMI_VERSION_RELEASE@ OPENSSLINCS = @OPENSSLINCS@ OPENSSLLIBS = @OPENSSLLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_DIR = @PERL_DIR@ PERL_HAS_POSIX_THREADS = @PERL_HAS_POSIX_THREADS@ PERL_INSTALL_DIR = @PERL_INSTALL_DIR@ PERL_POSIX_LIB = @PERL_POSIX_LIB@ PERL_POSIX_SO = @PERL_POSIX_SO@ POPTLIBS = @POPTLIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_DIR = @PYTHON_DIR@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_GUI_DIR = @PYTHON_GUI_DIR@ PYTHON_HAS_POSIX_THREADS = @PYTHON_HAS_POSIX_THREADS@ PYTHON_INSTALL_DIR = @PYTHON_INSTALL_DIR@ PYTHON_INSTALL_LIB_DIR = @PYTHON_INSTALL_LIB_DIR@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_POSIX_LIB = @PYTHON_POSIX_LIB@ PYTHON_POSIX_SO = @PYTHON_POSIX_SO@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_SWIG_FLAGS = @PYTHON_SWIG_FLAGS@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RT_LIB = @RT_LIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNMPLIBS = @SNMPLIBS@ SOCKETLIB = @SOCKETLIB@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_DIR = @SWIG_DIR@ SWIG_LIB = @SWIG_LIB@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_DIR = @TCL_DIR@ TCL_LIB = @TCL_LIB@ TCL_LIBS = @TCL_LIBS@ TCL_PKGCONF = @TCL_PKGCONF@ TCL_SO = @TCL_SO@ TCL_TARGET = @TCL_TARGET@ TERM_LIBS = @TERM_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ diaprog = @diaprog@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlprog = @perlprog@ pkgprog = @pkgprog@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkginclude_HEADERS = lanserv.h serserv.h serv.h extcmd.h persist.h msg.h \ mcserv.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lanserv/OpenIPMI/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lanserv/OpenIPMI/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-pkgincludeHEADERS install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-pkgincludeHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: OpenIPMI-2.0.27/lanserv/OpenIPMI/lanserv.h0000644000175000017500000002123513042716522014765 00000000000000/* * lanserv.h * * MontaVista IPMI LAN server include file * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #ifndef __LANSERV_H #define __LANSERV_H #include #include #ifdef __cplusplus extern "C" { #endif /* * Restrictions: <=64 sessions */ #define SESSION_BITS_REQ 6 /* Bits required to hold a session. */ #define SESSION_MASK 0x3f typedef struct session_s session_t; typedef struct lanserv_data_s lanserv_data_t; typedef struct integ_handlers_s { int (*init)(lanserv_data_t *lan, session_t *session); void (*cleanup)(lanserv_data_t *lan, session_t *session); int (*add)(lanserv_data_t *lan, session_t *session, unsigned char *pos, unsigned int *data_len, unsigned int data_size); int (*check)(lanserv_data_t *lan, session_t *session, msg_t *msg); } integ_handlers_t; typedef struct conf_handlers_s { int (*init)(lanserv_data_t *lan, session_t *session); void (*cleanup)(lanserv_data_t *lan, session_t *session); int (*encrypt)(lanserv_data_t *lan, session_t *session, unsigned char **pos, unsigned int *hdr_left, unsigned int *data_len, unsigned int *data_size); int (*decrypt)(lanserv_data_t *lan, session_t *session, msg_t *msg); } conf_handlers_t; typedef struct auth_handlers_s { int (*init)(lanserv_data_t *lan, session_t *session); int (*set2)(lanserv_data_t *lan, session_t *session, unsigned char *data, unsigned int *data_len, unsigned int max_len); int (*check3)(lanserv_data_t *lan, session_t *session, unsigned char *data, unsigned int *data_len); int (*set4)(lanserv_data_t *lan, session_t *session, unsigned char *data, unsigned int *data_len, unsigned int max_len); } auth_handlers_t; typedef struct auth_data_s { unsigned char rand[16]; unsigned char rem_rand[16]; unsigned char role; unsigned char username_len; unsigned char username[16]; unsigned char sik[20]; unsigned char k1[20]; unsigned char k2[20]; unsigned int akey_len; unsigned int integ_len; void *adata; const void *akey; unsigned int ikey_len; void *idata; const void *ikey; const void *ikey2; unsigned int ckey_len; void *cdata; const void *ckey; } auth_data_t; #define LANSERV_NUM_CLOSERS 3 struct session_s { unsigned int active : 1; unsigned int in_startup : 1; unsigned int rmcpplus : 1; int handle; /* My index in the table. */ uint32_t recv_seq; uint32_t xmit_seq; uint32_t sid; unsigned char userid; /* RMCP data */ unsigned char authtype; ipmi_authdata_t authdata; /* RMCP+ data */ uint32_t unauth_recv_seq; uint32_t unauth_xmit_seq; uint32_t rem_sid; unsigned int auth; unsigned int conf; unsigned int integ; integ_handlers_t *integh; conf_handlers_t *confh; auth_handlers_t *authh; auth_data_t auth_data; unsigned char priv; unsigned char max_priv; /* The number of seconds left before the session is shut down. */ unsigned int time_left; /* Address of the message that started the sessions. */ void *src_addr; int src_len; struct { /* Function to call when the session closes */ void (*close_cb)(lmc_data_t *mc, uint32_t session_id, void *cb_data); void *close_cb_data; /* The MC associated with the RMCP session activation, used for SOL. */ lmc_data_t *mc; } closers[3]; }; typedef struct lanparm_data_s lanparm_data_t; struct lanparm_data_s { unsigned int set_in_progress : 2; unsigned int num_destinations : 4; /* Read-only */ unsigned char ip_addr_src; unsigned char ip_addr[4]; unsigned char mac_addr[6]; unsigned char subnet_mask[4]; unsigned char default_gw_ip_addr[4]; unsigned char default_gw_mac_addr[6]; unsigned char backup_gw_ip_addr[4]; unsigned char backup_gw_mac_addr[6]; /* FIXME - we don't handle these now. */ unsigned char ipv4_hdr_parms[3]; unsigned char vlan_id[2]; unsigned char vlan_priority; unsigned int num_cipher_suites : 4; unsigned char cipher_suite_entry[17]; unsigned char max_priv_for_cipher_suite[9]; }; enum lanread_e { ip_addr_o, ip_addr_src_o, mac_addr_o, subnet_mask_o, default_gw_ip_addr_o, default_gw_mac_addr_o, backup_gw_ip_addr_o, backup_gw_mac_addr_o, lanread_len }; struct lanserv_data_s { sys_data_t *sysinfo; ipmi_tick_handler_t tick_handler; unsigned char *guid; channel_t channel; /* user 0 is not used. */ user_t *users; pef_data_t *pef; /* The amount of time in seconds before a session will be shut down if there is no activity. */ unsigned int default_session_timeout; unsigned char *bmc_key; void *user_info; /* Set by the user code, used to actually send a raw message out the UDP socket */ void (*send_out)(lanserv_data_t *lan, struct iovec *data, int vecs, void *addr, int addr_len); /* Generate 'size' bytes of random data into 'data'. */ int (*gen_rand)(lanserv_data_t *lan, void *data, int size); /* Don't fill in the below in the user code. */ /* session 0 is not used. */ session_t sessions[MAX_SESSIONS+1]; /* Used to make the sid somewhat unique. */ uint32_t sid_seq; ipmi_authdata_t challenge_auth; unsigned int next_challenge_seq; lanparm_data_t lanparm; unsigned char lanparm_changed[lanread_len]; unsigned int persist_changed; lanparm_data_t lanparm_rollback; /* Used to access and set the external LAN config items. */ char *config_prog; lan_addr_t lan_addr; int lan_addr_set; uint16_t port; }; void handle_asf(lanserv_data_t *lan, unsigned char *data, int len, void *from_addr, int from_len); void ipmi_handle_lan_msg(lanserv_data_t *lan, unsigned char *data, int len, void *from_addr, int from_len); /* Read in a configuration file and fill in the lan and address info. */ int lanserv_read_config(sys_data_t *sys, FILE *f, int *line, unsigned int channel_num); int ipmi_lan_init(lanserv_data_t *lan); typedef void (*ipmi_payload_handler_cb)(lanserv_data_t *lan, msg_t *msg); int ipmi_register_payload(unsigned int payload_id, ipmi_payload_handler_cb handler); #ifdef __cplusplus } #endif #endif /* __LANSERV_H */ OpenIPMI-2.0.27/lanserv/OpenIPMI/persist.h0000644000175000017500000000770612236440517015015 00000000000000/* * persist.h * * MontaVista IPMI LAN server persistence tool * * Author: MontaVista Software, LLC. * Corey Minyard * source@mvista.com * * Copyright 2012 MontaVista Software LLC. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #ifndef __PERSIST_H__ #define __PERSIST_H__ typedef struct persist_s persist_t; int persist_init(const char *app, const char *instance, const char *basedir); persist_t *alloc_persist(const char *name, ...); persist_t *read_persist(const char *name, ...); int write_persist(persist_t *p); int write_persist_file(persist_t *p, FILE *f); void free_persist(persist_t *p); int add_persist_data(persist_t *p, void *data, unsigned int len, const char *name, ...); int read_persist_data(persist_t *p, void **data, unsigned int *len, const char *name, ...); int add_persist_int(persist_t *p, long val, const char *name, ...); int read_persist_int(persist_t *p, long *val, const char *name, ...); int add_persist_str(persist_t *p, const char *val, const char *name, ...); int read_persist_str(persist_t *p, char **val, const char *name, ...); /* * Iterate over all the values in the persist. Call the data function * for each data or string entry, and call the int function for each * integer. */ #define ITER_PERSIST_CONTINUE 0 #define ITER_PERSIST_STOP 1 int iterate_persist(persist_t *p, void *cb_data, int (*data_func)(const char *name, void *data, unsigned int len, void *cb_data), int (*int_func)(const char *name, long val, void *cb_data)); /* Free the values return by read_persist_data() and read_persist_str() */ void free_persist_data(void *data); void free_persist_str(char *str); /* Can be set to zero to disable persistence. */ extern int persist_enable; #endif /* __PERSIST_H__ */ OpenIPMI-2.0.27/lanserv/bmc_storage.c0000644000175000017500000013726513414036033014221 00000000000000/* * bmc_storage.c * * MontaVista IPMI code for emulating a MC. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2012 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include "bmc.h" #include #include #include #include #include #include #include #include #include #include #include /* * SEL handling commands. */ #define IPMI_SEL_SUPPORTS_DELETE (1 << 3) #define IPMI_SEL_SUPPORTS_RESERVE (1 << 1) #define IPMI_SEL_SUPPORTS_GET_ALLOC_INFO (1 << 0) static sel_entry_t * find_sel_event_by_recid(lmc_data_t *mc, uint16_t record_id, sel_entry_t **prev) { sel_entry_t *entry; sel_entry_t *p_entry = NULL; entry = mc->sel.entries; while (entry) { if (record_id == entry->record_id) break; p_entry = entry; entry = entry->next; } if (prev) *prev = p_entry; return entry; } static int handle_sel(const char *name, void *data, unsigned int len, void *cb_data) { sel_entry_t *e, *n; lmc_data_t *mc = cb_data; if (len != 16) { mc->sysinfo->log(mc->sysinfo, INFO, NULL, "Got invalid SEL entry for %2.2x, name is %s", ipmi_mc_get_ipmb(mc), name); goto out; } n = malloc(sizeof(*n)); if (!n) return ENOMEM; memcpy(n->data, data, 16); n->record_id = n->data[0] | (n->data[1] << 8); n->next = NULL; e = mc->sel.entries; if (!e) mc->sel.entries = n; else { while (e->next) e = e->next; e->next = n; } mc->sel.count++; out: return ITER_PERSIST_CONTINUE; } static int handle_sel_time(const char *name, long val, void *cb_data) { lmc_data_t *mc = cb_data; if (strcmp(name, "last_add_time") == 0) mc->sel.last_add_time = val; else if (strcmp(name, "last_erase_time") == 0) mc->sel.last_erase_time = val; return ITER_PERSIST_CONTINUE; } int ipmi_mc_enable_sel(lmc_data_t *mc, int max_entries, unsigned char flags) { persist_t *p; mc->sel.entries = NULL; mc->sel.count = 0; mc->sel.max_count = max_entries; mc->sel.last_add_time = 0; mc->sel.last_erase_time = 0; mc->sel.flags = flags & 0xb; mc->sel.reservation = 0; mc->sel.next_entry = 1; p = read_persist("sel.%2.2x", ipmi_mc_get_ipmb(mc)); if (!p) return 0; iterate_persist(p, mc, handle_sel, handle_sel_time); free_persist(p); return 0; } static void rewrite_sels(lmc_data_t *mc) { persist_t *p = NULL; sel_entry_t *e; int err; p = alloc_persist("sel.%2.2x", ipmi_mc_get_ipmb(mc)); if (!p) { err = ENOMEM; goto out_err; } err = add_persist_int(p, mc->sel.last_add_time, "last_add_time"); if (err) goto out_err; err = add_persist_int(p, mc->sel.last_erase_time, "last_erase_time"); if (err) goto out_err; for (e = mc->sel.entries; e; e = e->next) { err = add_persist_data(p, e->data, 16, "%d", e->record_id); if (err) goto out_err; } err = write_persist(p); if (err) goto out_err; free_persist(p); return; out_err: mc->sysinfo->log(mc->sysinfo, OS_ERROR, NULL, "Unable to write persistent SELs for MC %d: %d", ipmi_mc_get_ipmb(mc), err); if (p) free_persist(p); } int ipmi_mc_add_to_sel(lmc_data_t *mc, unsigned char record_type, unsigned char event[13], unsigned int *recid) { sel_entry_t *e; struct timeval t; uint16_t start_record_id; if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) return ENOTSUP; if (mc->sel.count >= mc->sel.max_count) { mc->sel.flags |= 0x80; return EAGAIN; } e = malloc(sizeof(*e)); if (!e) return ENOMEM; /* FIXME - this is inefficient, but simple */ e->record_id = mc->sel.next_entry; mc->sel.next_entry++; start_record_id = e->record_id; while ((mc->sel.next_entry == 0) || find_sel_event_by_recid(mc, e->record_id, NULL)) { e->record_id++; if (e->record_id == start_record_id) { free(e); return EAGAIN; } mc->sel.next_entry++; } mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); ipmi_set_uint16(e->data, e->record_id); e->data[2] = record_type; if (record_type < 0xe0) { ipmi_set_uint32(e->data+3, t.tv_sec + mc->sel.time_offset); memcpy(e->data+7, event+4, 9); } else { memcpy(e->data+3, event, 13); } e->next = NULL; if (!mc->sel.entries) { mc->sel.entries = e; } else { sel_entry_t *f = mc->sel.entries; while (f->next) f = f->next; f->next = e; } mc->sel.count++; mc->sel.last_add_time = t.tv_sec + mc->sel.time_offset; if (recid) *recid = e->record_id; rewrite_sels(mc); return 0; } void mc_new_event(lmc_data_t *mc, unsigned char record_type, unsigned char event[13]) { unsigned int recid; int rv; if (IPMI_MC_EVENT_LOG_ENABLED(mc)) { rv = ipmi_mc_add_to_sel(mc, record_type, event, &recid); if (rv) recid = 0xffff; } else recid = 0xffff; if (!mc->ev_in_q && IPMI_MC_EVENT_MSG_BUF_ENABLED(mc)) { channel_t *chan = mc->channels[15]; mc->ev_in_q = 1; ipmi_set_uint16(mc->evq, recid); mc->evq[2] = record_type; memcpy(mc->evq + 3, event, 13); mc->msg_flags |= IPMI_MC_MSG_FLAG_EVT_BUF_FULL; if (chan->set_atn) chan->set_atn(chan, 1, IPMI_MC_EVBUF_FULL_INT_ENABLED(mc)); } } static void handle_get_sel_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } memset(rdata, 0, 15); rdata[1] = 0x51; ipmi_set_uint16(rdata+2, mc->sel.count); ipmi_set_uint16(rdata+4, (mc->sel.max_count - mc->sel.count) * 16); ipmi_set_uint32(rdata+6, mc->sel.last_add_time); ipmi_set_uint32(rdata+10, mc->sel.last_erase_time); rdata[14] = mc->sel.flags; *rdata_len = 15; } static void handle_get_sel_allocation_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (!(mc->sel.flags & IPMI_SEL_SUPPORTS_GET_ALLOC_INFO)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } memset(rdata, 0, 10); ipmi_set_uint16(rdata+1, mc->sel.max_count * 16); ipmi_set_uint16(rdata+3, 16); ipmi_set_uint32(rdata+5, (mc->sel.max_count - mc->sel.count) * 16); ipmi_set_uint32(rdata+7, (mc->sel.max_count - mc->sel.count) * 16); rdata[9] = 1; *rdata_len = 10; } static void handle_reserve_sel(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (!(mc->sel.flags & IPMI_SEL_SUPPORTS_RESERVE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } mc->sel.reservation++; if (mc->sel.reservation == 0) mc->sel.reservation++; rdata[0] = 0; ipmi_set_uint16(rdata+1, mc->sel.reservation); *rdata_len = 3; } static void handle_get_sel_entry(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint16_t record_id; int offset; int count; sel_entry_t *entry; if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 6, rdata, rdata_len)) return; if (mc->sel.flags & IPMI_SEL_SUPPORTS_RESERVE) { uint16_t reservation = ipmi_get_uint16(msg->data+0); if ((reservation != 0) && (reservation != mc->sel.reservation)) { rdata[0] = IPMI_INVALID_RESERVATION_CC; *rdata_len = 1; return; } } record_id = ipmi_get_uint16(msg->data+2); offset = msg->data[4]; count = msg->data[5]; if (offset >= 16) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (record_id == 0) { entry = mc->sel.entries; } else if (record_id == 0xffff) { entry = mc->sel.entries; if (entry) { while (entry->next) { entry = entry->next; } } } else { entry = find_sel_event_by_recid(mc, record_id, NULL); } if (entry == NULL) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } rdata[0] = 0; if (entry->next) ipmi_set_uint16(rdata+1, entry->next->record_id); else { rdata[1] = 0xff; rdata[2] = 0xff; } if ((offset+count) > 16) count = 16 - offset; memcpy(rdata+3, entry->data+offset, count); *rdata_len = count + 3; } static void handle_add_sel_entry(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int rv; unsigned int r; if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 16, rdata, rdata_len)) return; rv = ipmi_mc_add_to_sel(mc, msg->data[2], msg->data+3, &r); if (rv == EAGAIN) { rdata[0] = IPMI_OUT_OF_SPACE_CC; } else if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; } else { rdata[0] = 0; ipmi_set_uint16(rdata+1, r); } *rdata_len = 3; } static void handle_delete_sel_entry(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint16_t record_id; sel_entry_t *entry, *p_entry; if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (!(mc->sel.flags & IPMI_SEL_SUPPORTS_DELETE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 4, rdata, rdata_len)) return; if (mc->sel.flags & IPMI_SEL_SUPPORTS_RESERVE) { uint16_t reservation = ipmi_get_uint16(msg->data+0); if ((reservation != 0) && (reservation != mc->sel.reservation)) { rdata[0] = IPMI_INVALID_RESERVATION_CC; *rdata_len = 1; return; } } record_id = ipmi_get_uint16(msg->data+2); if (record_id == 0) { entry = mc->sel.entries; p_entry = NULL; } else if (record_id == 0xffff) { entry = mc->sel.entries; p_entry = NULL; if (entry) { while (entry->next) { p_entry = entry; entry = entry->next; } } } else { entry = find_sel_event_by_recid(mc, record_id, &p_entry); } if (!entry) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } if (p_entry) p_entry->next = entry->next; else mc->sel.entries = entry->next; /* Clear the overflow flag. */ mc->sel.flags &= ~0x80; rdata[0] = 0; ipmi_set_uint16(rdata+1, entry->record_id); *rdata_len = 3; mc->sel.count--; free(entry); rewrite_sels(mc); } static void handle_clear_sel(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { sel_entry_t *entry, *n_entry; unsigned char op; struct timeval t; if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 6, rdata, rdata_len)) return; if (mc->sel.flags & IPMI_SEL_SUPPORTS_RESERVE) { uint16_t reservation = ipmi_get_uint16(msg->data+0); if ((reservation != 0) && (reservation != mc->sel.reservation)) { rdata[0] = IPMI_INVALID_RESERVATION_CC; *rdata_len = 1; return; } } if ((msg->data[2] != 'C') || (msg->data[3] != 'L') || (msg->data[4] != 'R')) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } op = msg->data[5]; if ((op != 0) && (op != 0xaa)) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[1] = 1; if (op == 0xaa) { entry = mc->sel.entries; mc->sel.entries = NULL; mc->sel.count = 0; while (entry) { n_entry = entry->next; free(entry); entry = n_entry; } } mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); mc->sel.last_erase_time = t.tv_sec + mc->sel.time_offset; rdata[0] = 0; *rdata_len = 2; /* Clear the overflow flag. */ mc->sel.flags &= ~0x80; rewrite_sels(mc); } static void handle_get_sel_time(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { struct timeval t; if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); rdata[0] = 0; ipmi_set_uint32(rdata+1, t.tv_sec + mc->sel.time_offset); *rdata_len = 5; } static void handle_set_sel_time(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { struct timeval t; if (!(mc->device_support & IPMI_DEVID_SEL_DEVICE)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 4, rdata, rdata_len)) return; mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); mc->sel.time_offset = ipmi_get_uint32(msg->data) - t.tv_sec; rdata[0] = 0; *rdata_len = 1; } /* * SDR handling commands */ #define IPMI_SDR_OVERFLOW_FLAG (1 << 7) #define IPMI_SDR_GET_MODAL(v) (((v) >> 5) & 0x3) #define IPMI_SDR_MODAL_UNSPECIFIED 0 #define IPMI_SDR_NON_MODAL_ONLY 1 #define IPMI_SDR_MODAL_ONLY 2 #define IPMI_SDR_MODAL_BOTH 3 sdr_t * find_sdr_by_recid(sdrs_t *sdrs, uint16_t record_id, sdr_t **prev) { sdr_t *entry; sdr_t *p_entry = NULL; entry = sdrs->sdrs; while (entry) { if (record_id == entry->record_id) break; p_entry = entry; entry = entry->next; } if (prev) *prev = p_entry; return entry; } sdr_t * new_sdr_entry(sdrs_t *sdrs, unsigned char length) { sdr_t *entry; uint16_t start_recid; start_recid = sdrs->next_entry; while (find_sdr_by_recid(sdrs, sdrs->next_entry, NULL)) { sdrs->next_entry++; if (sdrs->next_entry == 0xffff) sdrs->next_entry = 1; if (sdrs->next_entry == start_recid) return NULL; } entry = malloc(sizeof(*entry)); if (!entry) return NULL; entry->data = malloc(length + 6); if (!entry->data) { free(entry); return NULL; } entry->record_id = sdrs->next_entry; sdrs->next_entry++; ipmi_set_uint16(entry->data, entry->record_id); entry->length = length + 6; entry->next = NULL; return entry; } static void rewrite_sdrs(lmc_data_t *mc, sdrs_t *sdrs) { persist_t *p = NULL; sdr_t *sdr; int err; p = alloc_persist("sdr.%2.2x.main", ipmi_mc_get_ipmb(mc)); if (!p) { err = ENOMEM; goto out_err; } err = add_persist_int(p, sdrs->last_add_time, "last_add_time"); if (err) goto out_err; err = add_persist_int(p, sdrs->last_erase_time, "last_erase_time"); if (err) goto out_err; for (sdr = sdrs->sdrs; sdr; sdr = sdr->next) { unsigned int recid = ipmi_get_uint16(sdr->data); err = add_persist_data(p, sdr->data, sdr->length, "%d", recid); if (err) goto out_err; } err = write_persist(p); if (err) goto out_err; free_persist(p); return; out_err: mc->sysinfo->log(mc->sysinfo, OS_ERROR, NULL, "Unable to write persistent SDRs for MC %d: %d", ipmi_mc_get_ipmb(mc), err); if (p) free_persist(p); } void add_sdr_entry(lmc_data_t *mc, sdrs_t *sdrs, sdr_t *entry) { sdr_t *p; struct timeval t; entry->next = NULL; p = sdrs->sdrs; if (!p) sdrs->sdrs = entry; else { while (p->next) p = p->next; p->next = entry; } mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); sdrs->last_add_time = t.tv_sec + mc->main_sdrs.time_offset; sdrs->sdr_count++; rewrite_sdrs(mc, sdrs); } static void free_sdr(sdr_t *sdr) { free(sdr->data); free(sdr); } static int handle_sdr(const char *name, void *data, unsigned int len, void *cb_data) { sdr_t *sdr, *p; sdrs_t *sdrs = cb_data; sdr = new_sdr_entry(sdrs, len); if (!sdr) return ENOMEM; memcpy(sdr->data, data, len); sdr->next = NULL; p = sdrs->sdrs; if (!p) sdrs->sdrs = sdr; else { while (p->next) p = p->next; p->next = sdr; } sdrs->sdr_count++; return ITER_PERSIST_CONTINUE; } static int handle_sdr_time(const char *name, long val, void *cb_data) { sdrs_t *sdrs = cb_data; if (strcmp(name, "last_add_time") == 0) sdrs->last_add_time = val; else if (strcmp(name, "last_erase_time") == 0) sdrs->last_erase_time = val; return ITER_PERSIST_CONTINUE; } void read_mc_sdrs(lmc_data_t *mc, sdrs_t *sdrs, const char *sdrtype) { persist_t *p; p = read_persist("sdr.%2.2x.%s", ipmi_mc_get_ipmb(mc), sdrtype); if (!p) return; iterate_persist(p, sdrs, handle_sdr, handle_sdr_time); free_persist(p); } int ipmi_mc_add_main_sdr(lmc_data_t *mc, unsigned char *data, unsigned int data_len) { sdr_t *entry; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) return ENOSYS; if ((data_len < 5) || (data_len != (((unsigned int) data[4]) + 5))) return EINVAL; entry = new_sdr_entry(&mc->main_sdrs, data_len); if (!entry) return ENOMEM; memcpy(entry->data+2, data+2, data_len-2); add_sdr_entry(mc, &mc->main_sdrs, entry); return 0; } int ipmi_mc_add_device_sdr(lmc_data_t *mc, unsigned char lun, unsigned char *data, unsigned int data_len) { struct timeval t; sdr_t *entry; if (lun >= 4) return EINVAL; if (!(mc->has_device_sdrs)) { return ENOSYS; } entry = new_sdr_entry(&mc->device_sdrs[lun], data_len); if (!entry) return ENOMEM; add_sdr_entry(mc, &mc->device_sdrs[lun], entry); memcpy(entry->data+2, data+2, data_len-2); mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); mc->sensor_population_change_time = t.tv_sec + mc->main_sdrs.time_offset; mc->lun_has_sensors[lun] = 1; mc->num_sensors_per_lun[lun]++; return 0; } static void handle_get_sdr_repository_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned int space; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } rdata[0] = 0; rdata[1] = 0x51; ipmi_set_uint16(rdata+2, mc->main_sdrs.sdr_count); space = MAX_SDR_LENGTH * (MAX_NUM_SDRS - mc->main_sdrs.sdr_count); if (space > 0xfffe) space = 0xfffe; ipmi_set_uint16(rdata+4, space); ipmi_set_uint32(rdata+6, mc->main_sdrs.last_add_time); ipmi_set_uint32(rdata+10, mc->main_sdrs.last_erase_time); rdata[14] = mc->main_sdrs.flags; *rdata_len = 15; } static void handle_get_sdr_repository_alloc_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (!(mc->main_sdrs.flags & IPMI_SDR_GET_SDR_ALLOC_INFO_SDR_SUPPORTED)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } rdata[0] = 0; ipmi_set_uint16(rdata+1, MAX_NUM_SDRS); ipmi_set_uint16(rdata+3, MAX_SDR_LENGTH); ipmi_set_uint16(rdata+5, MAX_NUM_SDRS - mc->main_sdrs.sdr_count); ipmi_set_uint16(rdata+7, MAX_NUM_SDRS - mc->main_sdrs.sdr_count); rdata[9] = 1; *rdata_len = 10; } static void handle_reserve_sdr_repository(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (!(mc->main_sdrs.flags & IPMI_SDR_RESERVE_SDR_SUPPORTED)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } mc->main_sdrs.reservation++; if (mc->main_sdrs.reservation == 0) mc->main_sdrs.reservation++; rdata[0] = 0; ipmi_set_uint16(rdata+1, mc->main_sdrs.reservation); *rdata_len = 3; /* If adding an SDR and the reservation changes, we have to destroy the working SDR addition. */ if (mc->part_add_sdr) { free_sdr(mc->part_add_sdr); mc->part_add_sdr = NULL; } } static void handle_get_sdr(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint16_t record_id; unsigned int offset; unsigned int count; sdr_t *entry; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 6, rdata, rdata_len)) return; if (mc->main_sdrs.flags & IPMI_SDR_RESERVE_SDR_SUPPORTED) { uint16_t reservation = ipmi_get_uint16(msg->data+0); if ((reservation != 0) && (reservation != mc->main_sdrs.reservation)) { rdata[0] = IPMI_INVALID_RESERVATION_CC; *rdata_len = 1; return; } } record_id = ipmi_get_uint16(msg->data+2); offset = msg->data[4]; count = msg->data[5]; if (record_id == 0) { entry = mc->main_sdrs.sdrs; } else if (record_id == 0xffff) { entry = mc->main_sdrs.sdrs; if (entry) { while (entry->next) { entry = entry->next; } } } else { entry = find_sdr_by_recid(&mc->main_sdrs, record_id, NULL); } if (entry == NULL) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } if (offset >= entry->length) { rdata[0] = IPMI_PARAMETER_OUT_OF_RANGE_CC; *rdata_len = 1; return; } if ((offset+count) > entry->length) count = entry->length - offset; if (count+3 > *rdata_len) { /* Too much data to put into response. */ rdata[0] = IPMI_CANNOT_RETURN_REQ_LENGTH_CC; *rdata_len = 1; return; } rdata[0] = 0; if (entry->next) ipmi_set_uint16(rdata+1, entry->next->record_id); else { rdata[1] = 0xff; rdata[2] = 0xff; } memcpy(rdata+3, entry->data+offset, count); *rdata_len = count + 3; } static void handle_add_sdr(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int modal; sdr_t *entry; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } modal = IPMI_SDR_GET_MODAL(mc->main_sdrs.flags); if ((modal == IPMI_SDR_NON_MODAL_ONLY) && !mc->in_update_mode) { rdata[0] = IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC; *rdata_len = 1; return; } if (check_msg_length(msg, 6, rdata, rdata_len)) return; if (msg->len != (unsigned int) msg->data[5] + 6) { rdata[0] = 0x80; /* Length is invalid. */ *rdata_len = 1; return; } entry = new_sdr_entry(&mc->main_sdrs, msg->data[5]); if (!entry) { rdata[0] = IPMI_OUT_OF_SPACE_CC; *rdata_len = 1; return; } add_sdr_entry(mc, &mc->main_sdrs, entry); memcpy(entry->data+2, msg->data+2, entry->length-2); rdata[0] = 0; ipmi_set_uint16(rdata+1, entry->record_id); *rdata_len = 3; } static void handle_partial_add_sdr(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint16_t record_id; unsigned int offset; int modal; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (!(mc->main_sdrs.flags & IPMI_SDR_PARTIAL_ADD_SDR_SUPPORTED)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (mc->main_sdrs.flags & IPMI_SDR_RESERVE_SDR_SUPPORTED) { uint16_t reservation = ipmi_get_uint16(msg->data+0); if ((reservation != 0) && (reservation != mc->main_sdrs.reservation)) { rdata[0] = IPMI_INVALID_RESERVATION_CC; *rdata_len = 1; return; } } modal = IPMI_SDR_GET_MODAL(mc->main_sdrs.flags); if ((modal == IPMI_SDR_NON_MODAL_ONLY) && !mc->in_update_mode) { rdata[0] = IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC; *rdata_len = 1; return; } offset = msg->data[4]; record_id = ipmi_get_uint16(rdata+2); if (record_id == 0) { /* New add. */ if (check_msg_length(msg, 12, rdata, rdata_len)) return; if (offset != 0) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (msg->len > (unsigned int) msg->data[11] + 12) { rdata[0] = 0x80; /* Invalid data length */ *rdata_len = 1; return; } if (mc->part_add_sdr) { /* Still working on a previous one, return an error and abort. */ free_sdr(mc->part_add_sdr); mc->part_add_sdr = NULL; rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } mc->part_add_sdr = new_sdr_entry(&mc->main_sdrs, msg->data[11]); memcpy(mc->part_add_sdr->data+2, msg->data+8, msg->len - 8); mc->part_add_next = msg->len - 8; } else { if (!mc->part_add_next) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } if (offset != mc->part_add_next) { free_sdr(mc->part_add_sdr); mc->part_add_sdr = NULL; rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if ((offset + msg->len - 6) > mc->part_add_sdr->length) { free_sdr(mc->part_add_sdr); mc->part_add_sdr = NULL; rdata[0] = 0x80; /* Invalid data length */ *rdata_len = 1; return; } memcpy(mc->part_add_sdr->data+offset, msg->data+6, msg->len-6); mc->part_add_next += msg->len - 6; } if ((msg->data[5] & 0xf) == 1) { /* End of the operation. */ if (mc->part_add_next != mc->part_add_sdr->length) { free_sdr(mc->part_add_sdr); mc->part_add_sdr = NULL; rdata[0] = 0x80; /* Invalid data length */ *rdata_len = 1; return; } add_sdr_entry(mc, &mc->main_sdrs, mc->part_add_sdr); mc->part_add_sdr = NULL; } rdata[0] = 0; *rdata_len = 1; } void iterate_sdrs(lmc_data_t *mc, sdrs_t *sdrs, int (*func)(lmc_data_t *mc, unsigned char *sdr, unsigned int len, void *cb_data), void *cb_data) { sdr_t *entry; for (entry = sdrs->sdrs; entry; entry = entry->next) func(mc, entry->data, entry->length, cb_data); } static void handle_delete_sdr(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint16_t record_id; sdr_t *entry, *p_entry; struct timeval t; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 4, rdata, rdata_len)) return; if (mc->main_sdrs.flags & IPMI_SDR_RESERVE_SDR_SUPPORTED) { uint16_t reservation = ipmi_get_uint16(msg->data+0); if ((reservation != 0) && (reservation != mc->main_sdrs.reservation)) { rdata[0] = IPMI_INVALID_RESERVATION_CC; *rdata_len = 1; return; } } record_id = ipmi_get_uint16(rdata+2); if (record_id == 0) { entry = mc->main_sdrs.sdrs; p_entry = NULL; } else if (record_id == 0xffff) { entry = mc->main_sdrs.sdrs; p_entry = NULL; if (entry) { while (entry->next) { p_entry = entry; entry = entry->next; } } } else { entry = find_sdr_by_recid(&mc->main_sdrs, record_id, &p_entry); } if (!entry) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } if (p_entry) p_entry->next = entry->next; else mc->main_sdrs.sdrs = entry->next; rdata[0] = 0; ipmi_set_uint16(rdata+1, entry->record_id); *rdata_len = 3; free_sdr(entry); mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); mc->main_sdrs.last_erase_time = t.tv_sec + mc->main_sdrs.time_offset; mc->main_sdrs.sdr_count--; rewrite_sdrs(mc, &mc->main_sdrs); } static void handle_clear_sdr_repository(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { sdr_t *entry, *n_entry; struct timeval t; unsigned char op; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 6, rdata, rdata_len)) return; if (mc->main_sdrs.flags & IPMI_SDR_RESERVE_SDR_SUPPORTED) { uint16_t reservation = ipmi_get_uint16(msg->data+0); if ((reservation != 0) && (reservation != mc->main_sdrs.reservation)) { rdata[0] = IPMI_INVALID_RESERVATION_CC; *rdata_len = 1; return; } } if ((msg->data[2] != 'C') || (msg->data[3] != 'L') || (msg->data[4] != 'R')) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } op = msg->data[5]; if ((op != 0) && (op != 0xaa)) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[1] = 1; if (op == 0) { entry = mc->main_sdrs.sdrs; while (entry) { n_entry = entry->next; free_sdr(entry); entry = n_entry; } } rdata[0] = 0; *rdata_len = 2; mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); mc->main_sdrs.last_erase_time = t.tv_sec + mc->main_sdrs.time_offset; rewrite_sdrs(mc, &mc->main_sdrs); } static void handle_get_sdr_repository_time(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { struct timeval t; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); rdata[0] = 0; ipmi_set_uint32(rdata+1, t.tv_sec + mc->main_sdrs.time_offset); *rdata_len = 5; } static void handle_set_sdr_repository_time(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { struct timeval t; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 4, rdata, rdata_len)) return; mc->emu->sysinfo->get_monotonic_time(mc->emu->sysinfo, &t); mc->main_sdrs.time_offset = ipmi_get_uint32(msg->data) - t.tv_sec; rdata[0] = 0; *rdata_len = 1; } static void handle_enter_sdr_repository_update(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int modal; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } modal = IPMI_SDR_GET_MODAL(mc->main_sdrs.flags); if ((modal == IPMI_SDR_MODAL_UNSPECIFIED) || (modal == IPMI_SDR_NON_MODAL_ONLY)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } mc->in_update_mode = 1; rdata[0] = 0; *rdata_len = 1; } static void handle_exit_sdr_repository_update(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int modal; if (!(mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } modal = IPMI_SDR_GET_MODAL(mc->main_sdrs.flags); if ((modal == IPMI_SDR_MODAL_UNSPECIFIED) || (modal == IPMI_SDR_NON_MODAL_ONLY)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } mc->in_update_mode = 0; rdata[0] = 0; *rdata_len = 1; } /* * FRU Inventory handling */ fru_data_t * find_fru(lmc_data_t *mc, unsigned int devid) { fru_data_t *fru = mc->frulist; while (fru && fru->devid != devid) fru = fru->next; return fru; } int ipmi_mc_set_frudata_handler(lmc_data_t *mc, unsigned int devid, get_frudata_f handler, free_frudata_f freefunc) { fru_data_t *fru = find_fru(mc, devid); if (!fru) return EINVAL; fru->get = handler; fru->free = freefunc; return 0; } static void fru_session_closed(lmc_data_t *mc, uint32_t session_id, void *cb_data) { fru_session_t *ses = cb_data; fru_data_t *fru = ses->fru; if (fru->sessions == ses) { fru->sessions = ses->next; } else { fru_session_t *p = fru->sessions; while (p && p->next != ses) p = p->next; if (p && p->next != ses) p->next = ses->next; } fru->free(mc, ses->data_to_free); free(ses); } static void handle_get_fru_inventory_area_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char devid; fru_data_t *fru; unsigned int size; unsigned char *data; int rv; if (check_msg_length(msg, 1, rdata, rdata_len)) return; devid = msg->data[0]; fru = find_fru(mc, devid); if (!fru) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (fru->get) { channel_t *channel; fru_session_t *ses; int link_in = 0; ses = fru->sessions; while (ses) { if (ses->sid == msg->sid) break; ses = ses->next; } if (!ses) { ses = malloc(sizeof(*ses)); if (!ses) { rdata[0] = IPMI_OUT_OF_SPACE_CC; *rdata_len = 1; return; } memset(ses, 0, sizeof(*ses)); ses->sid = msg->sid; ses->fru = fru; link_in = 1; } /* Set up to free the FRU data when the session closes. */ channel = msg->orig_channel; rv = channel->set_associated_mc(channel, msg->sid, 0, mc, NULL, fru_session_closed, ses); if (rv == EBUSY) { rdata[0] = IPMI_NODE_BUSY_CC; *rdata_len = 1; return; } else if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } data = fru->get(mc, &size); if (!data) { channel->set_associated_mc(channel, msg->sid, 0, NULL, NULL, NULL, NULL); rdata[0] = IPMI_OUT_OF_SPACE_CC; *rdata_len = 1; return; } if (ses->data_to_free) fru->free(mc, ses->data_to_free); ses->data_to_free = data; if (size > 65535) { ses->data = data + (size - 65535); size = 65535; } else { ses->data = data; } ses->length = size; if (link_in) { ses->next = fru->sessions; fru->sessions = ses; } } else { size = fru->length; data = fru->data; } if (!data) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[0] = 0; ipmi_set_uint16(rdata+1, size); rdata[3] = 0; /* We only support byte access for now. */ *rdata_len = 4; } static int fru_sem_trywait(fru_data_t *fru) { struct timespec ts; int rv; /* Wait 250ms for the semaphore. */ restart: rv = clock_gettime(CLOCK_REALTIME, &ts); if (rv == -1) return errno; ts.tv_nsec += 250000000; if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec += 1; } rv = sem_timedwait(&fru->sem, &ts); if (rv) { if (rv == EINTR) goto restart; if (rv == ETIMEDOUT) rv = EAGAIN; else rv = errno; return rv; } return 0; } static void handle_read_fru_data(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char devid; unsigned int offset; unsigned int count; unsigned char *data = NULL; unsigned int size; fru_session_t *ses; fru_data_t *fru; int rv; if (check_msg_length(msg, 4, rdata, rdata_len)) return; devid = msg->data[0]; fru = find_fru(mc, devid); if (!fru) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rv = fru_sem_trywait(fru); if (rv) { if (rv == EAGAIN) rdata[0] = IPMI_NODE_BUSY_CC; else rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } offset = ipmi_get_uint16(msg->data+1); count = msg->data[3]; size = fru->length; if (!fru->fru_io_cb) { data = fru->data; ses = fru->sessions; while (ses && (ses->sid != msg->sid)) ses = ses->next; if (ses) { data = ses->data; size = ses->length; } if (!data) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; goto out_unlock; } if (offset >= size) { rdata[0] = IPMI_PARAMETER_OUT_OF_RANGE_CC; *rdata_len = 1; goto out_unlock; } } if ((offset+count) > size) count = size - offset; if (count+2 > *rdata_len) { /* Too much data to put into response. */ rdata[0] = IPMI_REQUESTED_DATA_LENGTH_EXCEEDED_CC; *rdata_len = 1; goto out_unlock; } if (fru->fru_io_cb) { int rv; rv = fru->fru_io_cb(fru->data, FRU_IO_READ, rdata + 2, offset, count); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; goto out_unlock; } } else { memcpy(rdata + 2, data + offset, count); } rdata[0] = 0; rdata[1] = count; *rdata_len = 2 + count; out_unlock: sem_post(&fru->sem); } static void handle_write_fru_data(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char device_id; unsigned int offset; unsigned int count; fru_data_t *fru; int rv; if (check_msg_length(msg, 3, rdata, rdata_len)) return; device_id = msg->data[0]; fru = find_fru(mc, device_id); if (!fru) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rv = fru_sem_trywait(fru); if (rv) { if (rv == EAGAIN) rdata[0] = IPMI_NODE_BUSY_CC; else rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } offset = ipmi_get_uint16(msg->data+1); count = msg->len - 3; if (offset >= fru->length) { rdata[0] = IPMI_PARAMETER_OUT_OF_RANGE_CC; *rdata_len = 1; goto out_unlock; } if ((offset+count) > fru->length) { /* Too much data to put into FRU. */ rdata[0] = IPMI_REQUESTED_DATA_LENGTH_EXCEEDED_CC; *rdata_len = 1; goto out_unlock; } if (fru->fru_io_cb) { int rv; rv = fru->fru_io_cb(fru->data, FRU_IO_WRITE, msg->data + 3, offset, count); if (rv) { rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; goto out_unlock; } } else { memcpy(fru->data+offset, msg->data+3, count); } rdata[0] = 0; rdata[1] = count; *rdata_len = 2; out_unlock: sem_post(&fru->sem); } int ipmi_mc_get_fru_data_len(lmc_data_t *mc, unsigned char device_id, unsigned int *length) { fru_data_t *fru; if (!(mc->device_support & IPMI_DEVID_FRU_INVENTORY_DEV)) return ENOSYS; if (device_id >= 255) return EINVAL; fru = find_fru(mc, device_id); if (!fru || !fru->data) return EINVAL; *length = fru->length; return 0; } int ipmi_mc_get_fru_data(lmc_data_t *mc, unsigned char device_id, unsigned int length, unsigned char *data) { fru_data_t *fru; int rv; if (!(mc->device_support & IPMI_DEVID_FRU_INVENTORY_DEV)) return ENOSYS; fru = find_fru(mc, device_id); if (!fru) return EINVAL; if (length > fru->length) return EINVAL; rv = fru_sem_trywait(fru); if (rv) return errno; if (fru->fru_io_cb) { rv = fru->fru_io_cb(fru->data, FRU_IO_READ, data, 0, length); } else { memcpy(data, fru->data, length); } sem_post(&fru->sem); return rv; } int ipmi_mc_add_fru_data(lmc_data_t *mc, unsigned char device_id, unsigned int length, fru_io_cb fru_io_cb, void *data) { fru_data_t *fru; if (device_id > 255) return EINVAL; fru = find_fru(mc, device_id); if (!fru) { int rv; fru = malloc(sizeof(*fru)); memset(fru, 0, sizeof(*fru)); rv = sem_init(&fru->sem, 0, 1); if (rv) { rv = errno; free(fru); return rv; } fru->devid = device_id; fru->next = mc->frulist; mc->frulist = fru; } if (fru->data) { free(fru->data); fru->length = 0; } if (fru_io_cb) { fru->fru_io_cb = fru_io_cb; fru->data = data; } else if (length) { fru->data = malloc(length); if (!fru->data) return ENOMEM; memcpy(fru->data, data, length); } else fru->data = NULL; fru->length = length; return 0; } int ipmi_mc_fru_sem_wait(lmc_data_t *mc, unsigned char device_id) { int rv; fru_data_t *fru = find_fru(mc, device_id); if (!fru) return EINVAL; rv = sem_wait(&fru->sem); if (rv) return errno; return 0; } int ipmi_mc_fru_sem_trywait(lmc_data_t *mc, unsigned char device_id) { int rv; fru_data_t *fru = find_fru(mc, device_id); if (!fru) return EINVAL; rv = fru_sem_trywait(fru); if (rv) return errno; return 0; } int ipmi_mc_fru_sem_post(lmc_data_t *mc, unsigned char device_id) { int rv; fru_data_t *fru = find_fru(mc, device_id); if (!fru) return EINVAL; rv = sem_post(&fru->sem); if (rv) return errno; return 0; } struct fru_file_io_info { lmc_data_t *mc; char *filename; unsigned int file_offset; unsigned int length; }; static int fru_file_io_cb(void *cb_data, enum fru_io_cb_op op, unsigned char *data, unsigned int offset, unsigned int length) { struct fru_file_io_info *info = cb_data; int fd; int rv = 0; int l; if (offset + length > info->length) return EINVAL; switch (op) { case FRU_IO_READ: fd = open(info->filename, O_RDONLY); if (fd == -1) { rv = errno; info->mc->sysinfo->log(info->mc->sysinfo, OS_ERROR, NULL, "fru_io: (read) error on open of %s: %s", info->filename, strerror(rv)); return rv; } if (lseek(fd, info->file_offset + offset, SEEK_SET) == -1) { rv = errno; close(fd); info->mc->sysinfo->log(info->mc->sysinfo, OS_ERROR, NULL, "fru_io: (read) error on lseek" " of %s to %u: %s", info->filename, info->file_offset + offset, strerror(rv)); return rv; } restart_read: l = read(fd, data, length); if (l == -1) { if (errno == EINTR) goto restart_read; rv = errno; info->mc->sysinfo->log(info->mc->sysinfo, OS_ERROR, NULL, "fru_io: error on read of %u bytes of %s" " at %u: %s", length, info->filename, info->file_offset + offset, strerror(rv)); } else if (l == 0) { rv = EIO; info->mc->sysinfo->log(info->mc->sysinfo, OS_ERROR, NULL, "fru_io: end of file read of %u bytes of %s" " at %u: %s", length, info->filename, info->file_offset + offset, strerror(rv)); } else if (((unsigned int) l) != length) { length -= l; data += l; goto restart_read; } close(fd); break; case FRU_IO_WRITE: fd = open(info->filename, O_WRONLY); if (fd == -1) { rv = errno; info->mc->sysinfo->log(info->mc->sysinfo, OS_ERROR, NULL, "fru_io: (write) error on open of %s: %s", info->filename, strerror(rv)); return rv; } if (lseek(fd, info->file_offset + offset, SEEK_SET) == -1) { rv = errno; close(fd); info->mc->sysinfo->log(info->mc->sysinfo, OS_ERROR, NULL, "fru_io: (write) error on lseek" " of %s to %u: %s", info->filename, info->file_offset + offset, strerror(rv)); return rv; } restart_write: l = write(fd, data, length); if (l == -1) { if (errno == EINTR) goto restart_write; rv = errno; info->mc->sysinfo->log(info->mc->sysinfo, OS_ERROR, NULL, "fru_io: error on write of %u bytes of %s" " at %u: %s", length, info->filename, info->file_offset + offset, strerror(rv)); } else if (l == 0) { rv = EIO; info->mc->sysinfo->log(info->mc->sysinfo, OS_ERROR, NULL, "fru_io: end of file write of %u bytes of %s" " at %u: %s", length, info->filename, info->file_offset + offset, strerror(rv)); } else if (((unsigned int) l) != length) { length -= l; data += l; goto restart_write; } close(fd); break; default: return EINVAL; } return rv; } int ipmi_mc_add_fru_file(lmc_data_t *mc, unsigned char device_id, unsigned int length, unsigned int file_offset, const char *filename) { struct fru_file_io_info *info; int rv; info = malloc(sizeof(*info)); if (!info) return ENOMEM; info->filename = strdup(filename); if (!info->filename) { free(info); return ENOMEM; } info->mc = mc; info->length = length; info->file_offset = file_offset; rv = ipmi_mc_add_fru_data(mc, device_id, length, fru_file_io_cb, info); if (rv) { free(info->filename); free(info); } return rv; } /* We don't currently care about partial sel adds, since they are pretty stupid. */ cmd_handler_f storage_netfn_handlers[256] = { [IPMI_GET_SEL_INFO_CMD] = handle_get_sel_info, [IPMI_GET_SEL_ALLOCATION_INFO_CMD] = handle_get_sel_allocation_info, [IPMI_RESERVE_SEL_CMD] = handle_reserve_sel, [IPMI_GET_SEL_ENTRY_CMD] = handle_get_sel_entry, [IPMI_ADD_SEL_ENTRY_CMD] = handle_add_sel_entry, [IPMI_DELETE_SEL_ENTRY_CMD] = handle_delete_sel_entry, [IPMI_CLEAR_SEL_CMD] = handle_clear_sel, [IPMI_GET_SEL_TIME_CMD] = handle_get_sel_time, [IPMI_SET_SEL_TIME_CMD] = handle_set_sel_time, [IPMI_GET_SDR_REPOSITORY_INFO_CMD] = handle_get_sdr_repository_info, [IPMI_GET_SDR_REPOSITORY_ALLOC_INFO_CMD] = handle_get_sdr_repository_alloc_info, [IPMI_RESERVE_SDR_REPOSITORY_CMD] = handle_reserve_sdr_repository, [IPMI_GET_SDR_CMD] = handle_get_sdr, [IPMI_ADD_SDR_CMD] = handle_add_sdr, [IPMI_PARTIAL_ADD_SDR_CMD] = handle_partial_add_sdr, [IPMI_DELETE_SDR_CMD] = handle_delete_sdr, [IPMI_CLEAR_SDR_REPOSITORY_CMD] = handle_clear_sdr_repository, [IPMI_GET_SDR_REPOSITORY_TIME_CMD] = handle_get_sdr_repository_time, [IPMI_SET_SDR_REPOSITORY_TIME_CMD] = handle_set_sdr_repository_time, [IPMI_ENTER_SDR_REPOSITORY_UPDATE_CMD] = handle_enter_sdr_repository_update, [IPMI_EXIT_SDR_REPOSITORY_UPDATE_CMD] = handle_exit_sdr_repository_update, [IPMI_GET_FRU_INVENTORY_AREA_INFO_CMD] = handle_get_fru_inventory_area_info, [IPMI_READ_FRU_DATA_CMD] = handle_read_fru_data, [IPMI_WRITE_FRU_DATA_CMD] = handle_write_fru_data }; OpenIPMI-2.0.27/lanserv/bmc.h0000664000175000017500000003150013160051361012464 00000000000000/* * bmc.h * * MontaVista IPMI LAN server include file * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #ifndef __BMC_H_ #define __BMC_H_ #include #include #include #include "emu.h" #define WATCHDOG_SENSOR_NUM 0 #define OPENIPMI_IANA 40820 /* OpenIPMI's own number */ typedef struct sel_entry_s { uint16_t record_id; unsigned char data[16]; struct sel_entry_s *next; } sel_entry_t; typedef struct sel_s { sel_entry_t *entries; int count; int max_count; uint32_t last_add_time; uint32_t last_erase_time; unsigned char flags; uint16_t reservation; uint16_t next_entry; long time_offset; } sel_t; #define MAX_SDR_LENGTH 261 #define MAX_NUM_SDRS 1024 typedef struct sdr_s { uint16_t record_id; unsigned int length; unsigned char *data; struct sdr_s *next; } sdr_t; typedef struct sdrs_s { uint16_t reservation; uint16_t sdr_count; uint16_t sensor_count; uint32_t last_add_time; uint32_t last_erase_time; long time_offset; unsigned char flags; uint16_t next_entry; unsigned int sdrs_length; /* A linked list of SDR entries. */ sdr_t *sdrs; } sdrs_t; typedef struct sensor_s sensor_t; struct sensor_s { lmc_data_t *mc; unsigned char num; unsigned int lun : 2; unsigned int scanning_enabled : 1; unsigned int events_enabled : 1; unsigned int enabled : 1; unsigned char sensor_type; unsigned char event_reading_code; unsigned char value; unsigned char hysteresis_support; unsigned char positive_hysteresis; unsigned char negative_hysteresis; unsigned char threshold_support; uint16_t threshold_supported; /* Bitmask */ unsigned char thresholds[6]; int event_only; unsigned char event_support; /* 0 for assertion, 1 for deassertion. */ uint16_t event_supported[2]; uint16_t event_enabled[2]; int (*rearm_handler)(void *cb_data, uint16_t assert, uint16_t deassert); void *rearm_cb_data; /* Current bit values */ uint16_t event_status; /* Called when the sensor changes values. */ void (*sensor_update_handler)(lmc_data_t *mc, sensor_t *sensor); ipmi_timer_t *poll_timer; struct timeval poll_timer_time; int (*poll)(void *cb_data, unsigned int *val, const char **errstr); void *cb_data; }; typedef struct fru_data_s fru_data_t; typedef struct fru_session_s { unsigned char *data_to_free; unsigned char *data; unsigned int length; unsigned int sid; fru_data_t *fru; struct fru_session_s *next; } fru_session_t; struct fru_data_s { unsigned int devid; fru_io_cb fru_io_cb; unsigned int length; unsigned char *data; fru_session_t *sessions; get_frudata_f get; free_frudata_f free; sem_t sem; fru_data_t *next; }; typedef struct led_data_s { unsigned char off_dur; unsigned char def_off_dur; unsigned char on_dur; unsigned char def_on_dur; unsigned char color; unsigned char color_sup; unsigned char loc_cnt; unsigned char loc_cnt_sup; unsigned char def_loc_cnt_color; unsigned char def_override_color; } led_data_t; struct lmc_data_s { emu_data_t *emu; char enabled; char configured; unsigned char ipmb; unsigned char guid_set; unsigned char guid[16]; channel_t *channels[IPMI_MAX_CHANNELS]; channel_t sys_channel; channel_t ipmb_channel; int users_changed; user_t users[MAX_USERS + 1]; pef_data_t pef; pef_data_t pef_rollback; ipmi_tick_handler_t tick_handler; ipmi_child_quit_t child_quit_handler; startcmd_t startcmd; unsigned char evq[16]; char ev_in_q; /* Get Device Id contents. */ unsigned char device_id; /* byte 2 */ unsigned char has_device_sdrs; /* byte 3, bit 7 */ unsigned char device_revision; /* byte 3, bits 0-6 */ unsigned char major_fw_rev; /* byte 4, bits 0-6 */ unsigned char minor_fw_rev; /* byte 5 */ unsigned char device_support; /* byte 7 */ unsigned char mfg_id[3]; /* bytes 8-10 */ unsigned char product_id[2]; /* bytes 11-12 */ unsigned char aux_fw_rev[4]; /* bytes 13-16 */ #define IPMI_MC_MSG_FLAG_WATCHDOG_TIMEOUT_MASK (1 << 3) #define IPMI_MC_MSG_FLAG_EVT_BUF_FULL (1 << 1) #define IPMI_MC_MSG_FLAG_RCV_MSG_QUEUE (1 << 0) #define IPMI_MC_MSG_FLAG_WATCHDOG_TIMEOUT_MASK_SET(mc) \ (IPMI_MC_MSG_FLAG_WATCHDOG_TIMEOUT_MASK & (mc)->msg_flags) #define IPMI_MC_MSG_FLAG_EVT_BUF_FULL_SET(mc) \ (IPMI_MC_MSG_FLAG_EVT_BUF_FULL & (mc)->msg_flags) #define IPMI_MC_MSG_FLAG_RCV_MSG_QUEUE_SET(mc) \ (IPMI_MC_MSG_FLAG_RCV_MSG_QUEUE & (mc)->msg_flags) unsigned char msg_flags; #define IPMI_MC_RCV_MSG_QUEUE_INT_BIT 0 #define IPMI_MC_EVBUF_FULL_INT_BIT 1 #define IPMI_MC_EVENT_MSG_BUF_BIT 2 #define IPMI_MC_EVENT_LOG_BIT 3 #define IPMI_MC_MSG_INTS_ON(mc) ((mc)->global_enables & \ (1 << IPMI_MC_RCV_MSG_QUEUE_INT_BIT)) #define IPMI_MC_EVBUF_FULL_INT_ENABLED(mc) ((mc)->global_enables & \ (1 << IPMI_MC_EVBUF_FULL_INT_BIT)) #define IPMI_MC_EVENT_LOG_ENABLED(mc) ((mc)->global_enables & \ (1 << IPMI_MC_EVENT_LOG_BIT)) #define IPMI_MC_EVENT_MSG_BUF_ENABLED(mc) ((mc)->global_enables & \ (1 << IPMI_MC_EVENT_MSG_BUF_BIT)) unsigned char global_enables; sys_data_t *sysinfo; sel_t sel; sdrs_t main_sdrs; sdr_t *part_add_sdr; unsigned int part_add_next; int in_update_mode; unsigned char event_receiver; unsigned char event_receiver_lun; sdrs_t device_sdrs[4]; unsigned int dynamic_sensor_population : 1; unsigned int sensors_enabled : 1; unsigned char lun_has_sensors[4]; unsigned char num_sensors_per_lun[4]; sensor_t *(sensors[4][255]); uint32_t sensor_population_change_time; fru_data_t *frulist; ipmi_sol_t sol; int (*chassis_control_set_func)(lmc_data_t *mc, int op, unsigned char *val, void *cb_data); int (*chassis_control_get_func)(lmc_data_t *mc, int op, unsigned char *val, void *cb_data); ipmi_timer_t *power_timer; void *chassis_control_cb_data; const char *chassis_control_prog; unsigned char power_value; #define MAX_LEDS 8 #define MIN_ATCA_LEDS 2 unsigned int num_leds; led_data_t leds[MAX_LEDS]; /* Will be NULL if not valid. */ sensor_t *hs_sensor; #define IPMI_MC_WATCHDOG_USE_MASK 0xc7 #define IPMI_MC_WATCHDOG_ACTION_MASK 0x77 #define IPMI_MC_WATCHDOG_GET_USE(s) ((s)->watchdog_use & 0x7) #define IPMI_MC_WATCHDOG_GET_DONT_LOG(s) (((s)->watchdog_use >> 7) & 0x1) #define IPMI_MC_WATCHDOG_GET_DONT_STOP(s) (((s)->watchdog_use >> 6) & 0x1) #define IPMI_MC_WATCHDOG_GET_PRE_ACTION(s) (((s)->watchdog_action >> 4) & 0x7) #define IPMI_MC_WATCHDOG_PRE_NONE 0 #define IPMI_MC_WATCHDOG_PRE_SMI 1 #define IPMI_MC_WATCHDOG_PRE_NMI 2 #define IPMI_MC_WATCHDOG_PRE_MSG_INT 3 #define IPMI_MC_WATCHDOG_GET_ACTION(s) ((s)->watchdog_action & 0x7) #define IPMI_MC_WATCHDOG_ACTION_NONE 0 #define IPMI_MC_WATCHDOG_ACTION_RESET 1 #define IPMI_MC_WATCHDOG_ACTION_POWER_DOWN 2 #define IPMI_MC_WATCHDOG_ACTION_POWER_CYCLE 3 unsigned char watchdog_use; unsigned char watchdog_action; unsigned char watchdog_pretimeout; unsigned char watchdog_expired; int watchdog_running; int watchdog_preaction_ran; int watchdog_initialized; struct timeval watchdog_time; /* Set time */ struct timeval watchdog_expiry; /* Timeout time */ ipmi_timer_t *watchdog_timer; }; typedef struct atca_site_s { unsigned char valid; unsigned char hw_address; unsigned char site_type; unsigned char site_number; } atca_site_t; #define MAX_EMU_ADDR 16 #define MAX_EMU_ADDR_DATA 64 typedef struct emu_addr_s { unsigned char valid; unsigned char addr_type; unsigned char addr_data[MAX_EMU_ADDR_DATA]; unsigned int addr_len; } emu_addr_t; struct emu_data_s { sys_data_t *sysinfo; int users_changed; int atca_mode; atca_site_t atca_sites[128]; /* Indexed by HW address. */ uint32_t atca_fru_inv_curr_timestamp; uint16_t atca_fru_inv_curr_lock_id; int atca_fru_inv_locked; int atca_fru_inv_lock_timeout; unsigned char *temp_fru_inv_data; unsigned int temp_fru_inv_data_len; void *user_data; ipmi_emu_sleep_cb sleeper; struct timeval last_addr_change_time; emu_addr_t addr[MAX_EMU_ADDR]; }; /* Device ID support bits */ #define IPMI_DEVID_CHASSIS_DEVICE (1 << 7) #define IPMI_DEVID_BRIDGE (1 << 6) #define IPMI_DEVID_IPMB_EVENT_GEN (1 << 5) #define IPMI_DEVID_IPMB_EVENT_RCV (1 << 4) #define IPMI_DEVID_FRU_INVENTORY_DEV (1 << 3) #define IPMI_DEVID_SEL_DEVICE (1 << 2) #define IPMI_DEVID_SDR_REPOSITORY_DEV (1 << 1) #define IPMI_DEVID_SENSOR_DEV (1 << 0) fru_data_t *find_fru(lmc_data_t *mc, unsigned int devid); int start_poweron_timer(lmc_data_t *mc); sdr_t *find_sdr_by_recid(sdrs_t *sdrs, uint16_t record_id, sdr_t **prev); sdr_t *new_sdr_entry(sdrs_t *sdrs, unsigned char length); void add_sdr_entry(lmc_data_t *mc, sdrs_t *sdrs, sdr_t *entry); void read_mc_sdrs(lmc_data_t *mc, sdrs_t *sdrs, const char *sdrtype); void iterate_sdrs(lmc_data_t *mc, sdrs_t *sdrs, int (*func)(lmc_data_t *mc, unsigned char *sdr, unsigned int len, void *cb_data), void *cb_data); void mc_new_event(lmc_data_t *mc, unsigned char record_type, unsigned char event[13]); #define IPMI_SDR_DELETE_SDR_SUPPORTED (1 << 3) #define IPMI_SDR_PARTIAL_ADD_SDR_SUPPORTED (1 << 2) #define IPMI_SDR_RESERVE_SDR_SUPPORTED (1 << 1) #define IPMI_SDR_GET_SDR_ALLOC_INFO_SDR_SUPPORTED (1 << 0) void picmg_led_set(lmc_data_t *mc, sensor_t *sensor); void set_sensor_bit(lmc_data_t *mc, sensor_t *sensor, unsigned char bit, unsigned char value, unsigned char evd1, unsigned char evd2, unsigned char evd3, int gen_event); void watchdog_timeout(void *cb_data); extern cmd_handler_f storage_netfn_handlers[256]; extern cmd_handler_f app_netfn_handlers[256]; extern cmd_handler_f chassis_netfn_handlers[256]; extern cmd_handler_f transport_netfn_handlers[256]; extern cmd_handler_f sensor_event_netfn_handlers[256]; extern cmd_handler_f oem0_netfn_handlers[256]; void handle_picmg_msg(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len); #define set_bit(m, b, v) (m) = (v) ? ((m) | (1 << (b))) : ((m) & ~(1 << (b))) #define bit_set(m, b) (!!((m) & (1 << (b)))) #endif /* __BMC_H_ */ OpenIPMI-2.0.27/lanserv/lanserv_config.c0000664000175000017500000001454513136461257014743 00000000000000/* * lanserv_config.c * * MontaVista IPMI code for reading lanserv configuration files. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include #ifndef IPMI_LAN_STD_PORT_STR #define IPMI_LAN_STD_PORT_STR "623" #endif int lanserv_read_config(sys_data_t *sys, FILE *f, int *line, unsigned int channel_num) { char buf[MAX_CONFIG_LINE]; const char *tok; char *tokptr; unsigned int val; int err = 0; const char *errstr; lanserv_data_t *lan; lan = sys->alloc(sys, sizeof(*lan)); if (!lan) { err = -1; errstr = "Out of memory allocating lan data"; goto out_err; } memset(lan, 0, sizeof(*lan)); lan->sysinfo = sys; lan->channel.chan_info = lan; lan->channel.channel_num = channel_num; lan->channel.medium_type = IPMI_CHANNEL_MEDIUM_8023_LAN; lan->channel.protocol_type = IPMI_CHANNEL_PROTOCOL_IPMB; lan->channel.session_support = IPMI_CHANNEL_MULTI_SESSION; lan->users = sys->cusers; if (sys->chan_set[channel_num]) { err = -1; errstr = "Channel already in use"; goto out_err; } while (fgets(buf, sizeof(buf), f) != NULL) { (*line)++; tok = mystrtok(buf, " \t\n", &tokptr); if (!tok || (tok[0] == '#')) continue; if (strcmp(tok, "endlan") == 0) { sys->chan_set[channel_num] = &lan->channel; return 0; } if (strcmp(tok, "PEF_alerting") == 0) { err = get_bool(&tokptr, &val, &errstr); lan->channel.PEF_alerting = val; } else if (strcmp(tok, "per_msg_auth") == 0) { err = get_bool(&tokptr, &val, &errstr); lan->channel.per_msg_auth = val; } else if (strcmp(tok, "priv_limit") == 0) { err = get_priv(&tokptr, &val, &errstr); lan->channel.privilege_limit = val; } else if (strcmp(tok, "allowed_auths_callback") == 0) { err = get_auths(&tokptr, &val, &errstr); lan->channel.priv_info[0].allowed_auths = val; } else if (strcmp(tok, "allowed_auths_user") == 0) { err = get_auths(&tokptr, &val, &errstr); lan->channel.priv_info[1].allowed_auths = val; } else if (strcmp(tok, "allowed_auths_operator") == 0) { err = get_auths(&tokptr, &val, &errstr); lan->channel.priv_info[2].allowed_auths = val; } else if (strcmp(tok, "allowed_auths_admin") == 0) { err = get_auths(&tokptr, &val, &errstr); lan->channel.priv_info[3].allowed_auths = val; } else if (strcmp(tok, "addr") == 0) { if (lan->lan_addr_set) { fprintf(stderr, "LAN address already set, line %d\n", *line); return -1; } err = get_sock_addr(&tokptr, &lan->lan_addr.addr, &lan->lan_addr.addr_len, IPMI_LAN_STD_PORT_STR, SOCK_DGRAM, &errstr); lan->lan_addr_set = 1; if (!err) { if (lan->lan_addr.addr.s_ipsock.s_addr0.sa_family == AF_INET) lan->port = lan->lan_addr.addr.s_ipsock.s_addr4.sin_port; else if (lan->lan_addr.addr.s_ipsock.s_addr0.sa_family == AF_INET6) lan->port = lan->lan_addr.addr.s_ipsock.s_addr6.sin6_port; else lan->port = 0; lan->port = htons(lan->port); } } else if (strcmp(tok, "guid") == 0) { if (!lan->guid) lan->guid = malloc(16); if (!lan->guid) return -1; err = read_bytes(&tokptr, lan->guid, &errstr, 16); if (err) goto out_err; } else if (strcmp(tok, "bmc_key") == 0) { if (!lan->bmc_key) lan->bmc_key = malloc(20); if (!lan->bmc_key) return -1; err = read_bytes(&tokptr, lan->bmc_key, &errstr, 20); if (err) goto out_err; } else if (strcmp(tok, "lan_config_program") == 0) { err = get_delim_str(&tokptr, &lan->config_prog, &errstr); if (err) goto out_err; } else { errstr = "Invalid configuration option"; err = -1; } if (err) { out_err: sys->free(sys, lan); fprintf(stderr, "Error on line %d: %s\n", *line, errstr); return err; } } sys->free(sys, lan); fprintf(stderr, "End of file in lan section\n"); return -1; } OpenIPMI-2.0.27/lanserv/bmc_sensor.c0000664000175000017500000013513613051576450014074 00000000000000/* * bmc_sensor.c * * MontaVista IPMI code for emulating a MC. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2012,2013 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include "bmc.h" #include #include #include #include #include #include #include #include #include #include #include #include static void sensor_poll(void *cb_data); static void handle_get_event_receiver(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!(mc->device_support & IPMI_DEVID_IPMB_EVENT_GEN)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } rdata[0] = 0; rdata[1] = mc->event_receiver; rdata[2] = mc->event_receiver_lun & 0x3; *rdata_len = 3; } static void handle_set_event_receiver(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!(mc->device_support & IPMI_DEVID_IPMB_EVENT_GEN)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 2, rdata, rdata_len)) return; mc->event_receiver = msg->data[0] & 0xfe; mc->event_receiver_lun = msg->data[1] & 0x3; rdata[0] = 0; *rdata_len = 1; } static void handle_get_device_sdr_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (! mc->has_device_sdrs) { handle_invalid_cmd(mc, rdata, rdata_len); return; } rdata[0] = 0; rdata[1] = mc->num_sensors_per_lun[msg->rs_lun]; rdata[2] = ((mc->dynamic_sensor_population << 7) | (mc->lun_has_sensors[3] << 3) | (mc->lun_has_sensors[2] << 2) | (mc->lun_has_sensors[1] << 1) | (mc->lun_has_sensors[0] << 0)); if (!mc->dynamic_sensor_population) { *rdata_len = 3; return; } ipmi_set_uint32(rdata+3, mc->sensor_population_change_time); *rdata_len = 7; } static void handle_reserve_device_sdr_repository(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!(mc->has_device_sdrs)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (!(mc->dynamic_sensor_population)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } mc->device_sdrs[msg->rs_lun].reservation++; if (mc->device_sdrs[msg->rs_lun].reservation == 0) mc->device_sdrs[msg->rs_lun].reservation++; rdata[0] = 0; ipmi_set_uint16(rdata+1, mc->device_sdrs[msg->rs_lun].reservation); *rdata_len = 3; } static void handle_get_device_sdr(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { uint16_t record_id; unsigned int offset; unsigned int count; sdr_t *entry; if (!(mc->has_device_sdrs)) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 6, rdata, rdata_len)) return; if (mc->dynamic_sensor_population) { uint16_t reservation = ipmi_get_uint16(msg->data+0); if ((reservation != 0) && (reservation != mc->device_sdrs[msg->rs_lun].reservation)) { rdata[0] = IPMI_INVALID_RESERVATION_CC; *rdata_len = 1; return; } } record_id = ipmi_get_uint16(msg->data+2); offset = msg->data[4]; count = msg->data[5]; if (record_id == 0) { entry = mc->device_sdrs[msg->rs_lun].sdrs; } else if (record_id == 0xffff) { entry = mc->device_sdrs[msg->rs_lun].sdrs; if (entry) { while (entry->next) { entry = entry->next; } } } else { entry = find_sdr_by_recid(&mc->device_sdrs[msg->rs_lun], record_id, NULL); } if (entry == NULL) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } if (offset >= entry->length) { rdata[0] = IPMI_PARAMETER_OUT_OF_RANGE_CC; *rdata_len = 1; return; } if ((offset+count) > entry->length) count = entry->length - offset; if (count+3 > *rdata_len) { /* Too much data to put into response. */ rdata[0] = IPMI_REQUESTED_DATA_LENGTH_EXCEEDED_CC; *rdata_len = 1; return; } rdata[0] = 0; if (entry->next) ipmi_set_uint16(rdata+1, entry->next->record_id); else { rdata[1] = 0xff; rdata[2] = 0xff; } memcpy(rdata+3, entry->data+offset, count); *rdata_len = count + 3; } static void handle_set_sensor_hysteresis(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int sens_num; sensor_t *sensor; if (check_msg_length(msg, 4, rdata, rdata_len)) return; sens_num = msg->data[0]; if ((sens_num >= 255) || (!mc->sensors[msg->rs_lun][sens_num])) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor = mc->sensors[msg->rs_lun][sens_num]; if (sensor->hysteresis_support != IPMI_HYSTERESIS_SUPPORT_SETTABLE) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } sensor->positive_hysteresis = msg->data[2]; sensor->negative_hysteresis = msg->data[3]; rdata[0] = 0; *rdata_len = 1; } static void handle_get_sensor_hysteresis(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int sens_num; sensor_t *sensor; if (check_msg_length(msg, 1, rdata, rdata_len)) return; sens_num = msg->data[0]; if ((sens_num >= 255) || (!mc->sensors[msg->rs_lun][sens_num])) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor = mc->sensors[msg->rs_lun][sens_num]; if ((sensor->hysteresis_support != IPMI_HYSTERESIS_SUPPORT_SETTABLE) && (sensor->hysteresis_support != IPMI_HYSTERESIS_SUPPORT_READABLE)) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = sensor->positive_hysteresis; rdata[2] = sensor->negative_hysteresis; *rdata_len = 3; } static void do_event(lmc_data_t *mc, sensor_t *sensor, int gen_event, unsigned char direction, unsigned char byte1, unsigned char byte2, unsigned char byte3) { lmc_data_t *dest_mc; unsigned char data[13]; int rv; if ((mc->event_receiver == 0) || (!sensor->enabled) || (!sensor->events_enabled) || (!gen_event)) return; rv = ipmi_emu_get_mc_by_addr(mc->emu, mc->event_receiver, &dest_mc); if (rv) return; /* Timestamp is ignored. */ data[0] = 0; data[1] = 0; data[2] = 0; data[3] = 0; data[4] = mc->ipmb; data[5] = sensor->lun; data[6] = 0x04; /* Event message revision for IPMI 1.5. */ data[7] = sensor->sensor_type; data[8] = sensor->num; data[9] = (direction << 7) | sensor->event_reading_code; data[10] = byte1; data[11] = byte2; data[12] = byte3; mc_new_event(dest_mc, 0x02, data); } void set_sensor_bit(lmc_data_t *mc, sensor_t *sensor, unsigned char bit, unsigned char value, unsigned char evd1, unsigned char evd2, unsigned char evd3, int gen_event) { if (sensor->event_only) { if (value) do_event(mc, sensor, gen_event, IPMI_ASSERTION, evd1 | bit, evd2, evd3); else do_event(mc, sensor, gen_event, IPMI_DEASSERTION, evd1 | bit, evd2, evd3); } else if (value != bit_set(sensor->event_status, bit)) { /* The bit value has changed. */ set_bit(sensor->event_status, bit, value); if (value && bit_set(sensor->event_enabled[0], bit)) { do_event(mc, sensor, gen_event, IPMI_ASSERTION, evd1 | bit, evd2, evd3); } else if (!value && bit_set(sensor->event_enabled[1], bit)) { do_event(mc, sensor, gen_event, IPMI_DEASSERTION, evd1 | bit, evd2, evd3); } } } static void check_thresholds(lmc_data_t *mc, sensor_t *sensor, int gen_event) { int i; int bits_to_set = 0; int bits_to_clear = 0; for (i=0; i<3; i++) { if (bit_set(sensor->threshold_supported, i)) { if (sensor->value <= sensor->thresholds[i]) bits_to_set |= (1 << i); else if ((sensor->value - sensor->negative_hysteresis) > sensor->thresholds[i]) bits_to_clear |= (1 << i); } } for (; i<6; i++) { if (bit_set(sensor->threshold_supported, i)) { if (sensor->value >= sensor->thresholds[i]) bits_to_set |= (1 << i); else if ((sensor->value + sensor->positive_hysteresis) < sensor->thresholds[i]) bits_to_clear |= (1 << i); } } /* We don't support lower assertions for high thresholds or higher assertions for low thresholds because that's just stupid. */ for (i=0; i<3; i++) { if (((bits_to_set >> i) & 1) && !bit_set(sensor->event_status, i)) { /* This bit was not set, but we need to set it. */ set_bit(sensor->event_status, i, 1); if (bit_set(sensor->event_enabled[0], i * 2)) { do_event(mc, sensor, gen_event, IPMI_ASSERTION, 0x50 | (i*2), sensor->value, sensor->thresholds[i]); } } else if (((bits_to_clear >> i) & 1) && bit_set(sensor->event_status, i)) { /* This bit was not clear, but we need to clear it. */ set_bit(sensor->event_status, i, 0); if (bit_set(sensor->event_enabled[1], i * 2)) { do_event(mc, sensor, gen_event, IPMI_DEASSERTION, 0x50 | (i*2), sensor->value, sensor->thresholds[i]); } } } for (; i<6; i++) { if (((bits_to_set >> i) & 1) && !bit_set(sensor->event_status, i)) { /* This bit was not set, but we need to set it. */ set_bit(sensor->event_status, i, 1); if (bit_set(sensor->event_enabled[0], i * 2 + 1)) { do_event(mc, sensor, gen_event, IPMI_ASSERTION, 0x50 | (i*2+1), sensor->value, sensor->thresholds[i]); } } else if (((bits_to_clear >> i) & 1) && bit_set(sensor->event_status, i)) { /* This bit was not clear, but we need to clear it. */ set_bit(sensor->event_status, i, 0); if (bit_set(sensor->event_enabled[1], i * 2 + 1)) { do_event(mc, sensor, gen_event, IPMI_DEASSERTION, 0x50 | (i*2+1), sensor->value, sensor->thresholds[i]); } } } } static void handle_set_sensor_thresholds(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int sens_num; sensor_t *sensor; int i; if (check_msg_length(msg, 8, rdata, rdata_len)) return; sens_num = msg->data[0]; if ((sens_num >= 255) || (!mc->sensors[msg->rs_lun][sens_num])) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor = mc->sensors[msg->rs_lun][sens_num]; if ((sensor->event_reading_code != IPMI_EVENT_READING_TYPE_THRESHOLD) || (sensor->threshold_support != IPMI_THRESHOLD_ACCESS_SUPPORT_SETTABLE)) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } for (i=0; i<6; i++) { if ((msg->data[1] & (1 << i)) && (!bit_set(sensor->threshold_supported, i))) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } } for (i=0; i<6; i++) { if (msg->data[1] & (1 << i)) { sensor->thresholds[i] = msg->data[i+2]; } } check_thresholds(mc, sensor, 1); rdata[0] = 0; *rdata_len = 1; } static void handle_get_sensor_thresholds(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int sens_num; sensor_t *sensor; int i; if (check_msg_length(msg, 1, rdata, rdata_len)) return; sens_num = msg->data[0]; if ((sens_num >= 255) || (!mc->sensors[msg->rs_lun][sens_num])) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor = mc->sensors[msg->rs_lun][sens_num]; if ((sensor->event_reading_code != IPMI_EVENT_READING_TYPE_THRESHOLD) || ((sensor->threshold_support != IPMI_THRESHOLD_ACCESS_SUPPORT_SETTABLE) && (sensor->threshold_support != IPMI_THRESHOLD_ACCESS_SUPPORT_READABLE))) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = 0; for (i=0; i<6; i++) { if (bit_set(sensor->threshold_supported, i)) { rdata[1] |= 1 << i; rdata[2+i] = sensor->thresholds[i]; } else rdata[2+i] = 0; } *rdata_len = 8; } static void handle_set_sensor_event_enable(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int sens_num; sensor_t *sensor; unsigned int i; int j, e; unsigned char op; if (check_msg_length(msg, 2, rdata, rdata_len)) return; sens_num = msg->data[0]; if ((sens_num >= 255) || (!mc->sensors[msg->rs_lun][sens_num])) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor = mc->sensors[msg->rs_lun][sens_num]; if ((sensor->event_support == IPMI_EVENT_SUPPORT_NONE) || (sensor->event_support == IPMI_EVENT_SUPPORT_GLOBAL_ENABLE)) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } op = (msg->data[1] >> 4) & 0x3; if (sensor->event_support == IPMI_EVENT_SUPPORT_ENTIRE_SENSOR) { if (op != 0) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } } if (op == 3) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor->events_enabled = (msg->data[1] >> 7) & 1; sensor->scanning_enabled = (msg->data[1] >> 6) & 1; sensor_poll(sensor); if (op == 0) return; else if (op == 1) /* Enable selected events */ op = 1; else /* Disable selected events */ op = 0; e = 0; for (i=2; i<=3; i++) { if (msg->len <= i) break; for (j=0; j<8; j++, e++) { if (e >= 15) break; if (((msg->data[i] >> j) & 1) && bit_set(sensor->event_supported[0], e)) set_bit(sensor->event_enabled[0], e, op); } } e = 0; for (i=4; i<=5; i++) { if (msg->len <= i) break; for (j=0; j<8; j++, e++) { if (e >= 15) break; if (((msg->data[i] >> j) & 1) && bit_set(sensor->event_supported[1], e)) set_bit(sensor->event_enabled[1], e, op); } } rdata[0] = 0; *rdata_len = 1; } static void handle_get_sensor_event_enable(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int sens_num; sensor_t *sensor; if (check_msg_length(msg, 1, rdata, rdata_len)) return; sens_num = msg->data[0]; if ((sens_num >= 255) || (!mc->sensors[msg->rs_lun][sens_num])) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor = mc->sensors[msg->rs_lun][sens_num]; if ((sensor->event_support == IPMI_EVENT_SUPPORT_NONE) || (sensor->event_support == IPMI_EVENT_SUPPORT_GLOBAL_ENABLE)) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = ((sensor->events_enabled << 7) | ((sensor->scanning_enabled && sensor->enabled) << 6)); if (sensor->event_support == IPMI_EVENT_SUPPORT_ENTIRE_SENSOR) { *rdata_len = 2; return; } rdata[2] = sensor->event_enabled[0] & 0xff; rdata[3] = (sensor->event_enabled[0] >> 8) & 0xff; rdata[4] = sensor->event_enabled[1] & 0xff; rdata[5] = (sensor->event_enabled[1] >> 8) & 0xff; *rdata_len = 6; } static void handle_set_sensor_type(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_get_sensor_type(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int sens_num; sensor_t *sensor; if (check_msg_length(msg, 1, rdata, rdata_len)) return; sens_num = msg->data[0]; if ((sens_num >= 255) || (!mc->sensors[msg->rs_lun][sens_num])) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor = mc->sensors[msg->rs_lun][sens_num]; rdata[0] = 0; rdata[1] = sensor->sensor_type; rdata[2] = sensor->event_reading_code; *rdata_len = 3; } static void handle_get_sensor_reading(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int sens_num; sensor_t *sensor; if (check_msg_length(msg, 1, rdata, rdata_len)) return; sens_num = msg->data[0]; if ((sens_num >= 255) || (!mc->sensors[msg->rs_lun][sens_num])) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor = mc->sensors[msg->rs_lun][sens_num]; if (sensor->event_only) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = sensor->value; rdata[2] = ((sensor->events_enabled << 7) | ((sensor->scanning_enabled && sensor->enabled) << 6)); rdata[3] = sensor->event_status & 0xff; rdata[4] = (sensor->event_status >> 8) & 0xff; *rdata_len = 5; } static void handle_rearm_sensor_events(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int sens_num; sensor_t *sensor; uint16_t rearm_assert = 0, rearm_deassert = 0; unsigned int i; int rv; if (check_msg_length(msg, 2, rdata, rdata_len)) return; sens_num = msg->data[0]; if ((sens_num >= 255) || (!mc->sensors[msg->rs_lun][sens_num])) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sensor = mc->sensors[msg->rs_lun][sens_num]; if (msg->data[1] & (1 << 7)) { rearm_assert = 0x7fff; rearm_deassert = 0x7fff; } else { if (msg->len > 2) rearm_assert = msg->data[2]; if (msg->len > 3) rearm_assert |= msg->data[3] << 8; if (msg->len > 4) rearm_deassert = msg->data[4]; if (msg->len > 5) rearm_deassert |= msg->data[5] << 8; } if (sensor->rearm_handler) { rv = sensor->rearm_handler(sensor->rearm_cb_data, rearm_assert, rearm_deassert); if (rv) { rdata[0] = 0xff; *rdata_len = 1; return; } } rearm_assert &= sensor->event_enabled[0] & sensor->event_status; rearm_deassert &= sensor->event_enabled[1] & ~sensor->event_status; for (i = 0; i < 15; i++) { if (bit_set(rearm_assert, i)) do_event(mc, sensor, 1, IPMI_ASSERTION, 0, 0xff, 0xff); else if (bit_set(rearm_deassert, i)) do_event(mc, sensor, 1, IPMI_DEASSERTION, 0, 0xff, 0xff); } rdata[0] = 0; *rdata_len = 1; } int ipmi_mc_sensor_add_rearm_handler(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, int (*handler)(void *cb_data, uint16_t assert, uint16_t deassert), void *cb_data) { sensor_t *sensor; if ((sens_num >= 255) || (!mc->sensors[lun][sens_num])) return EINVAL; sensor = mc->sensors[lun][sens_num]; sensor->rearm_handler = handler; sensor->rearm_cb_data = cb_data; return 0; } int ipmi_mc_sensor_set_bit(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char bit, unsigned char value, int gen_event) { sensor_t *sensor; if ((lun >= 4) || (sens_num >= 255) || (!mc->sensors[lun][sens_num])) return EINVAL; if (bit >= 15) return EINVAL; sensor = mc->sensors[lun][sens_num]; set_sensor_bit(mc, sensor, bit, value, 0, 0xff, 0xff, gen_event); if (sensor->sensor_update_handler) sensor->sensor_update_handler(mc, sensor); return 0; } int ipmi_mc_sensor_set_bit_clr_rest(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char bit, int gen_event) { sensor_t *sensor; int i; if ((lun >= 4) || (sens_num >= 255) || (!mc->sensors[lun][sens_num])) return EINVAL; if (bit >= 15) return EINVAL; sensor = mc->sensors[lun][sens_num]; /* Clear all the other bits. */ for (i=0; i<15; i++) { if ((i != bit) && bit_set(sensor->event_status, i)) set_sensor_bit(mc, sensor, i, 0, 0, 0xff, 0xff, gen_event); } sensor->value = bit; set_sensor_bit(mc, sensor, bit, 1, 0, 0xff, 0xff, gen_event); if (sensor->sensor_update_handler) sensor->sensor_update_handler(mc, sensor); return 0; } int ipmi_mc_sensor_set_enabled(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char enabled) { sensor_t *sensor; if ((lun >= 4) || (sens_num >= 255) || (!mc->sensors[lun][sens_num])) return EINVAL; sensor = mc->sensors[lun][sens_num]; sensor->enabled = enabled; sensor_poll(sensor); return 0; } static void set_sensor_value(lmc_data_t *mc, sensor_t *sensor, unsigned char value, int gen_event) { sensor->value = value; if (sensor->sensor_update_handler) sensor->sensor_update_handler(mc, sensor); check_thresholds(mc, sensor, gen_event); } int ipmi_mc_sensor_set_value(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char value, int gen_event) { sensor_t *sensor; if ((lun >= 4) || (sens_num >= 255) || (!mc->sensors[lun][sens_num])) return EINVAL; sensor = mc->sensors[lun][sens_num]; set_sensor_value(mc, sensor, value, gen_event); return 0; } int ipmi_mc_sensor_set_hysteresis(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char support, unsigned char positive, unsigned char negative) { sensor_t *sensor; if ((lun >= 4) || (sens_num >= 255) || (!mc->sensors[lun][sens_num])) return EINVAL; sensor = mc->sensors[lun][sens_num]; sensor->hysteresis_support = support; sensor->positive_hysteresis = positive; sensor->negative_hysteresis = negative; return 0; } int ipmi_mc_sensor_set_threshold(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char support, uint16_t supported, int set_values, unsigned char values[6]) { sensor_t *sensor; if ((lun >= 4) || (sens_num >= 255) || (!mc->sensors[lun][sens_num])) return EINVAL; sensor = mc->sensors[lun][sens_num]; sensor->threshold_support = support; sensor->threshold_supported = supported; if (set_values) memcpy(sensor->thresholds, values, 6); return 0; } int ipmi_mc_sensor_set_event_support(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char init_events, unsigned char events_enable, unsigned char init_scanning, unsigned char scanning_enable, unsigned char event_support, uint16_t assert_supported, uint16_t deassert_supported, uint16_t assert_enabled, uint16_t deassert_enabled) { sensor_t *sensor; if ((lun >= 4) || (sens_num >= 255) || (!mc->sensors[lun][sens_num])) return EINVAL; sensor = mc->sensors[lun][sens_num]; if (init_events) sensor->events_enabled = events_enable; if (init_scanning) sensor->scanning_enabled = scanning_enable; sensor->event_support = event_support; sensor->event_supported[0] = assert_supported; sensor->event_supported[1] = deassert_supported; sensor->event_enabled[0] = assert_enabled & assert_supported; sensor->event_enabled[1] = deassert_enabled & deassert_supported; sensor_poll(sensor); return 0; } static int init_sensor_from_sdr(lmc_data_t *mc, unsigned char *sdr) { int err; unsigned int len = sdr[4]; unsigned char num = sdr[7]; unsigned char lun = sdr[6] & 0x3; uint16_t assert_sup, deassert_sup, assert_en, deassert_en; unsigned char events_on = (sdr[10] >> 1) & 1; unsigned char scan_on = (sdr[10] >> 0) & 1; unsigned char init_events = (sdr[10] >> 5) & 1; unsigned char init_scan = (sdr[10] >> 6) & 1; unsigned char init_thresh = (sdr[10] >> 4) & 1; unsigned char init_hyst = (sdr[10] >> 3) & 1; unsigned char init_type = (sdr[10] >> 2) & 1; unsigned char event_sup = sdr[11] & 0x3; unsigned char thresh_sup = (sdr[11] >> 2) & 0x3; uint16_t thresh_set; unsigned char hyst_sup = (sdr[11] >> 4) & 3; sensor_t *sensor; if ((lun >= 4) || (num >= 255) || (!mc->sensors[lun][num])) return EINVAL; sensor = mc->sensors[lun][num]; if (len < 20) return 0; if ((sdr[3] < 1) || (sdr[3] > 2)) return 0; /* Not a sensor SDR we set from */ thresh_set = ((sdr[15] >> 4) & 0x7) | (((sdr[17] >> 4) & 0x7) << 3); assert_sup = sdr[14] | (sdr[15] << 8); deassert_sup = sdr[16] | (sdr[17] << 8); assert_en = sdr[14] | (sdr[15] << 8); deassert_en = sdr[16] | (sdr[17] << 8); if (init_type) { sensor->sensor_type = sdr[12]; sensor->event_reading_code = sdr[13]; } err = ipmi_mc_sensor_set_event_support(mc, lun, num, init_events, events_on, init_scan, scan_on, event_sup, assert_sup, deassert_sup, assert_en, deassert_en); if (err) return err; if (init_thresh) { if (thresh_sup == 2 && sdr[3] == 1) { unsigned char thresh_val[6]; thresh_val[0] = sdr[41]; thresh_val[1] = sdr[40]; thresh_val[2] = sdr[39]; thresh_val[3] = sdr[38]; thresh_val[4] = sdr[37]; thresh_val[5] = sdr[36]; err = ipmi_mc_sensor_set_threshold(mc, lun, num, thresh_sup, thresh_set, 1, thresh_val); } else { err = ipmi_mc_sensor_set_threshold(mc, lun, num, thresh_sup, thresh_set, 0, NULL); } if (err) return err; } if (init_hyst) { if (sdr[3] == 1) { err = ipmi_mc_sensor_set_hysteresis(mc, lun, num, hyst_sup, sdr[42], sdr[43]); } else if (sdr[3] == 2) { err = ipmi_mc_sensor_set_hysteresis(mc, lun, num, hyst_sup, sdr[25], sdr[26]); } } return err; } static int check_sensor_sdr(lmc_data_t *mc, unsigned char *sdr, unsigned int len, void *cb_data) { sensor_t *sensor = cb_data; uint8_t mc_ipmb = ipmi_mc_get_ipmb(mc); if (len < 8) return 0; if ((sdr[3] != 1) && (sdr[3] != 2)) return 0; if (sdr[5] != mc_ipmb) return 0; if ((sdr[6] & 0x3) != sensor->lun) return 0; if (sdr[7] != sensor->num) return 0; init_sensor_from_sdr(mc, sdr); return 1; } int ipmi_mc_add_sensor(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char type, unsigned char event_reading_code, int event_only) { sensor_t *sensor; lmc_data_t *bmc; if ((lun >= 4) || (sens_num >= 255) || (mc->sensors[lun][sens_num])) return EINVAL; sensor = malloc(sizeof(*sensor)); if (!sensor) return ENOMEM; memset(sensor, 0, sizeof(*sensor)); sensor->mc = mc; sensor->lun = lun; sensor->num = sens_num; sensor->sensor_type = type; sensor->event_reading_code = event_reading_code; sensor->event_only = event_only; mc->sensors[lun][sens_num] = sensor; if (mc->emu->atca_mode && (type == 0xf0)) { /* This is the ATCA hot-swap sensor. */ mc->hs_sensor = sensor; sensor->sensor_update_handler = picmg_led_set; } bmc = ipmi_emu_get_bmc_mc(mc->emu); if (bmc) iterate_sdrs(mc, &bmc->main_sdrs, check_sensor_sdr, sensor); /* Delay enable so the above process won't generate any events. */ sensor->enabled = 1; /* Clear any status we might have just generated. */ sensor->event_status = 0; return 0; } struct file_data { char *filename; unsigned int offset; unsigned int length; unsigned int mask; unsigned int initstate; int is_raw; int mult; int div; int sub; int base; emu_data_t *emu; lmc_data_t *sensor_mc; unsigned char sensor_lun; unsigned char sensor_num; unsigned char depends_mc_addr; unsigned char depends_lun; unsigned char depends_sensor_num; unsigned char depends_sensor_bit; }; static int file_poll(void *cb_data, unsigned int *rval, const char **errstr) { struct file_data *f = cb_data; int fd; int rv; int val; char *end; int errv; if (f->depends_mc_addr) { lmc_data_t *mc = f->sensor_mc; sensor_t *sensor, *dsensor; sensor = mc->sensors[f->sensor_lun][f->sensor_num]; if (!sensor) { *errstr = "Invalid sensor"; return EINVAL; } errv = ipmi_emu_get_mc_by_addr(mc->emu, f->depends_mc_addr, &mc); if (errv) { *errstr = "Invalid depends mc address"; return errv; } dsensor = mc->sensors[f->depends_lun][f->depends_sensor_num]; if (!dsensor) { *errstr = "Invalid depends sensor number or LUN"; return EINVAL; } sensor->enabled = bit_set(dsensor->event_status, f->depends_sensor_bit); if (!sensor->enabled) return 0; } fd = open(f->filename, O_RDONLY); if (fd == -1) { errv = errno; *errstr = "Unable to open sensor file"; return errv; } if (f->offset) { if (lseek(fd, f->offset, SEEK_SET) == -1) { errv = errno; close(fd); *errstr = "Unable to seek file"; return errv; } } if (f->is_raw) { unsigned char data[4]; int i; int length = f->length; if (length > 4) length = 4; rv = read(fd, data, length); errv = errno; close(fd); if (rv == -1) { *errstr = "No data read from file"; return errv; } else if (rv < length) { *errstr = "Short data read from file"; return -1; } val = 0; for (i = 0; i < length; i++) val |= data[i] << (i * 8); } else { char data[100]; rv = read(fd, data, sizeof(data) - 1); errv = errno; close(fd); if (rv == -1) { *errstr = "No data read from file"; return errv; } data[rv] = '\0'; val = strtol(data, &end, f->base); if ((*end != '\0' && !isspace(*end)) || (end == data)) { *errstr = "Invalid data read from file"; return EINVAL; } } if (f->mask) val &= f->mask; val -= f->sub; if (f->mult) val = val * f->mult; if (f->div) val = (val + (f->div / 2)) / f->div; *rval = val; return 0; } static int file_init(lmc_data_t *mc, unsigned char lun, unsigned char sensor_num, char **toks, void *cb_data, void **rcb_data, const char **errstr) { char *fname = NULL; struct file_data *f; char *end; int err; const char *tok; if (lun >= 4) { *errstr = "Invalid sensor LUN"; return EINVAL; } err = get_delim_str(toks, &fname, errstr); if (err) return ENOMEM; f = malloc(sizeof(*f)); if (!f) { free(fname); return ENOMEM; } memset(f, 0, sizeof(*f)); f->emu = mc->emu; f->sensor_mc = mc; f->sensor_lun = lun; f->sensor_num = sensor_num; tok = mystrtok(NULL, " \t\n", toks); while (tok) { if (strncmp("div=", tok, 4) == 0) { f->div = strtol(tok + 4, &end, 0); if (*end != '\0') { *errstr = "Invalid div value"; goto out_err; } } else if (strncmp("mult=", tok, 5) == 0) { f->mult = strtol(tok + 5, &end, 0); if (*end != '\0') { *errstr = "Invalid mult value"; goto out_err; } } else if (strncmp("sub=", tok, 4) == 0) { f->sub = strtol(tok + 4, &end, 0); if (*end != '\0') { *errstr = "Invalid sub value"; goto out_err; } } else if (strncmp("base=", tok, 5) == 0) { f->base = strtol(tok + 5, &end, 0); if (*end != '\0') { *errstr = "Invalid base value"; goto out_err; } } else if (strncmp("mask=", tok, 5) == 0) { f->mask = strtol(tok + 5, &end, 0); if (*end != '\0') { *errstr = "Invalid mask value"; goto out_err; } } else if (strncmp("initstate=", tok, 5) == 0) { f->initstate = strtol(tok + 5, &end, 0); if (*end != '\0') { *errstr = "Invalid initstate value"; goto out_err; } } else if (strcmp("raw", tok) == 0) { f->is_raw = 1; } else if (strcmp("ascii", tok) == 0) { f->is_raw = 0; } else if (strncmp("offset=", tok, 7) == 0) { f->offset = strtoul(tok + 7, &end, 0); if (*end != '\0') { *errstr = "Invalid offset value"; goto out_err; } } else if (strncmp("length=", tok, 7) == 0) { f->length = strtoul(tok + 7, &end, 0); if (*end != '\0') { *errstr = "Invalid length value"; goto out_err; } } else if (strncmp("depends=", tok, 8) == 0) { char *toks2; tok = mystrtok((char *) tok + 8, ",", &toks2); if (!tok) { *errstr = "No mc address for sensor depends"; goto out_err; } f->depends_mc_addr = strtoul((char *) tok, &end, 0); if (*end != '\0') { *errstr = "Invalid depends mc addr"; goto out_err; } tok = mystrtok(NULL, ",", &toks2); if (!tok) { *errstr = "No lun for sensor depends"; goto out_err; } f->depends_lun = strtoul(tok, &end, 0); if (*end != '\0' || f->depends_lun >= 4) { *errstr = "Invalid depends lun"; goto out_err; } tok = mystrtok(NULL, ",", &toks2); if (!tok) { *errstr = "No sensor number for sensor depends"; goto out_err; } f->depends_sensor_num = strtoul(tok, &end, 0); if (*end != '\0') { *errstr = "Invalid depends sensor_number"; goto out_err; } tok = mystrtok(NULL, ",", &toks2); if (!tok) { *errstr = "No sensor bit for sensor depends"; goto out_err; } f->depends_sensor_bit = strtoul(tok, &end, 0); if (*end != '\0' || f->depends_sensor_bit >= 15) { *errstr = "Invalid depends sensor_number"; goto out_err; } } else { *errstr = "Invalid file option, options are div= and base="; goto out_err; } tok = mystrtok(NULL, " \t\n", toks); } f->filename = fname; *rcb_data = f; return 0; out_err: free(fname); free(f); return -1; } static int file_post_init(void *cb_data, const char **errstr) { struct file_data *f = cb_data; lmc_data_t *mc = f->sensor_mc; sensor_t *sensor; sensor = mc->sensors[f->sensor_lun][f->sensor_num]; if (!sensor) { *errstr = "Unable to find sensor"; return EINVAL; } sensor->event_status = f->initstate; return 0; } static ipmi_sensor_handler_t file_sensor = { .name = "file", .poll = file_poll, .init = file_init, .postinit = file_post_init }; static ipmi_sensor_handler_t *sensor_handlers = &file_sensor; int ipmi_sensor_add_handler(ipmi_sensor_handler_t *handler) { handler->next = sensor_handlers; sensor_handlers = handler; return 0; } ipmi_sensor_handler_t * ipmi_sensor_find_handler(const char *name) { ipmi_sensor_handler_t *handler = sensor_handlers; while (handler) { if (strcmp(handler->name, name) == 0) return handler; handler = handler->next; } return NULL; } static void free_sensor(lmc_data_t *mc, sensor_t *sensor) { mc->sensors[sensor->lun][sensor->num] = NULL; free(sensor); } static void sensor_poll(void *cb_data) { sensor_t *sensor = cb_data; if (sensor->poll && sensor->scanning_enabled) { lmc_data_t *mc = sensor->mc; unsigned int val; const char *errstr; int err; err = sensor->poll(sensor->cb_data, &val, &errstr); if (err) { mc->sysinfo->log(mc->sysinfo, OS_ERROR, NULL, "Error getting sensor value (%2.2x,%d,%d): %s, %s", ipmi_mc_get_ipmb(mc), sensor->lun, sensor->num, strerror(err), errstr); goto out_restart; } if (sensor->event_reading_code == IPMI_EVENT_READING_TYPE_THRESHOLD) { if (val > 255) val = 255; set_sensor_value(mc, sensor, val, 1); } else { unsigned int i; for (i = 0; i < 15; i++) set_sensor_bit(mc, sensor, i, ((val >> i) & 1), 0, 0xff, 0xff, 1); } out_restart: mc->sysinfo->start_timer(sensor->poll_timer, &sensor->poll_timer_time); } } int ipmi_mc_add_polled_sensor(lmc_data_t *mc, unsigned char lun, unsigned char sens_num, unsigned char type, unsigned char event_reading_code, unsigned int poll_rate, int (*poll)(void *cb_data, unsigned int *val, const char **errstr), void *cb_data) { sensor_t *sensor; int err; err = ipmi_mc_add_sensor(mc, lun, sens_num, type, event_reading_code, 0); if (err) return err; sensor = mc->sensors[lun][sens_num]; sensor->poll = poll; sensor->poll_timer_time.tv_sec = poll_rate / 1000; sensor->poll_timer_time.tv_usec = (poll_rate % 1000) * 1000; sensor->cb_data = cb_data; err = mc->sysinfo->alloc_timer(mc->sysinfo, sensor_poll, sensor, &sensor->poll_timer); if (err) { free_sensor(mc, sensor); return err; } mc->sysinfo->start_timer(sensor->poll_timer, &sensor->poll_timer_time); return 0; } static void handle_ipmi_get_pef_capabilities(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (!mc->sysinfo) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = 0x51; /* version */ rdata[2] = 0x3f; /* support everything but OEM */ rdata[3] = MAX_EVENT_FILTERS; *rdata_len = 4; } static void handle_ipmi_set_pef_config_parms(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned char err = 0; int set, block; sys_data_t *sys = mc->sysinfo; if (msg->len < 2) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (!sys) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } switch (msg->data[0] & 0x7f) { case 0: switch (msg->data[1] & 0x3) { case 0: if (mc->pef.set_in_progress) { /* rollback */ memcpy(&mc->pef, &mc->pef_rollback, sizeof(mc->pef)); } /* No affect otherwise */ break; case 1: if (mc->pef.set_in_progress) err = 0x81; /* Another user is writing. */ else { /* Save rollback data */ memcpy(&mc->pef_rollback, &mc->pef, sizeof(mc->pef)); mc->pef.set_in_progress = 1; } break; case 2: if (mc->pef.commit) mc->pef.commit(sys); memset(&mc->pef.changed, 0, sizeof(mc->pef.changed)); mc->pef.set_in_progress = 0; break; case 3: err = IPMI_INVALID_DATA_FIELD_CC; } break; case 5: case 8: case 11: err = 0x82; /* Read-only data */ break; case 1: mc->pef.pef_control = msg->data[1]; mc->pef.changed.pef_control = 1; break; case 2: mc->pef.pef_action_global_control = msg->data[1]; mc->pef.changed.pef_action_global_control = 1; break; case 3: mc->pef.pef_startup_delay = msg->data[1]; mc->pef.changed.pef_startup_delay = 1; break; case 4: mc->pef.pef_alert_startup_delay = msg->data[1]; mc->pef.changed.pef_alert_startup_delay = 1; break; case 6: set = msg->data[1] & 0x7f; if (msg->len < 22) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if ((set <= 0) || (set >= mc->pef.num_event_filters)) err = IPMI_INVALID_DATA_FIELD_CC; else { set = msg->data[1] & 0x7f; memcpy(mc->pef.event_filter_table[set], msg->data+1, 21); mc->pef.changed.event_filter_table[set] = 1; } break; case 7: set = msg->data[1] & 0x7f; if (msg->len < 3) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if ((set <= 0) || (set >= mc->pef.num_event_filters)) err = IPMI_INVALID_DATA_FIELD_CC; else { set = msg->data[1] & 0x7f; memcpy(mc->pef.event_filter_data1[set], msg->data+1, 2); mc->pef.changed.event_filter_data1[set] = 1; } break; case 9: set = msg->data[1] & 0x7f; if (msg->len < 5) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if ((set <= 0) || (set >= mc->pef.num_alert_policies)) err = IPMI_INVALID_DATA_FIELD_CC; else { set = msg->data[1] & 0x7f; memcpy(mc->pef.alert_policy_table[set], msg->data+1, 4); mc->pef.changed.alert_policy_table[set] = 1; } break; case 10: if (msg->len < 18) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(mc->pef.system_guid, msg->data+1, 17); mc->pef.changed.system_guid = 1; } break; case 12: set = msg->data[1] & 0x7f; if (msg->len < 4) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if (set >= mc->pef.num_alert_strings) err = IPMI_INVALID_DATA_FIELD_CC; else { set = msg->data[1] & 0x7f; memcpy(mc->pef.alert_string_keys[set], msg->data+1, 3); mc->pef.changed.alert_string_keys[set] = 1; } break; case 13: set = msg->data[1] & 0x7f; if (msg->len < 4) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if (set >= mc->pef.num_alert_strings) err = IPMI_INVALID_DATA_FIELD_CC; else if (msg->data[2] == 0) err = IPMI_INVALID_DATA_FIELD_CC; else { int dlen = msg->len - 3; set = msg->data[1] & 0x7f; block = msg->data[2] - 1; if (((block*16) + dlen) > MAX_ALERT_STRING_LEN) { err = IPMI_PARAMETER_OUT_OF_RANGE_CC; break; } memcpy(mc->pef.alert_strings[set]+(block*16), msg->data+3, dlen); mc->pef.changed.alert_strings[set] = 1; } break; default: err = 0x80; /* Parm not supported */ } rdata[0] = err; *rdata_len = 1; } static void handle_ipmi_get_pef_config_parms(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int set, block; unsigned char databyte = 0; unsigned char *data = NULL; unsigned int length = 0; unsigned char err = 0; unsigned char tmpdata[18]; sys_data_t *sys = mc->sysinfo; if (msg->len < 3) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (!sys) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; return; } switch (msg->data[0] & 0x7f) { case 0: databyte = mc->pef.set_in_progress; break; case 5: databyte = mc->pef.num_event_filters - 1; break; case 8: databyte = mc->pef.num_alert_policies - 1; break; case 11: databyte = mc->pef.num_alert_strings - 1; break; case 1: databyte = mc->pef.pef_control; break; case 2: databyte = mc->pef.pef_action_global_control; break; case 3: databyte = mc->pef.pef_startup_delay; break; case 4: databyte = mc->pef.pef_alert_startup_delay; break; case 6: set = msg->data[1] & 0x7f; if ((set <= 0) || (set >= mc->pef.num_event_filters)) err = IPMI_INVALID_DATA_FIELD_CC; else { data = mc->pef.event_filter_table[set]; length = 21; } break; case 7: set = msg->data[1] & 0x7f; if ((set <= 0) || (set >= mc->pef.num_event_filters)) err = IPMI_INVALID_DATA_FIELD_CC; else { data = mc->pef.event_filter_data1[set]; length = 2; } break; case 9: set = msg->data[1] & 0x7f; if ((set <= 0) || (set >= mc->pef.num_alert_policies)) err = IPMI_INVALID_DATA_FIELD_CC; else { data = mc->pef.alert_policy_table[set]; length = 4; } break; case 10: data = mc->pef.system_guid; length = 17; break; case 12: set = msg->data[1] & 0x7f; if (set >= mc->pef.num_alert_strings) err = IPMI_INVALID_DATA_FIELD_CC; else { data = mc->pef.alert_string_keys[set]; length = 3; } break; case 13: set = msg->data[1] & 0x7f; if (set >= mc->pef.num_alert_strings) err = IPMI_INVALID_DATA_FIELD_CC; else if (msg->data[2] == 0) err = IPMI_INVALID_DATA_FIELD_CC; else { block = msg->data[2] - 1; if ((block*16) > MAX_ALERT_STRING_LEN) { err = IPMI_PARAMETER_OUT_OF_RANGE_CC; break; } tmpdata[0] = set; tmpdata[1] = block + 1; memcpy(tmpdata+2, mc->pef.alert_strings[set]+(block*16), 16); data = tmpdata; length = 18; } break; default: err = 0x80; /* Parm not supported */ } rdata[0] = err; if (err) { *rdata_len = 1; return; } rdata[1] = 0x11; /* rev */ if (msg->data[0] & 0x80) { *rdata_len = 2; } else if (data) { memcpy(rdata + 2, data, length); *rdata_len = length + 2; } else { rdata[2] = databyte; *rdata_len = 3; } } cmd_handler_f sensor_event_netfn_handlers[256] = { [IPMI_GET_EVENT_RECEIVER_CMD] = handle_get_event_receiver, [IPMI_SET_EVENT_RECEIVER_CMD] = handle_set_event_receiver, [IPMI_GET_DEVICE_SDR_INFO_CMD] = handle_get_device_sdr_info, [IPMI_RESERVE_DEVICE_SDR_REPOSITORY_CMD] = handle_reserve_device_sdr_repository, [IPMI_GET_DEVICE_SDR_CMD] = handle_get_device_sdr, [IPMI_SET_SENSOR_HYSTERESIS_CMD] = handle_set_sensor_hysteresis, [IPMI_GET_SENSOR_HYSTERESIS_CMD] = handle_get_sensor_hysteresis, [IPMI_SET_SENSOR_THRESHOLD_CMD] = handle_set_sensor_thresholds, [IPMI_GET_SENSOR_THRESHOLD_CMD] = handle_get_sensor_thresholds, [IPMI_SET_SENSOR_EVENT_ENABLE_CMD] = handle_set_sensor_event_enable, [IPMI_GET_SENSOR_EVENT_ENABLE_CMD] = handle_get_sensor_event_enable, [IPMI_SET_SENSOR_TYPE_CMD] = handle_set_sensor_type, [IPMI_GET_SENSOR_TYPE_CMD] = handle_get_sensor_type, [IPMI_GET_SENSOR_READING_CMD] = handle_get_sensor_reading, [IPMI_GET_PEF_CAPABILITIES_CMD] = handle_ipmi_get_pef_capabilities, [IPMI_SET_PEF_CONFIG_PARMS_CMD] = handle_ipmi_set_pef_config_parms, [IPMI_GET_PEF_CONFIG_PARMS_CMD] = handle_ipmi_get_pef_config_parms, [IPMI_GET_SENSOR_EVENT_STATUS_CMD] = NULL, [IPMI_REARM_SENSOR_EVENTS_CMD] = handle_rearm_sensor_events, [IPMI_GET_SENSOR_READING_FACTORS_CMD] = NULL }; OpenIPMI-2.0.27/lanserv/emu.h0000664000175000017500000001064013051576450012525 00000000000000/* * emu.h * * MontaVista IPMI LAN server include file * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005,2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #ifndef __EMU_IPMI_ #define __EMU_IPMI_ #include #include #include void ipmi_emu_tick(emu_data_t *emu, unsigned int seconds); typedef void (*ipmi_emu_sleep_cb)(emu_data_t *emu, struct timeval *time); emu_data_t *ipmi_emu_alloc(void *user_data, ipmi_emu_sleep_cb sleeper, sys_data_t *sysinfo); void *ipmi_emu_get_user_data(emu_data_t *emu); void ipmi_emu_sleep(emu_data_t *emu, struct timeval *time); void ipmi_emu_handle_msg(emu_data_t *emu, lmc_data_t *srcmc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len); #define IPMI_MC_DYNAMIC_SENSOR_POPULATION (1 << 0) #define IPMI_MC_PERSIST_SDR (1 << 1) int ipmi_emu_add_mc(emu_data_t *emu, unsigned char ipmb, unsigned char device_id, unsigned char has_device_sdrs, unsigned char device_revision, unsigned char major_fw_rev, unsigned char minor_fw_rev, unsigned char device_support, unsigned char mfg_id[3], unsigned char product_id[2], unsigned int flags); lmc_data_t *ipmi_emu_get_bmc_mc(emu_data_t *emu); int ipmi_emu_set_bmc_mc(emu_data_t *emu, unsigned char ipmb); int ipmi_emu_get_mc_by_addr(emu_data_t *emu, unsigned char ipmb, lmc_data_t **mc); /* ATCA support */ int ipmi_emu_atca_enable(emu_data_t *emu); int ipmi_emu_atca_set_site(emu_data_t *emu, unsigned char hw_address, unsigned char site_type, unsigned char site_number); int ipmi_emu_set_addr(emu_data_t *emu, unsigned int addr_num, unsigned char addr_type, void *addr_data, unsigned int addr_len); int ipmi_emu_clear_addr(emu_data_t *emu, unsigned int addr_num); /* In emu_cmd.c */ void ipmi_emu_shutdown(emu_data_t *emu); int ipmi_emu_cmd(emu_out_t *out, emu_data_t *emu, char *cmd_str); int read_command_file(emu_out_t *out, emu_data_t *emu, const char *command_file); void emu_set_debug_level(emu_data_t *emu, unsigned int debug_level); #endif /* __EMU_IPMI_ */ OpenIPMI-2.0.27/lanserv/ipmi_checksum.c0000644000175000017500000000145512002623311014534 00000000000000 #include #include #include char buffer[65536]; int main(int argc, char *argv[]) { unsigned int sum = 0; int bytenum = 0; while (fgets(buffer, sizeof(buffer), stdin)) { char *s; s = strtok(buffer, " \n\t"); while (s) { unsigned char val; char *eos; if (*s == '\\') goto next_byte; bytenum++; if (*s == '\'') { val = *(s+1); sum += val; goto next_byte; } val = strtoul(s, &eos, 16); if (*eos != '\0') { fprintf(stderr, "Invalid byte %d\n", bytenum); return 1; } sum += val; next_byte: s = strtok(NULL, " \n\t"); } } sum &= 0xff; printf("Checksum of %d (%x) bytes is %x, to make zero is %x\n", bytenum, bytenum, sum, (0x100-sum) & 0xff); return 0; } OpenIPMI-2.0.27/lanserv/serv.c0000664000175000017500000001770013364071521012711 00000000000000/* * lanserv_ipmi.c * * MontaVista IPMI IPMI LAN interface protocol engine * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005,2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include int ipmi_oem_send_msg(channel_t *chan, unsigned char netfn, unsigned char cmd, unsigned char *data, unsigned int len, long oem_data) { msg_t *nmsg; int rv; nmsg = chan->alloc(chan, sizeof(*nmsg)+len); if (!nmsg) { chan->log(chan, OS_ERROR, NULL, "SMI message: out of memory"); return ENOMEM; } memset(nmsg, 0, sizeof(*nmsg)); nmsg->oem_data = oem_data; nmsg->netfn = netfn; nmsg->cmd = cmd; nmsg->data = ((unsigned char *) nmsg) + sizeof(*nmsg); nmsg->len = len; if (len > 0) memcpy(nmsg->data, data, len); rv = chan->smi_send(chan, nmsg); if (rv) { chan->log(chan, OS_ERROR, nmsg, "SMI send: error %d", rv); chan->free(chan, nmsg); } return rv; } void ipmi_handle_smi_rsp(channel_t *chan, msg_t *msg, uint8_t *rspd, int rsp_len) { rsp_msg_t rsp; rsp.netfn = msg->netfn | 1; rsp.cmd = msg->cmd; rsp.data = rspd; rsp.data_len = rsp_len; if (chan->oem.oem_handle_rsp && chan->oem.oem_handle_rsp(chan, msg, &rsp)) /* OEM code handled the response. */ return; chan->return_rsp(chan, msg, &rsp); chan->free(chan, msg); } static oem_handler_t *oem_handlers = NULL; void ipmi_register_oem(oem_handler_t *handler) { handler->next = oem_handlers; oem_handlers = handler; } static void check_oem_handlers(channel_t *chan) { oem_handler_t *c; c = oem_handlers; while (c) { if ((c->manufacturer_id == chan->manufacturer_id) && (c->product_id == chan->product_id)) { c->handler(chan, c->cb_data); break; } c = c->next; } } int channel_smi_send(channel_t *chan, msg_t *msg) { int rv; msg_t *nmsg; msg->channel = chan->channel_num; nmsg = chan->alloc(chan, sizeof(*nmsg)+msg->src_len+msg->len); if (!nmsg) { chan->log(chan, OS_ERROR, msg, "SMI message: out of memory"); return ENOMEM; } memcpy(nmsg, msg, sizeof(*nmsg)); if (msg->src_addr) { nmsg->src_addr = ((char *) nmsg) + sizeof(*nmsg); memcpy(nmsg->src_addr, msg->src_addr, msg->src_len); } nmsg->data = ((uint8_t *) nmsg) + sizeof(*nmsg) + msg->src_len; memcpy(nmsg->data, msg->data, msg->len); /* Let the low-level interface intercept. */ if (chan->oem_intf_recv_handler) { unsigned char msgd[36]; unsigned int msgd_len = sizeof(msgd); if (chan->oem_intf_recv_handler(chan, nmsg, msgd, &msgd_len)) { ipmi_handle_smi_rsp(chan, nmsg, msgd, msgd_len); return 0; } } rv = chan->smi_send(chan, nmsg); if (rv) chan->free(chan, nmsg); return rv; } static int look_for_get_devid(channel_t *chan, msg_t *msg, rsp_msg_t *rsp) { if ((rsp->netfn == (IPMI_APP_NETFN | 1)) && (rsp->cmd == IPMI_GET_DEVICE_ID_CMD) && (rsp->data_len >= 12) && (rsp->data[0] == 0)) { chan->oem.oem_handle_rsp = NULL; chan->manufacturer_id = (rsp->data[7] | (rsp->data[8] << 8) | (rsp->data[9] << 16)); chan->product_id = rsp->data[10] | (rsp->data[11] << 8); check_oem_handlers(chan); /* Will be set to 1 if we sent it. */ if (msg->oem_data) { chan->free(chan, msg); return 1; } } return 0; } int chan_init(channel_t *chan) { int rv = 0; /* If the calling code already hasn't set up an OEM handler, we set up our own to look for a get device id. When we find a get device ID, we call the OEM code to install their own. Hijack channel 0 for this. */ if ((chan->channel_num == 15) && (chan->oem.oem_handle_rsp == NULL)) { chan->oem.oem_handle_rsp = look_for_get_devid; /* Send a get device id to the low-level code so we can discover who we are. */ rv = ipmi_oem_send_msg(chan, IPMI_APP_NETFN, IPMI_GET_DEVICE_ID_CMD, NULL, 0, 1); } return rv; } void sysinfo_init(sys_data_t *sys) { memset(sys, 0, sizeof(*sys)); } void debug_log_raw_msg(sys_data_t *sys, unsigned char *data, unsigned int len, const char *format, ...) { va_list ap; char *str; int slen; int pos; char dummy; unsigned int i; struct timeval tv; gettimeofday(&tv, NULL); va_start(ap, format); slen = vsnprintf(&dummy, 1, format, ap); slen += snprintf(&dummy, 1, " %ld.%6.6ld", tv.tv_sec, tv.tv_usec); va_end(ap); slen += len * 3 + 2; str = malloc(slen); if (!str) return; va_start(ap, format); pos = vsprintf(str, format, ap); va_end(ap); pos += sprintf(str + pos, " %ld.%6.6ld", tv.tv_sec, tv.tv_usec); str[pos++] = '\n'; str[pos] = '\0'; for (i = 0; i < len; i++) pos += sprintf(str + pos, " %2.2x", data[i]); sys->log(sys, DEBUG, NULL, "%s", str); free(str); } /* Deal with multi-byte data, IPMI (little-endian) style. */ unsigned int ipmi_get_uint16(uint8_t *data) { return (data[0] | (data[1] << 8)); } void ipmi_set_uint16(uint8_t *data, int val) { data[0] = val & 0xff; data[1] = (val >> 8) & 0xff; } unsigned int ipmi_get_uint32(uint8_t *data) { return (data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24)); } void ipmi_set_uint32(uint8_t *data, int val) { data[0] = val & 0xff; data[1] = (val >> 8) & 0xff; data[2] = (val >> 16) & 0xff; data[3] = (val >> 24) & 0xff; } uint8_t ipmb_checksum(uint8_t *data, int size, uint8_t start) { uint8_t csum = start; for (; size > 0; size--, data++) csum += *data; return csum; } OpenIPMI-2.0.27/lanserv/sol.c0000664000175000017500000013027713414041615012531 00000000000000/* * sol.c * * MontaVista IPMI code for running the SOL protocol. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2012 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* FIXME - move to configure handling */ #define USE_UUCP_LOCKING #define SOL_INBUF_SIZE 32 #define SOL_OUTBUF_SIZE 16384 #define SOL_TELNET_IAC 255 #define SOL_TELNET_DONT 254 #define SOL_TELNET_DO 253 #define SOL_TELNET_WONT 252 #define SOL_TELNET_WILL 251 #define SOL_TELNET_SB 250 #define SOL_TELNET_SE 240 #define SOL_TELNET_BREAK 243 #define SOL_TELNETCODE_BINARY 0 #define SOL_TELNETCODE_ECHO 1 enum sol_telnet_state { SOL_TELNETST_NORMAL = 0, SOL_TELNETST_IAC, SOL_TELNETST_TWOBYTE, SOL_TELNETST_SUBNEG, SOL_TELNETST_SUBNEG_IAC }; struct soldata_s { int fd; sys_data_t *sys; ipmi_io_t *fd_id; struct termios termctl; int modemstate; channel_t *channel; /* Channel for I/O */ channel_t *logchan; /* Channel for logging errors. */ msg_t dummy_send_msg; /* Data from the remote to the serial port */ unsigned char inbuf[SOL_INBUF_SIZE]; unsigned int inlen; /* Data from the serial port to the remote */ unsigned char outbuf[SOL_OUTBUF_SIZE]; unsigned int outlen; /* * A circular history buffer. Note that history_end points to the * last byte (not one past the last byte) and history_start points * to the first byte. */ unsigned char *history; int history_start; int history_end; /* * Used to register history file handler on a shutdown. */ ipmi_shutdown_t backupfilehandler; /* * The amount of actual history to store when the copy request happens. * If zero, this is ignored. This is guaranteed to be <= history_size. * If this is non-zero, this is the */ unsigned int history_return_size; /* A copy of the history, used for reliable streaming. */ unsigned char *history_copy; unsigned int history_copy_size; unsigned int history_pos; msg_t history_dummy_send_msg; channel_t *history_channel; int history_last_acked_packet; int history_last_acked_packet_len; int history_curr_packet_seq; char history_in_nack; ipmi_timer_t *history_timer; unsigned int history_num_sends; char in_nack; char read_enabled; char write_enabled; char waiting_ack; int last_acked_packet; int last_acked_packet_len; int curr_packet_seq; ipmi_timer_t *timer; unsigned int num_sends; enum sol_telnet_state telnet_state; unsigned char telnet_twobyte; void (*reset_modemstate)(ipmi_sol_t *sol); void (*update_bitrate)(ipmi_sol_t *sol); void (*send_break)(ipmi_sol_t *sol); void (*update_modemstate)(ipmi_sol_t *sol, int ctspaus, int deassertdcd); int (*activate)(ipmi_sol_t *sol, msg_t *msg); void (*shutdown)(ipmi_sol_t *sol); int (*initialize)(ipmi_sol_t *sol); }; #ifdef USE_UUCP_LOCKING static char *uucp_lck_dir = "/var/lock"; static char *progname = "ipmisim"; static int uucp_fname_lock_size(const char *devname) { const char *ptr; (ptr = strrchr(devname, '/')); if (ptr == NULL) { ptr = devname; } else { ptr = ptr + 1; } return 7 + strlen(uucp_lck_dir) + strlen(ptr); } static void uucp_fname_lock(char *buf, const char *devname) { const char *ptr; (ptr = strrchr(devname, '/')); if (ptr == NULL) { ptr = devname; } else { ptr = ptr + 1; } sprintf(buf, "%s/LCK..%s", uucp_lck_dir, ptr); } static int write_full(int fd, char *data, size_t count) { ssize_t written; restart: while ((written = write(fd, data, count)) > 0) { data += written; count -= written; } if (written < 0) { if (errno == EAGAIN) goto restart; return -1; } return 0; } static void uucp_rm_lock(sys_data_t *sys, const char *devname) { char *lck_file; lck_file = sys->alloc(sys, uucp_fname_lock_size(devname)); if (lck_file == NULL) { return; } uucp_fname_lock(lck_file, devname); unlink(lck_file); sys->free(sys, lck_file); } /* return 0=OK, -1=error, 1=locked by other proces */ static int uucp_mk_lock(sys_data_t *sys, const char *devname) { struct stat stt; int pid = -1; if (stat(uucp_lck_dir, &stt) == 0) { /* is lock file directory present? */ char *lck_file; union { uint32_t ival; char str[64]; } buf; int fd; lck_file = sys->alloc(sys, uucp_fname_lock_size(devname)); if (lck_file == NULL) return -1; uucp_fname_lock(lck_file, devname); pid = 0; if ((fd = open(lck_file, O_RDONLY)) >= 0) { int n; n = read(fd, &buf, sizeof(buf) - 1); close(fd); if( n == 4 ) /* Kermit-style lockfile. */ pid = buf.ival; else if (n > 0) { /* Ascii lockfile. */ buf.str[n] = 0; sscanf(buf.str, "%d", &pid); } if (pid > 0 && kill((pid_t)pid, 0) < 0 && errno == ESRCH) { /* death lockfile - remove it */ unlink(lck_file); sleep(1); pid = 0; } } if (pid == 0) { int mask; int rv; mask = umask(022); fd = open(lck_file, O_WRONLY | O_CREAT | O_EXCL, 0666); umask(mask); if (fd >= 0) { snprintf(buf.str, sizeof(buf), "%10ld\t%s\n", (long)getpid(), progname ); rv = write_full(fd, buf.str, strlen(buf.str)); close(fd); if (rv < 0) { pid = -errno; unlink(lck_file); } } else { pid = -errno; } } sys->free(sys, lck_file); } return pid; } #endif /* USE_UUCP_LOCKING */ static int sol_to_termios_bitrate(ipmi_sol_t *sol, int solbps) { int retried = 0; retry: switch(solbps) { case 6: return B9600; case 7: return B19200; case 8: return B38400; case 9: return B57600; case 10: return B115200; case 0: default: if (retried) return B9600; solbps = sol->solparm.default_bitrate; goto retry; } } static void sol_serial_reset_modemstate(ipmi_sol_t *sol) { int modemstate; /* Turn on CTS and DCD if we have history, off if not */ /* Assuming standard NULL modem, RTS->CTS, DTR->DSR/DCD */ ioctl(sol->soldata->fd, TIOCMGET, &modemstate); if (sol->history_size) modemstate |= TIOCM_DTR | TIOCM_RTS; else modemstate &= ~(TIOCM_DTR | TIOCM_RTS); sol->soldata->modemstate = modemstate & (TIOCM_DTR | TIOCM_RTS); ioctl(sol->soldata->fd, TIOCMSET, &modemstate); } #ifndef HAVE_CFMAKERAW static void cfmakeraw(struct termios *t) { t->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); t->c_oflag &= ~OPOST; t->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); t->c_cflag &= ~(CSIZE | PARENB); t->c_cflag |= CS8; } #endif /* Initialize a serial port control structure for the first time. */ static void devinit(ipmi_sol_t *sol, struct termios *termctl) { int bitrate = sol_to_termios_bitrate(sol, sol->solparm.bitrate); cfmakeraw(termctl); cfsetospeed(termctl, bitrate); cfsetispeed(termctl, bitrate); termctl->c_cflag &= ~(CSTOPB); termctl->c_cflag &= ~(CSIZE); termctl->c_cflag |= CS8; termctl->c_cflag &= ~(PARENB); termctl->c_cflag |= CLOCAL; termctl->c_cflag &= ~(HUPCL); termctl->c_cflag |= CREAD; if (sol->use_rtscts) termctl->c_cflag |= CRTSCTS; else termctl->c_cflag &= ~(CRTSCTS); termctl->c_iflag &= ~(IXON | IXOFF | IXANY); termctl->c_iflag |= IGNBRK; sol_serial_reset_modemstate(sol); } static void sol_serial_update_bitrate(ipmi_sol_t *sol) { int bitrate = sol_to_termios_bitrate(sol, sol->solparm.bitrate); cfsetospeed(&sol->soldata->termctl, bitrate); cfsetispeed(&sol->soldata->termctl, bitrate); tcsetattr(sol->soldata->fd, TCSANOW, &sol->soldata->termctl); } static void sol_serial_send_break(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; tcsendbreak(sd->fd, 0); } static void sol_serial_update_modemstate(ipmi_sol_t *sol, int ctspause, int deassert_dcd) { soldata_t *sd = sol->soldata; /* * If history is enabled, we don't allow DCD/CTS fiddling, just leave * them on all the time. */ if (!sol->history_size) { int modemstate = 0; if (!ctspause) modemstate |= TIOCM_RTS; if (!deassert_dcd) modemstate |= TIOCM_DTR; if (modemstate != sd->modemstate) { int val; ioctl(sol->soldata->fd, TIOCMGET, &val); val &= ~(TIOCM_DTR | TIOCM_RTS); val |= modemstate; ioctl(sol->soldata->fd, TIOCMSET, &val); } } } static int sol_serial_activate(ipmi_sol_t *sol, msg_t *msg) { soldata_t *sd = sol->soldata; /* * Note that we enable CTS and DCD if history is set, because we * always monitor the history. */ if (!sol->history_size) { if ((msg->data[2] & 1) == 0) { /* Assuming standard NULL modem, RTS->CTS, DTR->DSR/DCD */ int modemstate; ioctl(sd->fd, TIOCMGET, &modemstate); modemstate |= TIOCM_DTR | TIOCM_RTS; sd->modemstate = TIOCM_DTR | TIOCM_RTS; ioctl(sd->fd, TIOCMSET, &modemstate); } } return 0; } static void sol_serial_shutdown(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; if (sd->fd >= 0) close(sd->fd); sd->fd = -1; #ifdef USE_UUCP_LOCKING uucp_rm_lock(sd->sys, sol->device); #endif /* USE_UUCP_LOCKING */ } static int sol_serial_initialize(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; int err; #ifdef USE_UUCP_LOCKING err = uucp_mk_lock(sd->sys, sol->device); if (err > 0) { fprintf(stderr, "SOL device %s is already owned by process %d\n", sol->device, err); err = EBUSY; goto out_nounlock; } if (err < 0) { fprintf(stderr, "Error locking SOL device %s\n", sol->device); err = -err; goto out_nounlock; } #endif /* USE_UUCP_LOCKING */ devinit(sol, &sd->termctl); sd->fd = open(sol->device, O_NONBLOCK | O_NOCTTY | O_RDWR); if (sd->fd == -1) { err = errno; fprintf(stderr, "Error opening SOL device %s\n", sol->device); goto out; } err = tcsetattr(sd->fd, TCSANOW, &sd->termctl); if (err == -1) { err = errno; close(sd->fd); sd->fd = -1; fprintf(stderr, "Error configuring SOL device %s\n", sol->device); goto out; } /* Turn off BREAK. */ ioctl(sd->fd, TIOCCBRK); out: #ifdef USE_UUCP_LOCKING if (err) uucp_rm_lock(sd->sys, sol->device); out_nounlock: #endif return err; } static void sol_serial_setup(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; sd->reset_modemstate = sol_serial_reset_modemstate; sd->update_bitrate = sol_serial_update_bitrate; sd->send_break = sol_serial_send_break; sd->update_modemstate = sol_serial_update_modemstate; sd->activate = sol_serial_activate; sd->shutdown = sol_serial_shutdown; sd->initialize = sol_serial_initialize; } static void sol_tcp_reset_modemstate(ipmi_sol_t *sol) { } static void sol_tcp_update_bitrate(ipmi_sol_t *sol) { } static void sol_tcp_send_break(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; int left = sizeof(sd->inbuf) - sd->inlen; if (left < 2) return; sd->inbuf[sd->inlen++] = SOL_TELNET_IAC; sd->inbuf[sd->inlen++] = SOL_TELNET_BREAK; } static void sol_tcp_update_modemstate(ipmi_sol_t *sol, int ctspause, int deassert_dcd) { } static int sol_tcp_activate(ipmi_sol_t *sol, msg_t *msg) { return 0; } static void sol_tcp_shutdown(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; if (sd->fd >= 0) close(sd->fd); sd->fd = -1; } static int sol_tcp_initialize(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; struct addrinfo hints, *addr; int rv; int options; if (sd->fd != -1) { sd->logchan->log(sd->logchan, OS_ERROR, NULL, "Error sol activate on active port %s:%s", sol->tcpdest, sol->tcpport); return -1; } memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; rv = getaddrinfo(sol->tcpdest, sol->tcpport, &hints, &addr); if (rv != 0) { sd->logchan->log(sd->logchan, OS_ERROR, NULL, "Error getting tcp sol port address for %s:%s: %s", sol->tcpdest, sol->tcpport, gai_strerror(rv)); return -1; } sd->fd = socket(addr->ai_family, SOCK_STREAM, 0); if (sd->fd == -1) { rv = -1; sd->logchan->log(sd->logchan, OS_ERROR, NULL, "Error creating tcp sol port socket for %s:%s: %s", sol->tcpdest, sol->tcpport, strerror(errno)); goto out; } rv = connect(sd->fd, addr->ai_addr, addr->ai_addrlen); if (rv == -1) { close(sd->fd); sd->fd = -1; if (sd->sys->debug & DEBUG_SOL) sd->logchan->log(sd->logchan, OS_ERROR, NULL, "Error connecting tcp sol port socket for %s:%s: %s", sol->tcpdest, sol->tcpport, strerror(errno)); goto out; } options = 1; rv = setsockopt(sd->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &options, sizeof(options)); if (rv == -1) { close(sd->fd); sd->fd = -1; sd->logchan->log(sd->logchan, OS_ERROR, NULL, "Error setting nodelay on tcp sol port socket" " for %s:%s: %s", sol->tcpdest, sol->tcpport, strerror(errno)); goto out; } rv = fcntl(sd->fd, F_SETFL, O_NONBLOCK); if (rv == -1) { close(sd->fd); sd->fd = -1; sd->logchan->log(sd->logchan, OS_ERROR, NULL, "Error setting nonblock on tcp sol port socket" " for %s:%s: %s", sol->tcpdest, sol->tcpport, strerror(errno)); goto out; } out: freeaddrinfo(addr); return rv; } static void sol_tcp_setup(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; sd->reset_modemstate = sol_tcp_reset_modemstate; sd->update_bitrate = sol_tcp_update_bitrate; sd->send_break = sol_tcp_send_break; sd->update_modemstate = sol_tcp_update_modemstate; sd->activate = sol_tcp_activate; sd->shutdown = sol_tcp_shutdown; sd->initialize = sol_tcp_initialize; } static char *end_history_msg = "\r\n\r\n"; #define MAX_HISTORY_SEND 64 #define MAX_SOL_RESENDS 4 static void sol_timeout(void *cb_data); static void sol_history_timeout(void *cb_data); static void sol_data_ready(int fd, void *cb_data); static void sol_write_ready(int fd, void *cb_data); static void sol_set_history_return_size(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { ipmi_sol_t *sol = ipmi_mc_get_sol(mc); soldata_t *sd = sol->soldata; unsigned int size; if (msg->len < 1) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return; } if (!sd) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } size = msg->data[0] * 1024; if (size >= sol->history_size || size == 0) sd->history_return_size = 0; else sd->history_return_size = size; rdata[0] = 0; *rdata_len = 1; } static void sol_get_history_return_size(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { ipmi_sol_t *sol = ipmi_mc_get_sol(mc); soldata_t *sd = sol->soldata; if (!sd) { rdata[0] = IPMI_NOT_PRESENT_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = sd->history_return_size / 1024; *rdata_len = 2; } static void sol_session_closed(lmc_data_t *mc, uint32_t session_id, void *cb_data) { ipmi_sol_t *sol = cb_data; soldata_t *sd = sol->soldata; if (session_id == sol->session_id) { if (sol->soldata->dummy_send_msg.src_addr) { sd->sys->free(sd->sys, sol->soldata->dummy_send_msg.src_addr); sol->soldata->dummy_send_msg.src_addr = NULL; } sol->active = 0; sd->channel = NULL; sol->session_id = 0; sd->reset_modemstate(sol); } else if (session_id == sol->history_session_id) { if (sol->soldata->history_dummy_send_msg.src_addr) { sd->sys->free(sd->sys, sol->soldata->history_dummy_send_msg.src_addr); sol->soldata->history_dummy_send_msg.src_addr = NULL; } if (sol->soldata->history_copy) { sd->sys->free(sd->sys, sol->soldata->history_copy); sol->soldata->history_copy = NULL; } sol->history_active = 0; sol->history_session_id = 0; } } static unsigned char * copy_history_buffer(ipmi_sol_t *sol, unsigned int *rsize) { soldata_t *sd = sol->soldata; unsigned int to_copy; unsigned int endmsg_size = strlen(end_history_msg); unsigned char *dest = sd->sys->alloc(sd->sys, sol->history_size + endmsg_size); unsigned int size; int start; if (!dest) return NULL; if (sd->history_start > sd->history_end) /* Buffer is filled. */ size = sol->history_size; else if (sd->history_start == sd->history_end) size = 0; /* Nothing written yet. */ else /* Buffer is not yet filled, just runs from start to end */ size = sd->history_end - sd->history_start + 1; start = sd->history_start; if (sd->history_return_size && (size > sd->history_return_size)) { start += size - sd->history_return_size; if (start >= (int) sol->history_size) start -= sol->history_size; size = sd->history_return_size; } if (start > sd->history_end) { /* Buffer spans end, copy in two chunks. */ to_copy = sol->history_size - start; memcpy(dest + to_copy, sd->history, sd->history_end + 1); } else { /* Buffer is not yet filled, just runs from start to end */ to_copy = sd->history_end - start + 1; } memcpy(dest, sd->history + start, to_copy); memcpy(dest + size, end_history_msg, endmsg_size); size += endmsg_size; *rsize = size; if (sol->readclear) { sd->history_start = 0; sd->history_end = -1; } return dest; } unsigned char * sol_set_frudata(lmc_data_t *mc, unsigned int *size) { ipmi_sol_t *sol = ipmi_mc_get_sol(mc); return copy_history_buffer(sol, size); } void sol_free_frudata(lmc_data_t *mc, unsigned char *data) { ipmi_sol_t *sol = ipmi_mc_get_sol(mc); soldata_t *sd = sol->soldata; if (data) sd->sys->free(sd->sys, data); } void ipmi_sol_activate(lmc_data_t *mc, channel_t *channel, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len) { ipmi_sol_t *sol = ipmi_mc_get_sol(mc); soldata_t *sd = sol->soldata; uint16_t port; int rv; msg_t *dmsg; unsigned int instance; if (!sol->solparm.enabled) { rdata[0] = 0x81; /* Payload is disabled. */ *rdata_len = 1; return; } /* * FIXME - we are currently ignoring all the payload encryption and * authentication bits in the message. */ instance = msg->data[1] & 0xf; if (instance == 1) { if (sol->active) { *rdata = 0x80; /* Payload already active */ *rdata_len = 1; return; } dmsg = &sd->dummy_send_msg; } else if (instance == 2 && sol->history_size) { if (sol->history_active) { *rdata = 0x80; /* Payload already active */ *rdata_len = 1; return; } dmsg = &sd->history_dummy_send_msg; } else { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } dmsg->src_addr = sd->sys->alloc(sd->sys, msg->src_len); if (!dmsg->src_addr) { rdata[0] = IPMI_OUT_OF_SPACE_CC; *rdata_len = 1; return; } memcpy(dmsg->src_addr, msg->src_addr, msg->src_len); dmsg->src_len = msg->src_len; dmsg->rmcpp.payload = IPMI_RMCPP_PAYLOAD_TYPE_SOL; rv = channel->set_associated_mc(channel, msg->sid, msg->data[0] & 0xf, mc, &port, sol_session_closed, sol); if (rv == EBUSY) { sd->sys->free(sd->sys, dmsg->src_addr); dmsg->src_addr = NULL; rdata[0] = IPMI_NODE_BUSY_CC; *rdata_len = 1; return; } else if (rv) { sd->sys->free(sd->sys, dmsg->src_addr); dmsg->src_addr = NULL; rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } dmsg->sid = msg->sid; if (instance == 1) { rv = sd->activate(sol, msg); if (rv) { sd->sys->free(sd->sys, dmsg->src_addr); dmsg->src_addr = NULL; rdata[0] = IPMI_UNKNOWN_ERR_CC; *rdata_len = 1; return; } sol->active = 1; sol->session_id = msg->sid; sd->channel = channel; sd->outlen = 0; ipmi_set_uint16(rdata + 5, sizeof(sd->inbuf)); ipmi_set_uint16(rdata + 7, sizeof(sd->outbuf)); } else if (instance == 2 && sol->history_size) { struct timeval tv; sd->history_copy = copy_history_buffer(sol, &sd->history_copy_size); if (!sd->history_copy) { rdata[0] = IPMI_OUT_OF_SPACE_CC; *rdata_len = 1; return; } sd->history_pos = 0; sol->history_active = 1; sol->history_session_id = msg->sid; sd->history_channel = channel; ipmi_set_uint16(rdata + 5, MAX_HISTORY_SEND); ipmi_set_uint16(rdata + 7, MAX_HISTORY_SEND); tv.tv_sec = 0; tv.tv_usec = 0; /* Send immediately */ sd->history_num_sends = 0; sd->sys->start_timer(sd->history_timer, &tv); } rdata[0] = 0; ipmi_set_uint32(rdata + 1, 0); ipmi_set_uint16(rdata + 9, port); ipmi_set_uint16(rdata + 11, 0xffff); *rdata_len = 13; } void ipmi_sol_deactivate(lmc_data_t *mc, channel_t *channel, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len) { ipmi_sol_t *sol = ipmi_mc_get_sol(mc); unsigned int instance; uint32_t session_id; instance = msg->data[1] & 0xf; if (instance == 1) { if (!sol->active) { *rdata = 0x80; /* Payload already deactivated */ *rdata_len = 1; return; } session_id = sol->session_id; } else if (instance == 2) { if (!sol->history_active) { *rdata = 0x80; /* Payload already deactivated */ *rdata_len = 1; return; } session_id = sol->history_session_id; } else { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } sol_session_closed(mc, session_id, sol); channel->set_associated_mc(channel, session_id, msg->data[0] & 0xf, NULL, NULL, NULL, NULL); rdata[0] = 0; *rdata_len = 1; } static void sol_update_bitrate(lmc_data_t *mc) { ipmi_sol_t *sol = ipmi_mc_get_sol(mc); soldata_t *sd = sol->soldata; sd->update_bitrate(ipmi_mc_get_sol(mc)); } static void set_read_enable(soldata_t *sd) { int val; if (sd->history) return; if (sizeof(sd->outbuf) == sd->outlen) /* Read is always disabled if we have nothing to read into. */ val = 0; else val = !sd->in_nack; if (sd->read_enabled == val) return; sd->read_enabled = val; sd->sys->io_set_enables(sd->fd_id, sd->read_enabled, sd->write_enabled, 0); } static void set_write_enable(soldata_t *sd) { int val = sd->inlen > 0; if (sd->write_enabled == val) return; sd->write_enabled = val; sd->sys->io_set_enables(sd->fd_id, sd->read_enabled, sd->write_enabled, 0); } static void send_data(ipmi_sol_t *sol, int need_send_ack) { soldata_t *sd = sol->soldata; rsp_msg_t msg; unsigned char data[SOL_OUTBUF_SIZE + 4]; unsigned int size = sd->outlen; data[0] = sd->curr_packet_seq; if (need_send_ack) { data[1] = sd->last_acked_packet; data[2] = sd->last_acked_packet_len; } else { data[1] = 0; data[2] = 0; } data[3] = (sd->inlen == sizeof(sd->inbuf)) << 6; if (size > 255) size = 255; memcpy(data + 4, sd->outbuf, size); msg.data = data; msg.data_len = size + 4; sd->waiting_ack = 1; sd->channel->return_rsp(sd->channel, &sd->dummy_send_msg, &msg); } static void send_ack(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; rsp_msg_t msg; unsigned char data[SOL_OUTBUF_SIZE + 4]; data[0] = 0; data[1] = sd->last_acked_packet; data[2] = sd->last_acked_packet_len; data[3] = (sd->inlen == sizeof(sd->inbuf)) << 6; msg.data = data; msg.data_len = 4; sd->channel->return_rsp(sd->channel, &sd->dummy_send_msg, &msg); } static void next_seq(soldata_t *sd) { sd->curr_packet_seq++; if (sd->curr_packet_seq >= 16) sd->curr_packet_seq = 1; } static unsigned char sol_telnet_initseq[] = { SOL_TELNET_IAC, SOL_TELNET_DO, SOL_TELNETCODE_BINARY, SOL_TELNET_IAC, SOL_TELNET_WILL, SOL_TELNETCODE_BINARY, SOL_TELNET_IAC, SOL_TELNET_DONT, SOL_TELNETCODE_ECHO, SOL_TELNET_IAC, SOL_TELNET_WONT, SOL_TELNETCODE_ECHO }; static int sol_port_init(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; int err; err = sd->initialize(sol); if (err) goto out_err; sol->configured++; /* Marked that we locked the device. */ sol->update_bitrate = sol_update_bitrate; sd->read_enabled = 1; sd->write_enabled = 0; if (sol->do_telnet) { int len = sizeof(sol_telnet_initseq); memcpy(sd->inbuf, sol_telnet_initseq, len); sd->inlen = len; } err = sd->sys->add_io_hnd(sd->sys, sd->fd, sol_data_ready, sol, &sd->fd_id); if (err) { sol->configured--; sd->shutdown(sol); goto out_err; } sd->sys->io_set_hnds(sd->fd_id, sol_write_ready, NULL); set_write_enable(sd); out_err: return err; } static void sol_timeout(void *cb_data) { ipmi_sol_t *sol = cb_data; soldata_t *sd = sol->soldata; struct timeval tv; if (sd->fd == -1) { sol_port_init(sol); } else if (sol->active) { if (sd->num_sends > MAX_SOL_RESENDS) { sd->waiting_ack = 0; next_seq(sd); sd->outlen = 0; return; } sd->num_sends++; send_data(sol, 0); } if (sd->fd == -1) /* Attempt to reconnect every 10 seconds. */ tv.tv_sec = 10; else tv.tv_sec = 1; tv.tv_usec = 0; sd->sys->start_timer(sd->timer, &tv); } static void handle_sol_port_payload(lanserv_data_t *lan, ipmi_sol_t *sol, msg_t *msg) { soldata_t *sd = sol->soldata; unsigned char seq, ack, count; char isnack, isbreak, ctspause, deassert_dcd, flush_in, flush_out; unsigned char *data; unsigned int len; int need_send_ack = 0; struct timeval tv; if (!sol->active || msg->len < 4) return; seq = msg->data[0] & 0xf; ack = msg->data[1] & 0xf; count = msg->data[2]; isnack = msg->data[3] & (1 << 6); /* Ring Indicator is ignored for now */ isbreak = msg->data[3] & (1 << 4); ctspause = msg->data[3] & (1 << 3); deassert_dcd = msg->data[3] & (1 << 2); flush_in = msg->data[3] & (1 << 1); flush_out = msg->data[3] & (1 << 0); data = msg->data + 4; len = msg->len - 4; if (seq != 0) { if (seq == sd->last_acked_packet) { need_send_ack = 1; } else if (sd->fd == -1) { /* Ignore the data. */ if (len) { sd->last_acked_packet = seq; need_send_ack = 1; sd->last_acked_packet_len = len; } } else if (len) { sd->last_acked_packet = seq; if (sol->do_telnet) { unsigned int i; for (i = 0; i < len; i++) { int left = sizeof(sd->inbuf) - sd->inlen; if (left < 1) break; if (data[i] == SOL_TELNET_IAC) { if (left < 2) break; sd->inbuf[sd->inlen++] = SOL_TELNET_IAC; } sd->inbuf[sd->inlen++] = data[i]; } } else { if (len > (sizeof(sd->inbuf) - sd->inlen)) len = sizeof(sd->inbuf) - sd->inlen; memcpy(sd->inbuf + sd->inlen, data, len); sd->inlen += len; } sd->last_acked_packet_len = len; need_send_ack = 1; set_write_enable(sol->soldata); } } if (ack == sd->curr_packet_seq) { next_seq(sd); sd->sys->stop_timer(sd->timer); if (isnack) { sd->in_nack = 1; set_read_enable(sd); } else { sd->in_nack = 0; if (count < sd->outlen) { unsigned int i; len = sd->outlen - count; for (i = 0; i < len; i++) sd->outbuf[i] = sd->outbuf[i + count]; sd->outlen = len; send_data(sol, need_send_ack); need_send_ack = 0; tv.tv_sec = 1; tv.tv_usec = 0; sd->sys->start_timer(sd->timer, &tv); } else { sd->waiting_ack = 0; sd->outlen = 0; } set_read_enable(sd); } } if (need_send_ack) send_ack(sol); if (flush_out) { sd->waiting_ack = 0; next_seq(sd); sd->outlen = 0; } if (flush_in) sd->inlen = 0; if (isbreak) sd->send_break(sol); sd->update_modemstate(sol, ctspause, deassert_dcd); } static int send_history_data(ipmi_sol_t *sol, int need_send_ack) { soldata_t *sd = sol->soldata; rsp_msg_t msg; unsigned char data[MAX_HISTORY_SEND + 4]; int to_send; to_send = sd->history_copy_size - sd->history_pos; if (to_send <= 0) return need_send_ack; if (to_send > MAX_HISTORY_SEND) to_send = MAX_HISTORY_SEND; data[0] = sd->history_curr_packet_seq; if (need_send_ack) { data[1] = sd->history_last_acked_packet; data[2] = sd->history_last_acked_packet_len; } else { data[1] = 0; data[2] = 0; } data[3] = 1 << 6; /* Always ready to get data, we just throw it away */ memcpy(data + 4, sd->history_copy + sd->history_pos, to_send); msg.data = data; msg.data_len = to_send + 4; sd->history_channel->return_rsp(sd->history_channel, &sd->history_dummy_send_msg, &msg); return 0; } static void send_history_ack(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; rsp_msg_t msg; unsigned char data[SOL_OUTBUF_SIZE + 4]; data[0] = 0; data[1] = sd->history_last_acked_packet; data[2] = sd->history_last_acked_packet_len; data[3] = 1 << 6; msg.data = data; msg.data_len = 4; sd->history_channel->return_rsp(sd->history_channel, &sd->history_dummy_send_msg, &msg); } static void sol_history_next_packet(soldata_t *sd) { /* Only send one size for history, no need to check msg's count */ sd->history_pos += MAX_HISTORY_SEND; sd->history_curr_packet_seq++; if (sd->history_curr_packet_seq >= 16) sd->history_curr_packet_seq = 1; sd->history_num_sends = 0; } static void sol_history_timeout(void *cb_data) { ipmi_sol_t *sol = cb_data; soldata_t *sd = sol->soldata; struct timeval tv; if (sd->history_num_sends > MAX_SOL_RESENDS) sol_history_next_packet(sd); if (sd->history_pos >= sd->history_copy_size) return; sd->history_num_sends++; send_history_data(sol, 0); tv.tv_sec = 1; tv.tv_usec = 0; sd->sys->start_timer(sd->history_timer, &tv); } static void handle_sol_history_payload(lanserv_data_t *lan, ipmi_sol_t *sol, msg_t *msg) { soldata_t *sd = sol->soldata; unsigned char seq, ack; char isnack; unsigned int len; int need_send_ack = 0; if (!sol->history_active || msg->len < 4) return; seq = msg->data[0] & 0xf; ack = msg->data[1] & 0xf; isnack = msg->data[3] & (1 << 6); len = msg->len - 4; if (seq != 0) { if (seq == sd->history_last_acked_packet) { need_send_ack = 1; } else if (len) { sd->history_last_acked_packet = seq; sd->history_last_acked_packet_len = len; need_send_ack = 1; } } if (ack == sd->history_curr_packet_seq) { if (isnack) { sd->history_in_nack = 1; } else { sd->history_in_nack = 0; sol_history_next_packet(sd); need_send_ack = send_history_data(sol, need_send_ack); } sd->sys->stop_timer(sd->history_timer); } if (need_send_ack) send_history_ack(sol); } static void handle_sol_payload(lanserv_data_t *lan, msg_t *msg) { ipmi_sol_t *sol; channel_t *channel = &lan->channel; lmc_data_t *mc; mc = channel->get_associated_mc(channel, msg->sid, IPMI_RMCPP_PAYLOAD_TYPE_SOL); if (!mc) return; sol = ipmi_mc_get_sol(mc); if (msg->sid == sol->session_id) handle_sol_port_payload(lan, sol, msg); else if (msg->sid == sol->history_session_id) handle_sol_history_payload(lan, sol, msg); } static void sol_port_error(ipmi_sol_t *sol) { soldata_t *sd = sol->soldata; struct timeval tv; sd->sys->remove_io_hnd(sd->fd_id); sd->shutdown(sol); /* Clear any data to send to the serial port. */ sd->inlen = 0; /* Retry in 10 seconds. */ tv.tv_sec = 10; tv.tv_usec = 0; sd->sys->start_timer(sd->timer, &tv); } static void sol_write_ready(int fd, void *cb_data) { ipmi_sol_t *sol = cb_data; soldata_t *sd = sol->soldata; int rv; rv = write(fd, sd->inbuf, sd->inlen); if (rv < 0) { sd->logchan->log(sd->logchan, OS_ERROR, NULL, "Error writing to serial port: %d, disabling\n", errno); sol_port_error(sol); return; } if (((unsigned int) rv) < sd->inlen) memcpy(sd->inbuf, sd->inbuf + rv, sd->inlen - rv); sd->inlen -= rv; set_write_enable(sd); } static void add_to_history(ipmi_sol_t *sol, unsigned char *buf, unsigned int len) { soldata_t *sd = sol->soldata; int to_copy; if (!sd->history || len == 0) return; /* * No point in handling more data than we can take, only take the * last history size section. */ if (len > sol->history_size) { buf += len - sol->history_size; len = sol->history_size; } if (sd->history_end + len + 1 > sol->history_size) { /* Wrap case, copy to the end and wrap history_end. */ to_copy = sol->history_size - sd->history_end - 1; memcpy(sd->history + sd->history_end + 1, buf, to_copy); sd->history_end = -1; len -= to_copy; buf += to_copy; } /* * At this point all the data should fit between history_end * and the end of the buffer. */ memcpy(sd->history + sd->history_end + 1, buf, len); if (sd->history_start > sd->history_end) { /* * Before we completely fill the buffer, history_start will * always be <= history_end. After we fill the buffer, * history_end will always be < history_start. */ sd->history_start += len; if (sd->history_start >= (int) sol->history_size) sd->history_start -= sol->history_size; } else if (sd->history_start == sd->history_end) { /* * First write to the buffer, it starts with start == end == 0, * so we need to fix things up on the first write. */ sd->history_start++; } sd->history_end += len; } static int sol_handle_telnet(ipmi_sol_t *sol, unsigned char *buf, int len) { soldata_t *sd = sol->soldata; int i, j; for (i = 0, j = 0; i < len; i++) { switch (sd->telnet_state) { case SOL_TELNETST_NORMAL: if (buf[i] == SOL_TELNET_IAC) sd->telnet_state = SOL_TELNETST_IAC; else buf[j++] = buf[i]; break; case SOL_TELNETST_IAC: switch (buf[i]) { case SOL_TELNET_DONT: case SOL_TELNET_DO: case SOL_TELNET_WONT: case SOL_TELNET_WILL: sd->telnet_twobyte = buf[i]; sd->telnet_state = SOL_TELNETST_TWOBYTE; break; case SOL_TELNET_SB: sd->telnet_state = SOL_TELNETST_SUBNEG; break; case SOL_TELNET_IAC: buf[j++] = SOL_TELNET_IAC; /* Fallthrough */ default: /* Ignore everything else. */ sd->telnet_state = SOL_TELNETST_NORMAL; break; } break; case SOL_TELNETST_TWOBYTE: /* Don't listen to these. */ sd->telnet_state = SOL_TELNETST_NORMAL; break; case SOL_TELNETST_SUBNEG: /* Don't listen to these. */ if (buf[i] == SOL_TELNET_IAC) sd->telnet_state = SOL_TELNETST_SUBNEG_IAC; break; case SOL_TELNETST_SUBNEG_IAC: if (buf[i] == SOL_TELNET_SE) sd->telnet_state = SOL_TELNETST_NORMAL; } } return j; } static void sol_data_ready(int fd, void *cb_data) { ipmi_sol_t *sol = cb_data; soldata_t *sd = sol->soldata; int rv; struct timeval tv; unsigned char buf[128]; unsigned int readsize = sizeof(buf); if (!sd->history && (readsize > (sizeof(sd->outbuf) - sd->outlen))) readsize = sizeof(sd->outbuf) - sd->outlen; rv = read(fd, buf, readsize); if (rv < 0) { sd->logchan->log(sd->logchan, OS_ERROR, NULL, "Error reading from serial port: %d, disabling\n", errno); sol_port_error(sol); return; } else if (rv == 0) { /* End of input, socket probably closed. */ sol_port_error(sol); return; } if (sol->do_telnet) rv = sol_handle_telnet(sol, buf, rv); add_to_history(sol, buf, rv); if (((unsigned int) rv) > (sizeof(sd->outbuf) - sd->outlen)) { /* Overflow happened. */ rv = sizeof(sd->outbuf) - sd->outlen; } if (!sol->active) { sd->outlen = 0; return; } memcpy(sd->outbuf + sd->outlen, buf, rv); sd->outlen += rv; /* Looks strange, but will turn off read if the buffer is full */ set_read_enable(sd); if (!sd->waiting_ack) { send_data(sol, 0); sd->num_sends = 0; tv.tv_sec = 1; tv.tv_usec = 0; sd->sys->start_timer(sd->timer, &tv); } } int sol_read_config(char **tokptr, sys_data_t *sys, const char **err) { ipmi_sol_t *sol = sys->sol; unsigned int val; int rv; const char *tok; sys->sol->use_rtscts = 1; rv = get_delim_str(tokptr, &sol->device, err); if (rv) return rv; if (strncmp(sol->device, "tcp:", 4) == 0) { sol->tcpdest = sol->device + 4; } else if (strncmp(sol->device, "telnet:", 7) == 0) { sol->do_telnet = 1; sol->tcpdest = sol->device + 7; } if (sol->tcpdest) { char *colon = strchr(sol->tcpdest, ':'); if (!colon) { *err = "No port specified in sol tcp connection"; return -1; } sol->tcpport = colon + 1; *colon = '\0'; } rv = get_uint(tokptr, &val, err); if (rv) return rv; switch (val) { case 9600: val = 6; break; case 19200: val = 7; break; case 38400: val = 8; break; case 57600: val = 9; break; case 115200: val = 10; break; default: *err = "Invalid bitrate, must be 9600, 19200, 38400, 57600, or 115200"; return -1; } while ((tok = mystrtok(NULL, " \t\n", tokptr))) { if (strncmp(tok, "history=", 8) == 0) { char *end, next; sol->history_size = strtoul(tok + 8, &end, 0); next = *end; while (next == ',') { char *opt = end + 1; end = strchr(opt, ','); if (!end) end = opt + strlen(opt); next = *end; *end = '\0'; if (strncmp(opt, "backupfile=", 11) == 0) { sol->backupfile = strdup(opt + 11); } else { *err = "Unknown history option"; return -1; } } if (*end != '\0') { *err = "Invalid history value"; return -1; } } else if (strncmp(tok, "historyfru=", 11) == 0) { char *end; unsigned int history_fru; history_fru = strtoul(tok + 11, &end, 0); if (*end != '\0') { *err = "Invalid history FRU value"; return -1; } if (history_fru >= 0xff) { *err = "history FRU value must be < 0xff"; return -1; } rv = ipmi_mc_add_fru_data(sys->mc, history_fru, 0, NULL, NULL); if (rv) { *err = "Cannot add frudata handler"; return -1; } rv = ipmi_mc_set_frudata_handler(sys->mc, history_fru, sol_set_frudata, sol_free_frudata); if (rv) { *err = "Cannot set frudata handler"; return -1; } } else if (strncmp(tok, "nortscts", 8) == 0) { sol->use_rtscts = 0; } else if (strncmp(tok, "readclear", 8) == 0) { sol->readclear = 1; } else { *err = "Invalid item"; return -1; } } sol->solparm.default_bitrate = val; sol->configured = 1; return 0; } int read_sol_config(sys_data_t *sys) { unsigned int i; int rv; for (i = 0; i < IPMI_MAX_MCS; i++) { lmc_data_t *mc = sys->ipmb_addrs[i]; ipmi_sol_t *sol; persist_t *p; long iv; if (!mc) continue; sol = ipmi_mc_get_sol(mc); if (!sol->configured) continue; sys->sol_present = 1; sol->solparm.enabled = 1; sol->solparm.bitrate_nonv = 0; p = read_persist("sol.mc%2.2x", ipmi_mc_get_ipmb(mc)); if (p) { if (!read_persist_int(p, &iv, "enabled")) sol->solparm.enabled = iv; if (!read_persist_int(p, &iv, "bitrate")) sol->solparm.bitrate_nonv = iv; sol->solparm.bitrate = sol->solparm.bitrate_nonv; free_persist(p); } rv = sol_init_mc(sys, mc); if (rv) return rv; } return 0; } int write_sol_config(lmc_data_t *mc) { ipmi_sol_t *sol; persist_t *p; sol = ipmi_mc_get_sol(mc); p = alloc_persist("sol.mc%2.2x", ipmi_mc_get_ipmb(mc)); if (!p) return ENOMEM; sol = ipmi_mc_get_sol(mc); add_persist_int(p, sol->solparm.enabled, "enabled"); add_persist_int(p, sol->solparm.bitrate_nonv, "bitrate"); write_persist(p); free_persist(p); return 0; } int sol_init(sys_data_t *sys) { int rv; rv = ipmi_emu_register_oi_iana_handler( OPENIPMI_IANA_CMD_SET_HISTORY_RETURN_SIZE, sol_set_history_return_size, NULL); if (rv) return rv; rv = ipmi_emu_register_oi_iana_handler( OPENIPMI_IANA_CMD_GET_HISTORY_RETURN_SIZE, sol_get_history_return_size, NULL); if (rv) return rv; return ipmi_register_payload(IPMI_RMCPP_PAYLOAD_TYPE_SOL, handle_sol_payload); } static void handle_sol_shutdown(void *info, int sig) { ipmi_sol_t *sol = info; soldata_t *sd = sol->soldata; FILE *f; if (sol->configured < 2 || !sd) return; sol->configured--; sd->shutdown(sol); if (!sol->backupfile || (sd->history_start == sd->history_end)) return; /* * Write the current history to the backup file. */ f = fopen(sol->backupfile, "w"); if (!f) return; if (sd->history_end >= sd->history_start) { /* History is fully contained between start and end. */ fwrite(sd->history + sd->history_start, 1, sd->history_end - sd->history_start + 1, f); } else { /* History laps over end, need two writes. */ fwrite(sd->history + sd->history_start, 1, sol->history_size - sd->history_start, f); fwrite(sd->history, 1, sd->history_end + 1, f); } fclose(f); } int sol_init_mc(sys_data_t *sys, lmc_data_t *mc) { ipmi_sol_t *sol = ipmi_mc_get_sol(mc); soldata_t *sd; sd = sys->alloc(sys, sizeof(*sd)); if (!sd) return ENOMEM; memset(sd, 0, sizeof(*sd)); sd->sys = sys; sol->soldata = sd; if (sol->tcpdest) sol_tcp_setup(sol); else sol_serial_setup(sol); if (sys->alloc_timer(sys, sol_timeout, sol, &sd->timer)) { sys->free(sys, sd); return ENOMEM; } if (sol->history_size) { if (sys->alloc_timer(sys, sol_history_timeout, sol, &sd->history_timer)) { sys->free_timer(sd->timer); sys->free(sys, sd); return ENOMEM; } sd->history = sys->alloc(sys, sol->history_size); if (!sd->history) { sys->free_timer(sd->history_timer); sys->free_timer(sd->timer); sys->free(sys, sd); return ENOMEM; } if (sol->backupfile) { FILE *f = fopen(sol->backupfile, "r"); if (f) { /* Ignore errors, it doesn't really matter. */ fseek(f, -sol->history_size, SEEK_END); sd->history_end = fread(sd->history, 1, sol->history_size, f); sd->history_end--; /* end point to last, not one after. */ fclose(f); } } } sd->backupfilehandler.handler = handle_sol_shutdown; sd->backupfilehandler.info = sol; ipmi_register_shutdown_handler(&sd->backupfilehandler); sd->fd = -1; sd->curr_packet_seq = 1; sd->history_curr_packet_seq = 1; sd->logchan = ipmi_mc_get_channelset(mc)[0]; if (sol_port_init(sol)) { /* Retry in 10 seconds. */ struct timeval tv; tv.tv_sec = 10; tv.tv_usec = 0; sd->sys->start_timer(sd->timer, &tv); } return 0; } OpenIPMI-2.0.27/lanserv/bmc.c0000664000175000017500000006441513160276524012504 00000000000000/* * emu.c * * MontaVista IPMI code for emulating a MC. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2012 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include "bmc.h" #include #include #include #include #include #include #include #include #include #include #include static void ipmi_mc_start_cmd(lmc_data_t *mc); const char * get_lanserv_version(void) { return PVERSION; } static void handle_group_extension_netfn(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (check_msg_length(msg, 1, rdata, rdata_len)) return; switch (msg->data[0]) { case IPMI_PICMG_GRP_EXT: if (mc->emu->atca_mode) handle_picmg_msg(mc, msg, rdata, rdata_len); else handle_invalid_cmd(mc, rdata, rdata_len); break; default: handle_invalid_cmd(mc, rdata, rdata_len); break; } } static struct iana_handler_elem { uint32_t iana; cmd_handler_f handler; void *cb_data; struct iana_handler_elem *next; } *iana_handlers; static struct iana_handler_elem *find_iana(uint32_t iana) { struct iana_handler_elem *p = iana_handlers; while (p) { if (p->iana == iana) return p; p = p->next; } return NULL; } int ipmi_emu_register_iana_handler(uint32_t iana, cmd_handler_f handler, void *cb_data) { struct iana_handler_elem *p; if (iana > 0xffffff) return EINVAL; if (find_iana(iana)) return EAGAIN; p = malloc(sizeof(*p)); if (!p) return ENOMEM; p->iana = iana; p->handler = handler; p->cb_data = cb_data; p->next = iana_handlers; iana_handlers = p; return 0; } static void handle_iana_netfn(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { struct iana_handler_elem *p; if (check_msg_length(msg, 3, rdata, rdata_len)) return; msg->iana = msg->data[0] | (msg->data[1] << 8) | (msg->data[2] << 16); p = find_iana(msg->iana); if (!p) { handle_invalid_cmd(mc, rdata, rdata_len); goto out; } /* Remove the IANA */ memcpy(msg->data, msg->data + 3, msg->len - 3); msg->len -= 3; p->handler(mc, msg, rdata, rdata_len, p->cb_data); out: /* Insert the IANA back in. */ memcpy(rdata + 4, rdata + 1, *rdata_len); rdata[1] = msg->iana & 0xff; rdata[2] = (msg->iana >> 8) & 0xff; rdata[3] = (msg->iana >> 16) & 0xff; *rdata_len += 3; } static struct oi_iana_cmd_elem { uint8_t cmd; cmd_handler_f handler; void *cb_data; struct oi_iana_cmd_elem *next; } *oi_iana_cmds; static struct oi_iana_cmd_elem *find_oi_iana(uint8_t cmd) { struct oi_iana_cmd_elem *p = oi_iana_cmds; while (p) { if (p->cmd == cmd) return p; p = p->next; } return NULL; } static void handle_oi_iana_cmd(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { struct oi_iana_cmd_elem *p; p = find_oi_iana(msg->cmd); if (!p) { handle_invalid_cmd(mc, rdata, rdata_len); return; } p->handler(mc, msg, rdata, rdata_len, p->cb_data); } int ipmi_emu_register_oi_iana_handler(uint8_t cmd, cmd_handler_f handler, void *cb_data) { struct oi_iana_cmd_elem *p; int rv; if (find_oi_iana(cmd)) return EAGAIN; rv = ipmi_emu_register_iana_handler(OPENIPMI_IANA, handle_oi_iana_cmd, NULL); if (rv != 0 && rv != EAGAIN) return rv; p = malloc(sizeof(*p)); if (!p) return ENOMEM; p->cmd = cmd; p->handler = handler; p->cb_data = cb_data; p->next = oi_iana_cmds; oi_iana_cmds = p; return 0; } static int check_chassis_capable(lmc_data_t *mc) { return (mc->device_support & IPMI_DEVID_CHASSIS_DEVICE); } typedef struct netfn_handler_s { cmd_handler_f *handlers; void **cb_data; cmd_handler_f main_handler; void *main_handler_cb_data; int (*check_capable)(lmc_data_t *mc); } netfn_handler_t; static netfn_handler_t netfn_handlers[32] = { [IPMI_APP_NETFN >> 1] = { .handlers = app_netfn_handlers }, [IPMI_STORAGE_NETFN >> 1] = { .handlers = storage_netfn_handlers }, [IPMI_CHASSIS_NETFN >> 1] = { .handlers = chassis_netfn_handlers, .check_capable = check_chassis_capable }, [IPMI_TRANSPORT_NETFN >> 1] = { .handlers = transport_netfn_handlers }, [IPMI_SENSOR_EVENT_NETFN >> 1] = { .handlers = sensor_event_netfn_handlers }, [IPMI_GROUP_EXTENSION_NETFN >> 1] = { .main_handler = handle_group_extension_netfn }, [IPMI_OEM_GROUP_NETFN >> 1] = { .main_handler = handle_iana_netfn }, [0x30 >> 1] = { .handlers = oem0_netfn_handlers } }; int ipmi_emu_register_cmd_handler(unsigned char netfn, unsigned char cmd, cmd_handler_f handler, void *cb_data) { unsigned int ni = netfn >> 1; if (netfn >= 32) return EINVAL; if (!netfn_handlers[ni].handlers) { netfn_handlers[ni].handlers = malloc(256 * sizeof(cmd_handler_f)); if (!netfn_handlers[ni].handlers) return ENOMEM; memset(netfn_handlers[ni].handlers, 0, 256 * sizeof(cmd_handler_f)); } if (!netfn_handlers[ni].cb_data) { netfn_handlers[ni].cb_data = malloc(256 * sizeof(void *)); if (!netfn_handlers[ni].cb_data) return ENOMEM; memset(netfn_handlers[ni].cb_data, 0, 256 * sizeof(void *)); } netfn_handlers[ni].cb_data[cmd] = cb_data; netfn_handlers[ni].handlers[cmd] = handler; return 0; } void ipmi_emu_tick(emu_data_t *emu, unsigned int seconds) { if (emu->atca_fru_inv_locked) { emu->atca_fru_inv_lock_timeout -= seconds; if (emu->atca_fru_inv_lock_timeout < 0) { emu->atca_fru_inv_locked = 0; free(emu->temp_fru_inv_data); emu->temp_fru_inv_data = NULL; } } if (emu->users_changed) { emu->users_changed = 0; write_persist_users(emu->sysinfo); } } #define IPMI_SEND_MSG_NO_TRACK 0x0 #define IPMI_SEND_MSG_TRACK_REQUEST 0x01 #define IPMI_SEND_MSG_SEND_RAW 0x2 #define IPMI_SEND_MSG_GET_TRACKING(v) ((v >> 6) & 0x3) void ipmi_emu_handle_msg(emu_data_t *emu, lmc_data_t *srcmc, msg_t *omsg, unsigned char *ordata, unsigned int *ordata_len) { lmc_data_t *mc; msg_t smsg, *rmsg = NULL; msg_t *msg; unsigned char *data = NULL; unsigned char *rdata; unsigned int *rdata_len; channel_t *rchan = omsg->orig_channel; if (emu->sysinfo->debug & DEBUG_MSG) emu->sysinfo->log(emu->sysinfo, DEBUG, omsg, "Receive message:"); if (omsg->netfn == IPMI_APP_NETFN && omsg->cmd == IPMI_SEND_MSG_CMD) { /* Encapsulated IPMB, do special handling. */ unsigned char slave; unsigned int data_len; if (check_msg_length(omsg, 8, ordata, ordata_len)) return; if ((omsg->data[0] & 0x3f) != 0) { ordata[0] = IPMI_INVALID_DATA_FIELD_CC; *ordata_len = 1; return; } switch (IPMI_SEND_MSG_GET_TRACKING(omsg->data[0])) { case IPMI_SEND_MSG_NO_TRACK: rchan = srcmc->channels[15]; break; case IPMI_SEND_MSG_TRACK_REQUEST: break; default: ordata[0] = IPMI_INVALID_DATA_FIELD_CC; *ordata_len = 1; return; } data = omsg->data + 1; data_len = omsg->len - 1; if (data[0] == 0) { /* Broadcast, just skip the first byte, but check len. */ data++; data_len--; if (data_len < 7) { ordata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *ordata_len = 1; return; } } slave = data[0]; mc = emu->sysinfo->ipmb_addrs[slave]; if (!mc || !mc->enabled) { ordata[0] = 0x83; /* NAK on Write */ *ordata_len = 1; return; } rmsg = malloc(sizeof(*rmsg) + IPMI_SIM_MAX_MSG_LENGTH); if (!rmsg) { ordata[0] = IPMI_OUT_OF_SPACE_CC; *ordata_len = 1; return; } *rmsg = *omsg; rmsg->data = ((unsigned char *) rmsg) + sizeof(*rmsg); rmsg->len = IPMI_SIM_MAX_MSG_LENGTH - 7; /* header and checksum */ rmsg->netfn = (data[1] & 0xfc) >> 2; rmsg->cmd = data[5]; rdata = rmsg->data + 6; rdata_len = &rmsg->len; rmsg->data[0] = emu->sysinfo->bmc_ipmb; rmsg->data[1] = ((data[1] & 0xfc) | 0x4) | (data[4] & 0x3); rmsg->data[2] = -ipmb_checksum(rdata+1, 2, 0); rmsg->data[3] = data[0]; rmsg->data[4] = (data[4] & 0xfc) | (data[1] & 0x03); rmsg->data[5] = data[5]; smsg.src_addr = omsg->src_addr; smsg.src_len = omsg->src_len; smsg.netfn = data[1] >> 2; smsg.rs_lun = data[1] & 0x3; smsg.cmd = data[5]; smsg.data = data + 6; smsg.len = data_len - 7; /* Subtract off the header and the end checksum */ smsg.channel = 0; /* IPMB channel is 0 */ smsg.orig_channel = omsg->orig_channel; smsg.sid = omsg->sid; msg = &smsg; } else { mc = srcmc; if (!mc || !mc->enabled) { ordata[0] = 0xff; *ordata_len = 1; return; } rdata = ordata; rdata_len = ordata_len; msg = omsg; } if (netfn_handlers[msg->netfn >> 1].check_capable && !netfn_handlers[msg->netfn >> 1].check_capable(mc)) handle_invalid_cmd(mc, rdata, rdata_len); else if (netfn_handlers[msg->netfn >> 1].main_handler) netfn_handlers[msg->netfn >> 1].main_handler(mc, msg, rdata, rdata_len, netfn_handlers[msg->netfn >> 1].main_handler_cb_data); else if (netfn_handlers[msg->netfn >> 1].handlers && netfn_handlers[msg->netfn >> 1].handlers[msg->cmd]) { void *cb_data = NULL; if (netfn_handlers[msg->netfn >> 1].cb_data) cb_data = netfn_handlers[msg->netfn >> 1].cb_data[msg->cmd]; netfn_handlers[msg->netfn >> 1].handlers[msg->cmd](mc, msg, rdata, rdata_len, cb_data); } else handle_invalid_cmd(mc, rdata, rdata_len); if (omsg->netfn == IPMI_APP_NETFN && omsg->cmd == IPMI_SEND_MSG_CMD) { /* An encapsulated command, put the response into the receive q. */ if (rchan->recv_in_q) { if (rchan->recv_in_q(srcmc->channels[15], rmsg)) return; } ordata[0] = 0; *ordata_len = 1; if (emu->sysinfo->debug & DEBUG_MSG) debug_log_raw_msg(emu->sysinfo, rdata, *rdata_len, "Response message:"); if (!rchan->has_recv_q) { free(rmsg); return; } rmsg->len += 6; rmsg->data[rmsg->len] = -ipmb_checksum(rmsg->data, rmsg->len, 0); rmsg->len += 1; if (rchan->recv_q_tail) { rmsg->next = rchan->recv_q_tail; rchan->recv_q_tail = rmsg; } else { rmsg->next = NULL; rchan->recv_q_head = rmsg; rchan->recv_q_tail = rmsg; if (rchan->channel_num == 15) { srcmc->msg_flags |= IPMI_MC_MSG_FLAG_RCV_MSG_QUEUE; if (rchan->set_atn) rchan->set_atn(rchan, 1, IPMI_MC_MSG_INTS_ON(mc)); } } } else if (emu->sysinfo->debug & DEBUG_MSG) debug_log_raw_msg(emu->sysinfo, ordata, *ordata_len, "Response message:"); } void ipmi_resend_atn(channel_t *chan) { lmc_data_t *mc = chan->mc; if (chan->set_atn) chan->set_atn(chan, !!mc->msg_flags, IPMI_MC_MSG_INTS_ON(mc)); } msg_t * ipmi_mc_get_next_recv_q(channel_t *chan) { msg_t *rv; if (!chan->recv_q_head) return NULL; rv = chan->recv_q_head; chan->recv_q_head = rv->next; if (!chan->recv_q_head) { chan->recv_q_tail = NULL; } return rv; } emu_data_t * ipmi_emu_alloc(void *user_data, ipmi_emu_sleep_cb sleeper, sys_data_t *sysinfo) { emu_data_t *data = malloc(sizeof(*data)); if (data) { memset(data, 0, sizeof(*data)); data->user_data = user_data; data->sleeper = sleeper; data->sysinfo = sysinfo; } return data; } int ipmi_emu_set_addr(emu_data_t *emu, unsigned int addr_num, unsigned char addr_type, void *addr_data, unsigned int addr_len) { emu_addr_t *addr; if (addr_num >= MAX_EMU_ADDR) return EINVAL; addr = &(emu->addr[addr_num]); if (addr_len > sizeof(addr->addr_data)) return EINVAL; emu->sysinfo->get_monotonic_time(emu->sysinfo, &emu->last_addr_change_time); addr->addr_type = addr_type; memcpy(addr->addr_data, addr_data, addr_len); addr->addr_len = addr_len; addr->valid = 1; return 0; } int ipmi_emu_clear_addr(emu_data_t *emu, unsigned int addr_num) { emu_addr_t *addr; if (addr_num >= MAX_EMU_ADDR) return EINVAL; addr = &(emu->addr[addr_num]); addr->valid = 0; return 0; } void ipmi_emu_sleep(emu_data_t *emu, struct timeval *time) { emu->sleeper(emu, time); } void * ipmi_emu_get_user_data(emu_data_t *emu) { return emu->user_data; } void ipmi_mc_destroy(lmc_data_t *mc) { sel_entry_t *entry, *n_entry; entry = mc->sel.entries; while (entry) { n_entry = entry->next; free(entry); entry = n_entry; } free(mc); } int ipmi_emu_set_mc_guid(lmc_data_t *mc, unsigned char guid[16], int force) { if (force || !mc->guid_set) memcpy(mc->guid, guid, 16); mc->guid_set = 1; return 0; } void ipmi_mc_disable(lmc_data_t *mc) { mc->enabled = 0; } void ipmi_mc_enable(lmc_data_t *mc) { unsigned int i; sys_data_t *sys = mc->sysinfo; mc->enabled = 1; for (i = 0; i < IPMI_MAX_CHANNELS; i++) { channel_t *chan = mc->channels[i]; int err = 0; if (!chan) continue; chan->smi_send = sys->csmi_send; chan->oem.user_data = sys->info; chan->alloc = sys->calloc; chan->free = sys->cfree; chan->log = sys->clog; chan->mc = mc; if (chan->medium_type == IPMI_CHANNEL_MEDIUM_8023_LAN) err = sys->lan_channel_init(sys->info, chan); else if (chan->medium_type == IPMI_CHANNEL_MEDIUM_RS232) err = sys->ser_channel_init(sys->info, chan); else chan_init(chan); if (err) { chan->log(chan, SETUP_ERROR, NULL, "Unable to initialize channel for " "IPMB 0x%2.2x, channel %d: %d", mc->ipmb, chan->channel_num, err); } } if (mc->startcmd.startnow && mc->startcmd.startcmd) ipmi_mc_start_cmd(mc); } int ipmi_mc_set_num_leds(lmc_data_t *mc, unsigned int count) { if (count > MAX_LEDS) return EINVAL; if (mc->emu->atca_mode && (count < MIN_ATCA_LEDS)) return EINVAL; mc->num_leds = count; return 0; } static int init_mc(emu_data_t *emu, lmc_data_t *mc, unsigned int persist_sdr) { int err; err = mc->sysinfo->alloc_timer(mc->sysinfo, watchdog_timeout, mc, &mc->watchdog_timer); if (err) return err; if (persist_sdr && mc->has_device_sdrs) { read_mc_sdrs(mc, &mc->device_sdrs[0], "device0"); read_mc_sdrs(mc, &mc->device_sdrs[1], "device1"); read_mc_sdrs(mc, &mc->device_sdrs[2], "device2"); read_mc_sdrs(mc, &mc->device_sdrs[3], "device3"); } if (persist_sdr && (mc->device_support & IPMI_DEVID_SDR_REPOSITORY_DEV)) read_mc_sdrs(mc, &mc->main_sdrs, "main"); return err; } static void ipmi_mc_start_cmd(lmc_data_t *mc) { if (!mc->startcmd.startcmd) { mc->sysinfo->log(mc->sysinfo, OS_ERROR, NULL, "Power on issued, no start command set"); return; } if (mc->startcmd.vmpid) { /* Already running */ /* If we are waiting for a poweroff, disable that. */ if (mc->startcmd.wait_poweroff) mc->startcmd.wait_poweroff = 0; return; } ipmi_do_start_cmd(&mc->startcmd); } static void chan_start_cmd(channel_t *chan) { ipmi_mc_start_cmd(chan->mc); } static void ipmi_mc_stop_cmd(lmc_data_t *mc, int do_it_now) { if (mc->startcmd.wait_poweroff || !mc->startcmd.vmpid) /* Already powering/powered off. */ return; if (!do_it_now) mc->startcmd.wait_poweroff = mc->startcmd.poweroff_wait_time; else mc->startcmd.wait_poweroff = 1; /* Just power off now. */ } static void chan_stop_cmd(channel_t *chan, int do_it_now) { ipmi_mc_stop_cmd(chan->mc, do_it_now); } channel_t ** ipmi_mc_get_channelset(lmc_data_t *mc) { return mc->channels; } ipmi_sol_t * ipmi_mc_get_sol(lmc_data_t *mc) { return &mc->sol; } unsigned char ipmi_mc_get_ipmb(lmc_data_t *mc) { return mc->ipmb; } int ipmi_mc_users_changed(lmc_data_t *mc) { int rv = mc->users_changed; mc->users_changed = 0; return rv; } user_t * ipmi_mc_get_users(lmc_data_t *mc) { return mc->users; } pef_data_t * ipmi_mc_get_pef(lmc_data_t *mc) { return &mc->pef; } startcmd_t * ipmi_mc_get_startcmdinfo(lmc_data_t *mc) { return &mc->startcmd; } int ipmi_mc_alloc_unconfigured(sys_data_t *sys, unsigned char ipmb, lmc_data_t **rmc) { lmc_data_t *mc; unsigned int i; mc = sys->ipmb_addrs[ipmb]; if (mc) { if (mc->configured) { sys->log(sys, SETUP_ERROR, NULL, "MC IPMB specified twice: 0x%x.", ipmb); return EBUSY; } goto out; } mc = malloc(sizeof(*mc)); if (!mc) return ENOMEM; memset(mc, 0, sizeof(*mc)); mc->ipmb = ipmb; sys->ipmb_addrs[ipmb] = mc; mc->startcmd.poweroff_wait_time = 60; mc->startcmd.kill_wait_time = 20; mc->startcmd.startnow = 0; for (i=0; i<=MAX_USERS; i++) { mc->users[i].idx = i; } mc->pef.num_event_filters = MAX_EVENT_FILTERS; for (i=0; ipef.event_filter_table[i][0] = i; mc->pef.event_filter_data1[i][0] = i; } mc->pef.num_alert_policies = MAX_ALERT_POLICIES; for (i=0; ipef.alert_policy_table[i][0] = i; mc->pef.num_alert_strings = MAX_ALERT_STRINGS; for (i=0; ipef.alert_string_keys[i][0] = i; } mc->ipmb_channel.medium_type = IPMI_CHANNEL_MEDIUM_IPMB; mc->ipmb_channel.channel_num = 0; mc->ipmb_channel.protocol_type = IPMI_CHANNEL_PROTOCOL_IPMB; mc->ipmb_channel.session_support = IPMI_CHANNEL_SESSION_LESS; mc->ipmb_channel.active_sessions = 0; mc->channels[0] = &mc->ipmb_channel; mc->channels[0]->log = sys->clog; out: *rmc = mc; return 0; } void handle_invalid_cmd(lmc_data_t *mc, unsigned char *rdata, unsigned int *rdata_len) { rdata[0] = IPMI_INVALID_CMD_CC; *rdata_len = 1; } int check_msg_length(msg_t *msg, unsigned int len, unsigned char *rdata, unsigned int *rdata_len) { if (msg->len < len) { rdata[0] = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; *rdata_len = 1; return 1; } return 0; } static void handle_tick(void *info, unsigned int seconds) { lmc_data_t *mc = info; if (mc->startcmd.wait_poweroff) { if (mc->startcmd.wait_poweroff > 0) { /* Waiting for the first kill */ mc->startcmd.wait_poweroff--; if (mc->startcmd.wait_poweroff == 0) { if (mc->startcmd.vmpid) ipmi_do_kill(&mc->startcmd, 0); mc->startcmd.wait_poweroff = -mc->startcmd.kill_wait_time; } } else { mc->startcmd.wait_poweroff++; if (mc->startcmd.wait_poweroff == 0 && mc->startcmd.vmpid) ipmi_do_kill(&mc->startcmd, 1); } } } static void handle_child_quit(void *info, pid_t pid) { lmc_data_t *mc = info; if (mc->startcmd.vmpid == pid) { mc->startcmd.vmpid = 0; mc->startcmd.wait_poweroff = 0; } } int ipmi_emu_add_mc(emu_data_t *emu, unsigned char ipmb, unsigned char device_id, unsigned char has_device_sdrs, unsigned char device_revision, unsigned char major_fw_rev, unsigned char minor_fw_rev, unsigned char device_support, unsigned char mfg_id[3], unsigned char product_id[2], unsigned int flags) { lmc_data_t *mc; struct timeval t; int i; sys_data_t *sys = emu->sysinfo; i = ipmi_mc_alloc_unconfigured(sys, ipmb, &mc); if (i) return i; mc->sysinfo = sys; mc->emu = emu; mc->ipmb = ipmb; mc->device_id = device_id; mc->has_device_sdrs = has_device_sdrs; mc->device_revision = device_revision; mc->major_fw_rev = major_fw_rev; mc->minor_fw_rev = minor_fw_rev; mc->device_support = device_support; mc->dynamic_sensor_population = flags & IPMI_MC_DYNAMIC_SENSOR_POPULATION; memcpy(mc->mfg_id, mfg_id, 3); memcpy(mc->product_id, product_id, 2); /* Enable the event log by default. */ mc->global_enables = 1 << IPMI_MC_EVENT_LOG_BIT; /* Start the time at zero. */ emu->sysinfo->get_monotonic_time(emu->sysinfo, &t); mc->sel.time_offset = 0; mc->main_sdrs.time_offset = 0; mc->main_sdrs.next_entry = 1; mc->main_sdrs.flags |= IPMI_SDR_RESERVE_SDR_SUPPORTED; for (i=0; i<4; i++) { mc->device_sdrs[i].time_offset = 0; mc->device_sdrs[i].next_entry = 1; } mc->event_receiver = sys->bmc_ipmb; mc->event_receiver_lun = 0; mc->hs_sensor = NULL; if (emu->atca_mode) { mc->num_leds = 2; /* By default only blue LED has local control. */ mc->leds[0].loc_cnt = 1; mc->leds[0].loc_cnt_sup = 1; mc->leds[0].def_loc_cnt_color = 1; /* Blue LED */ mc->leds[0].def_override_color = 1; mc->leds[0].color_sup = 0x2; mc->leds[0].color = 0x1; for (i=1; ileds[i].def_loc_cnt_color = 2; mc->leds[i].def_override_color = 2; mc->leds[i].color_sup = 0x2; mc->leds[i].color = 0x2; } } if (ipmb == emu->sysinfo->bmc_ipmb) { int rv; if (!mc->channels[15]) { /* No one specified a system channel, make one up */ mc->sys_channel.medium_type = IPMI_CHANNEL_MEDIUM_SYS_INTF; mc->sys_channel.channel_num = 15; mc->sys_channel.protocol_type = IPMI_CHANNEL_PROTOCOL_KCS; mc->sys_channel.session_support = IPMI_CHANNEL_SESSION_LESS; mc->sys_channel.active_sessions = 0; mc->channels[15] = &mc->sys_channel; } mc->channels[15]->has_recv_q = 1; mc->sysinfo = emu->sysinfo; rv = init_mc(emu, mc, flags & IPMI_MC_PERSIST_SDR); if (rv) { free(mc); return rv; } } if (mc->startcmd.startcmd) { mc->child_quit_handler.info = mc; mc->child_quit_handler.handler = handle_child_quit; ipmi_register_child_quit_handler(&mc->child_quit_handler); mc->tick_handler.info = mc; mc->tick_handler.handler = handle_tick; ipmi_register_tick_handler(&mc->tick_handler); mc->channels[15]->start_cmd = chan_start_cmd; mc->channels[15]->stop_cmd = chan_stop_cmd; } mc->configured = 1; return 0; } void ipmi_mc_set_device_id(lmc_data_t *mc, unsigned char device_id) { mc->device_id = device_id; } unsigned char ipmi_mc_get_device_id(lmc_data_t *mc) { return mc->device_id; } void ipmi_set_has_device_sdrs(lmc_data_t *mc, unsigned char has_device_sdrs) { mc->has_device_sdrs = has_device_sdrs; } unsigned char ipmi_get_has_device_sdrs(lmc_data_t *mc) { return mc->has_device_sdrs; } void ipmi_set_device_revision(lmc_data_t *mc, unsigned char device_revision) { mc->device_revision = device_revision; } unsigned char ipmi_get_device_revision(lmc_data_t *mc) { return mc->device_revision; } void ipmi_set_major_fw_rev(lmc_data_t *mc, unsigned char major_fw_rev) { mc->major_fw_rev = major_fw_rev; } unsigned char ipmi_get_major_fw_rev(lmc_data_t *mc) { return mc->major_fw_rev; } void ipmi_set_minor_fw_rev(lmc_data_t *mc, unsigned char minor_fw_rev) { mc->minor_fw_rev = minor_fw_rev; } unsigned char ipmi_get_minor_fw_rev(lmc_data_t *mc) { return mc->minor_fw_rev; } void ipmi_set_device_support(lmc_data_t *mc, unsigned char device_support) { mc->device_support = device_support; } unsigned char ipmi_get_device_support(lmc_data_t *mc) { return mc->device_support; } void ipmi_set_mfg_id(lmc_data_t *mc, unsigned char mfg_id[3]) { memcpy(mc->mfg_id, mfg_id, 3); } void ipmi_get_mfg_id(lmc_data_t *mc, unsigned char mfg_id[3]) { memcpy(mfg_id, mc->mfg_id, 3); } void ipmi_set_product_id(lmc_data_t *mc, unsigned char product_id[2]) { memcpy(mc->product_id, product_id, 2); } void ipmi_set_chassis_control_prog(lmc_data_t *mc, const char *prog) { mc->chassis_control_prog = prog; } void ipmi_mc_set_chassis_control_func(lmc_data_t *mc, int (*set)(lmc_data_t *mc, int op, unsigned char *val, void *cb_data), int (*get)(lmc_data_t *mc, int op, unsigned char *val, void *cb_data), void *cb_data) { mc->chassis_control_set_func = set; mc->chassis_control_get_func = get; mc->chassis_control_cb_data = cb_data; } void ipmi_get_product_id(lmc_data_t *mc, unsigned char product_id[2]) { memcpy(product_id, mc->product_id, 2); } int ipmi_emu_get_mc_by_addr(emu_data_t *emu, unsigned char ipmb, lmc_data_t **mc) { if (!emu->sysinfo->ipmb_addrs[ipmb]) return ENOSYS; *mc = emu->sysinfo->ipmb_addrs[ipmb]; return 0; } int ipmi_emu_set_bmc_mc(emu_data_t *emu, unsigned char ipmb) { lmc_data_t *mc; if (ipmb & 1) return EINVAL; emu->sysinfo->bmc_ipmb = ipmb; if (!ipmi_emu_get_mc_by_addr(emu, ipmb, &mc)) mc->sysinfo = emu->sysinfo; return 0; } lmc_data_t * ipmi_emu_get_bmc_mc(emu_data_t *emu) { lmc_data_t *mc; if (!ipmi_emu_get_mc_by_addr(emu, emu->sysinfo->bmc_ipmb, &mc)) return mc; return NULL; } void emu_set_debug_level(emu_data_t *emu, unsigned int debug_level) { emu->sysinfo->debug = debug_level; } OpenIPMI-2.0.27/lanserv/extcmd.c0000664000175000017500000002563213136461257013227 00000000000000/* * extcmd.c * * MontaVista IPMI IPMI LAN interface extern command handler * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #ifdef HAVE_NETINET_ETHER_H #include #elif defined(HAVE_SYS_ETHERNET_H) #include #else #error "either netinet/ether.h or sys/ethernet.h must exist." #endif #include #include #include #include #include #include #include #include static int extcmd_getval(void *baseloc, extcmd_info_t *t, char *val) { unsigned char *loc = baseloc; char *end; int ival; struct in_addr iaddr; while (isspace(*val)) val++; loc += t->offset; switch (t->type) { case extcmd_ip: if (inet_aton(val, &iaddr) == 0) return EINVAL; loc[3] = (iaddr.s_addr >> 24) & 0xff; loc[2] = (iaddr.s_addr >> 16) & 0xff; loc[1] = (iaddr.s_addr >> 8) & 0xff; loc[0] = (iaddr.s_addr >> 0) & 0xff; break; case extcmd_mac: if (ether_aton_r(val, (struct ether_addr *) loc) == 0) return EINVAL; break; case extcmd_uchar: if (*val == '\0') return EINVAL; if (t->map) { char *eval = val; unsigned int i; while (*eval && !isspace(*eval)) eval++; for (i = 0; t->map[i].name; i++) { if (strncmp(t->map[i].name, val, eval - val) == 0) break; } if (!t->map[i].name) return EINVAL; ival = t->map[i].value; } else { ival = strtol(val, &end, 0); if (!isspace(*end) && (*end != '\0')) return EINVAL; } *((unsigned char *) loc) = ival; break; case extcmd_int: if (*val == '\0') return EINVAL; if (t->map) { char *eval = val; unsigned int i; while (*eval && !isspace(*eval)) eval++; for (i = 0; t->map[i].name; i++) { if (strncmp(t->map[i].name, val, eval - val) == 0) break; } if (!t->map[i].name) return EINVAL; ival = t->map[i].value; } else { ival = strtol(val, &end, 0); if (!isspace(*end) && (*end != '\0')) return EINVAL; } *((int *) loc) = ival; break; default: return EINVAL; } return 0; } static char * extcmd_setval(void *baseloc, extcmd_info_t *t) { unsigned char *loc = baseloc; char cbuf[20]; /* Big enough to hold IP, MAC and src */ char *buf = cbuf; struct in_addr iaddr; loc += t->offset; switch (t->type) { case extcmd_ip: iaddr.s_addr = loc[3] << 24; iaddr.s_addr |= loc[2] << 16; iaddr.s_addr |= loc[1] << 8; iaddr.s_addr |= loc[0] << 0; if (!inet_ntop(AF_INET, &iaddr, buf, sizeof(cbuf))) return NULL; break; case extcmd_ident: sprintf(buf, "%u %u", (unsigned char)loc[0], (unsigned char)loc[1]); break; case extcmd_mac: if (!ether_ntoa_r((struct ether_addr *) loc, buf)) return NULL; break; case extcmd_uchar: if (t->map) { unsigned int i; buf = NULL; for (i = 0; t->map[i].name; i++) { if (t->map[i].value == *((unsigned char *) loc)) { buf = t->map[i].name; break; } } if (!buf) return NULL; } else { sprintf(buf, "%u", *((unsigned char *) loc)); } break; case extcmd_int: if (t->map) { unsigned int i; buf = NULL; for (i = 0; t->map[i].name; i++) { if (t->map[i].value == *((int *) loc)) { buf = t->map[i].name; break; } } if (!buf) return NULL; } else { sprintf(buf, "%d", *((int *) loc)); } break; default: return NULL; } return strdup(buf); } static int process_extcmd_value(void *baseloc, extcmd_info_t *t, char *buf) { unsigned int len = strlen(t->name); while (buf) { while (*buf == '\n') buf++; if ((strncmp(buf, t->name, len) == 0) && buf[len] == ':') return extcmd_getval(baseloc, t, buf + len + 1); buf = strchr(buf, '\n'); } return EEXIST; } static int add_cmd(char **cmd, const char *name, char *value, int freevalue) { unsigned int size; char *newcmd; int rv = 0; if (freevalue && !value) { rv = EINVAL; goto out; } size = strlen(name) + 1; if (value) size += strlen(value) + 3; size += strlen(*cmd); newcmd = malloc(size + 1); if (!newcmd) { rv = ENOMEM; goto out; } strcpy(newcmd, *cmd); free(*cmd); strcat(newcmd, " "); strcat(newcmd, name); if (value) { strcat(newcmd, " \""); strcat(newcmd, value); strcat(newcmd, "\""); } *cmd = newcmd; out: if (freevalue) free(value); return rv; } int extcmd_getvals(sys_data_t *sys, void *baseloc, const char *incmd, extcmd_info_t *ts, unsigned int count) { int rv; char *cmd; FILE *f = NULL; unsigned int i; char buf[2048]; unsigned int buflen = sizeof(buf); if (!incmd) return 0; cmd = malloc(strlen(incmd) + 5); if (!cmd) return ENOMEM; strcpy(cmd, incmd); strcat(cmd, " get"); for (i = 0; i < count; i++) { rv = add_cmd(&cmd, ts[i].name, NULL, 0); if (rv) { sys->log(sys, OS_ERROR, NULL, "Out of memory in extcmd read command\n"); goto out; } } f = popen(cmd, "r"); if (!f) { sys->log(sys, OS_ERROR, NULL, "Unable to execute extcmd read command (%s): %s\n", cmd, strerror(errno)); rv = errno; goto out; } rv = fread(buf, 1, buflen - 1, f); if ((unsigned int) rv == buflen - 1) { sys->log(sys, OS_ERROR, NULL, "Output of extcmd config read command (%s) is too big", cmd); rv = EINVAL; goto out; } buf[rv] = '\0'; rv = pclose(f); f = NULL; if (rv) { sys->log(sys, OS_ERROR, NULL, "extcmd read command (%s) failed: %x: %s", cmd, rv, buf); goto out; } for (i = 0; i < count; i++) { rv = process_extcmd_value(baseloc, ts + i, buf); if (rv) { sys->log(sys, OS_ERROR, NULL, "Setting extern command value of %s failed: %s", ts[i].name, strerror(rv)); goto out; } } out: if (f) pclose(f); free(cmd); return rv; } int extcmd_setvals(sys_data_t *sys, void *baseloc, const char *incmd, extcmd_info_t *ts, unsigned char *setit, unsigned int count) { int rv = 0; char *cmd; FILE *f = NULL; unsigned int i; char buf[2048]; unsigned int buflen = sizeof(buf); int oneset = 0; if (!incmd) return 0; cmd = malloc(strlen(incmd) + 5); if (!cmd) return ENOMEM; strcpy(cmd, incmd); strcat(cmd, " set"); for (i = 0; i < count; i++) { if (setit && !setit[i]) continue; oneset = 1; rv = add_cmd(&cmd, ts[i].name, extcmd_setval(baseloc, ts + i), 1); if (rv) { sys->log(sys, OS_ERROR, NULL, "Out of memory in extcmd write command (%d) %s\n", rv, strerror(rv)); goto out; } } if (!oneset) goto out; f = popen(cmd, "r"); if (!f) { sys->log(sys, OS_ERROR, NULL, "Unable to execute extcmd write command (%s): %s\n", cmd, strerror(errno)); rv = errno; goto out; } rv = fread(buf, 1, buflen - 1, f); if ((unsigned int) rv == buflen - 1) { sys->log(sys, OS_ERROR, NULL, "Output of extcmd config write command (%s) is too big", cmd); rv = EINVAL; goto out; } buf[rv] = '\0'; rv = pclose(f); f = NULL; if (rv) { sys->log(sys, OS_ERROR, NULL, "extcmd write command (%s) failed: %x: %s", cmd, rv, buf); goto out; } out: if (f) pclose(f); free(cmd); return rv; } int extcmd_checkvals(sys_data_t *sys, void *baseloc, const char *incmd, extcmd_info_t *ts, unsigned int count) { int rv = 0; char *cmd; FILE *f = NULL; unsigned int i; char buf[2048]; unsigned int buflen = sizeof(buf); if (!incmd) return 0; cmd = malloc(strlen(incmd) + 7); if (!cmd) return ENOMEM; strcpy(cmd, incmd); strcat(cmd, " check"); for (i = 0; i < count; i++) { rv = add_cmd(&cmd, ts[i].name, extcmd_setval(baseloc, ts + i), 1); if (rv == ENOMEM) { sys->log(sys, OS_ERROR, NULL, "Out of memory in extcmd check command\n"); goto out; } else if (rv) { sys->log(sys, OS_ERROR, NULL, "Invalid value in extcmd check command for %s\n", ts[i].name); goto out; } } f = popen(cmd, "r"); if (!f) { sys->log(sys, OS_ERROR, NULL, "Unable to execute extcmd check command (%s): %s\n", cmd, strerror(errno)); rv = errno; goto out; } rv = fread(buf, 1, buflen - 1, f); if ((unsigned int) rv == buflen - 1) { sys->log(sys, OS_ERROR, NULL, "Output of extcmd config check command (%s) is too big", cmd); rv = EINVAL; goto out; } buf[rv] = '\0'; /* Return value should tell us if it's ok. */ rv = pclose(f); f = NULL; out: if (f) pclose(f); free(cmd); return rv; } OpenIPMI-2.0.27/lanserv/lanserv_oem_force.c0000644000175000017500000001457513042447105015425 00000000000000/* * lanserv_force_oem.c * * MontaVista IPMI IPMI LAN code for OEM Force Computers board handling * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include typedef struct force_oem_data_s { unsigned char slave_addr; unsigned char curr_addr; } force_oem_data_t; static int force_rsp_handler(channel_t *chan, msg_t *msg, rsp_msg_t *rsp) { unsigned char new_addr; if (rsp->netfn == 0x31) { /* A force OEM response. */ force_oem_data_t *fdata = chan->oem.oem_data; switch (rsp->cmd) { case 3: /* A response to a change mode. */ /* Ignore errors. */ if (rsp->data_len < 1) return 0; if (rsp->data[0] != 0) return 0; /* See what it was changed to. */ if (msg->data[0] == 0) /* Changed to master, address is 0x20 */ new_addr = 0x20; else new_addr = fdata->slave_addr; if (new_addr != fdata->curr_addr) { fdata->curr_addr = fdata->slave_addr; chan->log(chan, INFO, NULL, "Change Force MC address to 0x%x", new_addr); if (chan->oem.ipmb_addr_change) chan->oem.ipmb_addr_change(chan, fdata->curr_addr); } break; case 4: /* A request for the IPMB address. */ /* Ignore errors. */ if (rsp->data_len < 4) return 0; if (rsp->data[0] != 0) return 0; fdata->slave_addr = rsp->data[3]; if (fdata->curr_addr != rsp->data[2]) { fdata->curr_addr = rsp->data[2]; if (chan->oem.ipmb_addr_change) chan->oem.ipmb_addr_change(chan, fdata->curr_addr); } return msg->oem_data; } } return 0; } static int force_check_permitted(unsigned char priv, unsigned char netfn, unsigned char cmd) { int req_priv = IPMI_PRIVILEGE_ADMIN; if (netfn != 0x30) return IPMI_PRIV_INVALID; switch (cmd) { case 3: req_priv = IPMI_PRIVILEGE_OPERATOR; break; case 4: req_priv = IPMI_PRIVILEGE_USER; break; case 5: req_priv = IPMI_PRIVILEGE_USER; break; case 6: req_priv = IPMI_PRIVILEGE_OPERATOR; break; } if (priv >= req_priv) return IPMI_PRIV_PERMITTED; else return IPMI_PRIV_DENIED; } static force_oem_data_t force_data = { .slave_addr = 0, .curr_addr = 0, }; static void force_oem_installer(channel_t *chan, void *cb_data) { chan->oem.oem_handle_rsp = force_rsp_handler; chan->oem.oem_check_permitted = force_check_permitted; chan->oem.oem_data = &force_data; /* Set a command to get the current address. */ ipmi_oem_send_msg(chan, 0x30, 4, NULL, 0, 1); } static oem_handler_t force_735_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0804, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_740_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0808, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_786_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0810, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_550_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0880, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_560_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0888, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_690_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0900, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_695_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0904, .handler = force_oem_installer, .cb_data = NULL, }; void init_oem_force(void) { ipmi_register_oem(&force_735_oem); ipmi_register_oem(&force_740_oem); ipmi_register_oem(&force_786_oem); ipmi_register_oem(&force_550_oem); ipmi_register_oem(&force_560_oem); ipmi_register_oem(&force_690_oem); ipmi_register_oem(&force_695_oem); } #if 0 /* If you include this as a module under Linux, you can use the following code to initialize it. Otherwise, something has to call init_oem_force(). */ static void (*const __init_patch_debug[1]) \ (void) __attribute__ ((section(".ctors"))) = { init_oem_force }; #endif OpenIPMI-2.0.27/lanserv/README.ipmi_sim0000664000175000017500000000657413033261266014262 00000000000000This is the IPMI simulator, which can perform the function of a BMC. It can act as a real BMC, too, see README.yourownbmc for details. Unfortunately, the documentation is lacking at the moment. The available docs will have to suffice at the moment. There are some example config files in this directory. If you want to just try it out, you can run: mkdir my_statedir ./ipmi_sim lan.conf -f ipmisim1.emu -s my_statedir You will be a BMC on your host at 9001. Then you can do, for instance: cminyard@t430:~$ ipmitool -I lanplus -U ipmiusr -P test -p 9001 -H localhost mc info Device ID : 0 Device Revision : 3 Firmware Revision : 9.08 IPMI Version : 2.0 Manufacturer ID : 4753 Manufacturer Name : Unknown (0x1291) Product ID : 3842 (0x0f02) Product Name : Unknown (0xF02) Device Available : yes Provides Device SDRs : no Additional Device Support : Sensor Device SDR Repository Device SEL Device FRU Inventory Device IPMB Event Receiver Chassis Device Aux Firmware Rev Info : 0x00 0x00 0x00 0x00 Unfortunately, you won't get any SDRs by default, the SDR repository will be empty: cminyard@t430:~$ ipmitool -I lanplus -U ipmiusr -P test -p 9001 -H localhost sdr list SDRR successfully erased Err in cmd get sensor sdr info Get SDR 0000 command failed: Requested sensor, data, or record not found Get SDR 0000 command failed: Requested sensor, data, or record not found Get SDR 0000 command failed: Requested sensor, data, or record not found Get SDR 0000 command failed: Requested sensor, data, or record not found Get SDR 0000 command failed: Requested sensor, data, or record not found To fix this, you have to install SDRs in the state directory. The SDRs should already be build for you, so you just have to copy them in. If you look in the my_statedir directory, you will see that it has created some directories: cminyard@t430:~/git/openipmi/O/lanserv$ ls -lR my_statedir/ my_statedir/: total 4 drwxr-xr-x 3 cminyard cminyard 4096 Jan 4 14:54 ipmi_sim my_statedir/ipmi_sim: total 4 drwxr-xr-x 2 cminyard cminyard 4096 Jan 4 14:54 ipmisim1 my_statedir/ipmi_sim/ipmisim1: total 0 Stop ipmi_sim, install the compiled SDRs: cp ipmisim1.bsdr my_statedir/ipmi_sim/ipmisim1/sdr.20.main then restart ipmi_sim as above. Now you have SDRs matching the sensors: cminyard@t430:~$ ipmitool -I lanplus -U ipmiusr -P test -p 9001 -H localhost sdr list MBTemp | 96 degrees C | ok SubTemp | 0 degrees C | ok Note that if you use IPMI commands to make any changes to the users, the users in the lan.conf file will no longer work, as the persistent data overrides what is in lan.conf. For more information, see: README.yourownbmc - More information on setting up BMCs, simulated and real README.vm - Information on the protocol to talk to qemu. README.design - Information about the design structure of ipmi_sim. ipmi_lan.5 - A man file describing lan.conf. lan.conf has quite a bit of information in it, too. ipmi_sim_cmd.5 - A amn file describing the ipmi_sim command language. This is what is in ipmisim1.emu (which doesn't have that much info in it) and is how you add MCs, sensors, etc. ipmi_sim.1 - A short man page on the program itself.OpenIPMI-2.0.27/lanserv/lanserv_asf.c0000644000175000017500000001040313136646135014232 00000000000000/* * lanserv_asf.c * * MontaVista IPMI RMCP/ASF LAN interface protocol engine * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include /* Deal with multi-byte data, RMCP (big-endian) style. */ #if 0 /* These are not currently used. */ static unsigned int rmcp_get_uint16(uint8_t *data) { return (data[1] | (data[0] << 8)); } static void rmcp_set_uint16(uint8_t *data, int val) { data[1] = val & 0xff; data[0] = (val >> 8) & 0xff; } #endif static unsigned int rmcp_get_uint32(uint8_t *data) { return (data[3] | (data[2] << 8) | (data[1] << 16) | (data[0] << 24)); } static void rmcp_set_uint32(uint8_t *data, int val) { data[3] = val & 0xff; data[2] = (val >> 8) & 0xff; data[1] = (val >> 16) & 0xff; data[0] = (val >> 24) & 0xff; } #define ASF_IANA 4542 void handle_asf(lanserv_data_t *lan, uint8_t *data, int len, void *from_addr, int from_len) { uint8_t rsp[28]; struct iovec vec[1]; if (len < 12) return; if (rmcp_get_uint32(data+4) != ASF_IANA) return; /* Not ASF IANA */ if (data[8] != 0x80) return; /* Not a presence ping. */ /* Ok, it's a valid RMCP/ASF Presence Ping, start working on the response. */ rsp[0] = 6; rsp[1] = 0; rsp[2] = 0xff; /* No ack, the ack is not required, so we don't do it. */ rsp[3] = 6; /* ASF class */ rmcp_set_uint32(rsp+4, ASF_IANA); rsp[8] = 0x40; /* Presence Pong */ rsp[9] = data[9]; /* Message tag */ rsp[10] = 0; rsp[11] = 16; /* Data length */ rmcp_set_uint32(rsp+12, ASF_IANA); /* no special capabilities */ rmcp_set_uint32(rsp+16, 0); /* no special capabilities */ rsp[20] = 0x81; /* We support IPMI */ rsp[21] = 0x0; /* No supported interactions */ memset(rsp+22, 0, 6); /* Reserved. */ vec[0].iov_base = rsp; vec[0].iov_len = 28; /* Return the response. */ lan->send_out(lan, vec, 1, from_addr, from_len); } OpenIPMI-2.0.27/lanserv/config.c0000664000175000017500000004752713414034466013214 00000000000000/* * config.c * * MontaVista IPMI code for reading lanserv configuration files. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003,2004,2005,2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include #include #include #include void read_persist_users(sys_data_t *sys) { unsigned int i, j; for (i = 0; i < IPMI_MAX_MCS; i++) { lmc_data_t *mc = sys->ipmb_addrs[i]; user_t *users; persist_t *p; long iv; if (!mc) continue; p = read_persist("users.mc%2.2x", ipmi_mc_get_ipmb(mc)); if (!p) continue; users = ipmi_mc_get_users(mc); for (j = 0; j <= MAX_USERS; j++) { void *data; unsigned int len; if (!read_persist_int(p, &iv, "%d.valid", j)) users[j].valid = iv; if (!read_persist_int(p, &iv, "%d.link_auth", j)) users[j].link_auth = iv; if (!read_persist_int(p, &iv, "%d.cb_only", j)) users[j].cb_only = iv; if (!read_persist_data(p, &data, &len, "%d.username", j)) { if (len == sizeof(users[j].username)) memcpy(users[j].username, data, len); free_persist_data(data); } if (!read_persist_data(p, &data, &len, "%d.passwd", j)) { if (len == sizeof(users[j].pw)) memcpy(users[j].pw, data, len); free_persist_data(data); } if (!read_persist_int(p, &iv, "%d.privilege", j)) users[j].privilege = iv; if (!read_persist_int(p, &iv, "%d.max_sessions", j)) users[j].max_sessions = iv; } free_persist(p); } } int write_persist_users(sys_data_t *sys) { unsigned int i, j; for (i = 0; i < IPMI_MAX_MCS; i++) { lmc_data_t *mc = sys->ipmb_addrs[i]; user_t *users; persist_t *p; if (!mc || !ipmi_mc_users_changed(mc)) continue; p = alloc_persist("users.mc%2.2x", ipmi_mc_get_ipmb(mc)); if (!p) return ENOMEM; users = ipmi_mc_get_users(mc); for (j = 0; j <= MAX_USERS; j++) { add_persist_int(p, users[j].valid, "%d.valid", j); add_persist_int(p, users[j].link_auth, "%d.link_auth", j); add_persist_int(p, users[j].cb_only, "%d.cb_only", j); add_persist_data(p, users[j].username, sizeof(users[j].username), "%d.username", j); add_persist_data(p, users[j].pw, sizeof(users[j].pw), "%d.passwd", j); add_persist_int(p, users[j].privilege, "%d.privilege", j); add_persist_int(p, users[j].max_sessions, "%d.max_sessions", j); } write_persist(p); free_persist(p); } return 0; } struct variable { char *name; char *value; struct variable *next; } *vars; /* * */ int add_variable(const char *name, char *value) { struct variable *var = vars, *last = NULL; while (var) { if (strcmp(name, var->name) == 0) break; last = var; var = var->next; } if (var) { free(var->value); } else { var = malloc(sizeof(*var)); if (!var) return ENOMEM; var->name = strdup(name); if (!var->name) { free(var); return ENOMEM; } var->next = NULL; if (last) last->next = var; else vars = var; } var->value = value; if (!var->value) return ENOMEM; return 0; } const char *find_variable(const char *name) { struct variable *var = vars; while (var) { if (strcmp(name, var->name) == 0) break; var = var->next; } if (!var) return NULL; return var->value; } /* * To parse more complex expressions, we really need to know what the * save state is. So we, unfortunately, have to create our own * version of strtok so we know what it is. */ const char * mystrtok(char *str, const char *delim, char **next) { char *pos; char *curr; if (str) curr = str; else curr = *next; /* Skip initial delimiters. */ for (;;) { const char *c = delim; if (*curr == '\0') { *next = curr; return NULL; } while (*c != '\0') { if (*c == *curr) break; c++; } if (*c == '\0') break; curr++; } pos = curr; /* Now collect until there is a delimiter. */ for (;;) { const char *c = delim; if (*curr == '\0') { *next = curr; goto out; } while (*c != '\0') { if (*c == *curr) { *curr = '\0'; *next = curr + 1; goto out; } c++; } curr++; } out: if (*pos == '$') return find_variable(pos + 1); else return pos; } int isquote(char c) { return c == '\'' || c == '"'; } int get_delim_str(char **rtokptr, char **rval, const char **err) { char *tokptr = *rtokptr; char endc; char *rv = NULL; while (isspace(*tokptr)) tokptr++; if (*tokptr == '\0') { *err = "missing string value"; return -1; } for (;;) { const char *val; if (*tokptr == '$') { char oldc; tokptr++; val = tokptr; while (*tokptr && *tokptr != '$' && !isspace(*tokptr) && !isquote(*tokptr)) { tokptr++; } oldc = *tokptr; *tokptr = '\0'; val = find_variable(val); if (!val) { if (rv) free(rv); *err = "unable to find variable"; return -1; } *tokptr = oldc; } else if (isquote(*tokptr)) { endc = *tokptr; tokptr++; val = tokptr; while (*tokptr != endc) { if (*tokptr == '\0') { if (rv) free(rv); *err = "End of line in string"; return -1; } tokptr++; } *tokptr = '\0'; tokptr++; } else { if (rv) free(rv); *err = "string value must start with '\"' or '''"; return -1; } if (rv) { char *newrv = malloc(strlen(rv) + strlen(val) + 1); if (!newrv) { free(rv); *err = "Out of memory copying string"; return -1; } strcpy(newrv, rv); strcat(newrv, val); free(rv); rv = newrv; } else { rv = strdup(val); if (!rv) { *err = "Out of memory copying string"; return -1; } } if (*tokptr == '\0' || isspace(*tokptr)) break; } *rtokptr = tokptr; *rval = rv; return 0; } int get_bool(char **tokptr, unsigned int *rval, const char **err) { const char *tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *err = "No boolean value given"; return -1; } if (strcasecmp(tok, "true") == 0) *rval = 1; else if (strcasecmp(tok, "false") == 0) *rval = 0; else if (strcasecmp(tok, "on") == 0) *rval = 1; else if (strcasecmp(tok, "off") == 0) *rval = 0; else if (strcasecmp(tok, "yes") == 0) *rval = 1; else if (strcasecmp(tok, "no") == 0) *rval = 0; else if (strcasecmp(tok, "1") == 0) *rval = 1; else if (strcasecmp(tok, "0") == 0) *rval = 0; else { *err = "Invalid boolean value, must be 'true', 'on', 'false', or 'off'"; return -1; } return 0; } int get_uint(char **tokptr, unsigned int *rval, const char **err) { char *end; const char *tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *err = "No integer value given"; return -1; } *rval = strtoul(tok, &end, 0); if (*end != '\0') { *err = "Invalid integer value"; return -1; } return 0; } int get_int(char **tokptr, int *rval, const char **err) { char *end; const char *tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *err = "No integer value given"; return -1; } *rval = strtol(tok, &end, 0); if (*end != '\0') { *err = "Invalid integer value"; return -1; } return 0; } int get_uchar(char **tokptr, unsigned char *rval, const char **err) { char *end; const char *tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *err = "No integer value given"; return -1; } *rval = strtoul(tok, &end, 0); if (*end != '\0') { *err = "Invalid integer value"; return -1; } return 0; } int get_priv(char **tokptr, unsigned int *rval, const char **err) { const char *tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *err = "No privilege specified, must be 'callback', 'user'," " 'operator', or 'admin'"; return -1; } if (strcmp(tok, "callback") == 0) *rval = IPMI_PRIVILEGE_CALLBACK; else if (strcmp(tok, "user") == 0) *rval = IPMI_PRIVILEGE_USER; else if (strcmp(tok, "operator") == 0) *rval = IPMI_PRIVILEGE_OPERATOR; else if (strcmp(tok, "admin") == 0) *rval = IPMI_PRIVILEGE_ADMIN; else { *err = "Invalid privilege specified, must be 'callback', 'user'," " 'operator', or 'admin'"; return -1; } return 0; } int get_auths(char **tokptr, unsigned int *rval, const char **err) { const char *tok = mystrtok(NULL, " \t\n", tokptr); int val = 0; while (tok) { if (strcmp(tok, "none") == 0) val |= (1 << IPMI_AUTHTYPE_NONE); else if (strcmp(tok, "md2") == 0) val |= (1 << IPMI_AUTHTYPE_MD2); else if (strcmp(tok, "md5") == 0) val |= (1 << IPMI_AUTHTYPE_MD5); else if (strcmp(tok, "straight") == 0) val |= (1 << IPMI_AUTHTYPE_STRAIGHT); else { *err = "Invalid authorization type, must be 'none', 'md2'," " 'md5', or 'straight'"; return -1; } tok = mystrtok(NULL, " \t\n", tokptr); } *rval = val; return 0; } int read_bytes(char **tokptr, unsigned char *data, const char **err, unsigned int len) { const char *tok = mystrtok(NULL, " \t\n", tokptr); char *end; if (!tok) { *err = "Missing password or username"; return -1; } if (*tok == '"') { unsigned int end; /* Ascii PW */ tok++; end = strlen(tok) - 1; if (tok[end] != '"') { *err = "ASCII password or username doesn't end in '\"'"; return -1; } if (end > (len - 1)) end = len - 1; memcpy(data, tok, end); data[end] = '\0'; zero_extend_ascii(data, len); } else { unsigned int i; char c[3]; /* HEX pw */ if (strlen(tok) != 32) { *err = "HEX password or username not 32 HEX characters long"; return -1; } c[2] = '\0'; for (i=0; iai_addr, res0->ai_addrlen); *len = res0->ai_addrlen; freeaddrinfo(res0); } #else /* System does not support getaddrinfo, just for IPv4*/ { struct hostent *ent; struct sockaddr_in *paddr; char *end; ent = gethostbyname(s); if (!ent) { *err = "Invalid IP address specified"; return -1; } paddr = (struct sockaddr_in *)addr; paddr->sin_family = AF_INET; if (p) { paddr->sin_port = htons(strtoul(p, &end, 0)); if (*end != '\0') { *err = "Invalid IP port specified"; return -1; } } else { paddr->sin_port = htons(623); } *len = sizeof(struct sockaddr_in); } #endif return 0; } static int get_user(char **tokptr, sys_data_t *sys, const char **err) { unsigned int num; unsigned int val; int rv; rv = get_uint(tokptr, &num, err); if (rv) return rv; if (num > MAX_USERS) { *err = "User number larger than the allowed number of users"; return -1; } rv = get_bool(tokptr, &val, err); if (rv) return rv; sys->cusers[num].valid = val; rv = read_bytes(tokptr, sys->cusers[num].username, err, 16); if (rv) return rv; rv = read_bytes(tokptr, sys->cusers[num].pw, err, 20); if (rv) return rv; rv = get_priv(tokptr, &val, err); if (rv) return rv; sys->cusers[num].privilege = val; rv = get_uint(tokptr, &val, err); if (rv) return rv; sys->cusers[num].max_sessions = val; return 0; } struct dliblist { const char *file; const char *init; void *handle; struct dliblist *next; }; static struct dliblist *dlibs; int load_dynamic_libs(sys_data_t *sys, int print_version) { struct dliblist *dlib = dlibs; int (*func)(sys_data_t *sys, const char *initstr); void *handle; int err; while (dlib) { handle = dlopen(dlib->file, RTLD_NOW | RTLD_GLOBAL); if (!handle) { fprintf(stderr, "Unable to load dynamic library %s: %s\n", dlib->file, dlerror()); return EINVAL; } if (print_version) { func = dlsym(handle, "ipmi_sim_module_print_version"); if (func) { err = func(sys, dlib->init); if (err) { dlclose(handle); fprintf(stderr, "Error from module %s version print: %s\n", dlib->file, strerror(err)); return EINVAL; } } dlclose(handle); } else { func = dlsym(handle, "ipmi_sim_module_init"); if (func) { err = func(sys, dlib->init); if (err) { dlclose(handle); fprintf(stderr, "Error from module %s init: %s\n", dlib->file, strerror(err)); return EINVAL; } } dlib->handle = handle; } dlib = dlib->next; } return 0; } void post_init_dynamic_libs(sys_data_t *sys) { struct dliblist *dlib = dlibs; void (*func)(sys_data_t *sys); while (dlib) { func = dlsym(dlib->handle, "ipmi_sim_module_post_init"); if (func) func(sys); dlib = dlib->next; } } int read_config(sys_data_t *sys, char *config_file, int print_version) { FILE *f = fopen(config_file, "r"); int line; unsigned int val; char buf[MAX_CONFIG_LINE]; const char *tok; char *tokptr; int err = 0; const char *errstr; if (!f) { fprintf(stderr, "Unable to open configuration file '%s'\n", config_file); return -1; } line = 0; while (fgets(buf, sizeof(buf), f) != NULL) { line++; tok = mystrtok(buf, " \t\n", &tokptr); if (!tok || (tok[0] == '#')) continue; if (strcmp(tok, "define") == 0) { const char *varname; char *value; varname = mystrtok(NULL, " \t\n", &tokptr); if (!varname) { err = EINVAL; errstr = "No variable supplied for define"; goto next; } err = get_delim_str(&tokptr, &value, &errstr); if (err) goto next; err = add_variable(varname, value); if (err) { free(value); err = ENOMEM; errstr = "Out of memory"; goto next; } } else if (strcmp(tok, "loadlib") == 0) { char *library = NULL, *initstr = NULL; struct dliblist *dlib, *dlibp; err = get_delim_str(&tokptr, &library, &errstr); if (!err) err = get_delim_str(&tokptr, &initstr, &errstr); if (!err) { dlib = malloc(sizeof(*dlib)); if (!dlib) { err = ENOMEM; errstr = "Out of memory"; } else { dlib->file = library; dlib->init = initstr; dlib->next = NULL; if (!dlibs) { dlibs = dlib; } else { dlibp = dlibs; while (dlibp->next) dlibp = dlibp->next; dlibp->next = dlib; } } } if (err) { if (library) free((char *) library); if (initstr) free((char *) initstr); } goto next; } if (print_version) goto next; if (strcmp(tok, "startlan") == 0) { err = get_uint(&tokptr, &val, &errstr); if (!err && (val >= IPMI_MAX_CHANNELS)) { err = -1; errstr = "Channel number out of range"; } if (!err) { err = lanserv_read_config(sys, f, &line, val); } } else if (strcmp(tok, "user") == 0) { err = get_user(&tokptr, sys, &errstr); } else if (strcmp(tok, "serial") == 0) { err = serserv_read_config(&tokptr, sys, &errstr); } else if (strcmp(tok, "sol") == 0) { err = sol_read_config(&tokptr, sys, &errstr); } else if (strcmp(tok, "chassis_control") == 0) { char *prog; err = get_delim_str(&tokptr, &prog, &errstr); if (!err) ipmi_set_chassis_control_prog(sys->mc, prog); } else if (strcmp(tok, "name") == 0) { err = get_delim_str(&tokptr, &sys->name, &errstr); } else if (strcmp(tok, "startcmd") == 0) { if (sys->startcmd) err = get_delim_str(&tokptr, &sys->startcmd->startcmd, &errstr); } else if (strcmp(tok, "startnow") == 0) { if (sys->startcmd) err = get_bool(&tokptr, &sys->startcmd->startnow, &errstr); } else if (strcmp(tok, "poweroff_wait") == 0) { if (sys->startcmd) err = get_uint(&tokptr, &sys->startcmd->poweroff_wait_time, &errstr); } else if (strcmp(tok, "kill_wait") == 0) { if (sys->startcmd) err = get_uint(&tokptr, &sys->startcmd->kill_wait_time, &errstr); } else if (strcmp(tok, "set_working_mc") == 0) { unsigned char ipmb; err = get_uchar(&tokptr, &ipmb, &errstr); if (!err) { lmc_data_t *mc; err = ipmi_mc_alloc_unconfigured(sys, ipmb, &mc); if (err == ENOMEM) { errstr = "Out of memory"; err = -1; } else if (err) { errstr = "Invalid IPMB specified"; err = -1; } else { sys->mc = mc; sys->cusers = ipmi_mc_get_users(mc); sys->chan_set = ipmi_mc_get_channelset(mc); sys->cpef = ipmi_mc_get_pef(mc); sys->startcmd = ipmi_mc_get_startcmdinfo(mc); sys->sol = ipmi_mc_get_sol(mc); } } } else if (strcmp(tok, "console") == 0) { err = get_sock_addr(&tokptr, &sys->console_addr, &sys->console_addr_len, NULL, SOCK_STREAM, &errstr); } else { errstr = "Invalid configuration option"; err = -1; } next: if (err) { fprintf(stderr, "Error on line %d: %s\n", line, errstr); break; } } fclose(f); if (print_version) load_dynamic_libs(sys, print_version); return err; } OpenIPMI-2.0.27/lanserv/lan.conf0000664000175000017500000001365413265432613013216 00000000000000# lan.conf # A configuration file for lanserv or ipmi_sim to configure the various # communication parameters for the device. # This is a name used to identify this instance, and used to create # the default name of the emulator startup command file and eventually # the storage facility for permanent storage. name "ipmisim1" # # Work on the BMC first set_working_mc 0x20 # Define a LAN channel on channel 1 startlan 1 # Define an IP address and port to listen on. You can define more # than one address/port to listen on multiple addresses. The :: # listens on all addresses. addr localhost 9001 #addr 192.168.27.126 9000 #addr 192.168.27.200 9000 # Maximum privilege limit on the channel. priv_limit admin # Allowed IPMI 1.5 authorization types allowed_auths_callback none md2 md5 straight allowed_auths_user none md2 md5 straight allowed_auths_operator none md2 md5 straight allowed_auths_admin none md2 md5 straight # guid for IPMI 2.0 authorization You can also use a string guid a123456789abcdefa123456789abcdef #guid "I_AM_A_REAL_BMC!" # You can specify a BMC key for IPMI 2.0 authorization. See the # spec for details. #bmc_key "abcdefghijklmnopqrst" # A program to get and set the LAN configuration of the interface. #lan_config_program "/usr/local/bin/ipmi_sim_lancontrol eth0" lan_config_program "./ipmi_sim_lancontrol eth1" endlan #chassis_control "./ipmi_sim_chassiscontrol 0x20" # Define a serial VM inteface for channel 15 (the system interface) on # port 9002, just available to the local system (localhost). serial 15 localhost 9002 codec VM # startcmd is what to execute to start a VM associated with the # codec above (localhost 9002). It also starts a console serial port # on port 9003 that is also used as the monitor interface. startcmd "qemu-system-x86_64 --enable-kvm -drive file=/opt/qemu/cge-complete-image-x86-generic-64-1.ext2,format=raw -nographic -kernel /opt/qemu/bzImage-1 -append 'root=/dev/sdb console=ttyS0,115200' -net nic,model=e1000,macaddr=52:54:00:12:34:59 -net user,hostfwd=tcp::5556-10.0.2.15:22 -chardev socket,id=ipmi0,host=localhost,port=9002,reconnect=10 -device ipmi-bmc-extern,id=bmc0,chardev=ipmi0 -device isa-ipmi-bt,bmc=bmc0 -serial mon:telnet::9003,server,telnet,nowait" sol "telnet:localhost:9003" 115200 # Start startcmd at startup? Default is false. startnow false # The amount of time to wait for the startcmd to do a power off # on a powerdown request. The simulator will send a request to the # target, wait this amount of time, and then do a SIGTERM kill on the # process. If this is zero, a SIGTERM will not be done (nor will a SIGKILL). # Note that if the simulator does not have a connection to the VM, the # graceful shutdown is skipped and a SIGTERM is done immediately. # Default time is 60 seconds. #poweroff_wait 30 # The amount of time to wait for SIGTERM to kill the process. If the process # does not terminate in this period of time, send a SIGKILL kill. If this # is zero, don't send the SIGKILL. Default time is 20 seconds. #kill_wait 5 # Now add some users. User 0 is invalid, user 1 is the special "anonymous" # user and cannot take a username. Note that the users here are only # used if the persistent user config doesn't exist. # # valid name passw priv-lim max-sess allowed-auths (ignored) user 1 true "" "test" user 10 none md2 md5 straight user 2 true "ipmiusr" "test" admin 10 none md2 md5 straight # sol "/dev/ttyUSB0" 38400 history=4000 historyfru=10 # # Switch to a new MC # set_working_mc 0x30 # Add a SOL config, a device and a default baud rate. # "history" sets a history buffer size. This means that DCD and CTS will # always be enabled to the device, and we will constantly collect # history for the device. It will be available as SOL instance 2 # on the device. If the optional backupfile option is specified, # the history data is stored in the given file if the BMC shuts down # (or is killed by a catchable signal) and restored from that file if it # starts up. # If historyfru=N is specified, then FRU device N on the MC will be # able to fetch the contents of the history buffer, too, up to # 65535 bytes (the max size of FRU data). # Specifying nortscts disabled rtscts on the port. It will still change # the RTS output line, but it won't listen to CTS. # Normally the data is left in the history buffer when read. If # you want the history data to be cleared from the buffer on read # add readclear. #sol "/dev/ttyUSB0" 19200 nortscts readclear # sol "/dev/ttyUSB0" 38400 history=4000,backupfile=/var/ipmi_sim/solhist1 historyfru=10 # Define a serial VM inteface for channel 15 (the system interface) on # port 9003 for the MC at 0x30 serial 15 localhost 9012 codec VM startcmd "qemu-system-x86_64 --enable-kvm -drive file=/opt/qemu/cge-complete-image-x86-generic-64-2.ext2,format=raw -nographic -kernel /opt/qemu/bzImage-2 -append 'root=/dev/sdb console=ttyS0,115200' -net nic,model=e1000,macaddr=52:54:00:12:34:59 -net user,hostfwd=tcp::5557-10.0.2.15:22 -chardev socket,id=ipmi0,host=localhost,port=9012,reconnect=10 -device ipmi-bmc-extern,id=bmc0,chardev=ipmi0 -device isa-ipmi-kcs,bmc=bmc0,irq=5 -serial mon:tcp::9013,server,telnet,nowait" sol "telnet:localhost:9013" 115200 # Start startcmd at startup? Default is false. startnow false # Allow a console connection to perform emulation commands. #console localhost 9000 # Dynamically load a module to extend the simulator. After the module is # loaded, if the function "ipmi_sim_module_init" is defined in the module, # it will be called with the following parameters: # int ipmi_sim_module_init(sys_data_t *sys, char *initstr); # where initstr is the init string passed on the module load line. # It should return 0 on success or an errno no failure. #loadlib "/opt/lib/ipmi_sim_extend.so" "Initialization String" OpenIPMI-2.0.27/lanserv/ipmi_sim_cmd.50000644000175000017500000002575713136646176014331 00000000000000.TH ipmi_sim_cmd 5 06/26/12 OpenIPMI "IPMI LAN Simulator commands" .SH DESCRIPTION The .B ipmi_sim emulation is set up using these commands. They can be read from a command file, run from the command line, or executed inside the simulator after it is started. This may be a little confusing, but the network interfaces are configured by the ipmi_lan configuration file, and the various management controllers, sensors, etc. are specified using this file. Plus, this can be used to configure the simulator after it is up, set sensor values, inject events, and things of that nature. .SH GENERAL COMMANDS Blank lines and lines starting with `#' are ignored. Long lines may be broken up by putting a '\' at the end of the line to be continued. .TP \fBquit\fP Exit the simulator .TP \fBinclude\fP \fI"file"\fP Include the given file. .TP \fBdefine\fP \fIname\fP \fI"value"\fP Define the given name as a variable with the given value. This variable may be used later by doing \fI$name\fP. This cannot be used in quotes, but quotes may be broken up and the variable put between them. For instance, if you say: define MCNUM "40" you can use it later as in mc_add $MCNUM 1 no-device-sdrs 00 00 00 0xc9 0x009000 0x0002 or sensor_add $MCNUM 0 21 12 0x6f poll 1000 file "/sys/dev/sens1-"$MCNUM"-1" .TP \fBsleep\fP \fItime\fP Pause the command interface for the given number of seconds. This does not affect the execution of the simulator. .TP \fBdebug\fP \fIoptions\fP Set the debugging output. Valid options are: .I msg Dump messages. .I raw Dump raw I/O Entering nothing turns of debugging. .TP \fBread_cmds\fP \fIfilename\fP Execute the commands in the given file. .SH MC COMMANDS .TP \fBmc_add\fP \fIIPMBAddress\fP \fIDeviceID\fP \fIHasDeviceSDRs\fP \fIDeviceRevision\fP \fIMajorFWRev\fP \fIMinorFWRev\fP \fIDeviceSupport\fP \fIManufacturerID\fP \fIProductID\fP Add an MC to the simulator. All values are hexadecimal. These are mostly values for the ``Get Device ID'' command, see the spec for details. Note that the MC is not enabled after being added, you must add it. Note that some of these values control the capabilities of the MC. For instance, HasDeviceSDRs sets whether device SDR repository commands will work. You may use has-device-sdrs or no-device-sdrs in the HasDeviceSDRs field. .TP \fBmc_add_fru_data\fP \fImc-addr\fP \fIDeviceID\fP \fIFRUSize\fP (data [\fIbyte1\fP [\fIbyte2\fP [...]]] | \fIfile\fP \fIoffset\fP \fIfilename\f{) Set the FRU data for a given MC and device id. Data may be supplied directly here, or it may be given as a file. The offset is the start from the beginning of the file where the data is kept. .TP \fBmc_dump_fru_data\fP \fImc-addr\fP \fIDeviceID\fP Dump the FRU data for a given MC and device id. .TP \fBmc_delete\fP \fImc-addr\fP Remove the MC from the system. .TP \fBmc_disable\fP \fImc-addr\fP Disable the MC, but don't remove it. .TP \fBmc_enable\fP \fImc-addr\fP Enable the given MC. .TP \fBmc_setbmc\fP \fImc-addr\fP Set the BMC's address. .TP \fBmc_set_guid\fP \fImc-addr\fP \fIguid\fP Set the GUID value. The guid may be a string (in quotes) or a hexadecimal string. .TP \fBsel_enable\fP \fImc-addr\fP \fImax-entries\fP \fIflags\fP Enable the System Event Log on the given MC. The flags is a byte this is returned from the ``Get SEL Info'' command; it controls various aspects of the SEL. See the spec for details. .TP \fBsel_add\fP \fImc-addr\fP \fIRecordType\fP \fIbyte1\fP \fIbyte2\fP ... \fIbyte13\fP Add an entry to the MC's SEL. .TP \fBmain_sdr_add\fP \fImc-addr\fP \fIbyte1\fP [\fIbyte2\fP [...]] Add an entry to the main SDR of the MC. .TP \fBdevice_sdr_add\fP \fImc-addr\fP \fILUN\fP \fIbyte1\fP [\fIbyte2\fP [...]] Add an entry to the device SDR of the MC. .SH SENSOR COMMANDS .TP \fBsensor_add\fP \fImc-addr\fP \fILUN\fP \fIsensor-num\fP \fIsensor-type\fP \fIevent-reading-code\fP [\fIpoll\fP \fIpoll_rate\fP \fIpoll_type\fP \fIpoll_type_options\fP] [event-only] Add a sensor to the given MC and LUN. The type of sensor is set by the event reading code. If \fIpoll\fP is specified, then the sensor will be polled for data. Only the \fIfile\fP poll type is currently supported. The value is a number read from a file. It has the following options, all optional: .I div=val will divide the read value by the given number. This is done after the multiply operation. .I mult=val will multiply the read value by the given number. This is done after the subtraction. .I sub=val will subtract the value by the given number. This is done after the mask. .I mask=val will mask (bitwise and) the value by the given number. .I base=value Specify the base of the value read from the file. By default this is zero, meaning "C" conventions are used. .I initstate=value sets what the event state is initially set to. This is useful for discrete sensors with bits that should normally be set to "1", like a presence bit, to keep the program from issuing an event every time the program starts. .I raw specifies that the data from the file is a raw value. Only \fIlength\fP bytes are read from \fIoffset\fP. .I ascii specifies that the data from the file is in ASCII. This is the default. The \fIoffset\fP value is used, but no the \fIlength\fP. .I length=val specifies the length of the data to read from the file. The maximum value is 4,and this is only used for raw data. .I depends=,,, specifies a discrete sensor bit that must be set to 1 for the sensor to be active. Generally, you use the presence bit of a sensor to mark whether other sensors on the device are actually present. Each of the other sensors would have one of these pointing to the presence bit. .I event-only specifies that the sensor will not be readable, it will only generate events (specified with a type 3 SDR). .TP \fBsensor_set_bit\fP \fImc-addr\fP \fILUN\fP \fIsensor-num\fP \fIbit-to-set\fP \fIbit-value\fP \fIgenerate-event\fP Set the given bit to bit-value (0 or 1) for the sensor by bit number, either the threshold for analog or the discrete sensor bit. If generate-event is non-zero and the sensor has events enabled for that bit, then generate an event. .TP \fBsensor_set_bit_clr_rest\fP \fImc-addr\fP \fILUN\fP \fIsensor-num\fP \fIbit-to-set\fP \fIbit-value\fP \fIgenerate-event\fP Like sensor_set_bit, but automatically clears all other bits. .TP \fBsensor_set_value\fP \fImc-addr\fP \fILUN\fP \fIsensor-num\fP \fIvalue\fP \fIgenerate-event\fP Set the byte value for an analog sensor. If the sensor exceeds a threshold, the sensor has events enabled, and generate-event is non-zero, then generate an event for the condition. .TP \fBsensor_set_hysteresis\fP \fImc-addr\fP \fILUN\fP \fIsensor-num\fP \fIsupport\fP \fIpositive\fP \fInegative\fP Set the hysteresis capabilities of the sensor. It must be an analog sensor. The support value is the hysteresis capability, the same as the hysteresis support value in the sensor SDR. The positive and negative hysteresis values are also set by this command. The support value may also be none, readable, settable, or fixed instead of the numbers. .TP \fBsensor_set_threshold\fP \fImc-addr\fP \fILUN\fP \fIsensor-num\fP \fIthreshold-support\fP \fIthreshold-enabled\fP [\fIvalue5\fP [\fIvalue4\fP [... [\fIvalue0\fP]]]] Set the threshold support for a sensor. It must be an analog sensor. The threshold-support value is the same as the threshold access support value in the sensor SDR. The threshold-enabled values is a string of ``0'' and ``1'' characters that enable the 6 corresponding thresholds; the rightmost value is value 0, the leftmost is value 5. Optionally, the threshold values may be specified as their byte values. The threshold-support value may also be none, readable, settable, or fixed to make it a bit more readable. The thresholds are: .I 0 - lower non critical .I 1 - lower critical .I 2 - lower non recoverable .I 3 - upper non critical .I 4 - upper critical .I 5 - upper non recoverable .TP \fBsensor_set_event_support\fP \fImc-addr\fP \fILUN\fP \fIsensor-num\fP \fIevents-enable\fP \fIscanning\fP \fIevent-support\fP \fIassert-support\fP \fIdeassert-support\fP \fIassert-enabled\fP \fIdeassert-enabled\fP Set the event support of a sensor. The events-enable will enable global events on the sensor if non-zero, otherwise they are disabled. The scanning values set the scanning value for the sensor. The event-support value sets the event capabilities in the sensor, this is the same as the ``sensor event message control support'' value in the sensor SDR. The assert-support, deassert-support, assert-enabled, and deassert-enabled are all bitmasks (a string of ``0'' and ``1'' characters) that set their corresponding sensor bit's capability to generate events (support) and whether it will generate events now (enabled). Note that all bitmasks have the rightmost digit as the zeroth bit, and the leftmost digit as the highest order bit. Note that you must specify 15 bits here, even if you don't use all of them. Note that you may use enable or disable in the events-enable field, and you may use scanning or no-scanning in the scanning field. For event-support, you may use per-state, entire-sensor, global or none instead of a number. For a threshold sensor, the values are: .I 0 - lower non-critical going low .I 1 - lower non-critical going high .I 2 - lower critical going low .I 3 - lower critical going high .I 4 - lower non-recoverable going low .I 5 - lower non-recoverable going high .I 6 - upper non-critical going low .I 7 - upper non-critical going high .I 8 - upper critical going low .I 9 - upper critical going high .I 1 - upper non-recoverable going low .I 1 - upper non-recoverable going high Note that the "lower going high" and "upper going low" values are not supported, since they are simply stupid. .SH ATCA OEM COMMANDS These are for emulation of special ATCA capabilities. .TP \fBatca_enable\fP The system is an ATCA system, enables the other ATCA capabilities. Note that you should do this *before* creating any MCs (this should really be first) because the MCs are set up a little differently for ATCA mode. This causes the MCs to be able to handle PICMG commands properly, sets up 2 LEDs by default, and enables proper hot-swap handling, including the blue LED. By default the blue LED supports local control and the other LEDs do not and are red. In ATCA mode, to drive the hot-swap state machine, you should use sensor_set_bit_clr_rest to set the hot-swap state. .TP \fBatca_set_site\fP \fIhardware-address\fP \fIsite-type\fP \fIsite-number\fP Sets the given values for an ATCA system, the values returned by the get address commands. .TP \fBmc_set_num_leds\fP \fImc-addr\fP \fIcount\fP Set the number of ATCA LEDs the MC has. .TP \fBmc_set_power\fP \fImc-addr\fP \fIpower\fP \fIgen-event\fP Set the ATCA power setting for the MC as its numeric value. If gen-event is non-zero, generate an event for the change. .SH "FILES" /etc/ipmi/lan.conf .SH "SEE ALSO" .BR ipmi_sim (1) .SH "KNOWN PROBLEMS" IPMI is unnecessarily complicated. Hords of capabilities are not yet implemented. .SH AUTHOR .PP Corey Minyard OpenIPMI-2.0.27/lanserv/ipmilan.80000644000175000017500000000440112116456523013303 00000000000000.TH ipmilan 8 06/26/12 OpenIPMI "IPMI LAN to System Interface Converter" .SH NAME ipmilan \- IPMI LAN to System Interface Converter .SH SYNOPSIS .B ipmilan .RB [ \-c .IR configfile ] .RB [ \-i .IR ipmidevice ] .RB [ \-d ] .RB [ \-n ] .SH DESCRIPTION The .B ipmilan daemon allows an IPMI system interface using the OpenIPMI device driver to be accessed using the IPMI 1.5 or 2.0 LAN protocol. .B ipmilan supports the full authentication capabilities of the IPMI LAN protocol. .B ipmilan supports multiple IP addresses for fault-tolerance. Note that messages coming in on an address are always sent back out on the same address they came in. .SH OPTIONS .TP .BI \-c\ config-file Set the configuration file to one other than the default of .I "/etc/ipmi_lan.conf" .TP .B \-n Stops the daemon from forking and detaching from the controlling terminal. This is useful for running from init. .TP .B \-d Turns on debugging to standard output. You generally have to use .B \-n with this. .SH CONFIGURATION Configuration is accomplished through the file .IR /etc/ipmi_lan.conf . A file with another name or path may be specified using the .B \-c option. See the ipmi_lan config file man page for more details. .SH SECURITY .B ipmilan implements normal IPMI security. The default is no access for anyone, so the default is pretty safe, but be careful what you add, because this is access to control your box. \fBstraight\fP and \fBnone\fP authorizations are not recommended, you should probably stick with \fBmd2\fP or \fBmd5\fP. .SH "SIGNALS" .TP 0.5i .B SIGHUP .B ipmilan should handle SIGHUP and reread it's configuration files. However, it doesn't right now. It might in the future, for now you will have to kill it and restart it. Clients should handle reconnecting in this case. If they don't, they are broken. .SH "ERROR OUTPUT" At startup, all error output goes to stderr. After that, all error output goes to syslog. .SH "FILES" /etc/ipmi_lan.conf .SH "SEE ALSO" .BR ipmi_lan (5), ipmi_ui (1), openipmish (1) .SH "KNOWN PROBLEMS" Currently, .B ipmilan does not implement writing the config file. IPMI commands to change configuration options are accepted, but the permanent writing of the changes does not currently work. .SH AUTHOR .PP Corey Minyard OpenIPMI-2.0.27/lanserv/persist.c0000664000175000017500000002766113360135570013433 00000000000000/* * persist.c * * MontaVista IPMI LAN server persistence tool * * Author: MontaVista Software, LLC. * Corey Minyard * source@mvista.com * * Copyright 2012 MontaVista Software LLC. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include #include enum pitem_type { PITEM_DATA = 'd', PITEM_INT = 'i', PITEM_STR = 's' }; struct pitem { char *iname; enum pitem_type type; void *data; long dval; struct pitem *next; }; struct persist_s { char *name; struct pitem *items; }; int persist_enable = 1; static char *app = NULL; static const char *basedir; int persist_init(const char *papp, const char *instance, const char *ibasedir) { unsigned int len; char *dname; struct stat st; char *n; int rv = 0; if (!persist_enable) return 0; if (app) return EBUSY; basedir = ibasedir; len = strlen(papp) + strlen(instance) + 2; app = malloc(len); if (!app) return ENOMEM; strcpy(app, papp); strcat(app, "/"); strcat(app, instance); len = strlen(basedir) + strlen(app) + 3; dname = malloc(len); if (!dname) { free(app); return ENOMEM; } strcpy(dname, basedir); strcat(dname, "/"); strcat(dname, app); strcat(dname, "/"); if (dname[0] == '/') n = strchr(dname + 1, '/'); else n = strchr(dname, '/'); while (n) { *n = '\0'; if (stat(dname, &st) != 0) { if (mkdir(dname, 0755) != 0) { rv = errno; goto out; } } else if (!S_ISDIR(st.st_mode)) { rv = ENOTDIR; goto out; } *n++ = '/'; n = strchr(n, '/'); } out: free(dname); return rv; } static char * do_va_nameit(const char *name, va_list ap) { unsigned int len; va_list aq; char dummy; char *rv; va_copy(aq, ap); len = vsnprintf(&dummy, 1, name, aq); va_end(aq); rv = malloc(len + 1); if (!rv) return NULL; vsprintf(rv, name, ap); return rv; } persist_t * alloc_vpersist(const char *iname, va_list ap) { persist_t *p = malloc(sizeof(*p)); if (!p) return NULL; p->name = do_va_nameit(iname, ap); if (!p->name) { free(p); return NULL; } p->items = NULL; return p; } persist_t * alloc_persist(const char *name, ...) { persist_t *p; va_list ap; va_start(ap, name); p = alloc_vpersist(name, ap); va_end(ap); return p; } static char * get_fname(persist_t *p, char *sfx) { int len = (strlen(basedir) + strlen(app) + strlen(p->name) + strlen(sfx) + 3); char *fname = malloc(len); if (!fname) return NULL; strcpy(fname, basedir); strcat(fname, "/"); strcat(fname, app); strcat(fname, "/"); strcat(fname, p->name); strcat(fname, sfx); return fname; } static unsigned char fromhex(char c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'A' && c <= 'Z') return (c - 'A' + 10) & 0xf; return c - 'a' + 10; } static void * read_data(char *l, long *rsize, int isstr) { int size = 0; char *c; unsigned char *r, *p; for (c = l; *c && *c != '\n'; c++) { if (*c == '\\') { c++; if (!isxdigit(*c)) return NULL; c++; if (!isxdigit(*c)) return NULL; } size++; } r = malloc(size + isstr); if (!r) return NULL; *rsize = size; for (c = l, p = r; *c && *c != '\n'; c++, p++) { if (*c == '\\') { *p = (fromhex(*(c + 1)) << 4) | fromhex(*(c + 2)); c += 2; } else { *p = *c; } } if (isstr) *p = '\0'; return r; } static void write_data(void *idata, unsigned int len, FILE *f) { unsigned char *d = idata; unsigned int i; for (i = 0; i < len; i++, d++) { if (isprint(*d) && (*d != '\\')) fputc(*d, f); else fprintf(f, "\\%2.2x", *d); } } persist_t * read_persist(const char *name, ...) { char *fname; va_list ap; persist_t *p; FILE *f; char *line; char *end; size_t n; if (!persist_enable) return NULL; va_start(ap, name); p = alloc_vpersist(name, ap); if (!p) return NULL; fname = get_fname(p, ""); if (!fname) { free_persist(p); return NULL; } f = fopen(fname, "r"); free(fname); if (!f) { free_persist(p); return NULL; } for (line = NULL; getline(&line, &n, f) != -1; free(line), line = NULL) { char *name = line; char *type = strchr(name, ':'); char *val; struct pitem *pi; if (!type) continue; *type++ = '\0'; if (strlen(name) == 0 || !*type || *(type + 1) != ':') continue; *(type + 1) = '\0'; val = type + 2; pi = malloc(sizeof(*pi)); if (!pi) { free(line); free_persist(p); return NULL; } pi->iname = strdup(name); if (!pi->iname) { free(pi); free(line); free_persist(p); return NULL; } pi->type = type[0]; switch (type[0]) { case PITEM_DATA: pi->data = read_data(val, &pi->dval, 0); if (!pi->data) goto bad_data; break; case PITEM_INT: pi->data = NULL; pi->dval = strtol(val, &end, 0); if (*end != '\n' && *end != '\0') goto bad_data; break; case PITEM_STR: pi->data = read_data(val, &pi->dval, 1); if (!pi->data) goto bad_data; break; bad_data: default: free(pi->iname); free(pi); continue; } pi->next = p->items; p->items = pi; } return p; } int write_persist_file(persist_t *p, FILE *f) { struct pitem *pi; for (pi = p->items; pi; pi = pi->next) { fprintf(f, "%s:%c:", pi->iname, pi->type); switch (pi->type) { case PITEM_DATA: case PITEM_STR: write_data(pi->data, pi->dval, f); break; case PITEM_INT: fprintf(f, "%ld", pi->dval); } fputc('\n', f); } return 0; } int write_persist(persist_t *p) { char *fname, *fname2; int rv = 0; FILE *f; if (!persist_enable) return 0; fname = get_fname(p, ".tmp"); if (!fname) { return ENOMEM; } fname2 = get_fname(p, ""); if (!fname2) { free(fname); return ENOMEM; } f = fopen(fname, "w"); if (!f) { free(fname); free(fname2); return ENOMEM; } write_persist_file(p, f); fclose(f); if (rename(fname, fname2) != 0) rv = errno; free(fname); free(fname2); return rv; } int iterate_persist(persist_t *p, void *cb_data, int (*data_func)(const char *name, void *data, unsigned int len, void *cb_data), int (*int_func)(const char *name, long val, void *cb_data)) { struct pitem *pi; int rv = 0; for (pi = p->items; pi; pi = pi->next) { rv = ITER_PERSIST_CONTINUE; switch (pi->type) { case PITEM_DATA: case PITEM_STR: if (data_func) rv = data_func(pi->iname, pi->data, pi->dval, cb_data); break; case PITEM_INT: if (int_func) rv = int_func(pi->iname, pi->dval, cb_data); break; } if (rv != ITER_PERSIST_CONTINUE) return rv; } return rv; } void free_persist(persist_t *p) { struct pitem *pi; while (p->items) { pi = p->items; p->items = pi->next; if (pi->data) free(pi->data); free(pi->iname); free(pi); } free(p); } static int alloc_pi(persist_t *p, enum pitem_type type, const void *data, long len, const char *iname, va_list ap) { struct pitem *pi; pi = malloc(sizeof(*pi)); if (!pi) return ENOMEM; pi->type = type; pi->iname = do_va_nameit(iname, ap); if (!pi->iname) { free(pi); return ENOMEM; } if (data) { pi->data = malloc(len); if (!pi->data) { free(pi->iname); free(pi); return ENOMEM; } memcpy(pi->data, data, len); } else { pi->data = NULL; } pi->dval = len; pi->next = p->items; p->items = pi; return 0; } static struct pitem * find_pi(persist_t *p, const char *iname, va_list ap) { struct pitem *pi = p->items; char *name = do_va_nameit(iname, ap); if (!name) return NULL; while (pi) { if (strcmp(pi->iname, name) == 0) break; pi = pi->next; } free(name); return pi; } int add_persist_data(persist_t *p, void *data, unsigned int len, const char *name, ...) { va_list ap; int rv; va_start(ap, name); rv = alloc_pi(p, PITEM_DATA, data, len, name, ap); va_end(ap); return rv; } int read_persist_data(persist_t *p, void **data, unsigned int *len, const char *name, ...) { va_list ap; struct pitem *pi; va_start(ap, name); pi = find_pi(p, name, ap); va_end(ap); if (!pi) return ENOENT; if (pi->type != PITEM_DATA) return EINVAL; *data = malloc(pi->dval); if (!*data) return ENOMEM; memcpy(*data, pi->data, pi->dval); *len = pi->dval; return 0; } int add_persist_int(persist_t *p, long val, const char *name, ...) { va_list ap; int rv; va_start(ap, name); rv = alloc_pi(p, PITEM_INT, NULL, val, name, ap); va_end(ap); return rv; } int read_persist_int(persist_t *p, long *val, const char *name, ...) { va_list ap; struct pitem *pi; va_start(ap, name); pi = find_pi(p, name, ap); va_end(ap); if (!pi) return ENOENT; if (pi->type != PITEM_INT) return EINVAL; *val = pi->dval; return 0; } int add_persist_str(persist_t *p, const char *val, const char *name, ...) { va_list ap; int rv; va_start(ap, name); rv = alloc_pi(p, PITEM_STR, val, strlen(val), name, ap); va_end(ap); return rv; } int read_persist_str(persist_t *p, char **val, const char *name, ...) { va_list ap; struct pitem *pi; va_start(ap, name); pi = find_pi(p, name, ap); va_end(ap); if (!pi) return ENOENT; if (pi->type != PITEM_STR) return EINVAL; *val = strdup(pi->data); if (!*val) return ENOMEM; return 0; } void free_persist_data(void *data) { free(data); } void free_persist_str(char *str) { free(str); } OpenIPMI-2.0.27/lanserv/Makefile.in0000644000175000017500000011770713437611454013647 00000000000000# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = ipmi_sim$(EXEEXT) $(am__EXEEXT_1) noinst_PROGRAMS = ipmi_checksum$(EXEEXT) subdir = lanserv ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/ax_config_feature.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_python_version.m4 \ $(top_srcdir)/m4/ax_python_devel.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" \ "$(DESTDIR)$(man8dir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libIPMIlanserv_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_libIPMIlanserv_la_OBJECTS = lanserv_ipmi.lo lanserv_asf.lo \ priv_table.lo lanserv_oem_force.lo lanserv_config.lo config.lo \ serv.lo serial_ipmi.lo persist.lo extcmd.lo libIPMIlanserv_la_OBJECTS = $(am_libIPMIlanserv_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libIPMIlanserv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libIPMIlanserv_la_LDFLAGS) $(LDFLAGS) \ -o $@ @HAVE_OPENIPMI_SMI_TRUE@am__EXEEXT_1 = ipmilan$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_ipmi_checksum_OBJECTS = ipmi_checksum.$(OBJEXT) ipmi_checksum_OBJECTS = $(am_ipmi_checksum_OBJECTS) ipmi_checksum_LDADD = $(LDADD) am_ipmi_sim_OBJECTS = ipmi_sim.$(OBJEXT) bmc.$(OBJEXT) \ emu_cmd.$(OBJEXT) sol.$(OBJEXT) bmc_storage.$(OBJEXT) \ bmc_app.$(OBJEXT) bmc_chassis.$(OBJEXT) \ bmc_transport.$(OBJEXT) bmc_sensor.$(OBJEXT) \ bmc_picmg.$(OBJEXT) ipmi_sim_OBJECTS = $(am_ipmi_sim_OBJECTS) ipmi_sim_DEPENDENCIES = $(am__DEPENDENCIES_1) libIPMIlanserv.la \ $(am__DEPENDENCIES_1) ipmi_sim_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(ipmi_sim_LDFLAGS) $(LDFLAGS) -o $@ am__ipmilan_SOURCES_DIST = lanserv.c @HAVE_OPENIPMI_SMI_TRUE@am_ipmilan_OBJECTS = lanserv.$(OBJEXT) ipmilan_OBJECTS = $(am_ipmilan_OBJECTS) @HAVE_OPENIPMI_SMI_TRUE@ipmilan_DEPENDENCIES = $(am__DEPENDENCIES_1) \ @HAVE_OPENIPMI_SMI_TRUE@ libIPMIlanserv.la \ @HAVE_OPENIPMI_SMI_TRUE@ $(am__DEPENDENCIES_1) ipmilan_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(ipmilan_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libIPMIlanserv_la_SOURCES) $(ipmi_checksum_SOURCES) \ $(ipmi_sim_SOURCES) $(ipmilan_SOURCES) DIST_SOURCES = $(libIPMIlanserv_la_SOURCES) $(ipmi_checksum_SOURCES) \ $(ipmi_sim_SOURCES) $(am__ipmilan_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man1dir = $(mandir)/man1 man5dir = $(mandir)/man5 man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man_MANS) DATA = $(noinst_DATA) HEADERS = $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp TODO DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIBTEX = @BIBTEX@ BUILD_CC = @BUILD_CC@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIA = @DIA@ DIA_FILTER_NAME = @DIA_FILTER_NAME@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DVIPDF = @DVIPDF@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GDBM_LIB = @GDBM_LIB@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_DIR = @GLIB_DIR@ GLIB_LIB = @GLIB_LIB@ GLIB_LIBS = @GLIB_LIBS@ GLIB_PKGCONF = @GLIB_PKGCONF@ GLIB_SO = @GLIB_SO@ GLIB_TARGET = @GLIB_TARGET@ GLIB_VERSION = @GLIB_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MARVELL_BMC_DIR = @MARVELL_BMC_DIR@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENIPMI_SWIG_LIBS = @OPENIPMI_SWIG_LIBS@ OPENIPMI_SWIG_SO = @OPENIPMI_SWIG_SO@ OPENIPMI_VERSION_EXTRA = @OPENIPMI_VERSION_EXTRA@ OPENIPMI_VERSION_MAJOR = @OPENIPMI_VERSION_MAJOR@ OPENIPMI_VERSION_MINOR = @OPENIPMI_VERSION_MINOR@ OPENIPMI_VERSION_RELEASE = @OPENIPMI_VERSION_RELEASE@ OPENSSLINCS = @OPENSSLINCS@ OPENSSLLIBS = @OPENSSLLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_DIR = @PERL_DIR@ PERL_HAS_POSIX_THREADS = @PERL_HAS_POSIX_THREADS@ PERL_INSTALL_DIR = @PERL_INSTALL_DIR@ PERL_POSIX_LIB = @PERL_POSIX_LIB@ PERL_POSIX_SO = @PERL_POSIX_SO@ POPTLIBS = @POPTLIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_DIR = @PYTHON_DIR@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_GUI_DIR = @PYTHON_GUI_DIR@ PYTHON_HAS_POSIX_THREADS = @PYTHON_HAS_POSIX_THREADS@ PYTHON_INSTALL_DIR = @PYTHON_INSTALL_DIR@ PYTHON_INSTALL_LIB_DIR = @PYTHON_INSTALL_LIB_DIR@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_POSIX_LIB = @PYTHON_POSIX_LIB@ PYTHON_POSIX_SO = @PYTHON_POSIX_SO@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_SWIG_FLAGS = @PYTHON_SWIG_FLAGS@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RT_LIB = @RT_LIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNMPLIBS = @SNMPLIBS@ SOCKETLIB = @SOCKETLIB@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_DIR = @SWIG_DIR@ SWIG_LIB = @SWIG_LIB@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_DIR = @TCL_DIR@ TCL_LIB = @TCL_LIB@ TCL_LIBS = @TCL_LIBS@ TCL_PKGCONF = @TCL_PKGCONF@ TCL_SO = @TCL_SO@ TCL_TARGET = @TCL_TARGET@ TERM_LIBS = @TERM_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ diaprog = @diaprog@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlprog = @perlprog@ pkgprog = @pkgprog@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIB_VERSION = 0.0.1 LD_VERSION = 0:1:0 PVERSION = "1.0.13" SUBDIRS = OpenIPMI sdrcomp @MARVELL_BMC_DIR@ DIST_SUBDIRS = OpenIPMI sdrcomp marvell-bmc AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include -DIPMI_CHECK_LOCKS \ $(OPENSSLINCS) -DPVERSION="\"$(PVERSION)\"" AM_CPPFLAGS = -DSYSCONFDIR='"$(sysconfdir)"' -DSTATEDIR='"$(localstatedir)"' lib_LTLIBRARIES = libIPMIlanserv.la @HAVE_OPENIPMI_SMI_TRUE@IPMILAN_PROG = ipmilan @HAVE_OPENIPMI_SMI_FALSE@IPMILAN_MAN = @HAVE_OPENIPMI_SMI_TRUE@IPMILAN_MAN = ipmilan.8 @HAVE_OPENIPMI_SMI_FALSE@IPMILAN_NOMAN = ipmilan.8 @HAVE_OPENIPMI_SMI_TRUE@IPMILAN_NOMAN = @HAVE_OPENIPMI_SMI_FALSE@IPMILANPROG = noinst_HEADERS = emu.h bmc.h libIPMIlanserv_la_SOURCES = lanserv_ipmi.c lanserv_asf.c priv_table.c \ lanserv_oem_force.c lanserv_config.c config.c serv.c serial_ipmi.c \ persist.c extcmd.c libIPMIlanserv_la_LIBADD = $(OPENSSLLIBS) -ldl $(RT_LIB) libIPMIlanserv_la_LDFLAGS = -version-info $(LD_VERSION) \ ../utils/libOpenIPMIutils.la ipmi_checksum_SOURCES = ipmi_checksum.c @HAVE_OPENIPMI_SMI_TRUE@ipmilan_SOURCES = lanserv.c @HAVE_OPENIPMI_SMI_TRUE@ipmilan_LDADD = $(POPTLIBS) libIPMIlanserv.la -ldl $(RT_LIB) @HAVE_OPENIPMI_SMI_TRUE@ipmilan_LDFLAGS = -rdynamic ../unix/libOpenIPMIposix.la \ @HAVE_OPENIPMI_SMI_TRUE@ ../utils/libOpenIPMIutils.la ipmi_sim_SOURCES = ipmi_sim.c bmc.c emu_cmd.c sol.c \ bmc_storage.c bmc_app.c bmc_chassis.c bmc_transport.c \ bmc_sensor.c bmc_picmg.c ipmi_sim_LDADD = $(POPTLIBS) libIPMIlanserv.la -lpthread $(RT_LIB) ipmi_sim_LDFLAGS = -rdynamic ../unix/libOpenIPMIposix.la \ ../utils/libOpenIPMIutils.la $(SOCKETLIB) man_MANS = $(IPMILAN_MAN) ipmi_lan.5 ipmi_sim.1 ipmi_sim_cmd.5 READMES = README.ipmi_sim README.vm README.design README.yourownbmc EXTRA_DIST = atca.emu lan.conf ipmisim1.emu ipmisim1.sdrs \ $(man_MANS) $(IPMILAN_NOMAN) $(READMES) noinst_DATA = ipmisim1.bsdr SUFFIXES = .bsdr .sdrs CLEANFILES = ipmisim1.bsdr all: all-recursive .SUFFIXES: .SUFFIXES: .bsdr .sdrs .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lanserv/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lanserv/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libIPMIlanserv.la: $(libIPMIlanserv_la_OBJECTS) $(libIPMIlanserv_la_DEPENDENCIES) $(EXTRA_libIPMIlanserv_la_DEPENDENCIES) $(AM_V_CCLD)$(libIPMIlanserv_la_LINK) -rpath $(libdir) $(libIPMIlanserv_la_OBJECTS) $(libIPMIlanserv_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list ipmi_checksum$(EXEEXT): $(ipmi_checksum_OBJECTS) $(ipmi_checksum_DEPENDENCIES) $(EXTRA_ipmi_checksum_DEPENDENCIES) @rm -f ipmi_checksum$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ipmi_checksum_OBJECTS) $(ipmi_checksum_LDADD) $(LIBS) ipmi_sim$(EXEEXT): $(ipmi_sim_OBJECTS) $(ipmi_sim_DEPENDENCIES) $(EXTRA_ipmi_sim_DEPENDENCIES) @rm -f ipmi_sim$(EXEEXT) $(AM_V_CCLD)$(ipmi_sim_LINK) $(ipmi_sim_OBJECTS) $(ipmi_sim_LDADD) $(LIBS) ipmilan$(EXEEXT): $(ipmilan_OBJECTS) $(ipmilan_DEPENDENCIES) $(EXTRA_ipmilan_DEPENDENCIES) @rm -f ipmilan$(EXEEXT) $(AM_V_CCLD)$(ipmilan_LINK) $(ipmilan_OBJECTS) $(ipmilan_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmc_app.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmc_chassis.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmc_picmg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmc_sensor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmc_storage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmc_transport.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emu_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extcmd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipmi_checksum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipmi_sim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lanserv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lanserv_asf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lanserv_config.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lanserv_ipmi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lanserv_oem_force.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/persist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/priv_table.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serial_ipmi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sol.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man5: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man5dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.5[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) install-man8: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.8[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) install-binPROGRAMS: install-libLTLIBRARIES installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool clean-noinstPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 install-man5 install-man8 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \ uninstall-local uninstall-man uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8 .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-binPROGRAMS clean-generic \ clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am \ install-data-local install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man \ install-man1 install-man5 install-man8 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-libLTLIBRARIES uninstall-local \ uninstall-man uninstall-man1 uninstall-man5 uninstall-man8 .PRECIOUS: Makefile install-data-local: $(INSTALL) -m 755 -d "$(DESTDIR)$(sysconfdir)/ipmi/"; \ $(INSTALL) -m 644 $(srcdir)/lan.conf "$(DESTDIR)$(sysconfdir)/ipmi/"; $(INSTALL) -m 644 $(srcdir)/ipmisim1.emu "$(DESTDIR)$(sysconfdir)/ipmi/"; .sdrs.bsdr: sdrcomp/sdrcomp_build -o $@ $< ipmisim1.bsdr: $(top_srcdir)/lanserv/ipmisim1.sdrs sdrcomp/sdrcomp_build uninstall-local: -rm -f "$(DESTDIR)$(sysconfdir)/ipmi/lan.conf" -rm -f "$(DESTDIR)$(sysconfdir)/ipmi/sim.emu" -rmdir "$(DESTDIR)$(sysconfdir)/ipmi" 2>/dev/null # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: OpenIPMI-2.0.27/lanserv/bmc_picmg.c0000664000175000017500000007146713051576450013670 00000000000000/* * bmc_picmg.c * * MontaVista IPMI code for emulating a MC. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2012 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include "bmc.h" #include #include #include #include #include #include int ipmi_mc_set_power(lmc_data_t *mc, unsigned char power, int gen_event) { lmc_data_t *dest_mc; unsigned char data[13]; int rv; if (mc->power_value == power) return 0; mc->power_value = power; if ((mc->event_receiver == 0) || (!gen_event)) return 0; rv = ipmi_emu_get_mc_by_addr(mc->emu, mc->event_receiver, &dest_mc); if (rv) return 0; /* Timestamp is ignored. */ data[0] = 0; data[1] = 0; data[2] = 0; data[3] = 0; data[4] = 0x20; /* These come from 0x20. */ data[5] = 0; data[6] = 0x01; /* Version 1. */ data[7] = 0; data[8] = 0x40; /* IPMB of the device being powered. */ data[9] = 0; data[10] = power; data[11] = 0; data[12] = 0; mc_new_event(dest_mc, 0xc0, data); return 0; } static void handle_set_power(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (check_msg_length(msg, 1, rdata, rdata_len)) return; ipmi_mc_set_power(mc, msg->data[0], 1); rdata[0] = 0; *rdata_len = 1; } static void handle_get_power(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { rdata[0] = 0; rdata[1] = mc->power_value; *rdata_len = 2; } static void handle_set_hs_led(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (check_msg_length(msg, 1, rdata, rdata_len)) return; mc->leds[0].color = msg->data[0]; printf("Setting hotswap LED to %d\n", msg->data[0]); rdata[0] = 0; *rdata_len = 1; } static void handle_get_hs_led(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { rdata[0] = 0; rdata[1] = mc->leds[0].color; *rdata_len = 2; } cmd_handler_f oem0_netfn_handlers[256] = { [0x01] = handle_set_power, [0x02] = handle_get_power, [0x03] = handle_set_hs_led, [0x04] = handle_get_hs_led }; static void handle_picmg_get_properties(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; rdata[2] = 0x22; /* Version 2.2 */ rdata[3] = 0; /* Only have one FRU. */ rdata[4] = 0; /* As defined by spec. */ *rdata_len = 5; } static void handle_picmg_get_address_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { atca_site_t *sites = mc->emu->atca_sites; unsigned char hw_addr = mc->ipmb >> 1; unsigned char devid = 0; int i; if (msg->len == 3) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } if (msg->len >= 2) devid = msg->data[1]; if (msg->len >= 4) { switch (msg->data[2]) { case 0: hw_addr = msg->data[3]; break; case 1: hw_addr = msg->data[3] >> 1; break; case 3: if (msg->len < 5) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } for (i=0; i<128; i++) { if (sites[i].valid && (sites[i].site_type == msg->data[4]) && (sites[i].site_number == msg->data[3])) { break; } } if (i == 128) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } hw_addr = i; break; default: rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } } if ((hw_addr >= 128) || (!sites[hw_addr].valid) || (devid > 0)) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; rdata[2] = hw_addr; rdata[3] = hw_addr << 1; rdata[4] = 0xff; rdata[5] = devid; rdata[6] = sites[hw_addr].site_number; rdata[7] = sites[hw_addr].site_type; *rdata_len = 8; } static void handle_picmg_cmd_fru_control(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (check_msg_length(msg, 3, rdata, rdata_len)) return; if (msg->data[1] != 0) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } if (msg->data[2] >= 4) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } /* Nothing to reset. */ printf("Fru control set to %d\n", msg->data[2]); rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; *rdata_len = 2; } static void handle_picmg_cmd_get_fru_led_properties(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (check_msg_length(msg, 2, rdata, rdata_len)) return; if (msg->data[1] != 0) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; if (mc->num_leds <= 2) { mc->num_leds = 2; rdata[2] = 0x03; /* We support the first 2 LEDs. */ rdata[3] = 0x00; } else if (mc->num_leds == 3) { rdata[2] = 0x07; /* We support the first 3 LEDs. */ rdata[3] = 0x00; } else { rdata[2] = 0xf; /* We support the first 4 LEDs. */ rdata[3] = mc->num_leds = 4; /* How many more do we support? */ } *rdata_len = 4; } static void handle_picmg_cmd_get_led_color_capabilities(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned int led; if (check_msg_length(msg, 3, rdata, rdata_len)) return; if (msg->data[1] != 0) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } led = msg->data[2]; if (led >= mc->num_leds) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; rdata[2] = mc->leds[led].color_sup; rdata[3] = mc->leds[led].def_loc_cnt_color; rdata[4] = mc->leds[led].def_override_color; *rdata_len = 5; } void picmg_led_set(lmc_data_t *mc, sensor_t *sensor) { printf("ATCA hot-swap state is %d\n", sensor->value); switch (sensor->value) { case 0: case 3: case 4: /* off */ mc->leds[0].def_off_dur = 0; mc->leds[0].def_on_dur = 0; break; case 1: /* on */ mc->leds[0].def_off_dur = 0xff; mc->leds[0].def_on_dur = 0; break; case 2: /* long blink */ mc->leds[0].def_off_dur = 10; mc->leds[0].def_on_dur = 90; break; case 5: case 6: /* short blink */ mc->leds[0].def_off_dur = 90; mc->leds[0].def_on_dur = 10; break; case 7: /* Nothing to do */ break; } if (mc->leds[0].loc_cnt) { mc->leds[0].off_dur = mc->leds[0].def_off_dur; mc->leds[0].on_dur = mc->leds[0].def_on_dur; printf("Setting ATCA LED %d to %s %x %x %x\n", 0, mc->leds[0].loc_cnt ? "local_control" : "override", mc->leds[0].off_dur, mc->leds[0].on_dur, mc->leds[0].color); } } static void handle_picmg_cmd_set_fru_led_state(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned int led; if (check_msg_length(msg, 3, rdata, rdata_len)) return; if (msg->data[1] != 0) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } led = msg->data[2]; if (led >= mc->num_leds) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } switch (msg->data[3]) { case 0xfc: /* Local control */ if (!mc->leds[led].loc_cnt_sup) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } mc->leds[led].loc_cnt = 1; mc->leds[led].off_dur = mc->leds[led].def_off_dur; mc->leds[led].on_dur = mc->leds[led].def_on_dur; mc->leds[led].color = mc->leds[led].def_loc_cnt_color; break; case 0xfb: case 0xfd: case 0xfe: rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; default: /* Override mode */ mc->leds[led].loc_cnt = 0; mc->leds[led].off_dur = msg->data[3]; mc->leds[led].on_dur = msg->data[4]; if (msg->data[5] == 0xf) mc->leds[led].color = mc->leds[led].def_override_color; else if (msg->data[5] != 0xe) /* 0xe is don't change. */ mc->leds[led].color = msg->data[5]; } printf("Setting ATCA LED %d to %s %x %x %x\n", led, mc->leds[led].loc_cnt ? "local_control" : "override", mc->leds[led].off_dur, mc->leds[led].on_dur, mc->leds[led].color); rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; *rdata_len = 2; } static void handle_picmg_cmd_get_fru_led_state(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { unsigned int led; if (check_msg_length(msg, 3, rdata, rdata_len)) return; if (msg->data[1] != 0) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } led = msg->data[2]; if (led >= mc->num_leds) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; rdata[2] = 0x00; if (mc->leds[led].loc_cnt_sup) rdata[2] |= 0x01; /* Local control support */ if (mc->leds[led].loc_cnt) { rdata[3] = mc->leds[led].off_dur; rdata[4] = mc->leds[led].on_dur; rdata[5] = mc->leds[led].color; *rdata_len = 6; } else { rdata[2] |= 0x02; /* override state. */ rdata[3] = mc->leds[led].def_off_dur; rdata[4] = mc->leds[led].def_on_dur; rdata[5] = mc->leds[led].def_loc_cnt_color; rdata[6] = mc->leds[led].off_dur; rdata[7] = mc->leds[led].on_dur; rdata[8] = mc->leds[led].color; *rdata_len = 9; } } static void handle_picmg_cmd_get_shelf_address_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_set_shelf_address_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_set_ipmb_state(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_set_fru_activation_policy(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_get_fru_activation_policy(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_set_fru_activation(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { int op; sensor_t *hssens; if (check_msg_length(msg, 3, rdata, rdata_len)) return; if (msg->data[1] != 0) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } if (! mc->hs_sensor) { handle_invalid_cmd(mc, rdata, rdata_len); return; } op = msg->data[2]; if (op >= 2) { rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; return; } hssens = mc->hs_sensor; switch (op) { case 0: if (bit_set(hssens->event_status, 3) || bit_set(hssens->event_status, 4) || bit_set(hssens->event_status, 5)) { /* Transition to m6. */ ipmi_mc_sensor_set_bit_clr_rest(mc, hssens->lun, hssens->num, 6, 1); /* Transition to m1. */ ipmi_mc_sensor_set_bit_clr_rest(mc, hssens->lun, hssens->num, 1, 1); } break; case 1: if (bit_set(hssens->event_status, 2)) { /* Transition to m3. */ ipmi_mc_sensor_set_bit_clr_rest(mc, hssens->lun, hssens->num, 3, 1); /* Transition to m4. */ ipmi_mc_sensor_set_bit_clr_rest(mc, hssens->lun, hssens->num, 4, 1); } } rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; *rdata_len = 2; } static void handle_picmg_cmd_get_device_locator_record(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_set_port_state(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_get_port_state(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_compute_power_properties(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_set_power_level(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_get_power_level(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_renegotiate_power(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_get_fan_speed_properties(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_set_fan_level(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_get_fan_level(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_bused_resource(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_ipmb_link_info(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_shelf_power_allocation(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (check_msg_length(msg, 2, rdata, rdata_len)) return; if (msg->data[1] > 1) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; ipmi_set_uint16(rdata+2, 0); if (msg->data[1] == 0) { ipmi_set_uint16(rdata+4, 105); ipmi_set_uint16(rdata+6, 227); *rdata_len = 8; } else { ipmi_set_uint16(rdata+4, 227); *rdata_len = 6; } } static void handle_picmg_cmd_shelf_manager_ipmb_address(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_set_fan_policy(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_get_fan_policy(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { handle_invalid_cmd(mc, rdata, rdata_len); } static void handle_picmg_cmd_fru_control_capabilities(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { if (check_msg_length(msg, 2, rdata, rdata_len)) return; if (msg->data[1] != 0) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; rdata[2] = 0x0e; *rdata_len = 3; } static void handle_picmg_cmd_fru_inventory_device_lock_control(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { emu_data_t *emu = mc->emu; uint16_t lock_id; fru_data_t *fru; if (mc->ipmb != 0x20) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 5, rdata, rdata_len)) return; if (msg->data[1] != 254) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; switch (msg->data[2]) { case 0: rdata[2] = 0; rdata[3] = 0; ipmi_set_uint32(rdata+4, emu->atca_fru_inv_curr_timestamp); *rdata_len = 8; break; case 1: if (emu->atca_fru_inv_locked) { rdata[0] = 0x81; *rdata_len = 1; break; } fru = find_fru(mc, 254); if (!fru || fru->length == 0) { rdata[0] = IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC; *rdata_len = 1; break; } emu->temp_fru_inv_data = malloc(fru->length); if (!emu->temp_fru_inv_data) { rdata[0] = IPMI_OUT_OF_SPACE_CC; *rdata_len = 1; break; } emu->temp_fru_inv_data_len = fru->length; memcpy(emu->temp_fru_inv_data, fru->data, emu->temp_fru_inv_data_len); emu->atca_fru_inv_locked = 1; emu->atca_fru_inv_curr_lock_id++; ipmi_set_uint16(rdata+2, emu->atca_fru_inv_curr_lock_id); ipmi_set_uint32(rdata+4, emu->atca_fru_inv_curr_timestamp); *rdata_len = 8; emu->atca_fru_inv_lock_timeout = 20; break; case 2: lock_id = ipmi_get_uint16(msg->data+3); if (!emu->atca_fru_inv_locked || (lock_id != emu->atca_fru_inv_curr_lock_id)) { rdata[0] = 0x81; *rdata_len = 1; break; } emu->atca_fru_inv_locked = 0; rdata[2] = 0; rdata[3] = 0; ipmi_set_uint32(rdata+4, emu->atca_fru_inv_curr_timestamp); *rdata_len = 8; free(emu->temp_fru_inv_data); emu->temp_fru_inv_data = NULL; break; case 3: lock_id = ipmi_get_uint16(msg->data+3); if (!emu->atca_fru_inv_locked || (lock_id != emu->atca_fru_inv_curr_lock_id)) { rdata[0] = 0x81; *rdata_len = 1; break; } emu->atca_fru_inv_locked = 0; rdata[2] = 0; rdata[3] = 0; ipmi_set_uint32(rdata+4, emu->atca_fru_inv_curr_timestamp); *rdata_len = 8; emu->atca_fru_inv_curr_timestamp++; /* FIXME - validate data. */ fru = find_fru(mc, 254); if (!fru || fru->length == 0) { rdata[0] = IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC; *rdata_len = 1; break; } memcpy(fru->data, emu->temp_fru_inv_data, emu->temp_fru_inv_data_len); free(emu->temp_fru_inv_data); emu->temp_fru_inv_data = NULL; break; default: rdata[0] = IPMI_INVALID_DATA_FIELD_CC; *rdata_len = 1; break; } } static void handle_picmg_cmd_fru_inventory_device_write(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { emu_data_t *emu = mc->emu; uint16_t lock_id; unsigned int offset; unsigned int count; if (mc->ipmb != 0x20) { handle_invalid_cmd(mc, rdata, rdata_len); return; } if (check_msg_length(msg, 6, rdata, rdata_len)) return; if (msg->data[1] != 254) { rdata[0] = IPMI_DESTINATION_UNAVAILABLE_CC; *rdata_len = 1; return; } lock_id = ipmi_get_uint16(msg->data+2); if (!emu->atca_fru_inv_locked || (lock_id != emu->atca_fru_inv_curr_lock_id)) { rdata[0] = 0x80; *rdata_len = 1; return; } /* Reset the timer. */ emu->atca_fru_inv_lock_timeout = 20; offset = ipmi_get_uint16(msg->data+4); count = msg->len - 6; if (offset >= emu->temp_fru_inv_data_len) { rdata[0] = IPMI_PARAMETER_OUT_OF_RANGE_CC; *rdata_len = 1; return; } if ((offset+count) > emu->temp_fru_inv_data_len) { /* Too much data to put into FRU. */ rdata[0] = IPMI_REQUESTED_DATA_LENGTH_EXCEEDED_CC; *rdata_len = 1; return; } memcpy(emu->temp_fru_inv_data+offset, msg->data+6, count); rdata[0] = 0; rdata[1] = IPMI_PICMG_GRP_EXT; rdata[2] = count; *rdata_len = 3; } static void handle_picmg_cmd_get_shelf_manager_ip_addresses(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len, void *cb_data) { emu_data_t *emu = mc->emu; unsigned int addr; unsigned int count; emu_addr_t *ap = NULL; int i; if (check_msg_length(msg, 2, rdata, rdata_len)) return; addr = msg->data[1]; for (count=0, i=0; iaddr[i].valid) { if (count == addr) ap = &(emu->addr[i]); count++; } } if (addr >= count) { rdata[0] = IPMI_PARAMETER_OUT_OF_RANGE_CC; *rdata_len = 1; return; } rdata[0] = 0; ipmi_set_uint32(rdata+1, emu->last_addr_change_time.tv_sec); rdata[5] = count; rdata[6] = 0x03; rdata[7] = addr - 1; rdata[8] = 20; rdata[9] = ap->addr_type; if (addr == 0) rdata[9] |= 0x80; memcpy(rdata+10, ap->addr_data, ap->addr_len); *rdata_len = 10 + ap->addr_len; } int ipmi_emu_atca_enable(emu_data_t *emu) { emu->atca_mode = 1; return 0; } int ipmi_emu_atca_set_site(emu_data_t *emu, unsigned char hw_address, unsigned char site_type, unsigned char site_number) { if (hw_address >= 128) return EINVAL; emu->atca_sites[hw_address].valid = 1; emu->atca_sites[hw_address].hw_address = hw_address; emu->atca_sites[hw_address].site_type = site_type; emu->atca_sites[hw_address].site_number = site_number; return 0; } void handle_picmg_msg(lmc_data_t *mc, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len) { switch(msg->cmd) { case IPMI_PICMG_CMD_GET_PROPERTIES: handle_picmg_get_properties(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_ADDRESS_INFO: handle_picmg_get_address_info(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_FRU_CONTROL: handle_picmg_cmd_fru_control(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_FRU_LED_PROPERTIES: handle_picmg_cmd_get_fru_led_properties(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_LED_COLOR_CAPABILITIES: handle_picmg_cmd_get_led_color_capabilities(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SET_FRU_LED_STATE: handle_picmg_cmd_set_fru_led_state(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_FRU_LED_STATE: handle_picmg_cmd_get_fru_led_state(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_SHELF_ADDRESS_INFO: handle_picmg_cmd_get_shelf_address_info(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SET_SHELF_ADDRESS_INFO: handle_picmg_cmd_set_shelf_address_info(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SET_IPMB_STATE: handle_picmg_cmd_set_ipmb_state(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SET_FRU_ACTIVATION_POLICY: handle_picmg_cmd_set_fru_activation_policy(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_FRU_ACTIVATION_POLICY: handle_picmg_cmd_get_fru_activation_policy(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SET_FRU_ACTIVATION: handle_picmg_cmd_set_fru_activation(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_DEVICE_LOCATOR_RECORD: handle_picmg_cmd_get_device_locator_record(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SET_PORT_STATE: handle_picmg_cmd_set_port_state(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_PORT_STATE: handle_picmg_cmd_get_port_state(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_COMPUTE_POWER_PROPERTIES: handle_picmg_cmd_compute_power_properties(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SET_POWER_LEVEL: handle_picmg_cmd_set_power_level(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_POWER_LEVEL: handle_picmg_cmd_get_power_level(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_RENEGOTIATE_POWER: handle_picmg_cmd_renegotiate_power(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_FAN_SPEED_PROPERTIES: handle_picmg_cmd_get_fan_speed_properties(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SET_FAN_LEVEL: handle_picmg_cmd_set_fan_level(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_FAN_LEVEL: handle_picmg_cmd_get_fan_level(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_BUSED_RESOURCE: handle_picmg_cmd_bused_resource(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_IPMB_LINK_INFO: handle_picmg_cmd_ipmb_link_info(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SHELF_POWER_ALLOCATION: handle_picmg_cmd_shelf_power_allocation(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SHELF_MANAGER_IPMB_ADDRESS: handle_picmg_cmd_shelf_manager_ipmb_address(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_SET_FAN_POLICY: handle_picmg_cmd_set_fan_policy(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_FAN_POLICY: handle_picmg_cmd_get_fan_policy(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_FRU_CONTROL_CAPABILITIES: handle_picmg_cmd_fru_control_capabilities(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_FRU_INVENTORY_DEVICE_LOCK_CONTROL: handle_picmg_cmd_fru_inventory_device_lock_control(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_FRU_INVENTORY_DEVICE_WRITE: handle_picmg_cmd_fru_inventory_device_write(mc, msg, rdata, rdata_len, NULL); break; case IPMI_PICMG_CMD_GET_SHELF_MANAGER_IP_ADDRESSES: handle_picmg_cmd_get_shelf_manager_ip_addresses(mc, msg, rdata, rdata_len, NULL); break; default: handle_invalid_cmd(mc, rdata, rdata_len); break; } } OpenIPMI-2.0.27/lanserv/TODO0000644000175000017500000000022012116456523012244 00000000000000 * The depends= that is part of the polled file sensor really needs to be part of the main sensor structure, or at least the polled structure.OpenIPMI-2.0.27/lanserv/ipmisim1.emu0000664000175000017500000000365713107042442014027 00000000000000# This is an example simulation setup for ipmi_sim. It creates a single # management controller as a BMC. That will have the standard watchdog # sensor and we add a temperature sensor. # The BMC is the MC at address 20 mc_setbmc 0x20 # Now add the BMC mc_add 0x20 0 no-device-sdrs 0x23 9 8 0x9f 0x1291 0xf02 persist_sdr sel_enable 0x20 1000 0x0a # Watchdog sensor. This must be sensor zero. sensor_add 0x20 0 0 35 0x6f event-only sensor_set_event_support 0x20 0 0 enable scanning per-state \ 000000000001111 000000000000000 \ 000000000001111 000000000000000 # Add a temperature sensor and its SDR. Note that sensor 0 is already # taken as the watchdog sensor. sensor_add 0x20 0 1 0x01 0x01 # Start with the value set to 0x60 sensor_set_value 0x20 0 1 0x60 0 # Set just the upper thresholds with the values 0x70, 0x90, and 0xa0 sensor_set_threshold 0x20 0 1 settable 111000 0xa0 0x90 0x70 00 00 00 # Enable all upper threshold events events sensor_set_event_support 0x20 0 1 enable scanning per-state \ 000111111000000 000111111000000 \ 000111111000000 000111111000000 # Add a memory module presence sensor. sensor_add 0x20 0 2 37 0x6f sensor_set_bit_clr_rest 0x20 0 2 1 1 #sensor_set_bit_clr_rest 0x20 0 2 0 1 sensor_set_event_support 0x20 0 2 enable scanning per-state \ 000000000000011 000000000000011 \ 000000000000011 000000000000011 # FRU data for entity 8.2 mc_add_fru_data 0x30 3 128 data 0 # Add a satellite MC mc_add 0x30 2 no-device-sdrs 0x98 0x10 1 0xa0 0x1291 0xf03 sensor_add 0x30 0 1 0x01 0x01 # Uncomment the following and comment the proceding to read the value # from the given file. You can modify the file contents. #sensor_add 0x30 0 1 0x01 0x01 poll 1000 file "/tmp/file1.ipm" sensor_set_threshold 0x30 0 1 settable 111000 0xa0 0x90 0x70 00 00 00 sensor_set_event_support 0x30 0 1 enable scanning per-state \ 000111111000000 000111111000000 \ 000111111000000 000111111000000 mc_enable 0x30 # Turn on the BMC mc_enable 0x20 OpenIPMI-2.0.27/lanserv/sdrcomp/0000755000175000017500000000000013437611466013317 500000000000000OpenIPMI-2.0.27/lanserv/sdrcomp/sdrcomp.c0000664000175000017500000015427613136646123015065 00000000000000/* * sdrcomp.c * * MontaVista IPMI SDR compiler * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2012 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include /* Primarily to get string handling routines */ #include #include "persist.c" #include "string.c" #define MAX_SDR_LINE 256 static FILE *outfile; static char *outfname = NULL; static void out_err(int err) { if (outfname) { unlink(outfname); } exit(err); } struct sdr_field_name { char *name; int val; }; struct sdr_field { char *name; /* SBITS means signed bits, the highest bit is a sign bit, 2s complement */ enum { SDR_BITS, SDR_SBITS, SDR_MULTIBITS, SDR_MULTISBITS, SDR_MULTIBITS2, SDR_STRING, SDR_BOOLBIT, SDR_THRESH, SDR_THRESHREL } type; /* * IMPORTANT: pos is offset + 1, the values given in the IPMI spec. * It is not zero-based. */ uint16_t pos; uint8_t bitoff; uint8_t bitsize; uint8_t required; uint16_t default_val; struct sdr_field_name *strvals; }; static struct sdr_field_name entity_id_fields[] = { { "unspecified", 0 }, { "other", 1 }, { "unknown", 2 }, { "processor", 3 }, { "disk_or_disk_bay", 4 }, { "peripheral_bay", 5 }, { "system_management_module", 6 }, { "system_board", 7 }, { "memory_module", 8 }, { "processor_module", 9 }, { "power_supply", 10 }, { "add-in_card", 11 }, { "front_panel_board", 12 }, { "back_panel_board", 13 }, { "power_system_board", 14 }, { "drive_backplane", 15 }, { "system_internal_expansion_board", 16 }, { "other_system_board", 17 }, { "processor_board", 18 }, { "power_unit", 19 }, { "power_module", 20 }, { "power_management", 21 }, { "chassis_back_panel_board", 22 }, { "system_chassis", 23 }, { "sub-chassis", 24 }, { "Other_chassis_board", 25 }, { "Disk_Drive_Bay", 26 }, { "Peripheral_Bay", 27 }, { "Device_Bay", 28 }, { "fan_cooling_device", 29 }, { "cooling_unit", 30 }, { "cable_interconnect", 31 }, { "memory_device", 32 }, { "system_management_software", 33 }, { "bios", 34 }, { "operating_system", 35 }, { "system_bus", 36 }, { "group", 37 }, { "remote_management_communication_device", 38 }, { "external_environment", 39 }, { "battery", 40 }, { "processing_blade", 41 }, { "connectivity_switch", 42 }, { "processor/memory_module", 43 }, { "i/o_module", 44 }, { "processor/_io_module", 45 }, { "management_controller_firmware", 46 }, { "ipmi_channel", 47 }, { "pci_bus", 48 }, { "pci_express_bus", 49 }, { "scsi_bus", 50 }, { "sata_/_sas_bus", 51 }, { "processor_/_front-side_bus", 52 }, { "picmg_front", 0xa0 }, { "picmg_rtm", 0xc0 }, { "picmg_amc", 0xc1 }, { NULL } }; static struct sdr_field_name sensor_type_fields[] = { { "Temperature", 1 }, { "Voltage", 2 }, { "Current", 3 }, { "Fan", 4 }, { "Physical_Security", 5 }, { "Platform_Security_Violation_Attempt", 6 }, { "Processor", 7 }, { "Power_Supply", 8 }, { "Power_Unit", 9 }, { "Cooling_Device", 10 }, { "Other_Units_Based_Sensor", 11 }, { "Memory", 12 }, { "Drive_Slot", 13 }, { "POST_Memory_Resize", 14 }, { "System_Firmware_Progress", 15 }, { "Event_Logging_Disabled", 16 }, { "Watchdog_1", 17 }, { "System_Event", 18 }, { "Critical_Interrupt", 19 }, { "Button_Switch", 20 }, { "Module_Board", 21 }, { "Microcontroller_Coprocessor", 22 }, { "Add_In_Card", 23 }, { "Chassis", 24 }, { "Chip_Set", 25 }, { "Other_Fru", 26 }, { "Cable_Interconnect", 27 }, { "Terminator", 28 }, { "System_Boot_Initiated", 29 }, { "Boot_Error", 30 }, { "OS_Boot", 31 }, { "OS_Critical_Stop", 32 }, { "Slot_Connector", 33 }, { "System_ACPI_Power_State", 34 }, { "Watchdog_2", 35 }, { "Platform_Alert", 36 }, { "Entity_Presence", 37 }, { "Monitor_ASIC_IC", 38 }, { "LAN", 39 }, { "Management_Subsystem_Health", 40 }, { "Battery", 41 }, { "Session_Audit", 42 }, { "Version_Change", 43 }, { "FRU_State", 44 }, { "picmg_FruHotSwap", 0xF0 }, { "picmg_IPMB0", 0xF1 }, { "picmg_ModuleHotSwap", 0xF2 }, { NULL } }; static struct sdr_field_name sensor_access_fields[] = { { "no", 0 }, { "readable", 1 }, { "settable", 2 }, { "fixed", 3 }, { NULL } }; static struct sdr_field_name sensor_event_msg_ctrl_fields[] = { { "per_state", 0 }, { "entire_sensor", 1 }, { "global", 2 }, { "no", 3 }, { NULL } }; static struct sdr_field_name analog_data_format_fields[] = { { "unsigned", 0 }, { "1s_complement", 1 }, { "2s_complement", 2 }, { "no", 3 }, { NULL } }; static struct sdr_field_name rate_unit_fields[] = { { "none", 0 }, { "per_us", 1 }, { "per_ms", 2 }, { "per_s", 3 }, { "per_min", 4 }, { "per_hour", 5 }, { "per_day", 6 }, { NULL } }; static struct sdr_field_name modifier_unit_fields[] = { { "none", 0 }, { "multiply", 1 }, { "divide", 2 }, { NULL } }; static struct sdr_field_name base_unit_fields[] = { { "unspecified", 0 }, { "degrees_C", 1 }, { "degrees_F", 2 }, { "degrees_K", 3 }, { "Volts", 4 }, { "Amps", 5 }, { "Watts", 6 }, { "Joules", 7 }, { "Coulombs", 8 }, { "VA", 9 }, { "Nits", 10 }, { "lumen", 11 }, { "lux", 12 }, { "Candela", 13 }, { "kPa", 14 }, { "PSI", 15 }, { "Newton", 16 }, { "CFM", 17 }, { "RPM", 18 }, { "Hz", 19 }, { "microsecond", 20 }, { "millisecond", 21 }, { "second", 22 }, { "minute", 23 }, { "hour", 24 }, { "day", 25 }, { "week", 26 }, { "mil", 27 }, { "inches", 28 }, { "feet", 29 }, { "cu_in", 30 }, { "cu_feet", 31 }, { "mm", 32 }, { "cm", 33 }, { "m", 34 }, { "cu_cm", 35 }, { "cu_m", 36 }, { "liters", 37 }, { "fluid_ounce", 38 }, { "radians", 39 }, { "steradians", 40 }, { "revolutions", 41 }, { "cycles", 42 }, { "gravities", 43 }, { "ounce", 44 }, { "pound", 45 }, { "ft-lb", 46 }, { "oz-in", 47 }, { "gauss", 48 }, { "gilberts", 49 }, { "henry", 50 }, { "millihenry", 51 }, { "farad", 52 }, { "microfarad", 53 }, { "ohms", 54 }, { "siemens", 55 }, { "mole", 56 }, { "becquerel", 57 }, { "PPM", 58 }, { "reserved", 59 }, { "Decibels", 60 }, { "DbA", 61 }, { "DbC", 62 }, { "gray", 63 }, { "sievert", 64 }, { "color_temp_deg_K", 65 }, { "bit", 66 }, { "kilobit", 67 }, { "megabit", 68 }, { "gigabit", 69 }, { "byte", 70 }, { "kilobyte", 71 }, { "megabyte", 72 }, { "gigabyte", 73 }, { "word", 74 }, { "dword", 75 }, { "qword", 76 }, { "line", 77 }, { "hit", 78 }, { "miss", 79 }, { "retry", 80 }, { "reset", 81 }, { "overrun_overflow", 82 }, { "underrun", 83 }, { "collision", 84 }, { "packets", 85 }, { "messages", 86 }, { "characters", 87 }, { "error", 88 }, { "correctable_error", 89 }, { "uncorrectable_error", 90 }, { NULL } }; static struct sdr_field_name linearization_fields[] = { { "linear", 0 }, { "ln", 1 }, { "log10", 2 }, { "log2", 3 }, { "e", 4 }, { "exp10", 5 }, { "exp2", 6 }, { "1/x", 7 }, { "sqr(x)", 9 }, { "cube(x)", 10 }, { "sqrt(x)", 11 }, { "cube-1(x)", 12 }, { "non-linear", 0x70 }, { NULL } }; static struct sdr_field_name sensor_direction_fields[] = { { "n/a", 0 }, { "input", 1 }, { "output", 2 }, { NULL } }; static struct sdr_field type1[] = { { "sensor_owner_id", SDR_BITS, 6, 0, 8, .required = 1 }, { "channel_number", SDR_BITS, 7, 4, 4, .required = 1 }, { "sensor_owner_lun", SDR_BITS, 7, 0, 2, .required = 1 }, { "sensor_number", SDR_BITS, 8, 0, 8, .required = 1 }, { "entity_id", SDR_BITS, 9, 0, 8, .required = 1, .strvals = entity_id_fields }, { "logical_entity", SDR_BOOLBIT, 10, 7, 1 }, { "entity_instance", SDR_BITS, 10, 0, 8, .required = 1 }, { "init_scanning", SDR_BOOLBIT, 11, 6, 1 }, { "init_events", SDR_BOOLBIT, 11, 5, 1 }, { "init_thresholds", SDR_BOOLBIT, 11, 4, 1 }, { "init_hysteresis", SDR_BOOLBIT, 11, 3, 1 }, { "init_sensor_type", SDR_BOOLBIT, 11, 2, 1 }, { "default_event_gen_on", SDR_BOOLBIT, 11, 1, 1 }, { "default_sensor_scan_on", SDR_BOOLBIT, 11, 0, 1 }, { "ignore_if_no_entity", SDR_BOOLBIT, 12, 7, 1 }, { "sensor_auto_rearm", SDR_BOOLBIT, 12, 6, 1 }, { "sensor_hysteresis", SDR_BITS, 12, 4, 2, .strvals = sensor_access_fields }, { "sensor_threshold_access",SDR_BITS, 12, 2, 2, .strvals = sensor_access_fields }, { "sensor_event_msg_ctrl", SDR_BITS, 12, 0, 2, .strvals = sensor_event_msg_ctrl_fields }, { "sensor_type", SDR_BITS, 13, 0, 8, .required = 1, .strvals = sensor_type_fields }, { "event_reading_type_code",SDR_BITS, 14, 0, 8, .required = 1 }, { "assert_event14", SDR_BOOLBIT, 16, 6, 1 }, { "assert_event13", SDR_BOOLBIT, 16, 5, 1 }, { "assert_event12", SDR_BOOLBIT, 16, 4, 1 }, { "assert_event11", SDR_BOOLBIT, 16, 3, 1 }, { "assert_event10", SDR_BOOLBIT, 16, 2, 1 }, { "assert_event9", SDR_BOOLBIT, 16, 1, 1 }, { "assert_event8", SDR_BOOLBIT, 16, 0, 1 }, { "assert_event7", SDR_BOOLBIT, 15, 7, 1 }, { "assert_event6", SDR_BOOLBIT, 15, 6, 1 }, { "assert_event5", SDR_BOOLBIT, 15, 5, 1 }, { "assert_event4", SDR_BOOLBIT, 15, 4, 1 }, { "assert_event3", SDR_BOOLBIT, 15, 3, 1 }, { "assert_event2", SDR_BOOLBIT, 15, 2, 1 }, { "assert_event1", SDR_BOOLBIT, 15, 1, 1 }, { "assert_event0", SDR_BOOLBIT, 15, 0, 1 }, { "return_lnr", SDR_BOOLBIT, 16, 6, 1 }, { "return_lc", SDR_BOOLBIT, 16, 5, 1 }, { "return_lnc", SDR_BOOLBIT, 16, 4, 1 }, { "assert_unrgh", SDR_BOOLBIT, 16, 3, 1 }, { "assert_unrgl", SDR_BOOLBIT, 16, 2, 1 }, { "assert_ucgh", SDR_BOOLBIT, 16, 1, 1 }, { "assert_ucgl", SDR_BOOLBIT, 16, 0, 1 }, { "assert_uncgh", SDR_BOOLBIT, 15, 7, 1 }, { "assert_uncgl", SDR_BOOLBIT, 15, 6, 1 }, { "assert_lnrgh", SDR_BOOLBIT, 15, 5, 1 }, { "assert_lnrgl", SDR_BOOLBIT, 15, 4, 1 }, { "assert_lcgh", SDR_BOOLBIT, 15, 3, 1 }, { "assert_lcgl", SDR_BOOLBIT, 15, 2, 1 }, { "assert_lncgh", SDR_BOOLBIT, 15, 1, 1 }, { "assert_lncgl", SDR_BOOLBIT, 15, 0, 1 }, { "deassert_event14", SDR_BOOLBIT, 18, 6, 1 }, { "deassert_event13", SDR_BOOLBIT, 18, 5, 1 }, { "deassert_event12", SDR_BOOLBIT, 18, 4, 1 }, { "deassert_event11", SDR_BOOLBIT, 18, 3, 1 }, { "deassert_event10", SDR_BOOLBIT, 18, 2, 1 }, { "deassert_event9", SDR_BOOLBIT, 18, 1, 1 }, { "deassert_event8", SDR_BOOLBIT, 18, 0, 1 }, { "deassert_event7", SDR_BOOLBIT, 17, 7, 1 }, { "deassert_event6", SDR_BOOLBIT, 17, 6, 1 }, { "deassert_event5", SDR_BOOLBIT, 17, 5, 1 }, { "deassert_event4", SDR_BOOLBIT, 17, 4, 1 }, { "deassert_event3", SDR_BOOLBIT, 17, 3, 1 }, { "deassert_event2", SDR_BOOLBIT, 17, 2, 1 }, { "deassert_event1", SDR_BOOLBIT, 17, 1, 1 }, { "deassert_event0", SDR_BOOLBIT, 17, 0, 1 }, { "return_unr", SDR_BOOLBIT, 18, 6, 1 }, { "return_uc", SDR_BOOLBIT, 18, 5, 1 }, { "return_unc", SDR_BOOLBIT, 18, 4, 1 }, { "deassert_unrgh", SDR_BOOLBIT, 18, 3, 1 }, { "deassert_unrgl", SDR_BOOLBIT, 18, 2, 1 }, { "deassert_ucgh", SDR_BOOLBIT, 18, 1, 1 }, { "deassert_ucgl", SDR_BOOLBIT, 18, 0, 1 }, { "deassert_uncgh", SDR_BOOLBIT, 17, 7, 1 }, { "deassert_uncgl", SDR_BOOLBIT, 17, 6, 1 }, { "deassert_lnrgh", SDR_BOOLBIT, 17, 5, 1 }, { "deassert_lnrgl", SDR_BOOLBIT, 17, 4, 1 }, { "deassert_lcgh", SDR_BOOLBIT, 17, 3, 1 }, { "deassert_lcgl", SDR_BOOLBIT, 17, 2, 1 }, { "deassert_lncgh", SDR_BOOLBIT, 17, 1, 1 }, { "deassert_lncgl", SDR_BOOLBIT, 17, 0, 1 }, { "event14_state_ret", SDR_BOOLBIT, 20, 6, 1 }, { "event13_state_ret", SDR_BOOLBIT, 20, 5, 1 }, { "event12_state_ret", SDR_BOOLBIT, 20, 4, 1 }, { "event11_state_ret", SDR_BOOLBIT, 20, 3, 1 }, { "event10_state_ret", SDR_BOOLBIT, 20, 2, 1 }, { "event9_state_ret", SDR_BOOLBIT, 20, 1, 1 }, { "event8_state_ret", SDR_BOOLBIT, 20, 0, 1 }, { "event7_state_ret", SDR_BOOLBIT, 19, 7, 1 }, { "event6_state_ret", SDR_BOOLBIT, 19, 6, 1 }, { "event5_state_ret", SDR_BOOLBIT, 19, 5, 1 }, { "event4_state_ret", SDR_BOOLBIT, 19, 4, 1 }, { "event3_state_ret", SDR_BOOLBIT, 19, 3, 1 }, { "event2_state_ret", SDR_BOOLBIT, 19, 2, 1 }, { "event1_state_ret", SDR_BOOLBIT, 19, 1, 1 }, { "event0_state_ret", SDR_BOOLBIT, 19, 0, 1 }, { "unr_thrsh_settable", SDR_BOOLBIT, 20, 5, 1 }, { "uc_thrsh_settable", SDR_BOOLBIT, 20, 4, 1 }, { "unc_thrsh_settable", SDR_BOOLBIT, 20, 3, 1 }, { "lnr_thrsh_settable", SDR_BOOLBIT, 20, 2, 1 }, { "lc_thrsh_settable", SDR_BOOLBIT, 20, 1, 1 }, { "lnc_thrsh_settable", SDR_BOOLBIT, 20, 0, 1 }, { "unr_thrsh_readable", SDR_BOOLBIT, 19, 5, 1 }, { "uc_thrsh_readable", SDR_BOOLBIT, 19, 4, 1 }, { "unc_thrsh_readable", SDR_BOOLBIT, 19, 3, 1 }, { "lnr_thrsh_readable", SDR_BOOLBIT, 19, 2, 1 }, { "lc_thrsh_readable", SDR_BOOLBIT, 19, 1, 1 }, { "lnc_thrsh_readable", SDR_BOOLBIT, 19, 0, 1 }, { "analog_data_format", SDR_BITS, 21, 6, 2, .strvals = analog_data_format_fields }, { "rate_unit", SDR_BITS, 21, 3, 3, .strvals = rate_unit_fields }, { "modifier_unit", SDR_BITS, 21, 1, 2, .strvals = modifier_unit_fields }, { "percentage", SDR_BOOLBIT, 21, 0, 1 }, { "base_unit", SDR_BITS, 22, 0, 8, .strvals = base_unit_fields }, { "modifier_unit_code", SDR_BITS, 23, 0, 8, .strvals = base_unit_fields }, { "linearization", SDR_BITS, 24, 0, 7, .strvals = linearization_fields }, { "m", SDR_MULTISBITS, 25, 0, 8 }, { "m", SDR_MULTIBITS2, 26, 6, 2 }, { "tolerance", SDR_BITS, 26, 0, 6 }, { "b", SDR_MULTISBITS, 27, 0, 8 }, { "b", SDR_MULTIBITS2, 28, 6, 2 }, { "accuracy", SDR_MULTISBITS, 28, 0, 6 }, { "accuracy", SDR_MULTIBITS2, 29, 4, 4 }, { "accuracy_exp", SDR_BITS, 29, 2, 2 }, { "sensor_direction", SDR_BITS, 29, 0, 2, .strvals = sensor_direction_fields }, { "r_exp", SDR_SBITS, 30, 4, 4 }, { "b_exp", SDR_SBITS, 30, 0, 4 }, { "normal_min_specified", SDR_BOOLBIT, 31, 2, 1 }, { "normal_max_specified", SDR_BOOLBIT, 31, 1, 1 }, { "nominal_specified", SDR_BOOLBIT, 31, 0, 1 }, { "nominal_reading", SDR_BITS, 32, 0, 8 }, { "nominal_freading", SDR_THRESH, 32, 0, 8 }, { "normal_maximum", SDR_BITS, 33, 0, 8 }, { "normal_fmaximum", SDR_THRESH, 33, 0, 8 }, { "normal_minimum", SDR_BITS, 34, 0, 8 }, { "normal_fminimum", SDR_THRESH, 34, 0, 8 }, { "sensor_maximum", SDR_BITS, 35, 0, 8 }, { "sensor_minimum", SDR_BITS, 36, 0, 8 }, { "unr_thresh", SDR_BITS, 37, 0, 8 }, { "uc_thresh", SDR_BITS, 38, 0, 8 }, { "unc_thresh", SDR_BITS, 39, 0, 8 }, { "lnr_thresh", SDR_BITS, 40, 0, 8 }, { "lc_thresh", SDR_BITS, 41, 0, 8 }, { "lnc_thresh", SDR_BITS, 42, 0, 8 }, { "unr_fthresh", SDR_THRESH, 37, 0, 8 }, { "uc_fthresh", SDR_THRESH, 38, 0, 8 }, { "unc_fthresh", SDR_THRESH, 39, 0, 8 }, { "lnr_fthresh", SDR_THRESH, 40, 0, 8 }, { "lc_fthresh", SDR_THRESH, 41, 0, 8 }, { "lnc_fthresh", SDR_THRESH, 42, 0, 8 }, { "positive_hysteresis", SDR_BITS, 43, 0, 8 }, { "positive_fhysteresis", SDR_THRESHREL, 43, 0, 8 }, { "negative_hysteresis", SDR_BITS, 44, 0, 8 }, { "negative_fhysteresis", SDR_THRESHREL, 44, 0, 8 }, { "oem", SDR_BITS, 47, 0, 8 }, { "id_string", SDR_STRING, 48, 0, 8, .required = 1 }, }; #define TYPE1_LEN (sizeof(type1) / sizeof(struct sdr_field)) static struct sdr_field_name id_string_modifier_fields[] = { { "numeric", 0 }, { "alpha", 1 }, { NULL } }; static struct sdr_field type2[] = { { "sensor_owner_id", SDR_BITS, 6, 0, 8, .required = 1 }, { "channel_number", SDR_BITS, 7, 4, 4, .required = 1 }, { "sensor_owner_lun", SDR_BITS, 7, 0, 2, .required = 1 }, { "sensor_number", SDR_BITS, 8, 0, 8, .required = 1 }, { "entity_id", SDR_BITS, 9, 0, 8, .required = 1, .strvals = entity_id_fields }, { "logical_entity", SDR_BOOLBIT, 10, 7, 1 }, { "entity_instance", SDR_BITS, 10, 0, 8, .required = 1 }, { "init_scanning", SDR_BOOLBIT, 11, 6, 1 }, { "init_events", SDR_BOOLBIT, 11, 5, 1 }, { "init_thresholds", SDR_BOOLBIT, 11, 4, 1 }, { "init_systeresis", SDR_BOOLBIT, 11, 3, 1 }, { "init_sensor_type", SDR_BOOLBIT, 11, 2, 1 }, { "default_event_gen_on", SDR_BOOLBIT, 11, 1, 1 }, { "default_sensor_scan_on", SDR_BOOLBIT, 11, 0, 1 }, { "ignore_if_no_entity", SDR_BOOLBIT, 12, 7, 1 }, { "sensor_auto_rearm", SDR_BOOLBIT, 12, 6, 1 }, { "sensor_hysteresis", SDR_BITS, 12, 4, 2, .strvals = sensor_access_fields }, { "sensor_threshold_access",SDR_BITS, 12, 2, 2, .strvals = sensor_access_fields }, { "sensor_event_msg_ctrl", SDR_BITS, 12, 0, 2, .strvals = sensor_event_msg_ctrl_fields }, { "sensor_type", SDR_BITS, 13, 0, 8, .required = 1, .strvals = sensor_type_fields }, { "event_reading_type_code",SDR_BITS, 14, 0, 8, .required = 1 }, { "assert_event14", SDR_BOOLBIT, 16, 6, 1 }, { "assert_event13", SDR_BOOLBIT, 16, 5, 1 }, { "assert_event12", SDR_BOOLBIT, 16, 4, 1 }, { "assert_event11", SDR_BOOLBIT, 16, 3, 1 }, { "assert_event10", SDR_BOOLBIT, 16, 2, 1 }, { "assert_event9", SDR_BOOLBIT, 16, 1, 1 }, { "assert_event8", SDR_BOOLBIT, 16, 0, 1 }, { "assert_event7", SDR_BOOLBIT, 15, 7, 1 }, { "assert_event6", SDR_BOOLBIT, 15, 6, 1 }, { "assert_event5", SDR_BOOLBIT, 15, 5, 1 }, { "assert_event4", SDR_BOOLBIT, 15, 4, 1 }, { "assert_event3", SDR_BOOLBIT, 15, 3, 1 }, { "assert_event2", SDR_BOOLBIT, 15, 2, 1 }, { "assert_event1", SDR_BOOLBIT, 15, 1, 1 }, { "assert_event0", SDR_BOOLBIT, 15, 0, 1 }, { "assert_lnr", SDR_BOOLBIT, 16, 6, 1 }, { "assert_lc", SDR_BOOLBIT, 16, 5, 1 }, { "assert_lnc", SDR_BOOLBIT, 16, 4, 1 }, { "assert_unrgh", SDR_BOOLBIT, 16, 3, 1 }, { "assert_unrgl", SDR_BOOLBIT, 16, 2, 1 }, { "assert_ucgh", SDR_BOOLBIT, 16, 1, 1 }, { "assert_ucgl", SDR_BOOLBIT, 16, 0, 1 }, { "assert_uncgh", SDR_BOOLBIT, 15, 7, 1 }, { "assert_uncgl", SDR_BOOLBIT, 15, 6, 1 }, { "assert_lnrgh", SDR_BOOLBIT, 15, 5, 1 }, { "assert_lnrgl", SDR_BOOLBIT, 15, 4, 1 }, { "assert_lcgh", SDR_BOOLBIT, 15, 3, 1 }, { "assert_lcgl", SDR_BOOLBIT, 15, 2, 1 }, { "assert_lncgh", SDR_BOOLBIT, 15, 1, 1 }, { "assert_lncgl", SDR_BOOLBIT, 15, 0, 1 }, { "deassert_event14", SDR_BOOLBIT, 18, 6, 1 }, { "deassert_event13", SDR_BOOLBIT, 18, 5, 1 }, { "deassert_event12", SDR_BOOLBIT, 18, 4, 1 }, { "deassert_event11", SDR_BOOLBIT, 18, 3, 1 }, { "deassert_event10", SDR_BOOLBIT, 18, 2, 1 }, { "deassert_event9", SDR_BOOLBIT, 18, 1, 1 }, { "deassert_event8", SDR_BOOLBIT, 18, 0, 1 }, { "deassert_event7", SDR_BOOLBIT, 17, 7, 1 }, { "deassert_event6", SDR_BOOLBIT, 17, 6, 1 }, { "deassert_event5", SDR_BOOLBIT, 17, 5, 1 }, { "deassert_event4", SDR_BOOLBIT, 17, 4, 1 }, { "deassert_event3", SDR_BOOLBIT, 17, 3, 1 }, { "deassert_event2", SDR_BOOLBIT, 17, 2, 1 }, { "deassert_event1", SDR_BOOLBIT, 17, 1, 1 }, { "deassert_event0", SDR_BOOLBIT, 17, 0, 1 }, { "deassert_lnr", SDR_BOOLBIT, 18, 6, 1 }, { "deassert_lc", SDR_BOOLBIT, 18, 5, 1 }, { "deassert_lnc", SDR_BOOLBIT, 18, 4, 1 }, { "deassert_unrgh", SDR_BOOLBIT, 18, 3, 1 }, { "deassert_unrgl", SDR_BOOLBIT, 18, 2, 1 }, { "deassert_ucgh", SDR_BOOLBIT, 18, 1, 1 }, { "deassert_ucgl", SDR_BOOLBIT, 18, 0, 1 }, { "deassert_uncgh", SDR_BOOLBIT, 17, 7, 1 }, { "deassert_uncgl", SDR_BOOLBIT, 17, 6, 1 }, { "deassert_lnrgh", SDR_BOOLBIT, 17, 5, 1 }, { "deassert_lnrgl", SDR_BOOLBIT, 17, 4, 1 }, { "deassert_lcgh", SDR_BOOLBIT, 17, 3, 1 }, { "deassert_lcgl", SDR_BOOLBIT, 17, 2, 1 }, { "deassert_lncgh", SDR_BOOLBIT, 17, 1, 1 }, { "deassert_lncgl", SDR_BOOLBIT, 17, 0, 1 }, { "event14_state_ret", SDR_BOOLBIT, 20, 6, 1 }, { "event13_state_ret", SDR_BOOLBIT, 20, 5, 1 }, { "event12_state_ret", SDR_BOOLBIT, 20, 4, 1 }, { "event11_state_ret", SDR_BOOLBIT, 20, 3, 1 }, { "event10_state_ret", SDR_BOOLBIT, 20, 2, 1 }, { "event9_state_ret", SDR_BOOLBIT, 20, 1, 1 }, { "event8_state_ret", SDR_BOOLBIT, 20, 0, 1 }, { "event7_state_ret", SDR_BOOLBIT, 19, 7, 1 }, { "event6_state_ret", SDR_BOOLBIT, 19, 6, 1 }, { "event5_state_ret", SDR_BOOLBIT, 19, 5, 1 }, { "event4_state_ret", SDR_BOOLBIT, 19, 4, 1 }, { "event3_state_ret", SDR_BOOLBIT, 19, 3, 1 }, { "event2_state_ret", SDR_BOOLBIT, 19, 2, 1 }, { "event1_state_ret", SDR_BOOLBIT, 19, 1, 1 }, { "event0_state_ret", SDR_BOOLBIT, 19, 0, 1 }, { "unr_thrsh_settable", SDR_BOOLBIT, 20, 5, 1 }, { "uc_thrsh_settable", SDR_BOOLBIT, 20, 4, 1 }, { "unc_thrsh_settable", SDR_BOOLBIT, 20, 3, 1 }, { "lnr_thrsh_settable", SDR_BOOLBIT, 20, 2, 1 }, { "lc_thrsh_settable", SDR_BOOLBIT, 20, 1, 1 }, { "lnc_thrsh_settable", SDR_BOOLBIT, 20, 0, 1 }, { "unr_thrsh_readable", SDR_BOOLBIT, 19, 5, 1 }, { "uc_thrsh_readable", SDR_BOOLBIT, 19, 4, 1 }, { "unc_thrsh_readable", SDR_BOOLBIT, 19, 3, 1 }, { "lnr_thrsh_readable", SDR_BOOLBIT, 19, 2, 1 }, { "lc_thrsh_readable", SDR_BOOLBIT, 19, 1, 1 }, { "lnc_thrsh_readable", SDR_BOOLBIT, 19, 0, 1 }, { "", SDR_BITS, 21, 6, 2, .default_val = 3 }, { "rate_unit", SDR_BITS, 21, 3, 3, .strvals = rate_unit_fields }, { "modifier_unit", SDR_BITS, 21, 1, 2, .strvals = modifier_unit_fields }, { "percentage", SDR_BOOLBIT, 21, 0, 1 }, { "base_unit", SDR_BITS, 22, 0, 8 }, { "modifier_unit", SDR_BITS, 23, 0, 8 }, { "sensor_direction", SDR_BITS, 24, 6, 2, .strvals = sensor_direction_fields }, { "id_string_modifier", SDR_BITS, 24, 4, 2, .strvals = id_string_modifier_fields }, { "share_count", SDR_BITS, 24, 0, 4 }, { "entity_instance_incr", SDR_BOOLBIT, 25, 7, 1 }, { "instance_modifier_off", SDR_BITS, 25, 0, 7 }, { "positive_hysteresis", SDR_BITS, 26, 0, 8 }, { "negative_hysteresis", SDR_BITS, 27, 0, 8 }, { "oem", SDR_BITS, 31, 0, 8 }, { "id_string", SDR_STRING, 32, 0, 8, .required = 1 }, }; #define TYPE2_LEN (sizeof(type2) / sizeof(struct sdr_field)) static struct sdr_field type3[] = { { "sensor_owner_id", SDR_BITS, 6, 0, 8, .required = 1 }, { "channel_number", SDR_BITS, 7, 4, 4, .required = 1 }, { "sensor_owner_lun", SDR_BITS, 7, 0, 2, .required = 1 }, { "sensor_number", SDR_BITS, 8, 0, 8, .required = 1 }, { "entity_id", SDR_BITS, 9, 0, 8, .required = 1, .strvals = entity_id_fields }, { "logical_entity", SDR_BOOLBIT, 10, 7, 1 }, { "entity_instance", SDR_BITS, 10, 0, 8, .required = 1 }, { "sensor_type", SDR_BITS, 11, 0, 8, .required = 1, .strvals = sensor_type_fields }, { "event_reading_type_code",SDR_BITS, 12, 0, 8, .required = 1 }, { "sensor_direction", SDR_BITS, 13, 6, 2, .strvals = sensor_direction_fields }, { "id_string_modifier", SDR_BITS, 13, 4, 2, .strvals = id_string_modifier_fields }, { "share_count", SDR_BITS, 13, 0, 4 }, { "entity_instance_incr", SDR_BOOLBIT, 14, 7, 1 }, { "instance_modifier_off", SDR_BITS, 14, 0, 7 }, { "oem", SDR_BITS, 16, 0, 8 }, { "id_string", SDR_STRING, 17, 0, 8, .required = 1 }, }; #define TYPE3_LEN (sizeof(type3) / sizeof(struct sdr_field)) static struct sdr_field type8[] = { { "container_entity_id", SDR_BITS, 6, 0, 8, .required = 1, .strvals = entity_id_fields }, { "container_entity_inst", SDR_BITS, 7, 0, 8, .required = 1 }, { "entities_are_range", SDR_BOOLBIT, 8, 7, 1 }, { "linked_ears", SDR_BOOLBIT, 8, 6, 1 }, { "presence_sensor_always_there",SDR_BOOLBIT, 8, 5, 1 }, { "entity_1_id", SDR_BITS, 9, 0, 8, .required = 1, .strvals = entity_id_fields }, { "entity_1_inst", SDR_BITS, 10, 0, 8, .required = 1 }, { "entity_2_id", SDR_BITS, 11, 0, 8, .strvals = entity_id_fields }, { "entity_2_inst", SDR_BITS, 12, 0, 8 }, { "entity_3_id", SDR_BITS, 13, 0, 8, .strvals = entity_id_fields }, { "entity_3_inst", SDR_BITS, 14, 0, 8 }, { "entity_4_id", SDR_BITS, 15, 0, 8, .strvals = entity_id_fields }, { "entity_4_inst", SDR_BITS, 16, 0, 8 }, }; #define TYPE8_LEN (sizeof(type8) / sizeof(struct sdr_field)) static struct sdr_field type9[] = { { "container_entity_id", SDR_BITS, 6, 0, 8, .required = 1, .strvals = entity_id_fields }, { "container_entity_inst", SDR_BITS, 7, 4, 4, .required = 1 }, { "container_entity_dev_addr", SDR_BITS, 8, 0, 8, .required = 1 }, { "container_entity_dev_chan", SDR_BITS, 9, 0, 8, .required = 1 }, { "entities_are_range", SDR_BOOLBIT, 10, 7, 1 }, { "linked_ears", SDR_BOOLBIT, 10, 6, 1 }, { "presence_sensor_always_there",SDR_BOOLBIT, 10, 5, 1 }, { "entity_1_dev_addr", SDR_BITS, 11, 0, 8, .required = 1 }, { "entity_1_dev_chan", SDR_BITS, 12, 0, 8, .required = 1 }, { "entity_1_id", SDR_BITS, 13, 0, 8, .required = 1, .strvals = entity_id_fields }, { "entity_1_inst", SDR_BITS, 14, 0, 8, .required = 1 }, { "entity_2_dev_addr", SDR_BITS, 15, 0, 8 }, { "entity_2_dev_chan", SDR_BITS, 16, 0, 8 }, { "entity_2_id", SDR_BITS, 17, 0, 8, .strvals = entity_id_fields }, { "entity_2_inst", SDR_BITS, 18, 0, 8 }, { "entity_3_dev_addr", SDR_BITS, 19, 0, 8 }, { "entity_3_dev_chan", SDR_BITS, 20, 0, 8 }, { "entity_3_id", SDR_BITS, 21, 0, 8, .strvals = entity_id_fields }, { "entity_3_inst", SDR_BITS, 22, 0, 8 }, { "entity_4_dev_addr", SDR_BITS, 23, 0, 8 }, { "entity_4_dev_chan", SDR_BITS, 24, 0, 8 }, { "entity_4_id", SDR_BITS, 25, 0, 8, .strvals = entity_id_fields }, { "entity_4_inst", SDR_BITS, 26, 0, 8 }, }; #define TYPE9_LEN (sizeof(type9) / sizeof(struct sdr_field)) static struct sdr_field type16[] = { { "device_access_address", SDR_BITS, 6, 0, 8, .required = 1 }, { "device_slave_address", SDR_BITS, 7, 0, 8, .required = 1 }, { "channel_number", SDR_BITS, 8, 5, 3 }, { "lun", SDR_BITS, 8, 3, 2 }, { "private_bus_id", SDR_BITS, 8, 0, 3 }, { "address_span", SDR_BITS, 9, 0, 3 }, { "device_type", SDR_BITS, 11, 0, 8, .required = 1 }, { "device_type_modifier", SDR_BITS, 12, 0, 8, .required = 1 }, { "entity_id", SDR_BITS, 13, 0, 8, .required = 1, .strvals = entity_id_fields }, { "entity_instance", SDR_BITS, 14, 0, 8, .required = 1 }, { "oem", SDR_BITS, 15, 0, 8 }, { "id_string", SDR_STRING, 16, 0, 8, .required = 1 }, }; #define TYPE16_LEN (sizeof(type16) / sizeof(struct sdr_field)) static struct sdr_field type17[] = { { "device_access_address", SDR_BITS, 6, 0, 8, .required = 1 }, { "fru_device_address", SDR_BITS, 7, 0, 8, .required = 1 }, { "logical_fru", SDR_BOOLBIT, 8, 7, 1 }, { "lun", SDR_BITS, 8, 3, 2 }, { "private_bus_id", SDR_BITS, 8, 0, 3 }, { "channel_number", SDR_BITS, 9, 4, 4 }, { "device_type", SDR_BITS, 11, 0, 8, .required = 1 }, { "device_type_modifier", SDR_BITS, 12, 0, 8, .required = 1 }, { "fru_entity_id", SDR_BITS, 13, 0, 8, .required = 1, .strvals = entity_id_fields }, { "fru_entity_instance", SDR_BITS, 14, 0, 8, .required = 1 }, { "oem", SDR_BITS, 15, 0, 8 }, { "id_string", SDR_STRING, 16, 0, 8, .required = 1 }, }; #define TYPE17_LEN (sizeof(type17) / sizeof(struct sdr_field)) static struct sdr_field_name gen_events_modifier_fields[] = { { "enable_event_msg_gen", 0 }, { "disable_event_msg_gen", 1 }, { "do_not_init", 2 }, { NULL } }; static struct sdr_field type18[] = { { "device_slave_address", SDR_BITS, 6, 0, 8, .required = 1 }, { "device_channel_number", SDR_BITS, 7, 0, 4, .required = 1 }, { "ACPI_sys_power_state", SDR_BOOLBIT, 8, 7, 1 }, { "ACPI_dev_power_state", SDR_BOOLBIT, 8, 6, 1 }, { "static_controller", SDR_BOOLBIT, 8, 5, 1 }, { "controller_logs_init", SDR_BOOLBIT, 8, 3, 1 }, { "log_init", SDR_BOOLBIT, 8, 2, 1 }, { "gen_events", SDR_BITS, 8, 0, 2, .strvals = gen_events_modifier_fields }, { "chassis", SDR_BOOLBIT, 9, 7, 1 }, { "bridge", SDR_BOOLBIT, 9, 6, 1 }, { "ipmb_event_gen", SDR_BOOLBIT, 9, 5, 1 }, { "ipmb_event_recv", SDR_BOOLBIT, 9, 4, 1 }, { "fru_inventory", SDR_BOOLBIT, 9, 3, 1 }, { "sel", SDR_BOOLBIT, 9, 2, 1 }, { "sdr", SDR_BOOLBIT, 9, 1, 1 }, { "sensor", SDR_BOOLBIT, 9, 0, 1 }, { "entity_id", SDR_BITS, 13, 0, 8, .required = 1, .strvals = entity_id_fields }, { "entity_instance", SDR_BITS, 14, 0, 8, .required = 1 }, { "oem", SDR_BITS, 15, 0, 8 }, { "id_string", SDR_STRING, 16, 0, 8, .required = 1 }, }; #define TYPE18_LEN (sizeof(type18) / sizeof(struct sdr_field)) struct variable { char *name; char *value; struct variable *next; } *vars; int add_variable(const char *name, const char *value) { struct variable *var = vars, *last = NULL; while (var) { if (strcmp(name, var->name) == 0) break; last = var; var = var->next; } if (var) { free(var->value); } else { var = malloc(sizeof(*var)); if (!var) { fprintf(stderr, "Out of memory\n"); return ENOMEM; } var->name = strdup(name); if (!var->name) { fprintf(stderr, "Out of memory\n"); return ENOMEM; } var->next = NULL; if (last) last->next = var; else vars = var; } var->value = strdup(value); if (!var->value) { fprintf(stderr, "Out of memory\n"); return ENOMEM; } return 0; } const char *find_var(const char *name) { struct variable *var = vars; while (var) { if (strcmp(name, var->name) == 0) break; var = var->next; } if (!var) { fprintf(stderr, "Unknown variable named %s\n", name); return NULL; } return var->value; } /* * To parse more complex expressions, we really need to know what the * save state is. So we, unfortunately, have to create our own * version of strtok so we know what it is. */ const char * mystrtok(char *str, const char *delim, char **next) { char *pos; char *curr; if (str) curr = str; else curr = *next; /* Skip initial delimiters. */ for (;;) { const char *c = delim; if (*curr == '\0') { *next = curr; return NULL; } while (*c != '\0') { if (*c == *curr) break; c++; } if (*c == '\0') break; curr++; } pos = curr; /* Now collect until there is a delimiter. */ for (;;) { const char *c = delim; if (*curr == '\0') { *next = curr; goto out; } while (*c != '\0') { if (*c == *curr) { *curr = '\0'; *next = curr + 1; goto out; } c++; } curr++; } out: if (*pos == '$') return find_var(pos + 1); else return pos; } int isquote(char c) { return c == '\'' || c == '"'; } int get_delim_str(char **rtokptr, char **rval, char **err) { char *tokptr = *rtokptr; char endc; char *rv = NULL; while (isspace(*tokptr)) tokptr++; if (*tokptr == '\0') { *err = "missing string value"; return -1; } for (;;) { const char *val; if (*tokptr == '$') { char oldc; tokptr++; val = tokptr; while (*tokptr && *tokptr != '$' && !isspace(*tokptr) && !isquote(*tokptr)) { tokptr++; } oldc = *tokptr; *tokptr = '\0'; val = find_var(val); if (!val) { if (rv) free(rv); *err = "variable not found"; return -1; } *tokptr = oldc; } else if (isquote(*tokptr)) { endc = *tokptr; tokptr++; val = tokptr; while (*tokptr != endc) { if (*tokptr == '\0') { if (rv) free(rv); *err = "End of line in string"; return -1; } tokptr++; } *tokptr = '\0'; tokptr++; } else { if (rv) free(rv); *err = "string value must start with '\"' or '''"; return -1; } if (rv) { char *newrv = malloc(strlen(rv) + strlen(val) + 1); if (!newrv) { *err = "Out of memory copying string"; return -1; } strcpy(newrv, rv); strcat(newrv, val); free(rv); rv = newrv; } else { rv = strdup(val); if (!rv) { *err = "Out of memory copying string"; return -1; } } if (*tokptr == '\0' || isspace(*tokptr)) break; } *rtokptr = tokptr; *rval = rv; return 0; } int get_bool(char **tokptr, unsigned int *rval, char **err) { const char *tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *err = "No boolean value given"; return -1; } if (strcasecmp(tok, "true") == 0) *rval = 1; else if (strcasecmp(tok, "false") == 0) *rval = 0; else if (strcasecmp(tok, "on") == 0) *rval = 1; else if (strcasecmp(tok, "off") == 0) *rval = 0; else if (strcasecmp(tok, "yes") == 0) *rval = 1; else if (strcasecmp(tok, "no") == 0) *rval = 0; else if (strcasecmp(tok, "1") == 0) *rval = 1; else if (strcasecmp(tok, "0") == 0) *rval = 0; else { *err = "Invalid boolean value, must be 'true', 'on', 'false', or 'off'"; return -1; } return 0; } int get_uint(char **tokptr, unsigned int *rval, char **err, const char *start) { char *end; const char *tok; if (start) tok = start; else { tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *err = "No integer value given"; return -1; } } *rval = strtoul(tok, &end, 0); if (*end != '\0') { *err = "Invalid integer value"; return -1; } tok = mystrtok(NULL, " \t\n", tokptr); if (tok) { const char *tok2 = mystrtok(NULL, " \t\n", tokptr); unsigned int val2; if (!tok2) { *err = "No value after operator"; return -1; } val2 = strtoul(tok2, &end, 0); if (*end != '\0') { *err = "Invalid integer value"; return -1; } if (strlen(tok) > 1) { *err = "Invalid operator"; return -1; } switch (*tok) { case '+': *rval += val2; break; case '-': *rval -= val2; break; default: *err = "Invalid operator"; return -1; } } return 0; } int get_int(char **tokptr, int *rval, char **err) { char *end; const char *tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *err = "No integer value given"; return -1; } *rval = strtol(tok, &end, 0); if (*end != '\0') { *err = "Invalid integer value"; return -1; } tok = mystrtok(NULL, " \t\n", tokptr); if (tok) { const char *tok2 = mystrtok(NULL, " \t\n", tokptr); int val2; if (!tok2) { *err = "No value after operator"; return -1; } val2 = strtol(tok2, &end, 0); if (*end != '\0') { *err = "Invalid integer value"; return -1; } if (strlen(tok) > 1) { *err = "Invalid operator"; return -1; } switch (*tok) { case '+': *rval += val2; break; case '-': *rval -= val2; break; default: *err = "Invalid operator"; return -1; } } return 0; } int get_float(char **tokptr, double *rval, char **err) { char *end; const char *tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *err = "No floating point value given"; return -1; } *rval = strtod(tok, &end); if (*end != '\0') { *err = "Invalid floating point value"; return -1; } return 0; } static int get_uint_str(struct sdr_field *t, char **tokptr, unsigned int *rval, char **err) { const char *tok = mystrtok(NULL, " \t\n", tokptr); if (t->strvals) { struct sdr_field_name *s = t->strvals; while (s->name) { if (strcmp(s->name, tok) == 0) { *rval = s->val; return 0; } s++; } } return get_uint(tokptr, rval, err, tok); } static int store_sdr_bits(struct sdr_field *t, unsigned char *sdr, unsigned int len, unsigned int bits, char **errstr) { if (t->pos > len) { *errstr = "Internal error: position out of range"; return -1; } sdr[t->pos - 1] |= (bits & ((1 << t->bitsize) - 1)) << t->bitoff; return 0; } static unsigned int get_sdr_bits(unsigned char *sdr, unsigned int pos, unsigned int bitoff, unsigned int len) { return (sdr[pos - 1] >> bitoff) & ((1 << len) - 1); } int get_sdr_type(int type, struct sdr_field **t, unsigned int *tlen, unsigned int *sdr_len, char **errstr) { switch (type) { case 1: *t = type1; *tlen = TYPE1_LEN; *sdr_len = 48; break; case 2: *t = type2; *tlen = TYPE2_LEN; *sdr_len = 32; break; case 3: *t = type3; *tlen = TYPE3_LEN; *sdr_len = 17; break; case 8: *t = type8; *tlen = TYPE8_LEN; *sdr_len = 16; break; case 9: *t = type9; *tlen = TYPE9_LEN; *sdr_len = 32; break; case 16: *t = type16; *tlen = TYPE16_LEN; *sdr_len = 16; break; case 17: *t = type17; *tlen = TYPE17_LEN; *sdr_len = 16; break; case 18: *t = type18; *tlen = TYPE18_LEN; *sdr_len = 16; break; default: if (errstr) *errstr = "Unknown SDR type, supported types are 1, 2, 3, 8, 9," " 16 (0x10) and 17 (0x11)"; return -1; } return 0; } int ipmi_compile_sdr(FILE *f, unsigned int type, unsigned char **retbuf, unsigned int *retlen, char **errstr, char **errstr2, unsigned int *line) { unsigned int i, j, tlen; struct sdr_field *t; char *requireds, *sets; char buf[MAX_SDR_LINE]; int err = -1; char *tokptr; unsigned char *sdr = NULL; unsigned int sdr_len; *errstr2 = NULL; if (get_sdr_type(type, &t, &tlen, &sdr_len, errstr)) return -1; requireds = malloc(tlen * sizeof(char)); if (!requireds) { *errstr = "Out of memory"; return -1; } sets = malloc(tlen * sizeof(char)); if (!sets) { free(requireds); *errstr = "Out of memory"; return -1; } sdr = malloc(sdr_len); if (!sdr) { err = -1; *errstr = "Out of memory"; goto out_err; } memset(sdr, 0, sdr_len); for (i = 0; i < tlen; i++) { requireds[i] = t[i].required; sets[i] = 0; if (t[i].default_val) store_sdr_bits(&t[i], sdr, sdr_len, t[i].default_val, errstr); } for (;;) { const char *tok; char *s = fgets(buf, sizeof(buf), f); if (s == NULL) { err = -1; *errstr = "Unexpected end of file"; goto out_err; } (*line)++; tok = mystrtok(buf, " \t\n", &tokptr); if (!tok || (tok[0] == '#')) continue; if (strcmp(tok, "endsdr") == 0) break; for (i = 0; i < tlen; i++) { if (strcmp(tok, t[i].name) == 0) { break; } } if (i == tlen) { err = -1; *errstr = "unknown SDR field"; goto out_err; } if (sets[i]) { err = -1; *errstr = "Field already set in this SDR"; *errstr2 = t[i].name; goto out_err; } sets[i] = 1; requireds[i] = 0; switch (t[i].type) { case SDR_BITS: { unsigned int uval, umax; err = get_uint_str(&t[i], &tokptr, &uval, errstr); if (err) goto out_err; umax = (1 << t[i].bitsize) - 1; if (uval > umax) { err = -1; *errstr = "Value too large for bit size"; goto out_err; } err = store_sdr_bits(&t[i], sdr, sdr_len, uval, errstr); if (err) goto out_err; break; } case SDR_SBITS: { int sval, smin, smax; err = get_int(&tokptr, &sval, errstr); if (err) goto out_err; smax = (1 << (t[i].bitsize - 1)) - 1; smin = -smax - 1; if (sval > smax || sval < smin) { err = -1; *errstr = "Value out of range for bit size"; goto out_err; } err = store_sdr_bits(&t[i], sdr, sdr_len, (unsigned int) sval, errstr); if (err) goto out_err; break; } case SDR_BOOLBIT: { unsigned int uval; err = get_bool(&tokptr, &uval, errstr); if (err) goto out_err; err = store_sdr_bits(&t[i], sdr, sdr_len, uval, errstr); if (err) goto out_err; break; } case SDR_MULTIBITS: case SDR_MULTISBITS: { unsigned int uval, totalbits; totalbits = t[i].bitsize; for (j = i + 1; t[j].type == SDR_MULTIBITS2; j++) totalbits += t[j].bitsize; if (t[i].type == SDR_MULTISBITS) { int sval, smin, smax; err = get_int(&tokptr, &sval, errstr); if (err) goto out_err; smax = 1 << (totalbits - 1); smin = -smax - 1; if (sval > smax || sval < smin) { err = -1; *errstr = "Value out of range for bit size"; goto out_err; } uval = (unsigned int) sval; } else { unsigned int umax; err = get_uint_str(&t[i], &tokptr, &uval, errstr); if (err) goto out_err; umax = 1 << totalbits; if (uval > umax) { err = -1; *errstr = "Value too large for bit size"; goto out_err; } } err = store_sdr_bits(&t[i], sdr, sdr_len, uval, errstr); if (err) goto out_err; for (j = i + 1; t[j].type == SDR_MULTIBITS2; j++) { uval >>= t[j - 1].bitsize; err = store_sdr_bits(&t[j], sdr, sdr_len, uval, errstr); if (err) goto out_err; } break; } case SDR_STRING: { unsigned char str[IPMI_MAX_STR_LEN]; char *sval; unsigned int out_len = sizeof(str); err = get_delim_str(&tokptr, &sval, errstr); if (err) goto out_err; ipmi_set_device_string(sval, IPMI_ASCII_STR, strlen(sval), str, 0, &out_len); free(sval); if (out_len > 1) { unsigned char *newsdr = realloc(sdr, sdr_len + out_len - 1); if (!newsdr) { err = -1; *errstr = "Out of memory"; goto out_err; } sdr = newsdr; sdr_len += out_len - 1; } memcpy(sdr + t[i].pos - 1, str, out_len); break; } case SDR_MULTIBITS2: /* Should never happen */ *errstr = "Internal error: multibits2 showed up"; goto out_err; break; case SDR_THRESH: case SDR_THRESHREL: { double fval, fx; int m, b, r_exp, b_exp; err = get_float(&tokptr, &fval, errstr); if (err) goto out_err; m = get_sdr_bits(sdr, 25, 0, 8); m |= get_sdr_bits(sdr, 26, 6, 2) << 8; if (m & (1 << 9)) m |= (~0U << 10); b = get_sdr_bits(sdr, 27, 0, 8); b |= get_sdr_bits(sdr, 28, 6, 2) << 8; if (b & (1 << 9)) b |= (~0U << 10); r_exp = get_sdr_bits(sdr, 30, 4, 4); if (r_exp & (1 << 3)) r_exp |= (~0U << 4); b_exp = get_sdr_bits(sdr, 30, 0, 4); if (b_exp & (1 << 3)) b_exp |= (~0U << 4); if (t[i].type == SDR_THRESHREL) /* * A threshold value, like hysteresis. It's not * an absolute value, it's a relative value, so we * leave "b" out of the equation. Note that this * only works for linear equations. */ fx = (((fval / pow(10, r_exp))) / ((double) m)); else fx = (((fval / pow(10, r_exp)) - ((double) b) * pow(10, b_exp)) / ((double) m)); /* * We always round here. This means that a threshold * may be set that is on the "wrong side" of the * threshold, and the trigger may too sensitive. Or * perhaps insensitive. Of course, that can happen * without rounding, too. There appears to be no easy * way to second-guess the user of this program and, * given a floating point value, figure out the proper * integer value they want. Instead, they are expected * to give a floating point value that will evaluate * very closely to the integer they want. Rounding * should handle the issue of getting it right on the * integer value the user wants and avoid issues with * floating point imprecision. */ fx = round(fx); if (fx < 0.0 || fx > 255.0) { err = -1; *errstr = "Value out of range type"; goto out_err; } err = store_sdr_bits(&t[i], sdr, sdr_len, (unsigned int) fx, errstr); if (err) goto out_err; break; } } } for (i = 0; i < tlen; i++) { if (requireds[i]) { err = -1; *errstr = "Missing required field:"; *errstr2 = t[i].name; goto out_err; } } free(requireds); free(sets); sdr[2] = 0x51; sdr[3] = type; sdr[4] = sdr_len - 5; *retbuf = sdr; *retlen = sdr_len; return 0; out_err: free(requireds); free(sets); if (sdr) free(sdr); return err; } static void compile_file(const char *filename, FILE *f, persist_t *p, int outraw, unsigned int *sdrnum) { char buf[MAX_SDR_LINE]; char *s; unsigned int line = 0; while ((s = fgets(buf, sizeof(buf), f))) { int err; unsigned int sdrtype; char *errstr, *errstr2; unsigned char *sdr; unsigned int sdrlen; char *tokptr; const char *tok; line++; tok = mystrtok(buf, " \t\n", &tokptr); if (!tok || (tok[0] == '#')) continue; if (strcmp(tok, "sdr") == 0) { tok = mystrtok(NULL, " \n\t", &tokptr); if (!tok || strcmp(tok, "type") != 0) { fprintf(stderr, "%s:%3d: Invalid input, expecting \"sdr type \"\n", filename, line); out_err(1); } err = get_uint(&tokptr, &sdrtype, &errstr, NULL); if (err) { fprintf(stderr, "%s:%3d: Invalid input, expecting \"sdr type \":" " %s\n", filename, line, errstr); out_err(1); } err = ipmi_compile_sdr(f, sdrtype, &sdr, &sdrlen, &errstr, &errstr2, &line); if (err) { if (errstr2) fprintf(stderr, "%s:%3d: %s: %s\n", filename, line, errstr, errstr2); else fprintf(stderr, "%s:%3d: %s\n", filename, line, errstr); out_err(1); } sdr[0] = *sdrnum & 0xff; sdr[1] = (*sdrnum >> 8) & 0xff; if (outraw) { fwrite(sdr, sdrlen, 1, outfile); } else { err = add_persist_data(p, sdr, sdrlen, "%d", *sdrnum); if (err) { fprintf(stderr, "Out of memory\n"); out_err(1); } } (*sdrnum)++; free(sdr); } else if (strcmp(tok, "define") == 0) { const char *name; char *value; name = mystrtok(NULL, " \n\t", &tokptr); if (!name) { fprintf(stderr, "%s:%3d: Invalid input, expecting variable name\n", filename, line); out_err(1); } err = get_delim_str(&tokptr, &value, &errstr); if (err) { fprintf(stderr, "%s:%3d: Invalid value, expecting quote delimited" " string: %s\n", filename, line, errstr); out_err(1); } err = add_variable(name, value); if (err) { free(value); out_err(1); } } else if (strcmp(tok, "include") == 0) { char *nfilename; FILE *f2; err = get_delim_str(&tokptr, &nfilename, &errstr); if (err) { fprintf(stderr, "%s:%3d: Invalid filename, expecting quote delimited" " string: %s\n", filename, line, errstr); out_err(1); } f2 = fopen(nfilename, "r"); if (!f2) { fprintf(stderr, "%s:%3d: Unable to open included file %s\n", filename, line, nfilename); out_err(1); } compile_file(nfilename, f2, p, outraw, sdrnum); fclose(f2); } else { fprintf(stderr, "%s:%3d: Invalid input," " expecting \"sdr type \"\n", filename, line); out_err(1); } } } static int extract_bits(uint8_t *sdr, struct sdr_field *t) { unsigned int v; /* * Note that the pos is the IPMI 1's based offset, not a zero * based offset. So we subtract 1 to get the array position. */ v = sdr[t->pos - 1]; v >>= t->bitoff; v &= (1 << t->bitsize) - 1; return v; } static int sign_extend(int v, int bitsize) { if (v & (1 << (bitsize - 1))) { /* Negative */ v &= ~(1 << (bitsize - 1)); v = -v - 1; } return v; } static void dump_val(struct sdr_field *t, int v) { struct sdr_field_name *n = t->strvals; if (n) { while (n->name) { if (v == n->val) { fprintf(outfile, "%s\n", n->name); return; } n++; } } fprintf(outfile, "%d\n", v); } static void dump_int(uint8_t *sdr, struct sdr_field *t, int is_signed) { int v = extract_bits(sdr, t); if (is_signed) v = sign_extend(v, t->bitsize); dump_val(t, v); } static void dump_multibits(uint8_t *sdr, struct sdr_field *t, int is_signed) { int v = extract_bits(sdr, t); int shift = t->bitsize; t++; while (t->type == SDR_MULTIBITS2) { v |= extract_bits(sdr, t) << shift; shift += t->bitsize; t++; } if (is_signed) v = sign_extend(v, t->bitsize); dump_val(t, v); } static void dump_thresh(uint8_t *sdr, struct sdr_field *t, int is_rel) { int v = extract_bits(sdr, t); int m, b, r_exp, b_exp, is_signed; double fx; is_signed = get_sdr_bits(sdr, 21, 6, 2); if (is_signed) v = sign_extend(v, t->bitsize); m = get_sdr_bits(sdr, 25, 0, 8); m |= get_sdr_bits(sdr, 26, 6, 2) << 8; if (m & (1 << 9)) m |= (~0U << 10); b = get_sdr_bits(sdr, 27, 0, 8); b |= get_sdr_bits(sdr, 28, 6, 2) << 8; if (b & (1 << 9)) b |= (~0U << 10); r_exp = get_sdr_bits(sdr, 30, 4, 4); if (r_exp & (1 << 3)) r_exp |= (~0U << 4); b_exp = get_sdr_bits(sdr, 30, 0, 4); if (b_exp & (1 << 3)) b_exp |= (~0U << 4); fx = ((double) m) * ((double) v); if (!is_rel) fx += ((double) b) * pow(10, b_exp); fx *= pow(10, r_exp); fprintf(outfile, "%f\n", fx); } static void dump_string(uint8_t *sdr, struct sdr_field *t, unsigned int sdr_len) { unsigned char *sptr = ((unsigned char *) sdr) + t->pos - 1; char str[IPMI_MAX_STR_LEN + 1]; unsigned int out_len; enum ipmi_str_type_e stype; int err; err = ipmi_get_device_string(&sptr, sdr_len + 5 - t->pos + 1, str, IPMI_STR_SDR_SEMANTICS, 0, &stype, sizeof(str), &out_len); if (err) { fprintf(stderr, "Warning: Invalid SDR string, search for **INVALID**" " in output\n"); fprintf(outfile, "**INVALID**\n"); return; } str[out_len] = '\0'; fprintf(outfile, "%s\n", str); } static void dump_sdr_field(uint8_t *sdr, struct sdr_field *t, unsigned int len) { if (t->type == SDR_MULTIBITS2) return; fprintf(outfile, "\t%s\t", t->name); switch(t->type) { case SDR_BITS: case SDR_SBITS: dump_int(sdr, t, t->type == SDR_SBITS); break; case SDR_BOOLBIT: if (sdr[t->pos] & (1 << t->bitoff)) fprintf(outfile, "true\n"); else fprintf(outfile, "false\n"); break; case SDR_MULTIBITS: case SDR_MULTISBITS: dump_multibits(sdr, t, t->type == SDR_MULTISBITS); break; case SDR_MULTIBITS2: break; case SDR_THRESH: case SDR_THRESHREL: dump_thresh(sdr, t, t->type == SDR_THRESHREL); break; case SDR_STRING: dump_string(sdr, t, len); break; } } static void decompile_file(FILE *f) { uint8_t sdr[261]; size_t l; int recnum = 0; struct sdr_field *t; unsigned int tlen, sdr_len; size_t offset = 0; unsigned int i; l = fread(sdr, 5, 1, f); while (l == 1) { uint16_t recid = sdr[0] | sdr[1] << 8; int badtype = 0; if (sdr[2] != 0x51) { fprintf(stderr, "SDR %d offset %ld: Unknown SDR version: 0x%x\n", recnum, offset, sdr[2]); } fprintf(outfile, "# Record id: %d\n", recid); fprintf(outfile, "# Record num: %d\n", recnum); if (get_sdr_type(sdr[3], &t, &tlen, &sdr_len, NULL)) { fprintf(outfile, "# unknown type: %d\n", sdr[3]); badtype = 1; } else if (sdr[4] < sdr_len - 5) { fprintf(stderr, "SDR %d offset %ld type %d: not long enough: %d," " expected %d\n", recnum, offset, sdr[3], sdr[4], sdr_len - 5); exit(1); } l = fread(sdr + 5, sdr[4], 1, f); if (l != 1) { if (ferror(f)) { fprintf(stderr, "Error reading file: %s\n", strerror(errno)); exit(1); } else { fprintf(stderr, "End of file in the middle of" " record %d offset %ld\n", recnum, offset); exit(1); } } if (!badtype) { fprintf(outfile, "sdr %d\n", sdr[3]); for (i = 0; i < tlen; i++) dump_sdr_field(sdr, t + i, sdr[4]); fprintf(outfile, "endsdr\n\n"); } offset += sdr[4] + 5; l = fread(sdr, 5, 1, f); recnum++; } if (ferror(f)) { fprintf(stderr, "Error reading file: %s\n", strerror(errno)); exit(1); } } static char *progname; static void help(void) { fprintf(stderr, "%s [-r] [-o ] [-d] \n", progname); exit(1); } int main(int argc, char *argv[]) { FILE *f; persist_t *p = NULL; unsigned int sdrnum = 1; int argn; int outraw = 0; int decompile = 0; progname = argv[0]; outfile = stdout; for (argn = 1; argn < argc; argn++) { if (argv[argn][0] != '-') break; if (strcmp(argv[argn], "--") == 0) break; if (strcmp(argv[argn], "-r") == 0) { outraw = 1; } else if (strcmp(argv[argn], "-d") == 0) { decompile = 1; } else if (strcmp(argv[argn], "-o") == 0) { argn++; if (argn == argc) { fprintf(stderr, "No value supplied for -o\n"); exit(1); } outfname = argv[argn]; } else { fprintf(stderr, "Invalid option: %s\n", argv[argn]); exit(1); } } if ((argc - argn) < 1) { fprintf(stderr, "No input file given\n"); help(); } f = fopen(argv[argn], "r"); if (!f) { fprintf(stderr, "Unable to open input file %s\n", argv[argn]); exit(1); } argn++; if (argn < argc) { fprintf(stderr, "Extra arguments at end: %s\n", argv[argn]); exit(1); } if (!outraw && !decompile) { p = alloc_persist(""); if (!p) { fprintf(stderr, "Out of memory\n"); exit(1); } } if (outfname) { outfile = fopen(outfname, "w"); if (!outfile) { fprintf(stderr, "Unable to open output file %s: %s\n", outfname, strerror(errno)); exit(1); } } if (decompile) decompile_file(f); else compile_file(argv[argn], f, p, outraw, &sdrnum); fclose(f); if (!outraw && !decompile) { add_persist_int(p, time(NULL), "last_add_time"); write_persist_file(p, outfile); free_persist(p); } return 0; } OpenIPMI-2.0.27/lanserv/sdrcomp/Makefile.am0000664000175000017500000000133213067176003015264 00000000000000 AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include \ -I$(top_srcdir)/lanserv -I$(top_srcdir)/utils AM_CPPFLAGS = -DSTATEDIR='"$(localstatedir)"' bin_PROGRAMS = sdrcomp noinst_PROGRAMS = sdrcomp_build # sdrcomp.c #includes persist.c and string.c sdrcomp_DEPENDENCIES = $(top_srcdir)/lanserv/persist.c \ $(top_srcdir)/utils/string.c sdrcomp_SOURCES = sdrcomp.c sdrcomp_LDFLAGS = -lm # Build host version of the program sdrcomp_build_SOURCES = sdrcomp.c BUILD_SDRCOMP_DEPS = $(top_srcdir)/lanserv/persist.c \ $(top_srcdir)/utils/string.c BUILD_SDRCOMP_SRCS = $(top_srcdir)/$(subdir)/sdrcomp.c sdrcomp_build$(EXEEXT): $(BUILD_SDRCOMP_SRCS) $(BUILD_SDRCOMP_DEPS) $(BUILD_CC) -o $@ $(BUILD_SDRCOMP_SRCS) $(AM_CFLAGS) -lm OpenIPMI-2.0.27/lanserv/sdrcomp/Makefile.in0000644000175000017500000005454213437611454015313 00000000000000# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = sdrcomp$(EXEEXT) noinst_PROGRAMS = sdrcomp_build$(EXEEXT) subdir = lanserv/sdrcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/ax_config_feature.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_python_version.m4 \ $(top_srcdir)/m4/ax_python_devel.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_sdrcomp_OBJECTS = sdrcomp.$(OBJEXT) sdrcomp_OBJECTS = $(am_sdrcomp_OBJECTS) sdrcomp_LDADD = $(LDADD) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = sdrcomp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(sdrcomp_LDFLAGS) $(LDFLAGS) -o $@ am_sdrcomp_build_OBJECTS = sdrcomp.$(OBJEXT) sdrcomp_build_OBJECTS = $(am_sdrcomp_build_OBJECTS) sdrcomp_build_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(sdrcomp_SOURCES) $(sdrcomp_build_SOURCES) DIST_SOURCES = $(sdrcomp_SOURCES) $(sdrcomp_build_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIBTEX = @BIBTEX@ BUILD_CC = @BUILD_CC@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIA = @DIA@ DIA_FILTER_NAME = @DIA_FILTER_NAME@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DVIPDF = @DVIPDF@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GDBM_LIB = @GDBM_LIB@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_DIR = @GLIB_DIR@ GLIB_LIB = @GLIB_LIB@ GLIB_LIBS = @GLIB_LIBS@ GLIB_PKGCONF = @GLIB_PKGCONF@ GLIB_SO = @GLIB_SO@ GLIB_TARGET = @GLIB_TARGET@ GLIB_VERSION = @GLIB_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MARVELL_BMC_DIR = @MARVELL_BMC_DIR@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENIPMI_SWIG_LIBS = @OPENIPMI_SWIG_LIBS@ OPENIPMI_SWIG_SO = @OPENIPMI_SWIG_SO@ OPENIPMI_VERSION_EXTRA = @OPENIPMI_VERSION_EXTRA@ OPENIPMI_VERSION_MAJOR = @OPENIPMI_VERSION_MAJOR@ OPENIPMI_VERSION_MINOR = @OPENIPMI_VERSION_MINOR@ OPENIPMI_VERSION_RELEASE = @OPENIPMI_VERSION_RELEASE@ OPENSSLINCS = @OPENSSLINCS@ OPENSSLLIBS = @OPENSSLLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_DIR = @PERL_DIR@ PERL_HAS_POSIX_THREADS = @PERL_HAS_POSIX_THREADS@ PERL_INSTALL_DIR = @PERL_INSTALL_DIR@ PERL_POSIX_LIB = @PERL_POSIX_LIB@ PERL_POSIX_SO = @PERL_POSIX_SO@ POPTLIBS = @POPTLIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_DIR = @PYTHON_DIR@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_GUI_DIR = @PYTHON_GUI_DIR@ PYTHON_HAS_POSIX_THREADS = @PYTHON_HAS_POSIX_THREADS@ PYTHON_INSTALL_DIR = @PYTHON_INSTALL_DIR@ PYTHON_INSTALL_LIB_DIR = @PYTHON_INSTALL_LIB_DIR@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_POSIX_LIB = @PYTHON_POSIX_LIB@ PYTHON_POSIX_SO = @PYTHON_POSIX_SO@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_SWIG_FLAGS = @PYTHON_SWIG_FLAGS@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RT_LIB = @RT_LIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNMPLIBS = @SNMPLIBS@ SOCKETLIB = @SOCKETLIB@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_DIR = @SWIG_DIR@ SWIG_LIB = @SWIG_LIB@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_DIR = @TCL_DIR@ TCL_LIB = @TCL_LIB@ TCL_LIBS = @TCL_LIBS@ TCL_PKGCONF = @TCL_PKGCONF@ TCL_SO = @TCL_SO@ TCL_TARGET = @TCL_TARGET@ TERM_LIBS = @TERM_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ diaprog = @diaprog@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlprog = @perlprog@ pkgprog = @pkgprog@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include \ -I$(top_srcdir)/lanserv -I$(top_srcdir)/utils AM_CPPFLAGS = -DSTATEDIR='"$(localstatedir)"' # sdrcomp.c #includes persist.c and string.c sdrcomp_DEPENDENCIES = $(top_srcdir)/lanserv/persist.c \ $(top_srcdir)/utils/string.c sdrcomp_SOURCES = sdrcomp.c sdrcomp_LDFLAGS = -lm # Build host version of the program sdrcomp_build_SOURCES = sdrcomp.c BUILD_SDRCOMP_DEPS = $(top_srcdir)/lanserv/persist.c \ $(top_srcdir)/utils/string.c BUILD_SDRCOMP_SRCS = $(top_srcdir)/$(subdir)/sdrcomp.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lanserv/sdrcomp/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lanserv/sdrcomp/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list sdrcomp$(EXEEXT): $(sdrcomp_OBJECTS) $(sdrcomp_DEPENDENCIES) $(EXTRA_sdrcomp_DEPENDENCIES) @rm -f sdrcomp$(EXEEXT) $(AM_V_CCLD)$(sdrcomp_LINK) $(sdrcomp_OBJECTS) $(sdrcomp_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdrcomp.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile sdrcomp_build$(EXEEXT): $(BUILD_SDRCOMP_SRCS) $(BUILD_SDRCOMP_DEPS) $(BUILD_CC) -o $@ $(BUILD_SDRCOMP_SRCS) $(AM_CFLAGS) -lm # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: OpenIPMI-2.0.27/lanserv/README.vm0000644000175000017500000001145612002623311013053 00000000000000The ipmi_sim command can be used as an IPMI simulator for a virtual machine. The virtual machine talks to the simulator over a TCP socket, and the simulator can control the virtual machine aspects that it needs to be able to control. A Quick Start ------------- This section describes a quick start for getting running using the OpenIPMI simulator with qemu-kvm. This assume you have qemu-kvm patched with the IPMI patches, or they have been included. You will need: OpenIPMI-2.0.21-rc1 or later A qemu bootable disk with Linux (or something else that can use IPMI) installed on it. qemu-kvm compiled with the proper IPMI patches First, configure OpenIPMI to install someplace. We will assume this is $HOME/x3. Do this with: ./configure --prefix=$HOME/x3/usr --sysconfdir=$HOME/x3/etc \ --with-perlinstall=$HOME/x3/usr/lib/perl \ --with-pythoninstall=$HOME/x3/usr/lib/python then "make", then "make install". Note that I also had to add --with-tclcflags="-I/usr/include/tcl8.5" --with-tcllibs="-ltcl8.5" to the configure line for the gui to work because the TCL configuration was screwed up on my machine. Then edit $HOME/x3/etc/ipmi/lan.conf and find the "startcmd" variable. Edit that for your configuration of qemu. You need to leave the -ipmi option as is, of course. Run $HOME/x3/usr/bin/ipmi_sim. This will start the simulator and it will also automatically start ("Power on") the VM. You can telnet to port 9003 to get a console to the VM. In the OpenIPMI build directory, type "make rungui". This will run the OpenIPMI GUI. Pull down "File" and select "OpenDomain". In the dialog that comes up, enter "test" for the Domain name, "localhost" for the Address, "9001" for the Port, "ipmiusr" for the Username, and "test" for the Password. Then select "Ok". (Note that the username and password are configured in the lan.conf file that gets installed in $HOME/x3/etc/ipmi.) You should have "test" in the list of domains. Open it up, then open "Entities", then "test(23.1 system_chassis)", then "Controls". You will see a power and reset control. Right click on those; you can set them to "0" or "1" to perform the obvious functions. You will see that the VM is already powered on as it was started when ipmi_sim started up. If you log in to the VM, you can do a "modprobe ipmi_si" and "modprobe ipmi_devintf" and talk to the simulated BMC from there. A full watchdog is also simulated, so you can do a "modprobe ipmi_watchdog" and get a watchdog timer running. If you have the watchdog loaded, go to the OpenIPMI GUI window and right click on the "test" entry (the topmost one). Choose "Display SELS". Then in the target login, do "echo 1 >/dev/watchdog". In about 10 seconds, the VM will reset and you will see the reset log in the IPMI SEL display window. The VM Interface ---------------- The VM interface is a much simplified interface similar to the direct mode IPMI serial codec. The framing is done with special characters. A 0xa0 character says that all characters since the last framing character (or beginning of the session) is an IPMI message. A 0xa1 character says that the preceding characters are a control command. A 0xaa character says to change bit 4 of the next character from a '1' to a '0'. This way, a 0xa0 data character is sent as 0xaa 0xb0. An IPMI message has the following format: seq netfn << 2 | lun cmd data... checksum 0xa0 The sequence is a one-byte sequence number, it will be returned in the response. The response is the same as above, except a completion code is added after the cmd byte. This is much like the KCS interface with a sequence number at the beginning. Commands are pretty simple. The first byte of a command is the command id. The rest is data for the command. There are two commands sent from the VM to the simulator. Command 0x08 is followed by a single byte with the following bits telling the simulator the capabilities of the VM. These bits are: bit 0 - can do a power off. bit 1 - can do a target reset. bit 2 - can enable/disable the IPMI interrupt. bit 3 - can generate an NMI. bit 4 - can set the ATTN bit on the interface. A reset command is sent from the VM to the simulator to say that a reset has occurred. The commands from the simulator to the VM are based on the above capabilities. The simulator will not send a command where the VM does not have the capability. None of these have any data with them. The commands are: 0xFF - The next byte is the version of the protocol, currently 1 0x00 - Clear ATTN 0x01 - Set ATTN without an interrupt 0x02 - Set ATTN with an interrupt 0x03 - Power off (shut down) the VM 0x04 - Reset the target in the VM 0x05 - Enable the IPMI messaging interrupt 0x06 - Disable the IPMI messaging interrupt 0x07 - Send an NMI from the BMC. That's pretty much it. The idea was to keep it simple.OpenIPMI-2.0.27/lanserv/lanserv.c0000664000175000017500000005001413160276607013405 00000000000000/* * lanserv.c * * MontaVista IPMI code for creating a LAN interface to an SMI interface. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* Option parsing made easy */ #include #include #include #include #if HAVE_SYSLOG #include #endif #include #include #include #include #include /* Stolen from ipmi_mc.h can't include that and linux/ipmi.h */ #define IPMI_CHANNEL_MEDIUM_8023_LAN 4 #include static int daemonize = 1; #define MAX_ADDR 4 static void lanserv_log(sys_data_t *sys, int logtype, msg_t *msg, const char *format, ...); typedef struct misc_data { int smi_fd; sys_data_t *sys; os_handler_t *os_hnd; os_handler_waiter_factory_t *waiter_factory; os_hnd_timer_id_t *timer; unsigned char bmc_ipmb; } misc_data_t; static void * balloc(sys_data_t *sys, int size) { return malloc(size); } static void bfree(sys_data_t *sys, void *data) { return free(data); } typedef struct lanserv_addr_s { sockaddr_ip_t addr; socklen_t addr_len; int xmit_fd; } lanserv_addr_t; static void lan_send(lanserv_data_t *lan, struct iovec *data, int vecs, void *addr, int addr_len) { struct msghdr msg; lanserv_addr_t *l = addr; int rv; msg.msg_name = &(l->addr); msg.msg_namelen = l->addr_len; msg.msg_iov = data; msg.msg_iovlen = vecs; msg.msg_control = NULL; msg.msg_controllen = 0; msg.msg_flags = 0; rv = sendmsg(l->xmit_fd, &msg, 0); if (rv) { /* FIXME - log an error. */ } } static void ipmb_addr_change_dev(channel_t *chan, unsigned char addr) { unsigned int slave_addr = addr; int rv; misc_data_t *info = chan->oem.user_data; info->bmc_ipmb = addr; rv = ioctl(info->smi_fd, IPMICTL_SET_MY_ADDRESS_CMD, &slave_addr); if (rv) { chan->log(chan, OS_ERROR, NULL, "Error setting IPMB address: 0x%x", errno); } } static int smi_send_dev(channel_t *chan, msg_t *msg) { struct ipmi_req req; char addr_data[sizeof(struct ipmi_addr)]; struct ipmi_addr *addr = (struct ipmi_addr *) addr_data; misc_data_t *info = chan->oem.user_data; int rv; if (info->sys->debug & DEBUG_MSG) { info->sys->log(info->sys, DEBUG, msg, "msg: netfn = 0x%2.2x cmd=%2.2x", msg->netfn, msg->cmd); } req.addr = (unsigned char *) addr; if (msg->cmd == IPMI_SEND_MSG_CMD) { struct ipmi_ipmb_addr *ipmb = (void *) addr; int pos; /* Send message has special handling */ if (msg->len < 8) return EMSGSIZE; ipmb->addr_type = IPMI_IPMB_ADDR_TYPE; ipmb->channel = msg->data[0] & 0xf; pos = 1; if (msg->data[pos] == 0) { ipmb->addr_type = IPMI_IPMB_BROADCAST_ADDR_TYPE; pos++; if (msg->len < 9) return EMSGSIZE; } ipmb->slave_addr = msg->data[pos]; ipmb->lun = msg->data[pos+1] & 0x3; req.addr_len = sizeof(*ipmb); req.msg.netfn = msg->data[pos+1] >> 2; req.msg.cmd = msg->data[pos+5]; req.msg.data = msg->data+pos+6; req.msg.data_len = msg->len-(pos + 7); /* Subtract last checksum, too */ } else { /* Normal message to the BMC. */ struct ipmi_system_interface_addr *si = (void *) addr; si->addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; si->channel = 0xf; si->lun = msg->rs_lun; req.addr_len = sizeof(*si); req.msg.netfn = msg->netfn; req.msg.cmd = msg->cmd; req.msg.data = msg->data; req.msg.data_len = msg->len; } req.msgid = (long) msg; rv = ioctl(info->smi_fd, IPMICTL_SEND_COMMAND, &req); if (rv == -1) { free(msg); return errno; } else return 0; } static int gen_rand(lanserv_data_t *lan, void *data, int len) { int fd = open("/dev/urandom", O_RDONLY); int rv; if (fd == -1) return errno; while (len > 0) { rv = read(fd, data, len); if (rv < 0) { rv = errno; goto out; } len -= rv; } rv = 0; out: close(fd); return rv; } static void handle_msg_ipmi_dev(int smi_fd, void *cb_data, os_hnd_fd_id_t *id) { misc_data_t *info = cb_data; struct ipmi_recv rsp; char addr_data[sizeof(struct ipmi_addr)]; struct ipmi_addr *addr = (struct ipmi_addr *) addr_data; unsigned char data[IPMI_MAX_MSG_LENGTH+8]; unsigned char rdata[IPMI_MAX_MSG_LENGTH]; int rv; msg_t *msg; rsp.addr = (unsigned char *) addr; rsp.addr_len = sizeof(struct ipmi_addr); rsp.msg.data = rdata; rsp.msg.data_len = sizeof(rdata); rv = ioctl(smi_fd, IPMICTL_RECEIVE_MSG_TRUNC, &rsp); if (rv == -1) { if (errno == EINTR) return; /* Try again later. */ if (errno == EMSGSIZE) { rdata[0] = IPMI_REQUEST_DATA_TRUNCATED_CC; rsp.msg.data_len = sizeof(rdata); } else { lanserv_log(NULL, DEBUG, NULL, "Error receiving message: %s\n", strerror(errno)); return; } } msg = (msg_t *) rsp.msgid; if (rdata[0] == IPMI_TIMEOUT_CC) { /* Ignore timeouts, we let the LAN code do the timeouts. */ free(msg); return; } /* We only handle responses. */ if (rsp.recv_type != IPMI_RESPONSE_RECV_TYPE) { free(msg); return; } if (addr->addr_type == IPMI_SYSTEM_INTERFACE_ADDR_TYPE) { /* Nothing to do. */ } else if (addr->addr_type == IPMI_IPMB_ADDR_TYPE) { struct ipmi_ipmb_addr *ipmb = (void *) addr; data[0] = 0; /* return code. */ data[1] = info->bmc_ipmb; data[2] = (rsp.msg.netfn << 2) | 2; data[3] = -ipmb_checksum(data+1, 2, 0); data[4] = ipmb->slave_addr; data[5] = (msg->data[4] & 0xfc) | ipmb->lun; data[6] = rsp.msg.cmd; memcpy(data+7, rsp.msg.data, rsp.msg.data_len); rsp.msg.data = data; rsp.msg.data_len += 8; data[rsp.msg.data_len-1] = -ipmb_checksum(data+1, rsp.msg.data_len-2, 0); } else { lanserv_log(NULL, DEBUG, NULL, "Error!\n"); return; } ipmi_handle_smi_rsp(info->sys->chan_set[msg->channel], msg, rsp.msg.data, rsp.msg.data_len); } static void lan_data_ready(int lan_fd, void *cb_data, os_hnd_fd_id_t *id) { lanserv_data_t *lan = cb_data; int len; lanserv_addr_t l; unsigned char data[256]; l.addr_len = sizeof(l.addr); len = recvfrom(lan_fd, data, sizeof(data), 0, (struct sockaddr *)&(l.addr), &(l.addr_len)); if (len < 0) { if (errno != EINTR) { perror("Error receiving message"); exit(1); } return; } l.xmit_fd = lan_fd; if (lan->sysinfo->debug & DEBUG_RAW_MSG) { debug_log_raw_msg(lan->sysinfo, (void *) &l.addr, l.addr_len, "Raw LAN receive from:"); debug_log_raw_msg(lan->sysinfo, data, len, " Receive message:"); } if (len < 4) return; if (data[0] != 6) return; /* Invalid version */ /* Check the message class. */ switch (data[3]) { case 6: handle_asf(lan, data, len, &l, sizeof(l)); break; case 7: ipmi_handle_lan_msg(lan, data, len, &l, sizeof(l)); break; } } static int ipmi_open(char *ipmi_dev) { int ipmi_fd; if (ipmi_dev) { ipmi_fd = open(ipmi_dev, O_RDWR); } else { ipmi_fd = open("/dev/ipmidev/0", O_RDWR); if (ipmi_fd == -1) { ipmi_fd = open("/dev/ipmi0", O_RDWR); } } if (ipmi_fd == -1) { perror("Could not open ipmi device /dev/ipmidev/0 or /dev/ipmi0"); } else { /* Set the timing parameters for the connection to no retries and 1 second timeout. The LAN connection will retry, there is no reason for us to. If this fails, oh well, the kernel doesn't support it. It's not the end of the world. */ struct ipmi_timing_parms parms; int rv; parms.retries = 0; parms.retry_time_ms = 1000; rv = ioctl(ipmi_fd, IPMICTL_SET_TIMING_PARMS_CMD, &parms); if (rv == -1) perror("Could not set timing parms"); } return ipmi_fd; } static int open_lan_fd(struct sockaddr *addr, socklen_t addr_len) { int fd; int rv; fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd == -1) { perror("Unable to create socket"); exit(1); } rv = bind(fd, addr, addr_len); if (rv == -1) { fprintf(stderr, "Unable to bind to LAN port: %s\n", strerror(errno)); exit(1); } return fd; } static void ilanserv_log(sys_data_t *sys, int logtype, msg_t *msg, const char *format, va_list ap, int len) { if (msg) { char *str, dummy; int pos; unsigned int i; #define mformat " channel=%d netfn=0x%x cmd=0x%x rs_addr=0x%x rs_lun=0x%x" \ " rq_addr=0x%x\n rq_lun=0x%x rq_seq=0x%x\n" len += snprintf(&dummy, 1, mformat, msg->channel, msg->netfn, msg->cmd, msg->rs_addr, msg->rs_lun, msg->rq_addr, msg->rq_lun, msg->rq_seq); len += 3 * msg->len + 3; str = malloc(len); if (!str) goto print_no_msg; pos = vsprintf(str, format, ap); str[pos++] = '\n'; pos += sprintf(str + pos, mformat, msg->channel, msg->netfn, msg->cmd, msg->rs_addr, msg->rs_lun, msg->rq_addr, msg->rq_lun, msg->rq_seq); #undef mformat for (i = 0; i < msg->len; i++) pos += sprintf(str + pos, " %2.2x", msg->data[i]); if (!daemonize || (logtype == DEBUG)) printf("%s\n", str); #if HAVE_SYSLOG if (logtype != DEBUG) syslog(LOG_NOTICE, "%s", str); #endif free(str); return; } print_no_msg: if (!daemonize || (logtype == DEBUG)) { vprintf(format, ap); printf("\n"); } #if HAVE_SYSLOG if (logtype != DEBUG) vsyslog(LOG_NOTICE, format, ap); #endif } static void lanserv_log(sys_data_t *sys, int logtype, msg_t *msg, const char *format, ...) { va_list ap; char dummy; int len; va_start(ap, format); len = vsnprintf(&dummy, 1, format, ap); va_end(ap); va_start(ap, format); ilanserv_log(sys, logtype, msg, format, ap, len); va_end(ap); } static void lanserv_chan_log(channel_t *sys, int logtype, msg_t *msg, const char *format, ...) { va_list ap; char dummy; int len; va_start(ap, format); len = vsnprintf(&dummy, 1, format, ap); va_end(ap); va_start(ap, format); ilanserv_log(NULL, logtype, msg, format, ap, len); va_end(ap); } static char *config_file = "/etc/ipmi/lan.conf"; static char *ipmi_dev = NULL; static struct poptOption poptOpts[]= { { "config-file", 'c', POPT_ARG_STRING, &config_file, 'c', "configuration file", "" }, { "ipmi-dev", 'i', POPT_ARG_STRING, &ipmi_dev, 'i', "IPMI device", "" }, { "debug", 'd', POPT_ARG_NONE, NULL, 'd', "debug", "" }, { "daemonize", 'n', POPT_ARG_NONE, NULL, 'n', "daemonize", "" }, POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } }; void init_oem_force(void); static ipmi_tick_handler_t *tick_handlers; void ipmi_register_tick_handler(ipmi_tick_handler_t *handler) { handler->next = tick_handlers; tick_handlers = handler; } static void tick(void *cb_data, os_hnd_timer_id_t *id) { misc_data_t *data = cb_data; struct timeval tv; int err; ipmi_tick_handler_t *h; h = tick_handlers; while(h) { h->handler(h->info, 1); h = h->next; } tv.tv_sec = 1; tv.tv_usec = 0; err = data->os_hnd->start_timer(data->os_hnd, data->timer, &tv, tick, data); if (err) { fprintf(stderr, "Unable to start timer: 0x%x\n", err); exit(1); } } static void * ialloc(channel_t *chan, int size) { return malloc(size); } static void ifree(channel_t *chan, void *data) { return free(data); } void sys_start_cmd(sys_data_t *sys) { } void ipmi_resend_atn(channel_t *chan) { } msg_t * ipmi_mc_get_next_recv_q(channel_t *chan) { return NULL; } void ipmi_set_chassis_control_prog(lmc_data_t *mc, const char *prog) { } int ipmi_mc_set_frudata_handler(lmc_data_t *mc, unsigned int fru, get_frudata_f handler, free_frudata_f freefunc) { return 0; } int ipmi_mc_alloc_unconfigured(sys_data_t *sys, unsigned char ipmb, lmc_data_t **rmc) { *rmc = (lmc_data_t *) sys; return 0; } channel_t ** ipmi_mc_get_channelset(lmc_data_t *mc) { sys_data_t *sys = (sys_data_t *) mc; return sys->chan_set; } int sol_read_config(char **tokptr, sys_data_t *sys, const char **err) { *err = "SOL not supported in lanserv"; return -1; } ipmi_sol_t * ipmi_mc_get_sol(lmc_data_t *mc) { return NULL; } startcmd_t * ipmi_mc_get_startcmdinfo(lmc_data_t *mc) { return NULL; } static user_t musers[MAX_USERS + 1]; unsigned char ipmi_mc_get_ipmb(lmc_data_t *mc) { return 0x20; } int ipmi_mc_users_changed(lmc_data_t *mc) { return 0; } user_t * ipmi_mc_get_users(lmc_data_t *mc) { return musers; } static pef_data_t mpef; pef_data_t * ipmi_mc_get_pef(lmc_data_t *mc) { return &mpef; } void ipmi_do_start_cmd(startcmd_t *startcmd) { pid_t pid; char *cmd; cmd = malloc(strlen(startcmd->startcmd) + 6); if (!cmd) return; strcpy(cmd, "exec "); strcpy(cmd + 5, startcmd->startcmd); pid = fork(); if (pid == -1) { free(cmd); return; } if (pid == 0) { char *args[4] = { "/bin/sh", "-c", cmd, NULL }; execvp(args[0], args); exit(1); } startcmd->vmpid = pid; free(cmd); } void ipmi_do_kill(startcmd_t *startcmd, int noblock) { if (noblock) kill(startcmd->vmpid, SIGKILL); else kill(startcmd->vmpid, SIGTERM); } static int ipmi_get_monotonic_time(sys_data_t *sys, struct timeval *tv) { misc_data_t *data = sys->info; os_handler_t *os_hnd = data->os_hnd; return os_hnd->get_monotonic_time(os_hnd, tv); } static int ipmi_get_real_time(sys_data_t *sys, struct timeval *tv) { misc_data_t *data = sys->info; os_handler_t *os_hnd = data->os_hnd; return os_hnd->get_real_time(os_hnd, tv); } int main(int argc, const char *argv[]) { sys_data_t sysinfo; misc_data_t data; int o; unsigned int i; int err; poptContext poptCtx; struct timeval tv; int lan_fd; os_hnd_fd_id_t *fd_id; unsigned int debug = 0; channel_t *channels[16]; #if HAVE_SYSLOG openlog(argv[0], LOG_CONS, LOG_DAEMON); #endif poptCtx = poptGetContext(argv[0], argc, argv, poptOpts, 0); while ((o = poptGetNextOpt(poptCtx)) >= 0) { switch (o) { case 'd': debug++; break; case 'n': daemonize = 0; break; } } poptFreeContext(poptCtx); data.bmc_ipmb = 0x20; data.sys = &sysinfo; data.os_hnd = ipmi_posix_setup_os_handler(); if (!data.os_hnd) { fprintf(stderr, "Unable to allocate OS handler\n"); exit(1); } err = os_handler_alloc_waiter_factory(data.os_hnd, 0, 0, &data.waiter_factory); if (err) { fprintf(stderr, "Unable to allocate waiter factory: 0x%x\n", err); exit(1); } err = data.os_hnd->alloc_timer(data.os_hnd, &data.timer); if (err) { fprintf(stderr, "Unable to allocate timer: 0x%x\n", err); exit(1); } /* Call the OEM init code. */ init_oem_force(); sysinfo_init(&sysinfo); sysinfo.alloc = balloc; sysinfo.free = bfree; sysinfo.log = lanserv_log; sysinfo.debug = debug; sysinfo.get_monotonic_time = ipmi_get_monotonic_time; sysinfo.get_real_time = ipmi_get_real_time; memset(channels, 0, sizeof(channels)); sysinfo.chan_set = channels; if (read_config(&sysinfo, config_file, 0)) exit(1); data.smi_fd = ipmi_open(ipmi_dev); if (data.smi_fd == -1) exit(1); err = data.os_hnd->add_fd_to_wait_for(data.os_hnd, data.smi_fd, handle_msg_ipmi_dev, &data, NULL, &fd_id); if (err) { fprintf(stderr, "Unable to add input wait: 0x%x\n", err); exit(1); } for (i = 0; i < IPMI_MAX_CHANNELS; i++) { channel_t *chan = channels[i]; if (!chan) continue; chan->smi_send = smi_send_dev; chan->oem.user_data = &data; chan->oem.ipmb_addr_change = ipmb_addr_change_dev; chan->alloc = ialloc; chan->free = ifree; chan->log = lanserv_chan_log; if (chan->medium_type == IPMI_CHANNEL_MEDIUM_8023_LAN) { lanserv_data_t *lan = chan->chan_info; lan->user_info = &data; lan->send_out = lan_send; lan->gen_rand = gen_rand; err = ipmi_lan_init(lan); if (err) { fprintf(stderr, "Unable to init lan: 0x%x\n", err); exit(1); } if (!lan->lan_addr_set) { struct sockaddr_in *ipaddr = (void *) &lan->lan_addr.addr; ipaddr->sin_family = AF_INET; ipaddr->sin_port = htons(623); ipaddr->sin_addr.s_addr = INADDR_ANY; lan->lan_addr.addr_len = sizeof(*ipaddr); lan->lan_addr_set = 1; } lan_fd = open_lan_fd(&lan->lan_addr.addr.s_ipsock.s_addr0, lan->lan_addr.addr_len); if (lan_fd == -1) { fprintf(stderr, "Unable to open LAN address %d\n", i+1); exit(1); } err = data.os_hnd->add_fd_to_wait_for(data.os_hnd, lan_fd, lan_data_ready, lan, NULL, &fd_id); if (err) { fprintf(stderr, "Unable to add socket wait: 0x%x\n", err); exit(1); } } else chan_init(chan); } if (daemonize) { int pid; if ((pid = fork()) > 0) { exit(0); } else if (pid < 0) { lanserv_log(NULL, LAN_ERR, NULL, "Error forking first fork"); exit(1); } else { /* setsid() is necessary if we really want to demonize */ setsid(); /* Second fork to really deamonize me. */ if ((pid = fork()) > 0) { exit(0); } else if (pid < 0) { lanserv_log(NULL, LAN_ERR, NULL, "Error forking second fork"); exit(1); } } } lanserv_log(NULL, LAN_ERR, NULL, "%s startup", argv[0]); tv.tv_sec = 1; tv.tv_usec = 0; err = data.os_hnd->start_timer(data.os_hnd, data.timer, &tv, tick, &data); if (err) { fprintf(stderr, "Unable to start timer: 0x%x\n", err); exit(1); } data.os_hnd->operation_loop(data.os_hnd); return 0; } OpenIPMI-2.0.27/lanserv/ipmi_sim.c0000664000175000017500000010615013406774065013550 00000000000000/* * ipmi_sim.c * * MontaVista IPMI code for creating a LAN interface, emulated system * interfaces, and a full BMC emulator. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005,2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* Option parsing made easy */ #include #include #include #include #include #if HAVE_SYSLOG #include #endif #include #include #include #include #include #include #include #include #include #include "emu.h" #include #define MAX_ADDR 4 #define BASE_CONF_STR SYSCONFDIR "/ipmi" static char *config_file = BASE_CONF_STR "/lan.conf"; static const char *statedir = STATEDIR; static char *command_string = NULL; static char *command_file = NULL; static int debug = 0; static int nostdio = 0; /* * Keep track of open sockets so we can close them on exec(). */ typedef struct isim_fd { int fd; struct isim_fd *next; } isim_fd_t; static isim_fd_t *isim_fds = NULL; static void isim_add_fd(int fd) { isim_fd_t *n = malloc(sizeof(*n)); if (!n) { fprintf(stderr, "Unable to add fd to list, out of memory\n"); exit(1); } n->fd = fd; n->next = isim_fds; isim_fds = n; } static void isim_close_fds(void) { isim_fd_t *n = isim_fds; while(n) { close(n->fd); n = n->next; } } static void shutdown_handler(int sig); typedef struct misc_data misc_data_t; typedef struct console_info_s { char buffer[1024]; unsigned int pos; int telnet; int echo; int shutdown_on_close; misc_data_t *data; int outfd; os_hnd_fd_id_t *conid; unsigned int tn_pos; unsigned char tn_buf[4]; emu_out_t out; struct console_info_s *prev; struct console_info_s *next; } console_info_t; struct misc_data { sys_data_t *sys; emu_data_t *emu; os_handler_t *os_hnd; os_handler_waiter_factory_t *waiter_factory; os_hnd_timer_id_t *timer; console_info_t *consoles; }; static misc_data_t *global_misc_data; static void * balloc(sys_data_t *sys, int size) { return malloc(size); } static void bfree(sys_data_t *sys, void *data) { return free(data); } typedef struct sim_addr_s { struct sockaddr_storage addr; socklen_t addr_len; int xmit_fd; } sim_addr_t; static int smi_send(channel_t *chan, msg_t *msg) { misc_data_t *data = chan->oem.user_data; unsigned char msgd[36]; unsigned int msgd_len = sizeof(msgd); ipmi_emu_handle_msg(data->emu, chan->mc, msg, msgd, &msgd_len); ipmi_handle_smi_rsp(chan, msg, msgd, msgd_len); return 0; } static int gen_rand(lanserv_data_t *lan, void *data, int len) { int fd = open("/dev/urandom", O_RDONLY); int rv; if (fd == -1) return errno; while (len > 0) { rv = read(fd, data, len); if (rv < 0) { rv = errno; goto out; } len -= rv; } rv = 0; out: close(fd); return rv; } static int sys_gen_rand(sys_data_t *lan, void *data, int len) { gen_rand(NULL, data, len); return 0; } static void lan_send(lanserv_data_t *lan, struct iovec *data, int vecs, void *addr, int addr_len) { struct msghdr msg; sim_addr_t *l = addr; int rv; /* When we send messages to ourself, we set the address to NULL so it won't be used. */ if (!l) return; memset(&msg, 0, sizeof(msg)); msg.msg_name = &(l->addr); msg.msg_namelen = l->addr_len; msg.msg_iov = data; msg.msg_iovlen = vecs; rv = sendmsg(l->xmit_fd, &msg, 0); if (rv) { /* FIXME - log an error. */ } } static void lan_data_ready(int lan_fd, void *cb_data, os_hnd_fd_id_t *id) { lanserv_data_t *lan = cb_data; int len; sim_addr_t l; unsigned char msgd[256]; l.addr_len = sizeof(l.addr); len = recvfrom(lan_fd, msgd, sizeof(msgd), 0, (struct sockaddr *) &(l.addr), &(l.addr_len)); if (len < 0) { if (errno != EINTR) { perror("Error receiving message"); exit(1); } goto out; } l.xmit_fd = lan_fd; if (lan->sysinfo->debug & DEBUG_RAW_MSG) { debug_log_raw_msg(lan->sysinfo, (void *) &l.addr, l.addr_len, "Raw LAN receive from:"); debug_log_raw_msg(lan->sysinfo, msgd, len, " Receive message:"); } if (len < 4) goto out; if (msgd[0] != 6) goto out; /* Invalid version */ /* Check the message class. */ switch (msgd[3]) { case 6: handle_asf(lan, msgd, len, &l, sizeof(l)); break; case 7: ipmi_handle_lan_msg(lan, msgd, len, &l, sizeof(l)); break; } out: return; } static int open_lan_fd(struct sockaddr *addr, socklen_t addr_len) { int fd; int rv; int opt; fd = socket(addr->sa_family, SOCK_DGRAM, IPPROTO_UDP); if (fd == -1) { perror("Unable to create socket"); exit(1); } opt = 1; rv = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); if (rv == -1) { fprintf(stderr, "Unable to set SO_REUSEADDR: %s\n", strerror(errno)); exit(1); } rv = bind(fd, addr, addr_len); if (rv == -1) { fprintf(stderr, "Unable to bind to LAN port: %s\n", strerror(errno)); exit(1); } isim_add_fd(fd); return fd; } static int lan_channel_init(void *info, channel_t *chan) { misc_data_t *data = info; lanserv_data_t *lan = chan->chan_info; int err; int lan_fd; os_hnd_fd_id_t *fd_id; unsigned char addr_data[6]; lan->user_info = data; lan->send_out = lan_send; lan->gen_rand = gen_rand; err = ipmi_lan_init(lan); if (err) { fprintf(stderr, "Unable to init lan: 0x%x\n", err); exit(1); } if (lan->guid) { lmc_data_t *sys = ipmi_emu_get_bmc_mc(data->emu); if (sys) ipmi_emu_set_mc_guid(sys, lan->guid, 0); } if (lan->lan_addr_set) { lan_fd = open_lan_fd(&lan->lan_addr.addr.s_ipsock.s_addr0, lan->lan_addr.addr_len); if (lan_fd == -1) { fprintf(stderr, "Unable to open LAN address\n"); exit(1); } memcpy(addr_data, &lan->lan_addr.addr.s_ipsock.s_addr4.sin_addr.s_addr, 4); memcpy(addr_data + 4, &lan->lan_addr.addr.s_ipsock.s_addr4.sin_port, 2); ipmi_emu_set_addr(data->emu, 0, 0, addr_data, 6); err = data->os_hnd->add_fd_to_wait_for(data->os_hnd, lan_fd, lan_data_ready, lan, NULL, &fd_id); if (err) { fprintf(stderr, "Unable to add socket wait: 0x%x\n", err); exit(1); } } return err; } static void ser_send(serserv_data_t *ser, unsigned char *data, unsigned int data_len) { int rv; if (ser->con_fd == -1) /* Not connected */ return; rv = write(ser->con_fd, data, data_len); if (rv) { /* FIXME - log an error. */ } } static void ser_data_ready(int fd, void *cb_data, os_hnd_fd_id_t *id) { serserv_data_t *ser = cb_data; int len; unsigned char msgd[256]; len = read(fd, msgd, sizeof(msgd)); if (len <= 0) { if ((len < 0) && (errno == EINTR)) return; if (ser->codec->disconnected) ser->codec->disconnected(ser); ser->os_hnd->remove_fd_to_wait_for(ser->os_hnd, id); close(fd); ser->con_fd = -1; return; } serserv_handle_data(ser, msgd, len); } static void ser_bind_ready(int fd, void *cb_data, os_hnd_fd_id_t *id) { serserv_data_t *ser = cb_data; int rv; int err; os_hnd_fd_id_t *fd_id; struct sockaddr_storage addr; socklen_t addr_len = sizeof(addr); int val = 1; rv = accept(fd, (struct sockaddr *) &addr, &addr_len); if (rv < 0) { perror("Error from accept"); exit(1); } if (ser->con_fd >= 0) { close(rv); return; } setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); setsockopt(rv, SOL_SOCKET, SO_KEEPALIVE, (char *)&val, sizeof(val)); ser->con_fd = rv; err = ser->os_hnd->add_fd_to_wait_for(ser->os_hnd, ser->con_fd, ser_data_ready, ser, NULL, &fd_id); if (err) { fprintf(stderr, "Unable to add serial socket wait: 0x%x\n", err); ser->con_fd = -1; close(rv); } else { if (ser->codec->connected) ser->codec->connected(ser); } } static int ser_channel_init(void *info, channel_t *chan) { misc_data_t *data = info; serserv_data_t *ser = chan->chan_info; int err; int fd; struct sockaddr *addr = &ser->addr.addr.s_ipsock.s_addr0; os_hnd_fd_id_t *fd_id; int val; ser->os_hnd = data->os_hnd; ser->user_info = data; ser->send_out = ser_send; err = serserv_init(ser); if (err) { fprintf(stderr, "Unable to init serial: 0x%x\n", err); exit(1); } fd = socket(addr->sa_family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { perror("Unable to create socket"); exit(1); } if (ser->do_connect) { err = connect(fd, addr, ser->addr.addr_len); if (err == -1) { fprintf(stderr, "Unable to connect to serial TCP port: %s\n", strerror(errno)); exit(1); } ser->con_fd = fd; ser->bind_fd = -1; err = data->os_hnd->add_fd_to_wait_for(data->os_hnd, ser->con_fd, ser_data_ready, ser, NULL, &fd_id); if (err) { fprintf(stderr, "Unable to add serial socket wait: 0x%x\n", err); exit(1); } } else { int opt = 1; err = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); if (err == -1) { fprintf(stderr, "Unable to set SO_REUSEADDR on serial TCP: %s\n", strerror(errno)); exit(1); } err = bind(fd, addr, ser->addr.addr_len); if (err == -1) { fprintf(stderr, "Unable to bind to serial TCP port: %s\n", strerror(errno)); exit(1); } ser->bind_fd = fd; ser->con_fd = -1; err = listen(fd, 1); if (err == -1) { fprintf(stderr, "Unable to listen to serial TCP port: %s\n", strerror(errno)); exit(1); } val = 1; err = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val)); if (err == -1) { fprintf(stderr, "Unable to set SO_REUSEADDR on socket: %s\n", strerror(errno)); exit(1); } err = data->os_hnd->add_fd_to_wait_for(data->os_hnd, ser->bind_fd, ser_bind_ready, ser, NULL, &fd_id); if (err) { fprintf(stderr, "Unable to add serial socket wait: 0x%x\n", err); exit(1); } } if (!err) isim_add_fd(fd); return err; } static void isim_log(sys_data_t *sys, int logtype, msg_t *msg, const char *format, va_list ap, int len) { misc_data_t *data = sys->info; char *str; console_info_t *con; if (msg) { char dummy; int pos; unsigned int i; #define mformat " channel=%d netfn=0x%x cmd=0x%x rs_addr=0x%x rs_lun=0x%x" \ " rq_addr=0x%x\n rq_lun=0x%x rq_seq=0x%x\n" len += snprintf(&dummy, 1, mformat, msg->channel, msg->netfn, msg->cmd, msg->rs_addr, msg->rs_lun, msg->rq_addr, msg->rq_lun, msg->rq_seq); len += 3 * msg->len + 3; str = malloc(len); if (!str) return; pos = vsprintf(str, format, ap); str[pos++] = '\n'; pos += sprintf(str + pos, mformat, msg->channel, msg->netfn, msg->cmd, msg->rs_addr, msg->rs_lun, msg->rq_addr, msg->rq_lun, msg->rq_seq); #undef mformat for (i = 0; i < msg->len; i++) pos += sprintf(str + pos, " %2.2x", msg->data[i]); } else { str = malloc(len + 1); if (!str) return; vsprintf(str, format, ap); } con = data->consoles; while (con) { con->out.eprintf(&con->out, "%s", str); con->out.eprintf(&con->out, "\n"); con = con->next; } #if HAVE_SYSLOG if (logtype == DEBUG) syslog(LOG_DEBUG, "%s", str); else syslog(LOG_NOTICE, "%s", str); #endif free(str); } static void sim_log(sys_data_t *sys, int logtype, msg_t *msg, const char *format, ...) { va_list ap; char dummy; int len; va_start(ap, format); len = vsnprintf(&dummy, 1, format, ap); va_end(ap); va_start(ap, format); isim_log(sys, logtype, msg, format, ap, len); va_end(ap); } static void sim_chan_log(channel_t *chan, int logtype, msg_t *msg, const char *format, ...) { va_list ap; char dummy; int len; va_start(ap, format); len = vsnprintf(&dummy, 1, format, ap); va_end(ap); va_start(ap, format); isim_log(global_misc_data->sys, logtype, msg, format, ap, len); va_end(ap); } static struct poptOption poptOpts[]= { { "config-file", 'c', POPT_ARG_STRING, &config_file, 'c', "configuration file", "" }, { "command-string", 'x', POPT_ARG_STRING, &command_string, 'x', "command string", "" }, { "command-file", 'f', POPT_ARG_STRING, &command_file, 'f', "command file", "" }, { "state-dir", 's', POPT_ARG_STRING, &statedir, 's', "state directory", "" }, { "debug", 'd', POPT_ARG_NONE, NULL, 'd', "debug", "" }, { "version", 'v', POPT_ARG_NONE, NULL, 'v', "version", "" }, { "nostdio", 'n', POPT_ARG_NONE, NULL, 'n', "nostdio", "" }, { "nopersist", 'p', POPT_ARG_NONE, NULL, 'p', "nopersist", "" }, POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } }; static void emu_printf(emu_out_t *out, char *format, ...) { console_info_t *info = out->data; va_list ap; char buffer[500]; int start = 0; int pos; va_start(ap, format); vsnprintf(buffer, sizeof(buffer), format, ap); va_end(ap); for (pos = 0; buffer[pos]; pos++) { if (buffer[pos] == '\n') { (void) write(info->outfd, buffer + start, pos - start + 1); (void) write(info->outfd, "\r", 1); start = pos + 1; } } if (pos != start) (void) write(info->outfd, buffer + start, pos - start); } static void dummy_printf(emu_out_t *out, char *format, ...) { } #define TN_IAC 255 #define TN_WILL 251 #define TN_WONT 252 #define TN_DO 253 #define TN_DONT 254 #define TN_OPT_SUPPRESS_GO_AHEAD 3 #define TN_OPT_ECHO 1 static unsigned char handle_telnet(console_info_t *info, unsigned char c) { info->tn_buf[info->tn_pos++] = c; if ((info->tn_pos == 2) && (info->tn_buf[1] == TN_IAC)) /* Double IAC, just send it on. */ return TN_IAC; if ((info->tn_pos == 2) && (info->tn_buf[1] < 250)) /* Ignore 1-byte commands */ goto cmd_done; if ((info->tn_pos == 3) && (info->tn_buf[1] != 250)) { /* Two byte commands */ switch (info->tn_buf[1]) { case TN_WILL: goto send_dont; case TN_WONT: break; case TN_DO: if ((info->tn_buf[2] == TN_OPT_ECHO) || (info->tn_buf[2] == TN_OPT_SUPPRESS_GO_AHEAD)) break; goto send_wont; } goto cmd_done; } if (info->tn_pos < 4) return 0; /* * We are in a suboption, which we ignore. Just look for * IAC 240 for the end. Use tn_buf[2] to track the last * character we got. */ if ((info->tn_buf[2] == TN_IAC) && (info->tn_buf[3] == 240)) goto cmd_done; info->tn_buf[2] = info->tn_buf[3]; info->tn_pos--; send_wont: info->tn_buf[1] = TN_WONT; (void) write(info->outfd, info->tn_buf, 3); goto cmd_done; send_dont: info->tn_buf[1] = TN_DONT; (void) write(info->outfd, info->tn_buf, 3); goto cmd_done; cmd_done: info->tn_pos = 0; return 0; } static int handle_user_char(console_info_t *info, unsigned char c) { if (info->tn_pos) c = handle_telnet(info, c); if (!c) return 0; switch(c) { case TN_IAC: if (info->telnet) { info->tn_buf[0] = c; info->tn_pos = 1; } else goto handle_char; break; case 8: case 0x7f: if (info->pos > 0) { info->pos--; if (info->echo) (void) write(info->outfd, "\b \b", 3); } break; case 4: if (info->pos == 0) { if (info->echo) (void) write(info->outfd, "\n", 1); return 1; } break; case 10: case 13: if (info->echo) { (void) write(info->outfd, "\n", 1); if (info->telnet) (void) write(info->outfd, "\r", 1); } info->buffer[info->pos] = '\0'; if (strcmp(info->buffer, "noecho") == 0) { info->echo = 0; } else { ipmi_emu_cmd(&info->out, info->data->emu, info->buffer); } (void) write(info->outfd, "> ", 2); info->pos = 0; break; handle_char: default: if (info->pos >= sizeof(info->buffer)-1) { char *msg = "\nCommand is too long, max of %d characters\n"; (void) write(info->outfd, msg, strlen(msg)); } else { info->buffer[info->pos] = c; info->pos++; if (info->echo) (void) write(info->outfd, &c, 1); } } return 0; } static void user_data_ready(int fd, void *cb_data, os_hnd_fd_id_t *id) { console_info_t *info = cb_data; unsigned char rc[50]; unsigned char *c = rc; int count; count = read(fd, rc, sizeof(rc)); if (count == 0) goto closeit; while (count > 0) { if (handle_user_char(info, *c)) goto closeit; c++; count--; } return; closeit: if (info->shutdown_on_close) { ipmi_emu_shutdown(info->data->emu); return; } info->data->os_hnd->remove_fd_to_wait_for(info->data->os_hnd, info->conid); close(fd); if (info->prev) info->prev->next = info->next; else info->data->consoles = info->next; if (info->next) info->next->prev = info->prev; free(info); } static void console_bind_ready(int fd, void *cb_data, os_hnd_fd_id_t *id) { misc_data_t *misc = cb_data; console_info_t *newcon; int rv; int err; struct sockaddr_storage addr; socklen_t addr_len = sizeof(addr); int val = 1; static unsigned char telnet_init_seq[] = { TN_IAC, TN_WILL, TN_OPT_SUPPRESS_GO_AHEAD, TN_IAC, TN_WILL, TN_OPT_ECHO, TN_IAC, TN_DONT, TN_OPT_ECHO, }; rv = accept(fd, (struct sockaddr *) &addr, &addr_len); if (rv < 0) { perror("Error from accept"); exit(1); } newcon = malloc(sizeof(*newcon)); if (!newcon) { char *msg = "Out of memory\n"; err = write(rv, msg, strlen(msg)); close(rv); return; } newcon->data = misc; newcon->outfd = rv; newcon->pos = 0; newcon->echo = 1; newcon->shutdown_on_close = 0; newcon->telnet = 1; newcon->tn_pos = 0; newcon->out.eprintf = emu_printf; newcon->out.data = newcon; setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); setsockopt(rv, SOL_SOCKET, SO_KEEPALIVE, (char *)&val, sizeof(val)); err = misc->os_hnd->add_fd_to_wait_for(misc->os_hnd, rv, user_data_ready, newcon, NULL, &newcon->conid); if (err) { char *msg = "Unable to add socket wait\n"; err = write(rv, msg, strlen(msg)); close(rv); free(newcon); return; } newcon->next = misc->consoles; if (newcon->next) newcon->next->prev = newcon; newcon->prev = NULL; misc->consoles = newcon; err = write(rv, telnet_init_seq, sizeof(telnet_init_seq)); err = write(rv, "> ", 2); } struct termios old_termios; int old_flags; static void init_term(void) { struct termios new_termios; tcgetattr(0, &old_termios); new_termios = old_termios; new_termios.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON); new_termios.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); new_termios.c_cc[VTIME] = 0; new_termios.c_cc[VMIN] = 0; tcsetattr(0, TCSADRAIN, &new_termios); } void ipmi_emu_shutdown(emu_data_t *emu) { misc_data_t *data = ipmi_emu_get_user_data(emu); console_info_t *con; if (data->sys->console_fd != -1) close(data->sys->console_fd); con = data->consoles; while (con) { data->os_hnd->remove_fd_to_wait_for(data->os_hnd, con->conid); close(con->outfd); con = con->next; } if (!nostdio) tcsetattr(0, TCSADRAIN, &old_termios); fcntl(0, F_SETFL, old_flags); tcdrain(0); shutdown_handler(0); exit(0); } /* Sleep and don't take any user input. */ static void sleeper(emu_data_t *emu, struct timeval *time) { misc_data_t *data = ipmi_emu_get_user_data(emu); os_handler_waiter_t *waiter; waiter = os_handler_alloc_waiter(data->waiter_factory); if (!waiter) { fprintf(stderr, "Unable to allocate waiter\n"); exit(1); } os_handler_waiter_wait(waiter, time); os_handler_waiter_release(waiter); } struct ipmi_io_s { os_hnd_fd_id_t *id; misc_data_t *data; void (*read_cb)(int fd, void *cb_data); void (*write_cb)(int fd, void *cb_data); void (*except_cb)(int fd, void *cb_data); void *cb_data; }; static void io_read_ready(int fd, void *cb_data, os_hnd_fd_id_t *id) { ipmi_io_t *io = cb_data; io->read_cb(fd, io->cb_data); } static void io_write_ready(int fd, void *cb_data, os_hnd_fd_id_t *id) { ipmi_io_t *io = cb_data; io->write_cb(fd, io->cb_data); } static void io_except_ready(int fd, void *cb_data, os_hnd_fd_id_t *id) { ipmi_io_t *io = cb_data; io->except_cb(fd, io->cb_data); } static void ipmi_io_set_hnds(ipmi_io_t *io, void (*write_hnd)(int fd, void *cb_data), void (*except_hnd)(int fd, void *cb_data)) { io->write_cb = write_hnd; io->except_cb = except_hnd; } static void ipmi_io_set_enables(ipmi_io_t *io, int read, int write, int except) { io->data->os_hnd->set_fd_enables(io->data->os_hnd, io->id, read, write, except); } static int ipmi_add_io_hnd(sys_data_t *sys, int fd, void (*read_hnd)(int fd, void *cb_data), void *cb_data, ipmi_io_t **rio) { ipmi_io_t *io; misc_data_t *data = sys->info; int err; io = malloc(sizeof(*io)); if (!io) return ENOMEM; io->data = data; io->read_cb = read_hnd; io->cb_data = cb_data; err = data->os_hnd->add_fd_to_wait_for(data->os_hnd, fd, io_read_ready, io, NULL, &io->id); if (err) { free(io); return err; } data->os_hnd->set_fd_handlers(data->os_hnd, io->id, io_write_ready, io_except_ready); *rio = io; return 0; } static void ipmi_remove_io_hnd(ipmi_io_t *io) { io->data->os_hnd->remove_fd_to_wait_for(io->data->os_hnd, io->id); } struct ipmi_timer_s { os_hnd_timer_id_t *id; misc_data_t *data; void (*cb)(void *cb_data); void *cb_data; }; static int ipmi_alloc_timer(sys_data_t *sys, void (*cb)(void *cb_data), void *cb_data, ipmi_timer_t **rtimer) { misc_data_t *data = sys->info; ipmi_timer_t *timer; int err; timer = malloc(sizeof(ipmi_timer_t)); if (!timer) return ENOMEM; timer->cb = cb; timer->cb_data = cb_data; timer->data = data; err = data->os_hnd->alloc_timer(data->os_hnd, &timer->id); if (err) { free(timer); return err; } *rtimer = timer; return 0; } static void timer_cb(void *cb_data, os_hnd_timer_id_t *id) { ipmi_timer_t *timer = cb_data; timer->cb(timer->cb_data); } static int ipmi_start_timer(ipmi_timer_t *timer, struct timeval *timeout) { return timer->data->os_hnd->start_timer(timer->data->os_hnd, timer->id, timeout, timer_cb, timer); } static int ipmi_stop_timer(ipmi_timer_t *timer) { return timer->data->os_hnd->stop_timer(timer->data->os_hnd, timer->id); } static void ipmi_free_timer(ipmi_timer_t *timer) { timer->data->os_hnd->free_timer(timer->data->os_hnd, timer->id); } static ipmi_tick_handler_t *tick_handlers; void ipmi_register_tick_handler(ipmi_tick_handler_t *handler) { handler->next = tick_handlers; tick_handlers = handler; } static void tick(void *cb_data, os_hnd_timer_id_t *id) { misc_data_t *data = cb_data; struct timeval tv; int err; ipmi_tick_handler_t *h; h = tick_handlers; while(h) { h->handler(h->info, 1); h = h->next; } ipmi_emu_tick(data->emu, 1); tv.tv_sec = 1; tv.tv_usec = 0; err = data->os_hnd->start_timer(data->os_hnd, data->timer, &tv, tick, data); if (err) { fprintf(stderr, "Unable to start timer: 0x%x\n", err); exit(1); } } static void * ialloc(channel_t *chan, int size) { return malloc(size); } static void ifree(channel_t *chan, void *data) { return free(data); } static int sigpipeh[2] = {-1, -1}; static void handle_sigchld(int sig) { unsigned char c = 1; (void) write(sigpipeh[1], &c, 1); } static ipmi_child_quit_t *child_quit_handlers; void ipmi_register_child_quit_handler(ipmi_child_quit_t *handler) { handler->next = child_quit_handlers; child_quit_handlers = handler; } static void sigchld_ready(int fd, void *cb_data, os_hnd_fd_id_t *id) { char buf; int rv; int status; ipmi_child_quit_t *h; rv = read(sigpipeh[0], &buf, 1); rv = waitpid(-1, &status, WNOHANG); if (rv == -1) return; h = child_quit_handlers; while (h) { h->handler(h->info, rv); h = h->next; } } static ipmi_shutdown_t *shutdown_handlers; void ipmi_register_shutdown_handler(ipmi_shutdown_t *handler) { handler->next = shutdown_handlers; shutdown_handlers = handler; } static int shutdown_sigs[] = { SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTERM, SIGBUS, 0 }; static void shutdown_handler(int sig) { ipmi_shutdown_t *h = shutdown_handlers; while (h) { h->handler(h->info, sig); h = h->next; } if (sig) raise(sig); } void ipmi_do_start_cmd(startcmd_t *startcmd) { pid_t pid; char *cmd; cmd = malloc(strlen(startcmd->startcmd) + 6); if (!cmd) return; strcpy(cmd, "exec "); strcpy(cmd + 5, startcmd->startcmd); pid = fork(); if (pid == -1) { free(cmd); return; } if (pid == 0) { char *args[4] = { "/bin/sh", "-c", cmd, NULL }; isim_close_fds(); execvp(args[0], args); exit(1); } startcmd->vmpid = pid; free(cmd); } void ipmi_do_kill(startcmd_t *startcmd, int noblock) { if (noblock) kill(startcmd->vmpid, SIGKILL); else kill(startcmd->vmpid, SIGTERM); } static int ipmi_get_monotonic_time(sys_data_t *sys, struct timeval *tv) { misc_data_t *data = sys->info; os_handler_t *os_hnd = data->os_hnd; return os_hnd->get_monotonic_time(os_hnd, tv); } static int ipmi_get_real_time(sys_data_t *sys, struct timeval *tv) { misc_data_t *data = sys->info; os_handler_t *os_hnd = data->os_hnd; return os_hnd->get_real_time(os_hnd, tv); } int main(int argc, const char *argv[]) { sys_data_t sysinfo; misc_data_t data; int err, rv = 1; int i; poptContext poptCtx; struct timeval tv; console_info_t stdio_console; struct sigaction act; os_hnd_fd_id_t *conid; lmc_data_t *mc; int print_version = 0; poptCtx = poptGetContext(argv[0], argc, argv, poptOpts, 0); while ((i = poptGetNextOpt(poptCtx)) >= 0) { switch (i) { case 'd': debug++; break; case 'n': nostdio = 1; break; case 'v': print_version = 1; break; case 'p': persist_enable = 0; break; } } poptFreeContext(poptCtx); printf("IPMI Simulator version %s\n", PVERSION); global_misc_data = &data; data.os_hnd = ipmi_posix_setup_os_handler(); if (!data.os_hnd) { fprintf(stderr, "Unable to allocate OS handler\n"); exit(1); } err = os_handler_alloc_waiter_factory(data.os_hnd, 0, 0, &data.waiter_factory); if (err) { fprintf(stderr, "Unable to allocate waiter factory: 0x%x\n", err); exit(1); } err = data.os_hnd->alloc_timer(data.os_hnd, &data.timer); if (err) { fprintf(stderr, "Unable to allocate timer: 0x%x\n", err); exit(1); } sysinfo_init(&sysinfo); sysinfo.info = &data; sysinfo.alloc = balloc; sysinfo.free = bfree; sysinfo.get_monotonic_time = ipmi_get_monotonic_time; sysinfo.get_real_time = ipmi_get_real_time; sysinfo.alloc_timer = ipmi_alloc_timer; sysinfo.start_timer = ipmi_start_timer; sysinfo.stop_timer = ipmi_stop_timer; sysinfo.free_timer = ipmi_free_timer; sysinfo.add_io_hnd = ipmi_add_io_hnd; sysinfo.io_set_hnds = ipmi_io_set_hnds; sysinfo.io_set_enables = ipmi_io_set_enables; sysinfo.remove_io_hnd = ipmi_remove_io_hnd; sysinfo.gen_rand = sys_gen_rand; sysinfo.debug = debug; sysinfo.log = sim_log; sysinfo.csmi_send = smi_send; sysinfo.clog = sim_chan_log; sysinfo.calloc = ialloc; sysinfo.cfree = ifree; sysinfo.lan_channel_init = lan_channel_init; sysinfo.ser_channel_init = ser_channel_init; data.sys = &sysinfo; err = pipe(sigpipeh); if (err) { perror("Creating signal handling pipe"); exit(1); } act.sa_handler = handle_sigchld; sigemptyset(&act.sa_mask); act.sa_flags = 0; err = sigaction(SIGCHLD, &act, NULL); if (err) { perror("setting up sigchld sigaction"); exit(1); } err = data.os_hnd->add_fd_to_wait_for(data.os_hnd, sigpipeh[0], sigchld_ready, &data, NULL, &conid); if (err) { fprintf(stderr, "Unable to sigchld pipe wait: 0x%x\n", err); exit(1); } data.emu = ipmi_emu_alloc(&data, sleeper, &sysinfo); /* Set this up for console I/O, even if we don't use it. */ stdio_console.data = &data; stdio_console.outfd = 1; stdio_console.pos = 0; stdio_console.echo = 1; stdio_console.shutdown_on_close = 1; stdio_console.telnet = 0; stdio_console.tn_pos = 0; if (nostdio) { stdio_console.out.eprintf = dummy_printf; stdio_console.out.data = &stdio_console; } else { stdio_console.out.eprintf = emu_printf; stdio_console.out.data = &stdio_console; } stdio_console.next = NULL; stdio_console.prev = NULL; data.consoles = &stdio_console; err = ipmi_mc_alloc_unconfigured(&sysinfo, 0x20, &mc); if (err) { if (err == ENOMEM) fprintf(stderr, "Out of memory allocation BMC MC\n"); exit(1); } sysinfo.mc = mc; sysinfo.chan_set = ipmi_mc_get_channelset(mc); sysinfo.startcmd = ipmi_mc_get_startcmdinfo(mc); sysinfo.cpef = ipmi_mc_get_pef(mc); sysinfo.cusers = ipmi_mc_get_users(mc); sysinfo.sol = ipmi_mc_get_sol(mc); if (read_config(&sysinfo, config_file, print_version)) exit(1); if (print_version) exit(0); if (!sysinfo.name) { fprintf(stderr, "name not set in config file\n"); exit(1); } err = persist_init("ipmi_sim", sysinfo.name, statedir); if (err) { fprintf(stderr, "Unable to initialize persistence: %s\n", strerror(err)); exit(1); } read_persist_users(&sysinfo); err = sol_init(&sysinfo); if (err) { fprintf(stderr, "Unable to initialize SOL: %s\n", strerror(err)); goto out; } err = read_sol_config(&sysinfo); if (err) { fprintf(stderr, "Unable to read SOL configs: %s\n", strerror(err)); goto out; } err = load_dynamic_libs(&sysinfo, 0); if (err) goto out; if (!command_file) { FILE *tf; command_file = malloc(strlen(BASE_CONF_STR) + 6 + strlen(sysinfo.name)); if (!command_file) { fprintf(stderr, "Out of memory\n"); goto out; } strcpy(command_file, BASE_CONF_STR); strcat(command_file, "/"); strcat(command_file, sysinfo.name); strcat(command_file, ".emu"); tf = fopen(command_file, "r"); if (!tf) { free(command_file); command_file = NULL; } else { fclose(tf); } } if (command_file) read_command_file(&stdio_console.out, data.emu, command_file); if (command_string) ipmi_emu_cmd(&stdio_console.out, data.emu, command_string); if (!sysinfo.bmc_ipmb || !sysinfo.ipmb_addrs[sysinfo.bmc_ipmb]) { sysinfo.log(&sysinfo, SETUP_ERROR, NULL, "No bmc_ipmb specified or configured."); goto out; } sysinfo.console_fd = -1; if (sysinfo.console_addr_len) { int nfd; int val; nfd = socket(sysinfo.console_addr.s_ipsock.s_addr0.sa_family, SOCK_STREAM, IPPROTO_TCP); if (nfd == -1) { perror("Console socket open"); goto out; } err = bind(nfd, (struct sockaddr *) &sysinfo.console_addr, sysinfo.console_addr_len); if (err) { perror("bind to console socket"); goto out; } err = listen(nfd, 1); if (err == -1) { perror("listen to console socket"); goto out; } val = 1; err = setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val)); if (err) { perror("console setsockopt reuseaddr"); goto out; } sysinfo.console_fd = nfd; err = data.os_hnd->add_fd_to_wait_for(data.os_hnd, nfd, console_bind_ready, &data, NULL, &conid); if (err) { fprintf(stderr, "Unable to add console wait: 0x%x\n", err); goto out; } else { isim_add_fd(nfd); } } if (!nostdio) { init_term(); err = write(1, "> ", 2); err = data.os_hnd->add_fd_to_wait_for(data.os_hnd, 0, user_data_ready, &stdio_console, NULL, &stdio_console.conid); if (err) { fprintf(stderr, "Unable to add input wait: 0x%x\n", err); goto out; } } post_init_dynamic_libs(&sysinfo); act.sa_handler = shutdown_handler; act.sa_flags = SA_RESETHAND; for (i = 0; shutdown_sigs[i]; i++) { err = sigaction(shutdown_sigs[i], &act, NULL); if (err) { fprintf(stderr, "Unable to register shutdown signal %d: %s\n", shutdown_sigs[i], strerror(errno)); } } tv.tv_sec = 1; tv.tv_usec = 0; err = data.os_hnd->start_timer(data.os_hnd, data.timer, &tv, tick, &data); if (err) { fprintf(stderr, "Unable to start timer: 0x%x\n", err); goto out; } data.os_hnd->operation_loop(data.os_hnd); rv = 0; out: shutdown_handler(0); exit(rv); } OpenIPMI-2.0.27/lanserv/serial_ipmi.c0000664000175000017500000007434113160276476014245 00000000000000/* * serial_ipmi.c * * MontaVista IPMI LAN server serial port interface. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2012 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include #include #include #define EVENT_BUFFER_GLOBAL_ENABLE (1 << 2) #define EVENT_LOG_GLOBAL_ENABLE (1 << 3) #define SUPPORTED_GLOBAL_ENABLES (EVENT_BUFFER_GLOBAL_ENABLE | \ EVENT_LOG_GLOBAL_ENABLE) static void raw_send(serserv_data_t *si, unsigned char *data, unsigned int len) { if (si->sysinfo->debug & DEBUG_RAW_MSG) debug_log_raw_msg(si->sysinfo, data, len, "Raw serial send:"); si->send_out(si, data, len); } static unsigned char hex2char[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; static int fromhex(unsigned char c) { if (isdigit(c)) return c - '0'; else if (isxdigit(c)) return tolower(c) - 'a' + 10; else return -1; } static int unformat_ipmb_msg(msg_t *msg, unsigned char *msgd, unsigned int len, serserv_data_t *si) { if (len < 7) { fprintf(stderr, "Message too short\n"); return -1; } if (ipmb_checksum(msgd, len, 0) != 0) { fprintf(stderr, "Message checksum failure\n"); return -1; } len--; msg->rs_addr = msgd[0]; msg->netfn = msgd[1] >> 2; msg->rs_lun = msgd[1] & 3; msg->rq_addr = msgd[3]; msg->rq_seq = msgd[4] >> 2; msg->rq_lun = msgd[4] & 3; msg->cmd = msgd[5]; msg->len = len - 6; msg->data = msgd + 6; msg->src_addr = NULL; msg->src_len = 0; return 0; } static void format_ipmb_rsp(msg_t *msg, unsigned char *msgd, unsigned int *msgd_len, serserv_data_t *mi) { msgd[0] = msg->rs_addr; msgd[1] = (msg->netfn << 2) | msg->rs_lun; msgd[2] = -ipmb_checksum(msgd, 2, 0); msgd[3] = msg->rq_addr; msgd[4] = (msg->rq_seq << 2) | msg->rq_lun; msgd[5] = msg->cmd; memcpy(msgd + 6, msg->data, msg->len); *msgd_len = msg->len + 6; msgd[*msgd_len] = -ipmb_checksum(msgd + 3, (*msgd_len) - 3, 0); (*msgd_len)++; } static void handle_attn(channel_t *chan, int val, int irq) { serserv_data_t *si = chan->chan_info; if (val && si->do_attn) raw_send(si, si->attn_chars, si->attn_chars_len); } /*********************************************************************** * * Radisys ASCII codec. * ***********************************************************************/ #define RA_MAX_CHARS_SIZE (((IPMI_SIM_MAX_MSG_LENGTH + 1) * 3) + 4) struct ra_data { unsigned char recv_chars[RA_MAX_CHARS_SIZE]; unsigned int recv_chars_len; int recv_chars_too_many; }; static void ra_format_msg(const unsigned char *msg, unsigned int msg_len, serserv_data_t *si) { unsigned int i; unsigned int len; unsigned char c[RA_MAX_CHARS_SIZE]; len = 0; for (i = 0; i < msg_len; i++) { c[len] = hex2char[msg[i] >> 4]; len++; c[len] = hex2char[msg[i] & 0xf]; len++; } c[len] = 0x0d; len++; raw_send(si, c, len); } static int ra_ipmb_handler(channel_t *chan, msg_t *msg) { serserv_data_t *si = chan->chan_info; ra_format_msg(msg->data, msg->len, si); free(msg); return 1; } /* * Called when the '0x0d' is seen. */ static int ra_unformat_msg(unsigned char *r, unsigned int len, serserv_data_t *si) { unsigned char real_o[IPMI_SIM_MAX_MSG_LENGTH + 1]; unsigned char *o = real_o + 1; msg_t msg; unsigned int p = 0; unsigned int i = 0; int rv; if (si->sysinfo->debug & DEBUG_RAW_MSG) debug_log_raw_msg(si->sysinfo, r, len, "Raw serial receive:"); while (p < len) { rv = fromhex(r[p]); if (rv < 0) return rv; o[i] = rv << 4; p++; if (p >= len) return -1; rv = fromhex(r[p]); if (rv < 0) return rv; o[i] |= rv; p++; i++; } if (i < 1) return -1; memset(&msg, 0, sizeof(msg)); if ((o[0] == si->sysinfo->bmc_ipmb) || (o[0] == 1)) { rv = unformat_ipmb_msg(&msg, o, i, si); if (rv) return rv; } else { msg.rs_addr = 1; msg.netfn = IPMI_APP_NETFN; msg.rs_lun = 0; msg.rq_addr = 1; msg.rq_seq = 0; msg.rq_lun = 0; msg.cmd = IPMI_SEND_MSG_CMD; msg.len = i + 1; msg.data = real_o; real_o[0] = 0; } channel_smi_send(&si->channel, &msg); return 0; } static void ra_handle_char(unsigned char ch, serserv_data_t *si) { struct ra_data *info = si->codec_info; unsigned int len = info->recv_chars_len; unsigned char *r; int rv; if (ch == 0x0d) { /* End of command, handle it. */ if (info->recv_chars_too_many) { /* Input data overrun. */ fprintf(stderr, "Data overrun\n"); info->recv_chars_too_many = 0; info->recv_chars_len = 0; return; } rv = ra_unformat_msg(info->recv_chars, info->recv_chars_len, si); info->recv_chars_too_many = 0; info->recv_chars_len = 0; if (rv) { /* Bad input data. */ fprintf(stderr, "Bad input data\n"); return; } return; } if (info->recv_chars_too_many) return; r = info->recv_chars; if (len >= sizeof(info->recv_chars)) { info->recv_chars_too_many = 1; } else if ((len > 0) && isspace(r[len-1]) && isspace(ch)) { /* Ignore multiple spaces together. */ } else { r[len] = ch; info->recv_chars_len++; } } static void ra_send(msg_t *omsg, serserv_data_t *si) { unsigned char msg[IPMI_SIM_MAX_MSG_LENGTH + 7]; unsigned int msg_len; if (omsg->netfn == IPMI_APP_NETFN && omsg->cmd == IPMI_SEND_MSG_CMD) return; /* These are dummies, ignore them. */ format_ipmb_rsp(omsg, msg, &msg_len, si); ra_format_msg(msg, msg_len, si); } int ra_setup(serserv_data_t *si) { struct ra_data *info; info = malloc(sizeof(*info)); if (!info) return -1; info->recv_chars_len = 0; info->recv_chars_too_many = 0; si->codec_info = info; si->channel.recv_in_q = ra_ipmb_handler; return 0; } /*********************************************************************** * * Direct Mode codec. * ***********************************************************************/ #define DM_START_CHAR 0xA0 #define DM_STOP_CHAR 0xA5 #define DM_PACKET_HANDSHAKE 0xA6 #define DM_DATA_ESCAPE_CHAR 0xAA struct dm_data { unsigned char recv_msg[IPMI_SIM_MAX_MSG_LENGTH + 4]; unsigned int recv_msg_len; int recv_msg_too_many; int in_recv_msg; int in_escape; }; static void dm_handle_msg(unsigned char *imsg, unsigned int len, serserv_data_t *si) { int rv; msg_t msg; if (si->sysinfo->debug & DEBUG_RAW_MSG) debug_log_raw_msg(si->sysinfo, imsg, len, "Raw serial receive:"); memset(&msg, 0, sizeof(msg)); rv = unformat_ipmb_msg(&msg, imsg, len, si); if (rv) return; channel_smi_send(&si->channel, &msg); } static void dm_handle_char(unsigned char ch, serserv_data_t *si) { struct dm_data *info = si->codec_info; unsigned int len = info->recv_msg_len; unsigned char c; switch (ch) { case DM_START_CHAR: if (info->in_recv_msg) fprintf(stderr, "Msg started in the middle of another\n"); info->in_recv_msg = 1; info->recv_msg_len = 0; info->recv_msg_too_many = 0; info->in_escape = 0; break; case DM_STOP_CHAR: if (!info->in_recv_msg) fprintf(stderr, "Empty message\n"); else if (info->in_escape) { info->in_recv_msg = 0; fprintf(stderr, "Message ended in escape\n"); } else if (info->recv_msg_too_many) { fprintf(stderr, "Message too long\n"); info->in_recv_msg = 0; } else { dm_handle_msg(info->recv_msg, info->recv_msg_len, si); info->in_recv_msg = 0; } info->in_escape = 0; c = DM_PACKET_HANDSHAKE; raw_send(si, &c, 1); break; case DM_PACKET_HANDSHAKE: info->in_escape = 0; break; case DM_DATA_ESCAPE_CHAR: if (!info->recv_msg_too_many) info->in_escape = 1; break; default: if (!info->in_recv_msg) /* Ignore characters outside of messages. */ break; if (info->in_escape) { info->in_escape = 0; switch (ch) { case 0xB0: ch = DM_START_CHAR; break; case 0xB5: ch = DM_STOP_CHAR; break; case 0xB6: ch = DM_PACKET_HANDSHAKE; break; case 0xBA: ch = DM_DATA_ESCAPE_CHAR; break; case 0x3B: ch = 0x1b; break; default: fprintf(stderr, "Invalid escape char: 0x%x\n", ch); info->recv_msg_too_many = 1; return; } } if (!info->recv_msg_too_many) { if (len >= sizeof(info->recv_msg)) { info->recv_msg_too_many = 1; break; } info->recv_msg[len] = ch; info->recv_msg_len++; } break; } } static void dm_send(msg_t *imsg, serserv_data_t *si) { unsigned int i; unsigned int len = 0; unsigned char c[(IPMI_SIM_MAX_MSG_LENGTH + 7) * 2]; unsigned char msg[IPMI_SIM_MAX_MSG_LENGTH + 7]; unsigned int msg_len; format_ipmb_rsp(imsg, msg, &msg_len, si); c[len++] = 0xA0; for (i = 0; i < msg_len; i++) { switch (msg[i]) { case 0xA0: c[len++] = 0xAA; c[len++] = 0xB0; break; case 0xA5: c[len++] = 0xAA; c[len++] = 0xB5; break; case 0xA6: c[len++] = 0xAA; c[len++] = 0xB6; break; case 0xAA: c[len++] = 0xAA; c[len++] = 0xBA; break; case 0x1B: c[len++] = 0xAA; c[len++] = 0x3B; break; default: c[len++] = msg[i]; } } c[len++] = 0xA5; raw_send(si, c, len); } static int dm_setup(serserv_data_t *si) { struct dm_data *info; info = malloc(sizeof(*info)); if (!info) return -1; memset(info, 0, sizeof(*info)); si->channel.set_atn = handle_attn; si->codec_info = info; return 0; } /*********************************************************************** * * Terminal Mode codec. * ***********************************************************************/ #define TM_MAX_CHARS_SIZE (((IPMI_SIM_MAX_MSG_LENGTH + 1) * 3) + 4) struct tm_data { unsigned char recv_chars[TM_MAX_CHARS_SIZE]; unsigned int recv_chars_len; int recv_chars_too_many; }; static void tm_send(msg_t *msg, serserv_data_t *si) { unsigned int i; unsigned int len; unsigned char c[TM_MAX_CHARS_SIZE]; unsigned char t; len = 0; c[len] = '['; len++; t = msg->netfn << 2 | msg->rs_lun; c[len] = hex2char[t >> 4]; len++; c[len] = hex2char[t & 0xf]; len++; /* * Insert the sequence number and bridge bits. Bridge bits * are always zero. */ t = msg->rq_seq << 2; c[len] = hex2char[t >> 4]; len++; c[len] = hex2char[t & 0xf]; len++; c[len] = hex2char[msg->cmd >> 4]; len++; c[len] = hex2char[msg->cmd & 0xf]; len++; /* Now the rest of the message. */ for (i = 0; ; ) { c[len] = hex2char[msg->data[i] >> 4]; len++; c[len] = hex2char[msg->data[i] & 0xf]; len++; i++; if (i == msg->len) break; c[len] = ' '; len++; } c[len] = ']'; len++; c[len] = 0x0a; len++; raw_send(si, c, len); } /* * Called when the ']' is seen, the leading '[' is removed, too. We * get this with a leading space and no more than one space between * items. */ static int tm_unformat_msg(unsigned char *r, unsigned int len, serserv_data_t *si) { unsigned char o[IPMI_SIM_MAX_MSG_LENGTH]; msg_t msg; unsigned int p = 0; unsigned int i = 0; int rv; if (si->sysinfo->debug & DEBUG_RAW_MSG) debug_log_raw_msg(si->sysinfo, r, len, "Raw serial receive:"); #define SKIP_SPACE if (isspace(r[p])) p++ #define ENSURE_MORE if (p >= len) return -1 SKIP_SPACE; while (p < len) { if (i >= sizeof(o)) return -1; ENSURE_MORE; rv = fromhex(r[p]); if (rv < 0) return rv; o[i] = rv << 4; p++; ENSURE_MORE; rv = fromhex(r[p]); if (rv < 0) return rv; o[i] |= rv; p++; i++; SKIP_SPACE; } if (i < 3) return -1; memset(&msg, 0, sizeof(msg)); msg.netfn = o[0] >> 2; msg.rq_lun = o[0] & 3; msg.rq_seq = o[1] >> 2; msg.cmd = o[2]; msg.data = o + 3; msg.len = i - 3; msg.src_addr = NULL; msg.src_len = 0; channel_smi_send(&si->channel, &msg); return 0; #undef SKIP_SPACE #undef ENSURE_MORE } static void tm_handle_char(unsigned char ch, serserv_data_t *si) { struct tm_data *info = si->codec_info; unsigned int len = info->recv_chars_len; unsigned char *r; int rv; if (ch == '[') { /* * Start of a command. Note that if a command is * already in progress (len != 0) we abort it. */ if (len != 0) fprintf(stderr, "Msg started in the middle of another\n"); /* Convert the leading '[' to a space, that's innocuous. */ info->recv_chars[0] = ' '; info->recv_chars_len = 1; info->recv_chars_too_many = 0; return; } if (len == 0) /* Ignore everything outside [ ]. */ return; if (ch == ']') { /* End of command, handle it. */ if (info->recv_chars_too_many) { /* Input data overrun. */ fprintf(stderr, "Data overrun\n"); info->recv_chars_too_many = 0; info->recv_chars_len = 0; return; } rv = tm_unformat_msg(info->recv_chars, info->recv_chars_len, si); info->recv_chars_too_many = 0; info->recv_chars_len = 0; if (rv) { /* Bad input data. */ fprintf(stderr, "Bad input data\n"); return; } return; } if (info->recv_chars_too_many) return; r = info->recv_chars; if (len >= sizeof(info->recv_chars)) { info->recv_chars_too_many = 1; } else if ((len > 0) && isspace(r[len-1]) && isspace(ch)) { /* Ignore multiple spaces together. */ } else { r[len] = ch; info->recv_chars_len++; } } static int tm_setup(serserv_data_t *si) { struct tm_data *info; info = malloc(sizeof(*info)); if (!info) return -1; info->recv_chars_len = 0; info->recv_chars_too_many = 0; si->channel.set_atn = handle_attn; si->codec_info = info; return 0; } /*********************************************************************** * * VM Mode codec. * ***********************************************************************/ /* * This protocol has an end-of-message marker, everything from the * beginning or the last end of message is a new message (or command). * Messages are normal IPMI messages with the following header: * * seq * netfn << 2 | lun * cmd * data.... * checksum * * The sequence is return in the response as-is. * Commands are special things to alert the other end of things like * attn, requests for reset/nmi/etc. */ #define VM_MSG_CHAR 0xA0 /* Marks end of message */ #define VM_CMD_CHAR 0xA1 /* Marks end of a command */ #define VM_ESCAPE_CHAR 0xAA /* Set bit 4 from the next byte to 0 */ #define VM_PROTOCOL_VERSION 1 #define VM_CMD_VERSION 0xff /* A version number byte follows */ #define VM_CMD_NOATTN 0x00 #define VM_CMD_ATTN 0x01 #define VM_CMD_ATTN_IRQ 0x02 #define VM_CMD_POWEROFF 0x03 #define VM_CMD_RESET 0x04 #define VM_CMD_ENABLE_IRQ 0x05 /* Enable/disable the messaging irq */ #define VM_CMD_DISABLE_IRQ 0x06 #define VM_CMD_SEND_NMI 0x07 #define VM_CMD_CAPABILITIES 0x08 #define VM_CAPABILITIES_POWER 0x01 #define VM_CAPABILITIES_RESET 0x02 #define VM_CAPABILITIES_IRQ 0x04 #define VM_CAPABILITIES_NMI 0x08 #define VM_CAPABILITIES_ATTN 0x10 #define VM_CAPABILITIES_GRACEFUL_SHUTDOWN 0x20 #define VM_CMD_GRACEFUL_SHUTDOWN 0x09 struct vm_data { unsigned char recv_msg[IPMI_SIM_MAX_MSG_LENGTH + 4]; unsigned int recv_msg_len; int recv_msg_too_many; int in_escape; int attn_works; }; static void vm_handle_msg(unsigned char *imsg, unsigned int len, serserv_data_t *si) { msg_t msg; if (si->sysinfo->debug & DEBUG_RAW_MSG) debug_log_raw_msg(si->sysinfo, imsg, len, "Raw serial receive:"); if (len < 4) { fprintf(stderr, "Message too short\n"); return; } if (ipmb_checksum(imsg, len, 0) != 0) { fprintf(stderr, "Message checksum failure\n"); return; } len--; memset(&msg, 0, sizeof(msg)); msg.rq_seq = imsg[0]; msg.netfn = imsg[1] >> 2; msg.rs_lun = imsg[1] & 0x3; msg.cmd = imsg[2]; msg.len = len - 3; msg.data = imsg + 3; channel_smi_send(&si->channel, &msg); } static void vm_handle_cmd(unsigned char *imsg, unsigned int len, serserv_data_t *si) { struct vm_data *info = si->codec_info; if (si->sysinfo->debug & DEBUG_RAW_MSG) debug_log_raw_msg(si->sysinfo, imsg, len, "Raw serial cmd:"); if (len < 1) return; switch (imsg[0]) { case VM_CMD_VERSION: /* We only support one version for now. */ break; case VM_CMD_CAPABILITIES: if (len < 2) return; if (imsg[1] & VM_CAPABILITIES_POWER) si->channel.hw_capabilities |= (1 << HW_OP_POWERON); if (imsg[1] & VM_CAPABILITIES_GRACEFUL_SHUTDOWN) si->channel.hw_capabilities |= (1 << HW_OP_GRACEFUL_SHUTDOWN); if (imsg[1] & VM_CAPABILITIES_RESET) si->channel.hw_capabilities |= (1 << HW_OP_RESET); if (imsg[1] & VM_CAPABILITIES_IRQ) si->channel.hw_capabilities |= (1 << HW_OP_IRQ_ENABLE); if (imsg[1] & VM_CAPABILITIES_NMI) si->channel.hw_capabilities |= (1 << HW_OP_SEND_NMI); if (imsg[1] & VM_CAPABILITIES_ATTN) info->attn_works = 1; break; case VM_CMD_RESET: /* The remote end reset, report it. */ if (si->sysinfo->target_reset) si->sysinfo->target_reset(si->sysinfo); break; } } static void vm_handle_char(unsigned char ch, serserv_data_t *si) { struct vm_data *info = si->codec_info; unsigned int len = info->recv_msg_len; switch (ch) { case VM_MSG_CHAR: case VM_CMD_CHAR: if (info->in_escape) { fprintf(stderr, "Message ended in escape\n"); } else if (info->recv_msg_too_many) { fprintf(stderr, "Message too long\n"); } else if (info->recv_msg_len == 0) { /* Nothing to do */ } else if (ch == VM_MSG_CHAR) { vm_handle_msg(info->recv_msg, info->recv_msg_len, si); } else if (ch == VM_CMD_CHAR) { vm_handle_cmd(info->recv_msg, info->recv_msg_len, si); } info->in_escape = 0; info->recv_msg_len = 0; info->recv_msg_too_many = 0; break; case VM_ESCAPE_CHAR: if (!info->recv_msg_too_many) info->in_escape = 1; break; default: if (info->in_escape) { info->in_escape = 0; ch &= ~0x10; } if (!info->recv_msg_too_many) { if (len >= sizeof(info->recv_msg)) { info->recv_msg_too_many = 1; break; } info->recv_msg[len] = ch; info->recv_msg_len++; } break; } } static void vm_add_char(unsigned char ch, unsigned char *c, unsigned int *pos) { switch (ch) { case VM_MSG_CHAR: case VM_CMD_CHAR: case VM_ESCAPE_CHAR: c[(*pos)++] = VM_ESCAPE_CHAR; c[(*pos)++] = ch | 0x10; break; default: c[(*pos)++] = ch; } } static void vm_send(msg_t *imsg, serserv_data_t *si) { unsigned int i; unsigned int len = 0; unsigned char c[(IPMI_SIM_MAX_MSG_LENGTH + 7) * 2]; unsigned char csum; unsigned char ch; ch = imsg->rq_seq; vm_add_char(ch, c, &len); csum = ipmb_checksum(&ch, 1, 0); ch = (imsg->netfn << 2) | imsg->rs_lun; vm_add_char(ch, c, &len); csum = ipmb_checksum(&ch, 1, csum); vm_add_char(imsg->cmd, c, &len); csum = ipmb_checksum(&imsg->cmd, 1, csum); for (i = 0; i < imsg->len; i++) vm_add_char(imsg->data[i], c, &len); vm_add_char(-ipmb_checksum(imsg->data, imsg->len, csum), c, &len); c[len++] = VM_MSG_CHAR; raw_send(si, c, len); } static void vm_set_attn(channel_t *chan, int val, int irq) { serserv_data_t *si = chan->chan_info; unsigned int len = 0; unsigned char c[3]; if (!val) vm_add_char(VM_CMD_NOATTN, c, &len); else if (irq) vm_add_char(VM_CMD_ATTN_IRQ, c, &len); else vm_add_char(VM_CMD_ATTN, c, &len); c[len++] = VM_CMD_CHAR; raw_send(si, c, len); } static int vm_hw_op(channel_t *chan, unsigned int op) { serserv_data_t *si = chan->chan_info; unsigned int len = 0; unsigned char c[3]; switch(op) { case HW_OP_RESET: vm_add_char(VM_CMD_RESET, c, &len); break; case HW_OP_POWERON: if (chan->start_cmd) chan->start_cmd(chan); return 0; case HW_OP_POWEROFF: if (si->connected) vm_add_char(VM_CMD_POWEROFF, c, &len); if (chan->stop_cmd) chan->stop_cmd(chan, !si->connected); break; case HW_OP_GRACEFUL_SHUTDOWN: if (si->connected) vm_add_char(VM_CMD_GRACEFUL_SHUTDOWN, c, &len); break; case HW_OP_SEND_NMI: vm_add_char(VM_CMD_SEND_NMI, c, &len); break; case HW_OP_IRQ_ENABLE: vm_add_char(VM_CMD_ENABLE_IRQ, c, &len); break; case HW_OP_IRQ_DISABLE: vm_add_char(VM_CMD_DISABLE_IRQ, c, &len); break; case HW_OP_CHECK_POWER: return si->connected; break; default: return 0; } c[len++] = VM_CMD_CHAR; raw_send(si, c, len); return 0; } static void vm_connected(serserv_data_t *si) { unsigned int len = 0; unsigned char c[5]; vm_add_char(VM_CMD_VERSION, c, &len); vm_add_char(VM_PROTOCOL_VERSION, c, &len); c[len++] = VM_CMD_CHAR; raw_send(si, c, len); si->connected = 1; ipmi_resend_atn(&si->channel); } static void vm_disconnected(serserv_data_t *si) { si->connected = 0; } static int vm_setup(serserv_data_t *si) { struct vm_data *info; info = malloc(sizeof(*info)); if (!info) return -1; memset(info, 0, sizeof(*info)); si->codec_info = info; si->channel.hw_op = vm_hw_op; si->channel.set_atn = vm_set_attn; si->channel.hw_capabilities = (1 << HW_OP_POWERON); return 0; } /*********************************************************************** * * codec structure * ***********************************************************************/ static ser_codec_t codecs[] = { { "TerminalMode", tm_handle_char, tm_send, tm_setup }, { "Direct", dm_handle_char, dm_send, dm_setup }, { "RadisysAscii", ra_handle_char, ra_send, ra_setup }, { "VM", vm_handle_char, vm_send, vm_setup, vm_connected, vm_disconnected }, { NULL } }; static ser_codec_t * ser_lookup_codec(const char *name) { unsigned int i; for (i = 0; codecs[i].name; i++) { if (strcmp(codecs[i].name, name) == 0) return &codecs[i]; } return NULL; } #define PP_GET_SERIAL_INTF_CMD 0x01 #define PP_SET_SERIAL_INTF_CMD 0x02 static unsigned char pp_oem_chars[] = { 0x00, 0x40, 0x0a }; static int pp_oem_handler(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len) { serserv_data_t *ser = chan->chan_info; if (msg->netfn != IPMI_OEM_GROUP_NETFN) return 0; if ((msg->len < 3) || (memcmp(msg->data, pp_oem_chars, 3) != 0)) return 0; switch (msg->cmd) { case PP_GET_SERIAL_INTF_CMD: rdata[0] = 0; memcpy(rdata + 1, pp_oem_chars, 3); rdata[4] = 0; if (msg->data[3] == 1) rdata[4] |= ser->echo; *rdata_len = 5; return 1; case PP_SET_SERIAL_INTF_CMD: if (msg->len < 5) rdata[0] = 0xcc; else if (msg->data[3] == 1) { ser->echo = msg->data[4] & 1; rdata[0] = 0; } memcpy(rdata + 1, pp_oem_chars, 3); *rdata_len = 4; return 1; } return 0; } static void pp_oem_init(serserv_data_t *ser) { ser->echo = 1; ser->channel.oem_intf_recv_handler = pp_oem_handler; } #define RA_CONTROLLER_OEM_NETFN 0x3e #define RA_GET_IPMB_ADDR_CMD 0x12 static int ra_oem_handler(channel_t *chan, msg_t *msg, unsigned char *rdata, unsigned int *rdata_len) { serserv_data_t *ser = chan->chan_info; if (msg->netfn == RA_CONTROLLER_OEM_NETFN) { switch (msg->cmd) { case RA_GET_IPMB_ADDR_CMD: rdata[0] = 0; rdata[1] = ser->my_ipmb; *rdata_len = 2; return 1; } } else if (msg->netfn == IPMI_APP_NETFN) { switch (msg->cmd) { case IPMI_GET_MSG_FLAGS_CMD: /* No message flag support. */ rdata[0] = 0xc1; *rdata_len = 1; return 1; } } return 0; } static void ra_oem_init(serserv_data_t *ser) { ser->channel.oem_intf_recv_handler = ra_oem_handler; } static ser_oem_handler_t oem_handlers[] = { { "PigeonPoint", pp_oem_handler, pp_oem_init }, { "Radisys", ra_oem_handler, ra_oem_init }, { NULL } }; static ser_oem_handler_t * ser_lookup_oem(const char *name) { unsigned int i; for (i = 0; oem_handlers[i].name; i++) { if (strcmp(oem_handlers[i].name, name) == 0) return &oem_handlers[i]; } return NULL; } static void ser_return_rsp(channel_t *chan, msg_t *imsg, rsp_msg_t *rsp) { serserv_data_t *ser = chan->chan_info; msg_t msg; if (!ser->connected) return; msg.netfn = rsp->netfn; msg.cmd = rsp->cmd; msg.data = rsp->data; msg.len = rsp->data_len; msg.rq_lun = imsg->rs_lun; msg.rq_addr = imsg->rs_addr; msg.rs_lun = imsg->rq_lun; msg.rs_addr = imsg->rq_addr; msg.rq_seq = imsg->rq_seq; ser->codec->send(&msg, ser); } void serserv_handle_data(serserv_data_t *ser, uint8_t *data, unsigned int len) { unsigned int i; for (i = 0; i < len; i++) ser->codec->handle_char(data[i], ser); } int serserv_init(serserv_data_t *ser) { ser->channel.return_rsp = ser_return_rsp; ser->codec->setup(ser); if (ser->oem) ser->oem->init(ser); chan_init(&ser->channel); return 0; } int serserv_read_config(char **tokptr, sys_data_t *sys, const char **errstr) { serserv_data_t *ser; const char *tok, *tok2; char *endp; int err; unsigned int chan_num; ser = malloc(sizeof(*ser)); if (!ser) { *errstr = "Out of memory"; return -1; } memset(ser, 0, sizeof(*ser)); tok = mystrtok(NULL, " \t\n", tokptr); if (!tok) { *errstr = "No channel given"; goto out_err; } ser->channel.session_support = IPMI_CHANNEL_SESSION_LESS; ser->channel.medium_type = IPMI_CHANNEL_MEDIUM_RS232; if (strcmp(tok, "kcs") == 0) { chan_num = 15; ser->channel.protocol_type = IPMI_CHANNEL_PROTOCOL_KCS; } else if (strcmp(tok, "bt") == 0) { chan_num = 15; ser->channel.protocol_type = IPMI_CHANNEL_PROTOCOL_BT_v15; } else if (strcmp(tok, "smic") == 0) { chan_num = 15; ser->channel.protocol_type = IPMI_CHANNEL_PROTOCOL_SMIC; } else { chan_num = strtoul(tok, &endp, 0); if (*endp != '\0') { *errstr = "Channel not a valid number"; goto out_err; } ser->channel.protocol_type = IPMI_CHANNEL_PROTOCOL_TMODE; } if (chan_num != 15) { *errstr = "Only BMC channel (channel 15, or kcs/bt/smic) is" " supported for serial"; goto out_err; } if (sys->chan_set[chan_num]) { *errstr = "System channel already defined"; goto out_err; } ser->channel.channel_num = chan_num; err = get_sock_addr(tokptr, &ser->addr.addr, &ser->addr.addr_len, NULL, SOCK_STREAM, errstr); if (err) goto out_err; for (tok = mystrtok(NULL, " \t\n", tokptr); tok; tok = mystrtok(NULL, " \t\n", tokptr)) { if (strcmp(tok, "connect") == 0) { ser->do_connect = 1; continue; } tok2 = mystrtok(NULL, " \t\n", tokptr); if (strcmp(tok, "codec") == 0) { if (!tok2) { *errstr = "Missing parameter for codec"; return -1; } ser->codec = ser_lookup_codec(tok2); if (!ser->codec) { *errstr = "Invalid codec"; return -1; } } else if (strcmp(tok, "oem") == 0) { if (!tok2) { *errstr = "Missing parameter for oem"; return -1; } ser->oem = ser_lookup_oem(tok2); if (!ser->oem) { *errstr = "Invalid oem setting"; return -1; } } else if (strcmp(tok, "attn") == 0) { unsigned int pos = 0; char *tokptr2 = NULL; if (!tok2) { *errstr = "Missing parameter for attn"; return -1; } ser->do_attn = 1; tok2 = mystrtok((char *) tok2, ",", &tokptr2); while (tok2) { if (pos >= sizeof(ser->attn_chars)) { *errstr = "Too many attn characters"; return -1; } ser->attn_chars[pos] = strtoul(tok2, &endp, 0); if (*endp != '\0') { *errstr = "Invalid attn value"; return -1; } pos++; tok2 = mystrtok(NULL, ",", &tokptr2); } ser->attn_chars_len = pos; } else if (strcmp(tok, "ipmb") == 0) { char *endp; ser->my_ipmb = strtoul(tok2, &endp, 0); if (*endp != '\0') { *errstr = "Invalid IPMB address"; return -1; } } else { *errstr = "Invalid setting, not connect, codec, oem, attn, or ipmb"; return -1; } } if (!ser->codec) { *errstr = "codec not specified"; goto out_err; } ser->sysinfo = sys; ser->channel.chan_info = ser; sys->chan_set[chan_num] = &ser->channel; return 0; out_err: free(ser); return -1; } OpenIPMI-2.0.27/lanserv/atca.emu0000644000175000017500000002704312002623311013171 00000000000000# Turn on ATCA mode atca_enable # Add the BMC at 0x20 # Entity id 0xf0 1 mc_add 20 0 1 23 9 8 1f 1291 f02 atca_set_site 0x10 3 1 mc_setbmc 20 main_sdr_add 20 00 00 51 12 0f 20 00 00 1f 00 00 00 f0 1 0 c4 'T 'e 's 't sel_enable 20 100 0b mc_add_fru_data 20 0 400 \ 01 00 01 03 00 00 00 fb \ # Chassis info 01 02 01 c4 'A 'T 'C 'A \ c4 'T 'e 's 't c1 00 fa \ # Board info 01 05 00 00 00 00 c4 'T \ 'e 's 't c4 'T 'e 's 't \ c4 'T 'e 's 't c4 'T 'e \ 's 't c4 'T 'e 's 't c1 \ 00 00 00 00 00 00 00 45 mc_add_fru_data 20 9 200 \ 0x01 0x00 0x00 0x01 0x09 0x17 0x00 0xde \ 0x01 0x08 0x19 0xa4 0x76 0x4e 0xc3 0x43 \ 0x45 0x53 0xcf 0x41 0x64 0x76 0x61 0x6e \ 0x63 0x65 0x64 0x4d 0x43 0x20 0x39 0x34 \ 0x37 0x38 0x89 0x23 0x5a 0x49 0x13 0x04 \ 0x45 0xd2 0x04 0x00 0x86 0x19 0x75 0x61 \ 0x21 0x00 0x00 0xd2 0x66 0x72 0x75 0x2d \ 0x69 0x6e 0x66 0x6f 0x2d 0x30 0x2d 0x30 \ 0x2d 0x34 0x2e 0x69 0x6e 0x66 0xc1 0x11 \ 0x01 0x0e 0x19 0xc3 0x43 0x45 0x53 0xcf \ 0x41 0x64 0x76 0x61 0x6e 0x63 0x65 0x64 \ 0x4d 0x43 0x20 0x39 0x34 0x37 0x38 0x86 \ 0x10 0x04 0x41 0x10 0x04 0x00 0xe4 0x42 \ 0x65 0x74 0x61 0x20 0x70 0x72 0x6f 0x74 \ 0x6f 0x74 0x79 0x70 0x65 0x73 0x20 0x2f \ 0x20 0x43 0x45 0x53 0x20 0x49 0x50 0x4d \ 0x49 0x20 0x72 0x65 0x76 0x20 0x30 0x2e \ 0x31 0x2e 0x30 0x89 0x23 0x5a 0x49 0x13 \ 0x04 0x45 0xd2 0x04 0x00 0x86 0x90 0x03 \ 0x39 0x14 0x00 0x00 0xd2 0x66 0x72 0x75 \ 0x2d 0x69 0x6e 0x66 0x6f 0x2d 0x30 0x2d \ 0x30 0x2d 0x34 0x2e 0x69 0x6e 0x66 0xc1 \ 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xb8 \ 0xc0 0x02 0x06 0x55 0xe3 0x5a 0x31 0x00 \ 0x16 0x00 0x0a 0xc0 0x82 0x22 0xf1 0xab \ 0x5a 0x31 0x00 0x19 0x00 0x00 0x80 0x02 \ 0xa4 0x98 0xf3 0x28 0xa9 0xf5 0x00 0x2f \ 0x10 0x00 0xfd 0x01 0x2f 0x10 0x00 0xfd \ 0x00 0x2f 0x10 0x01 0xfd 0x01 0x2f 0x10 \ 0x01 0xfd 0x00 0x00 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff \ 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff # Shelf FRU information mc_add_fru_data 20 fe 400 \ 01 00 01 03 00 08 00 f3 \ # Chassis info 01 02 01 c4 'A 'T 'C 'A \ c4 'T 'e 's 't c1 00 fa \ # Board info 01 05 00 00 00 00 c4 'T \ 'e 's 't c4 'T 'e 's 't \ c4 'T 'e 's 't c4 'T 'e \ 's 't c4 'T 'e 's 't c1 \ 00 00 00 00 00 00 00 45 \ # The multi-records # record 1, the address table c0 02 2b 1f f4 5a 31 00 \ 10 00 c6 'S 'h 'e 'l 'f \ '1 00 00 00 00 00 00 00 \ 00 00 00 00 00 00 00 03 \ 08 01 02 09 02 02 41 01 \ 00 00 00 00 00 00 00 00 \ # record 2, the backplane point-to-point connectivity record c0 02 17 51 d6 5a 31 00 \ 04 00 09 40 02 42 21 00 \ 44 32 02 08 42 01 40 21 \ 00 0a 44 00 \ # record 3, the shelf power distribution record c0 02 1a 89 9b 5a 31 00 \ 11 00 02 00 01 e0 00 40 \ 02 30 20 40 21 00 02 d0 \ 01 3a 01 50 23 60 24 \ # record 4, the shelf activation and power management record c0 02 1b de 45 5a 31 00 \ 12 00 27 04 10 24 00 04 \ 47 20 25 03 07 49 30 26 \ 01 10 48 40 27 09 1b 09 \ # record 5, the shelf manager ip connection record, version 0 c0 02 09 bd 78 5a 31 00 \ 13 00 c0 a8 19 24 \ # record 6, the shelf manager ip connection record, version 1 c0 02 11 3d f0 5a 31 00 \ 13 01 c0 a8 19 24 c0 a8 \ 19 01 ff ff ff 00 \ # record 7, the board point-to-point connectivity record c0 02 2e f6 1a 5a 31 00 \ 14 00 02 11 22 33 44 55 \ 66 77 88 99 aa bb cc dd \ ee ff fe 12 23 34 45 56 \ 67 78 89 9a ab bc cd de \ ef f0 01 01 0f 11 02 42 \ 13 00 03 \ # record 8, the radial IPMB-0 link mapping record c0 02 19 fb 2a 5a 31 00 \ 15 00 11 22 33 44 55 02 \ 20 01 01 30 10 30 03 03 \ 11 31 12 32 13 33 \ # record 9, the shelf fan geography record c0 02 16 72 b6 5a 31 00 \ 1b 00 04 20 10 01 02 21 \ 11 02 03 22 12 03 04 23 \ 13 04 05 \ # record 10, Bogus end record c1 82 1b 3d 65 5a 31 00 \ 13 00 27 04 10 24 00 04 \ 27 20 25 03 07 29 30 26 \ 01 10 28 40 27 09 1b 09 mc_enable 20 ## Add a shelf FRU device at 0x10 ## Entity id 0xf2 60 mc_add 10 0 1 23 9 8 08 1291 f03 main_sdr_add 20 00 00 51 12 0f 10 00 00 08 00 00 00 f2 60 0 c4 'F 'R 'U '1 atca_set_site 9 2 1 # Board FRU information mc_add_fru_data 10 0 400 \ 01 00 01 03 00 00 00 fb \ # Chassis info 01 02 01 c4 'A 'T 'C 'A \ c4 'T 'e 's 't c1 00 fa \ # Board info 01 05 00 00 00 00 c4 'T \ 'e 's 't c4 'T 'e 's 't \ c4 'T 'e 's 't c4 'T 'e \ 's 't c4 'T 'e 's 't c1 \ 00 00 00 00 00 00 00 45 # Shelf FRU information mc_add_fru_data 10 1 400 \ 01 00 01 03 00 08 00 f3 \ # Chassis info 01 02 01 c4 'A 'T 'C 'A \ c4 'T 'e 's 't c1 00 fa \ # Board info 01 05 00 00 00 00 c4 'T \ 'e 's 't c4 'T 'e 's 't \ c4 'T 'e 's 't c4 'T 'e \ 's 't c4 'T 'e 's 't c1 \ 00 00 00 00 00 00 00 45 \ # The multi-records # record 1, the address table c0 02 2b 1f f4 5a 31 00 \ 10 00 c6 'S 'h 'e 'l 'f \ '1 00 00 00 00 00 00 00 \ 00 00 00 00 00 00 00 03 \ 08 01 02 09 02 02 41 01 \ 00 00 00 00 00 00 00 00 \ # record 2, the backplane point-to-point connectivity record c0 82 17 51 56 5a 31 00 \ 04 00 09 40 02 42 21 00 \ 44 32 02 08 42 01 40 21 \ 00 0a 44 00 # The hot-swap sensor # sensor #0 sensor_add 10 0 0 f0 6f sensor_set_event_support 10 0 0 1 1 0 \ 000000011111111 000000000000000 000000011111111 000000000000000 sensor_set_bit_clr_rest 10 0 0 1 1 device_sdr_add 10 0 \ 00 00 51 02 22 \ 10 00 00 f2 60 ff c0 f0 6f ff 00 ff 00 ff 00 00 \ 00 00 00 00 00 00 00 00 00 00 c7 'H 'o 't 's 'w \ 'a 'p device_sdr_add 10 0 \ 01 00 51 02 22 \ 11 00 01 f2 60 ff c0 0c 6f ff 00 ff 00 ff 00 00 \ 00 00 00 00 00 00 00 00 00 00 c7 'T 'e 's 't '0 \ '0 '1 device_sdr_add 10 0 \ 02 00 51 03 12 \ 10 00 02 f2 60 0c 6f 00 00 00 c7 'T 'e 's 't '0 \ '0 '2 device_sdr_add 10 0 \ 03 00 51 01 38 \ 82 00 18 a0 60 7f 69 02 \ 01 04 22 04 22 12 12 00 \ 04 00 00 ac 00 00 00 00 \ c0 07 bf c5 b9 ff 00 00 \ c9 00 00 b5 00 01 01 00 \ 00 00 ce 53 42 43 20 2b \ 33 2e 33 56 20 53 55 53 mc_enable 10 # Add a shelf FRU device at 0x12 # Entity id 0xf2 60 mc_add 12 0 1 23 9 8 08 1291 f03 main_sdr_add 20 00 00 51 12 0f 12 00 00 08 00 00 00 f2 60 0 c4 'F 'R 'U '2 atca_set_site 9 2 2 # Board FRU information mc_add_fru_data 12 0 400 \ 01 00 01 03 00 00 00 fb \ # Chassis info 01 02 01 c4 'A 'T 'C 'A \ c4 'T 'e 's 't c1 00 fa \ # Board info 01 05 00 00 00 00 c4 'T \ 'e 's 't c4 'T 'e 's 't \ c4 'T 'e 's 't c4 'T 'e \ 's 't c4 'T 'e 's 't c1 \ 00 00 00 00 00 00 00 45 mc_add_fru_data 12 1 400 \ 01 00 01 03 00 08 00 f3 \ # Chassis info 01 02 01 c4 'A 'T 'C 'A \ c4 'T 'e 's 't c1 00 fa \ # Board info 01 05 00 00 00 00 c4 'T \ 'e 's 't c4 'T 'e 's 't \ c4 'T 'e 's 't c4 'T 'e \ 's 't c4 'T 'e 's 't c1 \ 00 00 00 00 00 00 00 45 \ # The multi-records # record 1, the address table c0 02 2b 1f f4 5a 31 00 \ 10 00 c6 'S 'h 'e 'l 'f \ '1 00 00 00 00 00 00 00 \ 00 00 00 00 00 00 00 03 \ 08 01 02 09 02 02 41 01 \ 00 00 00 00 00 00 00 00 \ # record 2, the backplane point-to-point connectivity record c0 82 17 51 56 5a 31 00 \ 04 00 09 40 02 42 21 00 \ 44 32 02 08 42 01 40 21 \ 00 0a 44 00 # The hot-swap sensor # sensor #0 sensor_add 12 0 0 f0 6f sensor_set_event_support 12 0 0 1 1 0 \ 000000011111111 000000000000000 000000011111111 000000000000000 sensor_set_bit_clr_rest 12 0 0 1 1 device_sdr_add 12 0 \ 00 00 51 02 22 \ 12 00 00 f2 60 ff c0 f0 6f ff 00 ff 00 ff 00 00 \ 00 00 00 00 00 00 00 00 00 00 c7 'H 'o 't 's 'w \ 'a 'p mc_enable 12 # Add a board in site 1 (0x82) # Entity id 0xa0 60 mc_add 82 0 1 19 4 3 29 1291 f04 #main_sdr_add 20 00 00 51 12 12 \ # 82 00 00 29 00 00 00 a0 60 0 c6 'B 'o 'a 'r 'd '1 atca_set_site 41 0 1 mc_add_fru_data 82 0 400 \ 01 00 01 03 00 00 00 fb \ # Chassis info 01 02 01 c4 'A 'T 'C 'A \ c4 'T 'e 's 't c1 00 fa \ # Board info 01 05 00 00 00 00 c4 'T \ 'e 's 't c4 'T 'e 's 't \ c4 'T 'e 's 't c4 'T 'e \ 's 't c4 'T 'e 's 't c1 \ 00 00 00 00 00 00 00 45 # The hot-swap sensor # sensor #0 sensor_add 82 0 0 f0 6f sensor_set_event_support 82 0 0 1 1 0 \ 000000011111111 000000000000000 000000011111111 000000000000000 sensor_set_bit_clr_rest 82 0 0 1 1 device_sdr_add 82 0 \ 00 00 51 12 12 \ 82 00 00 29 00 00 00 a0 60 0 c6 'B 'o 'a 'r 'd '1 device_sdr_add 82 0 \ 00 00 51 02 22 \ 82 00 00 a0 60 ff c0 f0 6f ff 00 ff 00 ff 00 00 \ 00 00 00 00 00 00 00 00 00 00 c7 'H 'o 't 's 'w \ 'a 'p mc_enable 82 # # An SDR for an MC that is not present. # IPMB 84 # device_sdr_add 82 0 \ 00 00 51 12 11 \ 84 00 00 29 00 00 00 a0 60 0 c6 'B 'o 'a 'r 'd \ '2 OpenIPMI-2.0.27/lanserv/emu_cmd.c0000664000175000017500000007704413414043165013351 00000000000000/* * config.c * * MontaVista IPMI code for reading lanserv configuration files. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005,2012,2016 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include "emu.h" #include #define BASE_CONF_STR SYSCONFDIR "/ipmi" static int emu_get_uchar(emu_out_t *out, char **toks, unsigned char *val, char *errstr, int empty_ok) { const char *str; char *tmpstr; str = mystrtok(NULL, " \t\n", toks); if (!str) { if (empty_ok) return ENOSPC; if (errstr) out->eprintf(out, "**No %s given\n", errstr); return EINVAL; } if (str[0] == '\'') { *val = str[1]; return 0; } *val = strtoul(str, &tmpstr, 0); if (*tmpstr != '\0') { if (errstr) out->eprintf(out, "**Invalid %s given\n", errstr); return EINVAL; } return 0; } static int emu_get_uchar_with_vals(emu_out_t *out, char **toks, unsigned char *val, char *errstr, int empty_ok, unsigned int numopts, ...) { const char *str; char *tmpstr; va_list ap; unsigned int i; str = mystrtok(NULL, " \t\n", toks); if (!str) { if (empty_ok) return ENOSPC; if (errstr) out->eprintf(out, "**No %s given\n", errstr); return EINVAL; } if (str[0] == '\'') { *val = str[1]; return 0; } va_start(ap, numopts); for (i = 0; i < numopts; i++) { char *v = va_arg(ap, char *); unsigned char vval = va_arg(ap, unsigned int); if (strcmp(v, str) == 0) { *val = vval; va_end(ap); goto out; } } va_end(ap); *val = strtoul(str, &tmpstr, 0); if (*tmpstr != '\0') { if (errstr) out->eprintf(out, "**Invalid %s given\n", errstr); return EINVAL; } out: return 0; } static int emu_get_bitmask(emu_out_t *out, char **toks, uint16_t *val, char *errstr, unsigned int size, int empty_ok) { const char *str; int i, j; str = mystrtok(NULL, " \t\n", toks); if (!str) { if (empty_ok) return ENOSPC; if (errstr) out->eprintf(out, "**No %s given\n", errstr); return EINVAL; } if (strlen(str) != size) { if (errstr) out->eprintf(out, "**invalid number of bits in %s\n", errstr); return EINVAL; } *val = 0; for (i=size-1, j=0; i>=0; i--, j++) { if (str[j] == '0') { /* Nothing to do */ } else if (str[j] == '1') { *val |= 1 << i; } else { if (errstr) out->eprintf(out, "**Invalid bit value '%c' in %s\n", str[j], errstr); return EINVAL; } } return 0; } static int emu_get_uint(emu_out_t *out, char **toks, unsigned int *val, char *errstr) { const char *str; char *tmpstr; str = mystrtok(NULL, " \t\n", toks); if (!str) { if (errstr) out->eprintf(out, "**No %s given\n", errstr); return EINVAL; } *val = strtoul(str, &tmpstr, 0); if (*tmpstr != '\0') { if (errstr) out->eprintf(out, "**Invalid %s given\n", errstr); return EINVAL; } return 0; } static int emu_get_bytes(emu_out_t *out, char **tokptr, unsigned char *data, char *errstr, unsigned int len) { const char *tok = mystrtok(NULL, " \t\n", tokptr); char *end; if (!tok) { if (errstr) out->eprintf(out, "**No %s given\n", errstr); return EINVAL; } if (*tok == '"') { unsigned int end; /* Ascii PW */ tok++; end = strlen(tok) - 1; if (tok[end] != '"') { out->eprintf(out, "**ASCII %s doesn't end in '\"'", errstr); return EINVAL; } if (end > (len - 1)) end = len - 1; memcpy(data, tok, end); data[end] = '\0'; zero_extend_ascii(data, len); } else { unsigned int i; char c[3]; /* HEX pw */ if (strlen(tok) != 32) { out->eprintf(out, "**HEX %s not 32 HEX characters long", errstr); return EINVAL; } c[2] = '\0'; for (i=0; ieprintf(out, "**Invalid HEX character in %s", errstr); return -1; } } } return 0; } #define INPUT_BUFFER_SIZE 65536 int read_command_file(emu_out_t *out, emu_data_t *emu, const char *command_file) { FILE *f = fopen(command_file, "r"); int rv = 0; if (!f) { rv = ENOENT; } else { char *buffer; int pos = 0; buffer = malloc(INPUT_BUFFER_SIZE); if (!buffer) { out->eprintf(out, "Could not allocate buffer memory\n"); rv = ENOMEM; goto out; } while (fgets(buffer+pos, INPUT_BUFFER_SIZE-pos, f)) { out->eprintf(out, "%s", buffer+pos); if (buffer[pos] == '#') continue; pos = strlen(buffer); if (pos == 0) continue; pos--; while ((pos > 0) && (buffer[pos] == '\n')) pos--; if (pos == 0) continue; if ((pos > 0) && (buffer[pos] == '\\')) { /* Continue the line. */ /* Don't do pos--, write over the "\\" */ continue; } pos++; buffer[pos] = 0; rv = ipmi_emu_cmd(out, emu, buffer); if (rv) break; pos = 0; } out: if (buffer) free(buffer); fclose(f); } return rv; } static int sel_enable(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned int max_records; unsigned char flags; rv = emu_get_uint(out, toks, &max_records, "max records"); if (rv) return rv; rv = emu_get_uchar(out, toks, &flags, "flags", 0); if (rv) return rv; rv = ipmi_mc_enable_sel(mc, max_records, flags); if (rv) out->eprintf(out, "**Unable to enable sel, error 0x%x\n", rv); return rv; } static int sel_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int i; int rv; unsigned char record_type; unsigned char data[13]; unsigned int r; rv = emu_get_uchar(out, toks, &record_type, "record type", 0); if (rv) return rv; for (i=0; i<13; i++) { rv = emu_get_uchar(out, toks, &data[i], "data byte", 0); if (rv) return rv; } rv = ipmi_mc_add_to_sel(mc, record_type, data, &r); if (rv) out->eprintf(out, "**Unable to add to sel, error 0x%x\n", rv); else out->eprintf(out, "Added record %d\n", r); return rv; } static int main_sdr_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int i; int rv; unsigned char data[256]; for (i=0; i<256; i++) { rv = emu_get_uchar(out, toks, &data[i], "data byte", 1); if (rv == ENOSPC) break; if (rv) { out->eprintf(out, "**Error 0x%x in data byte %d\n", rv, i); return rv; } } rv = ipmi_mc_add_main_sdr(mc, data, i); if (rv) out->eprintf(out, "**Unable to add to sdr, error 0x%x\n", rv); return rv; } static int device_sdr_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int i; int rv; unsigned char data[256]; unsigned char lun; rv = emu_get_uchar(out, toks, &lun, "LUN", 0); if (rv) return rv; for (i=0; i<256; i++) { rv = emu_get_uchar(out, toks, &data[i], "data byte", 1); if (rv == ENOSPC) break; if (rv) { out->eprintf(out, "**Error 0x%x in data byte %d\n", rv, i); return rv; } } rv = ipmi_mc_add_device_sdr(mc, lun, data, i); if (rv) out->eprintf(out, "**Unable to add to sdr, error 0x%x\n", rv); return rv; } static int sensor_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char type; unsigned char code; int event_only = 0; const char *tok; ipmi_sensor_handler_t *handler = NULL; unsigned int poll_rate = 0; void *rcb_data = NULL; const char *errstr; rv = emu_get_uchar(out, toks, &lun, "LUN", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &num, "sensor num", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &type, "sensor type", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &code, "event reading code", 0); if (rv) return rv; /* * FIXME - the depends that is part of the polled file sensor should * really be part of the main sensor structure. */ tok = mystrtok(NULL, " \t\n", toks); while (tok) { if (strcmp(tok, "poll") == 0) { if (handler) { out->eprintf(out, "**poll given twice in sensor\n", tok); return -1; } rv = emu_get_uint(out, toks, &poll_rate, "poll rate"); if (rv) return rv; tok = mystrtok(NULL, " \t\n", toks); if (!tok) { out->eprintf(out, "**No polled sensor handler given\n", tok); return -1; } handler = ipmi_sensor_find_handler(tok); if (!handler) { out->eprintf(out, "**Invalid sensor handler: %s\n", tok); return -1; } rv = handler->init(mc, lun, num, toks, handler->cb_data, &rcb_data, &errstr); if (rv) { out->eprintf(out, "**Error initializing sensor handler: %s\n", errstr); return rv; } } else if (strcmp(tok, "event-only") == 0) { event_only = 1; } else { out->eprintf(out, "**Unknown sensor option: %s\n", tok); return -1; } tok = mystrtok(NULL, " \t\n", toks); } if (handler && event_only) { out->eprintf(out, "**An event-only sensor cannot be polled\n"); return -1; } if (handler) { rv = ipmi_mc_add_polled_sensor(mc, lun, num, type, code, poll_rate, handler->poll, rcb_data); if (!rv && handler->postinit) { rv = handler->postinit(rcb_data, &errstr); if (rv) { out->eprintf(out, "**Error in sensor handler postinit: %s\n", errstr); } } } else { rv = ipmi_mc_add_sensor(mc, lun, num, type, code, event_only); } if (rv) out->eprintf(out, "**Unable to add to sensor, error 0x%x\n", rv); return rv; } static int sensor_set_bit(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char bit; unsigned char value; unsigned char gen_event; rv = emu_get_uchar(out, toks, &lun, "LUN", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &num, "sensor num", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &bit, "bit to set", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &value, "bit value", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &gen_event, "generate event", 0); if (rv) return rv; rv = ipmi_mc_sensor_set_bit(mc, lun, num, bit, value, gen_event); if (rv) out->eprintf(out, "**Unable to set sensor bit, error 0x%x\n", rv); return rv; } static int sensor_set_bit_clr_rest(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char bit; unsigned char gen_event; rv = emu_get_uchar(out, toks, &lun, "LUN", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &num, "sensor num", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &bit, "bit to set", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &gen_event, "generate event", 0); if (rv) return rv; rv = ipmi_mc_sensor_set_bit_clr_rest(mc, lun, num, bit, gen_event); if (rv) out->eprintf(out, "**Unable to set sensor bit, error 0x%x\n", rv); return rv; } static int sensor_set_value(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char value; unsigned char gen_event; rv = emu_get_uchar(out, toks, &lun, "LUN", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &num, "sensor num", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &value, "value", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &gen_event, "generate event", 0); if (rv) return rv; rv = ipmi_mc_sensor_set_value(mc, lun, num, value, gen_event); if (rv) out->eprintf(out, "**Unable to set sensor value, error 0x%x\n", rv); return rv; } static int sensor_set_hysteresis(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char support; unsigned char positive, negative; rv = emu_get_uchar(out, toks, &lun, "LUN", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &num, "sensor num", 0); if (rv) return rv; rv = emu_get_uchar_with_vals(out, toks, &support, "hysteresis support", 0, 4, "none", 0, "readable", 1, "settable", 2, "fixed", 3); if (rv) return rv; printf("Hysteresis: %d\n", support); rv = emu_get_uchar(out, toks, &positive, "positive hysteresis", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &negative, "negative hysteresis", 0); if (rv) return rv; rv = ipmi_mc_sensor_set_hysteresis(mc, lun, num, support, positive, negative); if (rv) out->eprintf(out, "**Unable to set sensor hysteresis, error 0x%x\n", rv); return rv; } static int sensor_set_threshold(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char support; uint16_t enabled; unsigned char thresholds[6]; int i; rv = emu_get_uchar(out, toks, &lun, "LUN", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &num, "sensor num", 0); if (rv) return rv; rv = emu_get_uchar_with_vals(out, toks, &support, "threshold support", 0, 4, "none", 0, "readable", 1, "settable", 2, "fixed", 3); if (rv) return rv; rv = emu_get_bitmask(out, toks, &enabled, "threshold enabled", 6, 0); if (rv) return rv; for (i=5; i>=0; i--) { rv = emu_get_uchar(out, toks, &thresholds[i], "threshold value", 0); if (rv) return rv; } rv = ipmi_mc_sensor_set_threshold(mc, lun, num, support, enabled, 1, thresholds); if (rv) out->eprintf(out, "**Unable to set sensor thresholds, error 0x%x\n", rv); return rv; } static int sensor_set_event_support(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char support; unsigned char events_enable; unsigned char scanning; uint16_t assert_support; uint16_t deassert_support; uint16_t assert_enabled; uint16_t deassert_enabled; rv = emu_get_uchar(out, toks, &lun, "LUN", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &num, "sensor num", 0); if (rv) return rv; rv = emu_get_uchar_with_vals(out, toks, &events_enable, "events enable", 0, 4, "enable", 1, "true", 1, "disable", 0, "false", 0); if (rv) return rv; rv = emu_get_uchar_with_vals(out, toks, &scanning, "scanning", 0, 4, "scanning", 1, "true", 1, "no-scanning", 0, "false", 0); if (rv) return rv; rv = emu_get_uchar_with_vals(out, toks, &support, "event support", 0, 4, "per-state", 0, "entire-sensor", 1, "global", 2, "none", 3); if (rv) return rv; rv = emu_get_bitmask(out, toks, &assert_support, "assert support", 15, 0); if (rv) return rv; rv = emu_get_bitmask(out, toks, &deassert_support, "deassert support", 15, 0); if (rv) return rv; rv = emu_get_bitmask(out, toks, &assert_enabled, "assert enabled", 15, 0); if (rv) return rv; rv = emu_get_bitmask(out, toks, &deassert_enabled, "deassert enabled", 15, 0); if (rv) return rv; rv = ipmi_mc_sensor_set_event_support(mc, lun, num, 1, events_enable, 1, scanning, support, assert_support, deassert_support, assert_enabled, deassert_enabled); if (rv) out->eprintf(out, "**Unable to set sensor thresholds, error 0x%x\n", rv); return rv; } static int mc_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char ipmb; unsigned char device_id; unsigned char has_device_sdrs; unsigned char device_revision; unsigned char major_fw_rev; unsigned char minor_fw_rev; unsigned char device_support; unsigned char mfg_id[3]; unsigned int mfg_id_i; unsigned char product_id[2]; unsigned int product_id_i; unsigned int flags = 0; int rv; const char *tok; rv = emu_get_uchar(out, toks, &ipmb, "IPMB address", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &device_id, "Device ID", 0); if (rv) return rv; rv = emu_get_uchar_with_vals(out, toks, &has_device_sdrs, "Has Device SDRs", 0, 2, "has-device-sdrs", 1, "no-device-sdrs", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &device_revision, "Device Revision", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &major_fw_rev, "Major FW Rev", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &minor_fw_rev, "Minor FW Rev", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &device_support, "Device Support", 0); if (rv) return rv; rv = emu_get_uint(out, toks, &mfg_id_i, "Manufacturer ID"); if (rv) return rv; rv = emu_get_uint(out, toks, &product_id_i, "Product ID"); if (rv) return rv; while ((tok = mystrtok(NULL, " \t\n", toks))) { if (strcmp("dynsens", tok) == 0) flags |= IPMI_MC_DYNAMIC_SENSOR_POPULATION; else if (strcmp("persist_sdr", tok) == 0) flags |= IPMI_MC_PERSIST_SDR; else { out->eprintf(out, "**Invalid MC flag: %s\n", tok); return -1; } } mfg_id[0] = mfg_id_i & 0xff; mfg_id[1] = (mfg_id_i >> 8) & 0xff; mfg_id[2] = (mfg_id_i >> 16) & 0xff; product_id[0] = product_id_i & 0xff; product_id[1] = (product_id_i >> 8) & 0xff; rv = ipmi_emu_add_mc(emu, ipmb, device_id, has_device_sdrs, device_revision, major_fw_rev, minor_fw_rev, device_support, mfg_id, product_id, flags); if (rv) out->eprintf(out, "**Unable to add the MC, error 0x%x\n", rv); return rv; } static int mc_set_guid(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char guid[16]; int rv; rv = emu_get_bytes(out, toks, guid, "GUID", 16); if (rv) return rv; rv = ipmi_emu_set_mc_guid(mc, guid, 1); return rv; } static int mc_delete(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { ipmi_mc_destroy(mc); return 0; } static int mc_disable(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { ipmi_mc_disable(mc); return 0; } static int mc_enable(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { ipmi_mc_enable(mc); return 0; } static int mc_set_power(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char power; unsigned char gen_int; int rv; rv = emu_get_uchar(out, toks, &power, "Power", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &gen_int, "Gen int", 0); if (rv) return rv; rv = ipmi_mc_set_power(mc, power, gen_int); if (rv) out->eprintf(out, "**Unable to set power, error 0x%x\n", rv); return rv; } #define MAX_FRU_SIZE 8192 static int mc_add_fru_data(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char data[MAX_FRU_SIZE]; unsigned char devid; unsigned int length; unsigned int i; int rv; const char *tok; const char *errstr; rv = emu_get_uchar(out, toks, &devid, "Device ID", 0); if (rv) return rv; rv = emu_get_uint(out, toks, &length, "FRU physical size"); if (rv) return rv; tok = mystrtok(NULL, " \t\n", toks); if (!tok) { out->eprintf(out, "**No FRU data type given"); return -1; } if (strcmp(tok, "file") == 0) { unsigned int file_offset; char *frufn; rv = emu_get_uint(out, toks, &file_offset, "file offset"); if (rv) return rv; rv = get_delim_str(toks, &frufn, &errstr); if (rv) { out->eprintf(out, "**Error with FRU filename: %d", strerror(rv)); return rv; } rv = ipmi_mc_add_fru_file(mc, devid, length, file_offset, (void *) frufn); if (rv) out->eprintf(out, "**Unable to add FRU file, error 0x%x\n", rv); free(frufn); } else if (strcmp(tok, "data") == 0) { for (i=0; ieprintf(out, "**Error 0x%x in data byte %d\n", rv, i); return rv; } } rv = emu_get_uchar(out, toks, &data[i], "data byte", 1); if (rv != ENOSPC) { out->eprintf(out, "**Error: input data too long for FRU\n", rv, i); return EINVAL; } memset(data + i, 0, length - i); rv = ipmi_mc_add_fru_data(mc, devid, length, NULL, data); if (rv) out->eprintf(out, "**Unable to add FRU data, error 0x%x\n", rv); } else { out->eprintf(out, "**FRU type not given, need file or data\n"); rv = EINVAL; } return rv; } static int mc_dump_fru_data(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char *data = NULL; unsigned char devid; unsigned int length; unsigned int i; int rv; rv = emu_get_uchar(out, toks, &devid, "Device ID", 0); if (rv) return rv; rv = ipmi_mc_get_fru_data_len(mc, devid, &length); if (rv) { out->eprintf(out, "**Unable to dump FRU data, error 0x%x\n", rv); goto out; } data = malloc(length); if (!data) { out->eprintf(out, "**Unable to dump FRU data, out of memory\n", rv); goto out; } rv = ipmi_mc_get_fru_data(mc, devid, length, data); if (rv) { out->eprintf(out, "**Unable to dump FRU data, error 0x%x\n", rv); goto out; } for (i=0; i 0) && ((i % 8) == 0)) out->eprintf(out, "\n"); out->eprintf(out, " 0x%2.2x", data[i]); } out->eprintf(out, "\n"); out: if (data) free(data); return rv; } static int mc_setbmc(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char ipmb; int rv; rv = emu_get_uchar(out, toks, &ipmb, "IPMB address of BMC", 0); if (rv) return rv; rv = ipmi_emu_set_bmc_mc(emu, ipmb); if (rv) out->eprintf(out, "**Invalid IPMB address\n"); return rv; } static int atca_enable(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; rv = ipmi_emu_atca_enable(emu); if (rv) out->eprintf(out, "**Unable to enable ATCA mode, error 0x%x\n", rv); return rv; } static int atca_set_site(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char hw_address; unsigned char site_type; unsigned char site_number; rv = emu_get_uchar(out, toks, &hw_address, "hardware address", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &site_type, "site type", 0); if (rv) return rv; rv = emu_get_uchar(out, toks, &site_number, "site number", 0); if (rv) return rv; rv = ipmi_emu_atca_set_site(emu, hw_address, site_type, site_number); if (rv) out->eprintf(out, "**Unable to set site type, error 0x%x\n", rv); return rv; } static int mc_set_num_leds(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char count; rv = emu_get_uchar(out, toks, &count, "number of LEDs", 0); if (rv) return rv; rv = ipmi_mc_set_num_leds(mc, count); if (rv) out->eprintf(out, "**Unable to set number of LEDs, error 0x%x\n", rv); return rv; } static int read_cmds(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { char *filename; const char *errstr; int err; err = get_delim_str(toks, &filename, &errstr); if (err) { out->eprintf(out, "Could not get include filename: %s\n", errstr); return err; } err = read_command_file(out, emu, filename); if (err == ENOENT && filename[0] != '/' && strncmp(filename, "./", 2) && strncmp(filename, "../", 3)) { char *nf = malloc(strlen(BASE_CONF_STR) + strlen(filename) + 2); if (!nf) { out->eprintf(out, "Out of memory in include\n", errstr); goto out_err; } strcpy(nf, BASE_CONF_STR); strcat(nf, "/"); strcat(nf, filename); free((char *) filename); filename = nf; err = read_command_file(out, emu, filename); if (err) { out->eprintf(out, "Could not read include file %s\n", filename); } } out_err: free((char *) filename); return err; } static int sleep_cmd(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned int time; struct timeval tv; int rv; rv = emu_get_uint(out, toks, &time, "timeout"); if (rv) return rv; tv.tv_sec = time / 1000; tv.tv_usec = (time % 1000) * 1000; ipmi_emu_sleep(emu, &tv); return 0; } static int debug_cmd(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned int level = 0; const char *tok; while ((tok = mystrtok(NULL, " \t\n", toks))) { if (strcmp(tok, "raw") == 0) { level |= DEBUG_RAW_MSG; } else if (strcmp(tok, "msg") == 0) { level |= DEBUG_MSG; } else if (strcmp(tok, "sol") == 0) { level |= DEBUG_SOL; } else { out->eprintf(out, "Invalid debug level '%s', options are 'raw' and 'msg'\n", tok); return EINVAL; } } emu_set_debug_level(emu, level); return 0; } static int persist_cmd(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { const char *tok; while ((tok = mystrtok(NULL, " \t\n", toks))) { if (strcmp(tok, "on") == 0) { persist_enable = 1; } else if (strcmp(tok, "off") == 0) { persist_enable = 0; } else { out->eprintf(out, "Invalid persist vale '%s', options are 'on' and 'off'\n", tok); return EINVAL; } } return 0; } static int quit(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { fflush(stdout); ipmi_emu_shutdown(emu); return 0; } static int do_define(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) { const char *name; char *value; int err; const char *errstr; name = mystrtok(NULL, " \t\n", toks); if (!name) { out->eprintf(out, "No variable name given for define\n"); return EINVAL; } err = get_delim_str(toks, &value, &errstr); if (err) { out->eprintf(out, "Could not get variable %s value: %s\n", name, errstr); return err; } err = add_variable(name, value); if (err) { free(value); out->eprintf(out, "Out of memory setting variable %s\n", name); return err; } return 0; } struct emu_cmd_info { const char *name; unsigned int flags; ipmi_emu_cmd_handler handler; struct emu_cmd_info *next; }; static struct emu_cmd_info cmds[] = { { "quit", NOMC, quit, &cmds[1] }, { "define", NOMC, do_define, &cmds[2] }, { "sel_enable", MC, sel_enable, &cmds[3] }, { "sel_add", MC, sel_add, &cmds[4] }, { "main_sdr_add", MC, main_sdr_add, &cmds[5] }, { "device_sdr_add", MC, device_sdr_add, &cmds[6] }, { "sensor_add", MC, sensor_add, &cmds[7] }, { "sensor_set_bit", MC, sensor_set_bit, &cmds[8] }, { "sensor_set_bit_clr_rest", MC, sensor_set_bit_clr_rest, &cmds[9] }, { "sensor_set_value", MC, sensor_set_value, &cmds[10] }, { "sensor_set_hysteresis", MC, sensor_set_hysteresis, &cmds[11] }, { "sensor_set_threshold", MC, sensor_set_threshold, &cmds[12] }, { "sensor_set_event_support", MC, sensor_set_event_support,&cmds[13] }, { "mc_set_power", MC, mc_set_power, &cmds[14] }, { "mc_add_fru_data",MC, mc_add_fru_data, &cmds[15] }, { "mc_dump_fru_data",MC, mc_dump_fru_data, &cmds[16] }, { "mc_set_num_leds",MC, mc_set_num_leds, &cmds[17] }, { "mc_add", NOMC, mc_add, &cmds[18] }, { "mc_delete", MC, mc_delete, &cmds[19] }, { "mc_disable", MC, mc_disable, &cmds[20] }, { "mc_enable", MC, mc_enable, &cmds[21] }, { "mc_setbmc", NOMC, mc_setbmc, &cmds[22] }, { "mc_set_guid", MC, mc_set_guid, &cmds[23] }, { "atca_enable", NOMC, atca_enable, &cmds[24] }, { "atca_set_site", NOMC, atca_set_site, &cmds[25] }, { "read_cmds", NOMC, read_cmds, &cmds[26] }, { "include", NOMC, read_cmds, &cmds[27] }, { "sleep", NOMC, sleep_cmd, &cmds[28] }, { "debug", NOMC, debug_cmd, &cmds[29] }, { "persist", NOMC, persist_cmd, NULL }, { NULL } }; static struct emu_cmd_info *cmdlist = &cmds[0]; int ipmi_emu_add_cmd(const char *name, unsigned int flags, ipmi_emu_cmd_handler handler) { struct emu_cmd_info *mcmd; mcmd = malloc(sizeof(*mcmd)); if (!mcmd) return ENOMEM; mcmd->name = strdup(name); if (!mcmd->name) { free(mcmd); return ENOMEM; } mcmd->flags = flags; mcmd->handler = handler; mcmd->next = cmdlist; cmdlist = mcmd; return 0; } int ipmi_emu_cmd(emu_out_t *out, emu_data_t *emu, char *cmd_str) { char *toks; const char *cmd; int rv = EINVAL; lmc_data_t *mc = NULL; struct emu_cmd_info *mcmd; cmd = mystrtok(cmd_str, " \t\n", &toks); if (!cmd) return 0; if (cmd[0] == '#') return 0; for (mcmd = cmdlist; mcmd; mcmd = mcmd->next) { if (strcmp(cmd, mcmd->name) == 0) { if (mcmd->flags & MC) { unsigned char ipmb; rv = emu_get_uchar(out, &toks, &ipmb, "MC address", 0); if (rv) return rv; rv = ipmi_emu_get_mc_by_addr(emu, ipmb, &mc); if (rv) { out->eprintf(out, "**Invalid MC address\n"); return rv; } } rv = mcmd->handler(out, emu, mc, &toks); if (rv) return rv; goto out; } } out->eprintf(out, "**Unknown command: %s\n", cmd); out: return rv; } OpenIPMI-2.0.27/OpenIPMI.spec.in0000644000175000017500000001302112002623311012727 00000000000000# For common adjustments that are needed for this file, search for # "USERFIX" Name: OpenIPMI Summary: %{name} - Library interface to IPMI Version: @OPENIPMI_VERSION_MAJOR@.@OPENIPMI_VERSION_MINOR@.@OPENIPMI_VERSION_RELEASE@ Release: 2 License: LGPL URL: http://openipmi.sourceforge.net Group: Utilities Vendor: OpenIPMI Project Packager: Tariq Shureih Source: %{name}-@VERSION@.tar.gz Buildroot: /var/tmp/%{name}-root BuildRequires: pkgconfig, perl >= 5, swig >= 1.3 Summary: IPMI Library Group: Utilities # Figure out if glib12 is installed %define glib12 %(if ls -l /usr/lib/libglib-1.2* >/dev/null 2>&1; then echo yes; else echo no; fi) %description This package contains a shared library implementation of IPMI and the basic tools used with OpenIPMI. %package devel Summary: Development files for OpenIPMI Group: Utilities Requires: OpenIPMI = %{version}, pkgconfig %description devel Contains additional files need for a developer to create applications and/or middleware that depends on libOpenIPMI %package perl Summary: Perl interface for OpenIPMI Group: Utilities Requires: OpenIPMI = %{version}, perl >= 5 %description perl A Perl interface for OpenIPMI. %package python Summary: Python interface for OpenIPMI Group: Utilities Requires: OpenIPMI = %{version}, python %description python A Python interface for OpenIPMI. %package gui Summary: GUI (in python) for OpenIPMI Group: Utilities Requires: OpenIPMI-python = %{version}, tkinter %description gui A GUI interface for OpenIPMI. Written in python an requiring wxWidgets. %package ui Summary: User Interface (ui) Group: Utilities Requires: OpenIPMI = %{version} %description ui This package contains a user interface %package lanserv Summary: Emulates an IPMI network listener Group: Utilities Requires: OpenIPMI = %{version} %description lanserv This package contains a network IPMI listener. ################################################### %prep ################################################### %setup ################################################### %build ################################################### # USERFIX: Things you might have to add to configure: # --with-tclcflags='-I /usr/include/tclN.M' --with-tcllibs=-ltclN.M # Obviously, replace N.M with the version of tcl on your system. %configure make ################################################### %install ################################################### rm -rf %{buildroot} make DESTDIR=%{buildroot} install install -d %{buildroot}/etc/init.d install -d %{buildroot}/etc/sysconfig install ipmi.init %{buildroot}/etc/init.d/ipmi install ipmi.sysconf %{buildroot}/etc/sysconfig/ipmi ################################################### %post ################################################### chkconfig --add ipmi ################################################### %preun ################################################### if [ $1 = 0 ]; then /etc/init.d/ipmi stop >/dev/null 2>&1 /sbin/chkconfig --del ipmi fi ################################################### %postun ################################################### if [ "$1" -ge "1" ]; then /etc/init.d/ipmi condrestart >/dev/null 2>&1 || : fi ################################################### %files ################################################### %defattr(-,root,root) %{_libdir}/libOpenIPMIcmdlang.so.* %{_libdir}/libOpenIPMIglib.so.* # USERFIX: You might need to modify the following if glib12 is not # handled properly by the autodetection %if %{glib12} != "no" %{_libdir}/libOpenIPMIglib12.so.* %endif %{_libdir}/libOpenIPMItcl.so.* %{_libdir}/libOpenIPMIposix.so.* %{_libdir}/libOpenIPMIpthread.so.* %{_libdir}/libOpenIPMI.so.* %{_libdir}/libOpenIPMIutils.so.* %doc COPYING COPYING.LIB FAQ INSTALL README README.Force %doc README.MotorolaMXP CONFIGURING_FOR_LAN COPYING.BSD /etc/init.d/ipmi /etc/sysconfig/ipmi ################################################### %files perl ################################################### %defattr(-,root,root) %{perl_vendorarch} %doc swig/OpenIPMI.i swig/perl/sample swig/perl/ipmi_powerctl ################################################### %files python ################################################### %defattr(-,root,root) %{_libdir}/python*/site-packages/*OpenIPMI.* %doc swig/OpenIPMI.i ################################################### %files gui ################################################### %defattr(-,root,root) %dir %{_libdir}/python*/site-packages/openipmigui %{_libdir}/python*/site-packages/openipmigui/* %{_bindir}/openipmigui ################################################### %files devel ################################################### %defattr(-,root,root) %{_includedir}/OpenIPMI %{_libdir}/*.a %{_libdir}/*.la %{_libdir}/*.so %{_libdir}/pkgconfig %doc doc/IPMI.pdf ################################################### %files ui ################################################### %defattr(-,root,root) %{_bindir}/ipmi_ui %{_bindir}/ipmicmd %{_bindir}/openipmicmd %{_bindir}/ipmish %{_bindir}/openipmish %{_bindir}/solterm %{_bindir}/rmcp_ping %{_libdir}/libOpenIPMIui.so.* %doc %{_mandir}/man1/ipmi_ui.1* %doc %{_mandir}/man1/openipmicmd.1* %doc %{_mandir}/man1/openipmish.1* %doc %{_mandir}/man1/openipmigui.1* %doc %{_mandir}/man1/solterm.1* %doc %{_mandir}/man1/rmcp_ping.1* %doc %{_mandir}/man7/ipmi_cmdlang.7* %doc %{_mandir}/man7/openipmi_conparms.7* ################################################### %files lanserv ################################################### %defattr(-,root,root) %{_bindir}/ipmilan %{_libdir}/libIPMIlanserv.so.* %doc %{_mandir}/man8/ipmilan.8* OpenIPMI-2.0.27/acinclude.m40000644000175000017500000000463212002623311012267 00000000000000 dnl dnl read lib version from file (and trim trailing newline) dnl define([EL_RELEASE], [patsubst(esyscmd([. src/shlib_version; echo $major.$minor]), [ ])]) dnl dnl read cvsexport timestamp from file (and trim trailing newline) dnl dnl define([EL_TIMESTAMP_CVSEXPORT], [patsubst(esyscmd([cat patches/timestamp.cvsexport]), [ define([EL_TIMESTAMP_CVSEXPORT], [patsubst(esyscmd([date +"%Y%m%d"]), [ ])]) dnl dnl NetBSD use the -mdoc macro package for manpages, but e.g. dnl AIX and Solaris only support the -man package. dnl AC_DEFUN([EL_MANTYPE], [ MANTYPE= TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb" AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath) if ${NROFF} -mdoc ${srcdir}/doc/editrc.5.roff >/dev/null 2>&1; then MANTYPE=mdoc fi AC_SUBST(MANTYPE) ]) dnl dnl Check if getpwnam_r and getpwuid_r are POSIX.1 compatible dnl POSIX draft version returns 'struct passwd *' (used on Solaris) dnl NOTE: getpwent_r is not POSIX so we always use getpwent dnl AC_DEFUN([EL_GETPW_R_POSIX], [ AC_MSG_CHECKING([whether getpwnam_r and getpwuid_r are posix like]) # The prototype for the POSIX version is: # int getpwnam_r(char *, struct passwd *, char *, size_t, struct passwd **) # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **); AC_TRY_LINK([#include #include #include ], [getpwnam_r(NULL, NULL, NULL, (size_t)0, NULL); getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);], [AC_DEFINE([HAVE_GETPW_R_POSIX], 1, [Define to 1 if you have getpwnam_r and getpwuid_r that are POSIX.1 compatible.]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) ]) AC_DEFUN([EL_GETPW_R_DRAFT], [ AC_MSG_CHECKING([whether getpwnam_r and getpwuid_r are posix _draft_ like]) # The prototype for the POSIX draft version is: # struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int); # struct passwd *getpwnam_r(char *, struct passwd *, char *, int); AC_TRY_LINK([#include #include #include ], [getpwnam_r(NULL, NULL, NULL, (size_t)0); getpwuid_r((uid_t)0, NULL, NULL, (size_t)0);], [AC_DEFINE([HAVE_GETPW_R_DRAFT], 1, [Define to 1 if you have getpwnam_r and getpwuid_r that are draft POSIX.1 versions.]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) ]) OpenIPMI-2.0.27/OpenIPMIui.pc.in0000644000175000017500000000042112002623311012735 00000000000000prefix=@prefix@ exec_prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ Name: OpenIPMIui Description: UI front-end for OpenIPMI Version: @VERSION@ Requires: OpenIPMI ncurses Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMIui -lOpenIPMI -lncurses Cflags: -I${includedir} OpenIPMI-2.0.27/CONFIGURING_FOR_LAN0000644000175000017500000001133612002623311012772 00000000000000I get asked this question a lot. Configuring a LAN interface is unfortunately complex because you have to do a bunch of different things to get one up and running. However, it can be done. First, I *strongly* recommend using the GUI for this. There are many parameters, far too many to easily handle in a command-line interface. It can be done with a command-line interface, but it is ugly. The first thing to do is open a connection to the system. Generally you would be doing this on a local BMC (because the LAN is not working), so I'll assume that. You can configure LAN remotely, with the obvious risks. Anyway, in the GUI, do File->Open Domain, select "smi", and select 0 for the interface (assuming that's the one you want). Let the connection come up. In openipmish, do: domain open local smi 0 and wait for it to come up. Once up, you have 3 major configuration items: * Channel configuration * User configuration * LAN Parameters CHANNEL CONFIGURATION --------------------- Once your connection is up, you need to figure out what channels need to be configured. Systems with more than one Ethernet port will generally have one channel for each port. In this case, figuring out which port goes to which channel is left as an exercise for the reader. You can list all the channels by right-clicking on the MC in the GUI and choosing "Channel Info", or by doing: mc chan info in ipmish. You are looking for channels with a medium of 4, or 8023_LAN. Once you have the channel(s), you need to enable them. Iin the GUI, open the tree for each channel you need to configure, and open up user access. There are two different user access setting, one is volatile (and will be set immediately) the other is non-volatile (and will be restored upon power-up). You need to set both of them. Enable "Per Msg Auth", "User Auth", set the "Access Mode" to "ALWAYS", and set the "Privilege Limit" to the limit you want, generally "admin". Then "Save" the configuration. In openipmish, do "help mc chan" and follow the instructions for the "set_access" command. USER CONFIGURATION ------------------ After this, re-open the channel menu because you need that to get to the user and LANPARM configuration. Right click on each channel you need to configure and choose "User Info". You need to add a user for each channel. User 1 generally has no username and is a generic user. The other users can get a name set. Unfortunately, there is no way to fetch the "Enabled" or "Session Limit" values, so those will show as "?" until you set them. You need to set the name (if not user 1), "Enabled" to True, "Link Auth Enabled" to True, "Msg Auth Enabled" to True, "Access Callback Only" to False, and the "Privilege Limit" to the privilege you want, generally admin for full access. To set the password for a user, right click on the user's number and choose "Set Password". Passwords cannot be fetched or displayed in IPMI. In openipmish, do "help mc chan user" and use these tools to set the various settings listed above for a user Note that on some systems, setting the user will fail unless you explicitly set the "Session Limit" (this is a bug in their implementation). so you might have to set that. Zero disables it and is generally a good choice. LAN CONFIGURATION ----------------- Once you have users configured, you are ready to configure LAN setting. Right-click on the channel again and choose "LANPARMS". This pulls up a large list of settings. There are several things you need to configure. First you need to set the ip_addr_source. If it is DHCP, BIOS, or some other automatic setting, that's fine. If it is manually configured, you must set the ip_addr and subnet_mask settings. If you want the system to be accessible when off, you must set the bmc_generated_arps and/or bmc_generated_garps to true. You might have to experiment to see which one works. If you want to route through a router, you must set up the gateway IP addresses and MAC addresses. Last, but not least, you must set up the enables. For LAN 1.5 (non-RMCP+) access, you must set the "enable_auth_xxx[privilege]" values to the ones you want. In general, md5 is the best you have with LAN 1.5, so enable md5 and disable everything else, unless you just want no access controls and enable "none". You should enable it for the privilege levels you want. FOr RMCP+, you have to enable the cipher suites you are interested in. The cipher suite entries are listed, you have to set the "max_priv_for_cipher_suite" for the corresponding cipher suites you want. Again, these are privilege levels. If you are using openipmish, use the "help lanparm" command and trace down. And good luck, you will need it. ANYTHING ELSE ------------- I think that is all, but I've probably missed something. OpenIPMI-2.0.27/COPYING.LIB0000644000175000017500000006364412002623311011546 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. ^L Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. ^L GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. ^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. ^L 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. ^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. ^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. ^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! OpenIPMI-2.0.27/configure0000755000175000017500000174547413437611455012051 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for OpenIPMI 2.0.27. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and minyard@acm.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='OpenIPMI' PACKAGE_TARNAME='OpenIPMI' PACKAGE_VERSION='2.0.27' PACKAGE_STRING='OpenIPMI 2.0.27' PACKAGE_BUGREPORT='minyard@acm.org' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS BUILD_CC TERM_LIBS OPENIPMI_SWIG_SO OPENIPMI_SWIG_LIBS DIA_FILTER_NAME DIA DVIPDF BIBTEX LATEX diaprog SOCKETLIB OPENSSLINCS OPENSSLLIBS SNMPLIBS SWIG_DIR SWIG_LIB SWIG PYTHON_GUI_DIR PYTHON_SWIG_FLAGS PYTHON_POSIX_SO PYTHON_POSIX_LIB PYTHON_HAS_POSIX_THREADS PYTHON_INSTALL_LIB_DIR PYTHON_INSTALL_DIR PYTHON_DIR PYTHON_EXTRA_LIBS PYTHON_EXTRA_LDFLAGS PYTHON_SITE_PKG PYTHON_LIBS PYTHON_CPPFLAGS PYTHON PYTHON_VERSION PERL_POSIX_SO PERL_POSIX_LIB PERL_HAS_POSIX_THREADS PERL_INSTALL_DIR PERL_CFLAGS PERL_DIR perlprog TCL_DIR TCL_TARGET TCL_PKGCONF TCL_SO TCL_LIB TCL_LIBS TCL_CFLAGS GLIB_DIR GLIB_TARGET GLIB_PKGCONF GLIB_SO GLIB_LIB GLIB_LIBS GLIB_CFLAGS GLIB_VERSION pkgprog GDBM_LIB POPTLIBS RT_LIB CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL MARVELL_BMC_DIR HAVE_OPENIPMI_SMI_FALSE HAVE_OPENIPMI_SMI_TRUE OPENIPMI_VERSION_EXTRA OPENIPMI_VERSION_RELEASE OPENIPMI_VERSION_MINOR OPENIPMI_VERSION_MAJOR am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC ac_ct_AR AR AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking with_ucdsnmp with_snmpflags with_snmplibs with_poptflags with_poptlibs with_openssl with_opensslflags with_openssllibs with_glib with_glibver with_glibcflags with_gliblibs with_tcl with_tclcflags with_tcllibs with_perl with_perlinstall with_perlcflags with_perlusepthreads with_python with_pythoninstall with_pythoninstalllib with_pythoncflags with_pythonusepthreads with_tkinter with_swig with_marvell_bmc enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_epoll_pwait ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CPP PYTHON_VERSION' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures OpenIPMI 2.0.27 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/OpenIPMI] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of OpenIPMI 2.0.27:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-epoll_pwait This platform supports epoll(7) with epoll_pwait(2) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-ucdsnmp=PATH Look for ucdsnmp in PATH. --with-snmpflags=flags Set the flags to compile with SNMP. --with-snmplibs=libs Set the libraries to link with SNMP. --with-poptflags=flags Set the flags to compile with popt. --with-poptlibs=libs Set the libraries to link with popt. --with-openssl[=yes|no|PATH] Look for openssl, with the optional path. --with-opensslflags=flags Set the flags to compile with OpenSSL. --with-openssllibs=libs Set the libraries to link with OpenSSL. --with-glib=yes|no Look for glib. --with-glibver=ver Set the glib version, either 1.2 or 2.0. --with-glibcflags=flags Set the flags to compile with glib. --with-gliblibs=libs Set the libraries to link with glib. --with-tcl=yes|no Look for tcl. --with-tclcflags=flags Set the flags to compile with tcl. --with-tcllibs=libs Set the libraries to link with tcl. --with-perl[=yes|no|PATH] Look for perl, with the optional path. --with-perlinstall=PATH Install perl modules in the given location. --with-perlcflags=PATH Use the given flags when compiling perl parts. --with-perlusepthreads[=yes|no] Use threads with perl. --with-python[=yes|no|PATH] Look for python, with the optional path. --with-pythoninstall=PATH Install python modules in the given location. --with-pythoninstalllib=PATH Install python libraries in the given location. --with-pythoncflags=PATH Use the given flags when compiling python parts. --with-pythonusepthreads[=yes|no] Use threads with python. --with-tkinter[=yes|no] GUI package for python. --with-swig[=yes|no|PATH] Look for swig, with the optional path. --with-marvell-bmc Enable the Marvell BMC. --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor PYTHON_VERSION The installed Python version to use, for example '2.3'. This string will be appended to the Python interpreter canonical name. Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF OpenIPMI configure 2.0.27 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------ ## ## Report this to minyard@acm.org ## ## ------------------------------ ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenIPMI $as_me 2.0.27, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version='1.15' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='OpenIPMI' VERSION='2.0.27' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi ac_config_headers="$ac_config_headers config.h" DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test -n "$ac_tool_prefix"; then for ac_prog in ar lib "link -lib" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar lib "link -lib" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} { $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 $as_echo_n "checking the archiver ($AR) interface... " >&6; } if ${am_cv_ar_interface+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am_cv_ar_interface=ar cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int some_variable = 0; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 $as_echo "$am_cv_ar_interface" >&6; } case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) as_fn_error $? "could not determine $AR interface" "$LINENO" 5 ;; esac OPENIPMI_VERSION_MAJOR=2 OPENIPMI_VERSION_MINOR=0 OPENIPMI_VERSION_RELEASE=27 OPENIPMI_SMI=false case $target_os in linux*) OPENIPMI_SMI=true $as_echo "#define HAVE_OPENIPMI_SMI 1" >>confdefs.h ;; cygwin*) $as_echo "#define HAVE_CYGWIN_TARGET 1" >>confdefs.h ;; solaris*) # Some solaris systems have epoll, but it's too broken to use. ax_cv_have_epoll_pwait=false ;; esac if ${OPENIPMI_SMI}; then HAVE_OPENIPMI_SMI_TRUE= HAVE_OPENIPMI_SMI_FALSE='#' else HAVE_OPENIPMI_SMI_TRUE='#' HAVE_OPENIPMI_SMI_FALSE= fi SNMPLIBS= # Where do we find the UCD SNMP includes and libs tryucdsnmp=yes # Check whether --with-ucdsnmp was given. if test "${with_ucdsnmp+set}" = set; then : withval=$with_ucdsnmp; if test "x$withval" = "xyes"; then tryucdsnmp=yes elif test "x$withval" = "xno"; then tryucdsnmp=no elif test -d "$withval"; then CPPFLAGS="-I$withval/include $CPPFLAGS" SNMPLIBS="-L$withval/lib $SNMPLIBS" tryucdsnmp=yes fi fi # Check whether --with-snmpflags was given. if test "${with_snmpflags+set}" = set; then : withval=$with_snmpflags; CPPFLAGS="$withval $CPPFLAGS" fi # Check whether --with-snmplibs was given. if test "${with_snmplibs+set}" = set; then : withval=$with_snmplibs; SNMPLIBS="$withval" fi POPTCFLAGS= # Check whether --with-poptflags was given. if test "${with_poptflags+set}" = set; then : withval=$with_poptflags; CPPFLAGS="$withval $CPPFLAGS" fi POPTCFLAGS= # Check whether --with-poptlibs was given. if test "${with_poptlibs+set}" = set; then : withval=$with_poptlibs; POPTLIBS="$withval" fi # If UCD SNMP requires OpenSSL, this tells where to find the crypto lib tryopenssl=yes # Check whether --with-openssl was given. if test "${with_openssl+set}" = set; then : withval=$with_openssl; if test "x$withval" = "xyes"; then tryopenssl=yes elif test "x$withval" = "xno"; then tryopenssl=no elif test -d "$withval"; then SNMPLIBS="-L$withval/lib $SNMPLIBS" OPENSSLLIBS="-L$withval/lib" OPENSSLINCS="-I$withval/include" tryopenssl=yes fi fi # Check whether --with-opensslflags was given. if test "${with_opensslflags+set}" = set; then : withval=$with_opensslflags; OPENSSLINCS="$withval" fi # Check whether --with-openssllibs was given. if test "${with_openssllibs+set}" = set; then : withval=$with_openssllibs; OPENSSLLIBS="$withval" fi tryglib=yes # Check whether --with-glib was given. if test "${with_glib+set}" = set; then : withval=$with_glib; if test "x$withval" = "xyes"; then tryglib=yes elif test "x$withval" = "xno"; then tryglib=no fi fi glibver= # Check whether --with-glibver was given. if test "${with_glibver+set}" = set; then : withval=$with_glibver; glibver="$withval" fi glibcflags= # Check whether --with-glibcflags was given. if test "${with_glibcflags+set}" = set; then : withval=$with_glibcflags; glibcflags="$withval" fi gliblibs= # Check whether --with-gliblibs was given. if test "${with_gliblibs+set}" = set; then : withval=$with_gliblibs; gliblibs="$withval" fi trytcl=yes # Check whether --with-tcl was given. if test "${with_tcl+set}" = set; then : withval=$with_tcl; if test "x$withval" = "xyes"; then trytcl=yes elif test "x$withval" = "xno"; then trytcl=no fi fi tclcflags= # Check whether --with-tclcflags was given. if test "${with_tclcflags+set}" = set; then : withval=$with_tclcflags; tclcflags="$withval" fi tcllibs= # Check whether --with-tcllibs was given. if test "${with_tcllibs+set}" = set; then : withval=$with_tcllibs; tcllibs="$withval" fi tryperl=yes perldir= # Check whether --with-perl was given. if test "${with_perl+set}" = set; then : withval=$with_perl; if test "x$withval" = "xyes"; then tryperl=yes elif test "x$withval" = "xno"; then tryperl=no elif test -d "$withval"; then perldir="$withval" tryperl=yes fi fi perlinstalldir= # Check whether --with-perlinstall was given. if test "${with_perlinstall+set}" = set; then : withval=$with_perlinstall; perlinstalldir="$withval" fi perlcflags= # Check whether --with-perlcflags was given. if test "${with_perlcflags+set}" = set; then : withval=$with_perlcflags; perlcflags="$withval" fi perlusepthreads= # Check whether --with-perlusepthreads was given. if test "${with_perlusepthreads+set}" = set; then : withval=$with_perlusepthreads; if test "x$withval" = "xyes"; then perlusepthreads="yes" elif test "x$withval" = "xno"; then perlusepthreads="no" elif test "x$withval" = "x"; then perlusepthreads="yes" fi fi pythonprog= trypython=yes # Check whether --with-python was given. if test "${with_python+set}" = set; then : withval=$with_python; if test "x$withval" = "x"; then trypython=yes elif test "x$withval" = "xyes"; then trypython=yes elif test "x$withval" = "xno"; then trypython=no else pythonprog="$withval" trypython=yes fi fi pythoninstalldir= # Check whether --with-pythoninstall was given. if test "${with_pythoninstall+set}" = set; then : withval=$with_pythoninstall; pythoninstalldir="$withval" fi pythoninstalllibdir= # Check whether --with-pythoninstalllib was given. if test "${with_pythoninstalllib+set}" = set; then : withval=$with_pythoninstalllib; pythoninstalllibdir="$withval" fi pythoncflags= # Check whether --with-pythoncflags was given. if test "${with_pythoncflags+set}" = set; then : withval=$with_pythoncflags; pythoncflags="$withval" fi pythonusepthreads= # Check whether --with-pythonusepthreads was given. if test "${with_pythonusepthreads+set}" = set; then : withval=$with_pythonusepthreads; if test "x$withval" = "xyes"; then pythonusepthreads="yes" elif test "x$withval" = "xno"; then pythonusepthreads="no" elif test "x$withval" = "x"; then pythonusepthreads="yes" fi fi tkinter= # Check whether --with-tkinter was given. if test "${with_tkinter+set}" = set; then : withval=$with_tkinter; if test "x$withval" = "xyes"; then tkinter="yes" elif test "x$withval" = "xno"; then tkinter="no" elif test "x$withval" = "x"; then tkinter="yes" fi fi tryswig=yes swigprog= # Check whether --with-swig was given. if test "${with_swig+set}" = set; then : withval=$with_swig; if test "x$withval" = "x"; then tryswig=yes elif test "x$withval" = "xyes"; then tryswig=yes elif test "x$withval" = "xno"; then tryswig=no else swigprog=$withval fi fi MARVELL_BMC_DIR= # Check whether --with-marvell-bmc was given. if test "${with_marvell_bmc+set}" = set; then : withval=$with_marvell_bmc; MARVELL_BMC_DIR=marvell-bmc fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi link_all_deplibs=no else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in execinfo.h do : ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default" if test "x$ac_cv_header_execinfo_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EXECINFO_H 1 _ACEOF fi done for ac_header in netinet/ether.h do : ac_fn_c_check_header_mongrel "$LINENO" "netinet/ether.h" "ac_cv_header_netinet_ether_h" "$ac_includes_default" if test "x$ac_cv_header_netinet_ether_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETINET_ETHER_H 1 _ACEOF fi done for ac_header in sys/ethernet.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/ethernet.h" "ac_cv_header_sys_ethernet_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ethernet_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_ETHERNET_H 1 _ACEOF fi done # Check whether we need -lrt added. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lc" >&5 $as_echo_n "checking for clock_gettime in -lc... " >&6; } if ${ac_cv_lib_c_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_clock_gettime=yes else ac_cv_lib_c_clock_gettime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_clock_gettime" >&5 $as_echo "$ac_cv_lib_c_clock_gettime" >&6; } if test "x$ac_cv_lib_c_clock_gettime" = xyes; then : RT_LIB= else RT_LIB=-lrt fi FOUND_POPT_HEADER=no ac_fn_c_check_header_mongrel "$LINENO" "popt.h" "ac_cv_header_popt_h" "$ac_includes_default" if test "x$ac_cv_header_popt_h" = xyes; then : FOUND_POPT_HEADER=yes; fi if test "x$FOUND_POPT_HEADER" != "xyes"; then echo "Could not find headers for the popt library" exit 1 fi if test "x$POPTLIBS" = "x"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for poptGetContext in -lpopt" >&5 $as_echo_n "checking for poptGetContext in -lpopt... " >&6; } if ${ac_cv_lib_popt_poptGetContext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpopt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char poptGetContext (); int main () { return poptGetContext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_popt_poptGetContext=yes else ac_cv_lib_popt_poptGetContext=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_popt_poptGetContext" >&5 $as_echo "$ac_cv_lib_popt_poptGetContext" >&6; } if test "x$ac_cv_lib_popt_poptGetContext" = xyes; then : POPTLIBS=-lpopt fi if test "x$POPTLIBS" = ""; then echo "Could not find the popt library" exit 1 fi fi # Check for GDBM have_gdbm_h="no" GDBM_LIB= ac_fn_c_check_header_mongrel "$LINENO" "gdbm.h" "ac_cv_header_gdbm_h" "$ac_includes_default" if test "x$ac_cv_header_gdbm_h" = xyes; then : have_gdbm_h="yes"; fi if test "x$have_gdbm_h" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdbm_open in -lgdbm" >&5 $as_echo_n "checking for gdbm_open in -lgdbm... " >&6; } if ${ac_cv_lib_gdbm_gdbm_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgdbm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gdbm_open (); int main () { return gdbm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gdbm_gdbm_open=yes else ac_cv_lib_gdbm_gdbm_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_gdbm_open" >&5 $as_echo "$ac_cv_lib_gdbm_gdbm_open" >&6; } if test "x$ac_cv_lib_gdbm_gdbm_open" = xyes; then : $as_echo "#define HAVE_GDBM /**/" >>confdefs.h GDBM_LIB=-lgdbm; fi fi # Find pkg-config pkgprog= # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_pkgprog+:} false; then : $as_echo_n "(cached) " >&6 else case $pkgprog in [\\/]* | ?:[\\/]*) ac_cv_path_pkgprog="$pkgprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_pkgprog="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi pkgprog=$ac_cv_path_pkgprog if test -n "$pkgprog"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkgprog" >&5 $as_echo "$pkgprog" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Handle GLIB support haveglib=no if test "x$glibver" = "x" -o "x$glibcflags" = "x" -o "x$gliblibs" = "x"; then glibprog= if test "x$tryglib" != "xno"; then if test "x$pkgprog" != "x"; then glibprog=$pkgprog fi fi GLIB_CFLAGS= GLIB_LIBS= if test "x$glibprog" != "x"; then GLIB_CFLAGS=`$glibprog --cflags gthread-2.0 2>/dev/null` if test $? = 0; then haveglib=yes GLIB_VERSION='2.0' GLIB_LIBS=`$glibprog --libs gthread-2.0 2>/dev/null` fi fi else haveglib=yes GLIB_CFLAGS="$glibcflags" GLIB_VERSION="$glibver" GLIB_LIBS="$gliblibs" fi echo "checking for glib... $haveglib" if test "x$haveglib" = "xyes"; then $as_echo "#define HAVE_GLIB /**/" >>confdefs.h GLIB_LIB='$(top_builddir)/glib/libOpenIPMIglib.la' GLIB_SO='$(top_builddir)/glib/.libs/libOpenIPMIglib.so' GLIB_PKGCONF=OpenIPMIglib.pc GLIB_TARGET=libOpenIPMIglib.la GLIB_DIR=glib else GLIB_LIB= GLIB_SO= GLIB_PKGCONF= GLIB_TARGET= GLIB_DIR= fi # Handle TCL support TCL_LIBS= TCL_CFLAGS= havetcl=no if test "x$trytcl" != "xno"; then FOUND_TCL_HEADER=no ver=`echo 'puts \$tcl_version' | tclsh` if test "x$tclcflags" = "x"; then ac_fn_c_check_header_mongrel "$LINENO" "tcl/tcl.h" "ac_cv_header_tcl_tcl_h" "$ac_includes_default" if test "x$ac_cv_header_tcl_tcl_h" = xyes; then : FOUND_TCL_HEADER=yes; fi if test "x$FOUND_TCL_HEADER" != "xyes"; then ac_fn_c_check_header_mongrel "$LINENO" "tcl/tcl.h" "ac_cv_header_tcl_tcl_h" "$ac_includes_default" if test "x$ac_cv_header_tcl_tcl_h" = xyes; then : FOUND_TCL_HEADER=yes; fi if test "x$FOUND_TCL_HEADER" == "xyes"; then tclcflags="-I /usr/include/tcl$ver" TCL_CFLAGS="$tclcflags" fi else tclcflags="-I /usr/include/tcl" TCL_CFLAGS="$tclcflags" fi else TCL_CFLAGS="$tclcflags" FOUND_TCL_HEADER=yes fi if test "x$tcllibs" = "x"; then if test "x$FOUND_TCL_HEADER" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl_DoOneEvent in -ltcl" >&5 $as_echo_n "checking for Tcl_DoOneEvent in -ltcl... " >&6; } if ${ac_cv_lib_tcl_Tcl_DoOneEvent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Tcl_DoOneEvent (); int main () { return Tcl_DoOneEvent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_tcl_Tcl_DoOneEvent=yes else ac_cv_lib_tcl_Tcl_DoOneEvent=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tcl_Tcl_DoOneEvent" >&5 $as_echo "$ac_cv_lib_tcl_Tcl_DoOneEvent" >&6; } if test "x$ac_cv_lib_tcl_Tcl_DoOneEvent" = xyes; then : TCL_LIBS=-ltcl fi if test "x$TCL_LIBS" = "x"; then as_ac_Lib=`$as_echo "ac_cv_lib_tcl$ver''_Tcl_DoOneEvent" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl_DoOneEvent in -ltcl$ver" >&5 $as_echo_n "checking for Tcl_DoOneEvent in -ltcl$ver... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl$ver $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Tcl_DoOneEvent (); int main () { return Tcl_DoOneEvent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : TCL_LIBS=-ltcl$ver fi fi fi else TCL_LIBS="$tcllibs" fi if test "x$FOUND_TCL_HEADER" = "xyes" -a "x$TCL_LIBS" != "x"; then havetcl=yes fi fi echo "checking for tcl... $havetcl" if test "x$havetcl" = "xyes"; then OLDLIBS="$LIBS" LIBS="$LIBS $TCL_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Tcl_GetTime (); int main () { return Tcl_GetTime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : echo "Have Tcl_GetTime" else echo "Redefine Tcl_GetTime as TclpGetTime"; $as_echo "#define Tcl_GetTime TclpGetTime" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$OLDLIBS" fi if test "x$havetcl" = "xyes"; then $as_echo "#define HAVE_TCL /**/" >>confdefs.h TCL_LIB='$(top_builddir)/tcl/libOpenIPMItcl.la' TCL_SO='$(top_builddir)/tcl/.libs/libOpenIPMItcl.so' TCL_PKGCONF=OpenIPMItcl.pc TCL_TARGET=libOpenIPMItcl.la TCL_DIR=tcl else TCL_LIB= TCL_SO= TCL_PKGCONF= TCL_TARGET= TCL_DIR= fi # Handle PERL support if test "x$perlcflags" = "x" -o "x$perlinstalldir" = "x"; then perlprog= if test "x$tryperl" != "xno"; then # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_perlprog+:} false; then : $as_echo_n "(cached) " >&6 else case $perlprog in [\\/]* | ?:[\\/]*) ac_cv_path_perlprog="$perlprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_perlprog="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi perlprog=$ac_cv_path_perlprog if test -n "$perlprog"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $perlprog" >&5 $as_echo "$perlprog" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test "x$perlprog" != "x"; then # Find the place where perl lives. if test "x$perldir" = "x"; then perldir=`$perlprog -e 'for $i (@INC) { if (-r "$i/CORE/perl.h") { print "$i"; last; } }'` fi # Now find a proper installation location. if test "x$perlinstalldir" = "x"; then perlinstalldir=`(eval \`perl -V:installvendorarch\`; echo $installvendorarch)` if test "x$perlinstalldir" = "x" -o ! -d "$perlinstalldir"; then perlinstalldir=`$perlprog -e 'for $i (@INC) { if ($i =~ /site_perl\/.+\/.+/) { print "$i"; last; } }'` fi if test "x$perlinstalldir" = "x" -o ! -d "$perlinstalldir"; then perlinstalldir=`$perlprog -e 'for $i (@INC) { if ($i =~ /vendor_perl\/.+\/.+/) { print "$i"; last; } }'` fi if test "x$perlinstalldir" = "x" -o ! -d "$perlinstalldir"; then perlinstalldir=$perldir fi fi fi if test "x$perldir" != "x"; then tpprog=`$perlprog -e "\\$p = \"$perlinstalldir\"; \\$u = \"$prefix\"; \\$p =~ s/\\$u//; print \\$p"` $as_echo "#define HAVE_PERL /**/" >>confdefs.h PERL_DIR=perl if test "x$perlcflags" = "x"; then PERL_CFLAGS="-I $perldir/CORE `$perlprog -V:ccflags | grep ccflags | sed 's/^.*ccflags=.\(.*\).;$/\1/'`" else PERL_CFLAGS="$perlcflags" fi if test "$tpprog" = "$perlinstalldir"; then PERL_INSTALL_DIR="$perlinstalldir" else PERL_INSTALL_DIR="\${prefix}$tpprog" fi else PERL_DIR= PERL_CFLAGS= PERL_INSTALL_DIR= PERL_HAS_POSIX_THREADS= PERL_POSIX_LIB= PERL_POSIX_SO= fi else $as_echo "#define HAVE_PERL /**/" >>confdefs.h PERL_DIR=perl PERL_CFLAGS="$perlcflags" PERL_INSTALL_DIR="$perlinstalldir" fi if test "x$perlprog" != "x"; then if test "x$perlusepthreads" = "x"; then if $perlprog -V:usethreads | grep -q 'define'; then perlusepthreads="yes" fi fi echo "checking for perl threads... $perlusepthreads" fi if test "x$perlusepthreads" = "xyes"; then PERL_HAS_POSIX_THREADS=1 PERL_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIpthread.la' PERL_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIpthread.so' else PERL_HAS_POSIX_THREADS=0 PERL_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIposix.la' PERL_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIposix.so' fi # Handle PYTHON support PYTHON_DIR= PYTHON_INSTALL_DIR= PYTHON_INSTALL_LIB_DIR= PYTHON_SWIG_FLAGS= if test "x$trypython" = "xyes"; then if test "x$pythonprog" != "x"; then PYTHON="$pythonprog" fi if test "x$pythoncflags" != "x"; then PYTHON_CPPFLAGS="$pythoncflags" fi # # Allow the use of a (user set) custom python version # # Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args. set dummy python$PYTHON_VERSION; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$PYTHON"; then as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5 PYTHON_VERSION="" fi # # Check for a version of Python >= 2.1.0 # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5 $as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; } ac_supports_python_ver=`$PYTHON -c "import sys; \ ver = sys.version.split ()[0]; \ print (ver >= '2.1.0')"` if test "$ac_supports_python_ver" != "True"; then if test -z "$PYTHON_NOVERSIONCHECK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? " This version of the AC_PYTHON_DEVEL macro doesn't work properly with versions of Python before 2.1.0. You may need to re-run configure, setting the variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG, PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. Moreover, to disable this check, set PYTHON_NOVERSIONCHECK to something else than an empty string. See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5 $as_echo "skip at user request" >&6; } fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi # # if the macro parameter ``version'' is set, honour it # if test -n ""; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python " >&5 $as_echo_n "checking for a version of Python ... " >&6; } ac_supports_python_ver=`$PYTHON -c "import sys; \ ver = sys.version.split ()[0]; \ print (ver )"` if test "$ac_supports_python_ver" = "True"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "this package requires Python . If you have it installed, but it isn't the default Python interpreter in your system path, please pass the PYTHON_VERSION variable to configure. See \`\`configure --help'' for reference. " "$LINENO" 5 PYTHON_VERSION="" fi fi # # Check if you have distutils, else fail # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` if test -z "$ac_distutils_result"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "cannot import Python module \"distutils\". Please check your Python installation. The error was: $ac_distutils_result" "$LINENO" 5 PYTHON_VERSION="" fi # # Check for Python include path # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5 $as_echo_n "checking for Python include path... " >&6; } if test -z "$PYTHON_CPPFLAGS"; then python_path=`$PYTHON -c "import distutils.sysconfig; \ print (distutils.sysconfig.get_python_inc ());"` plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ print (distutils.sysconfig.get_python_inc (plat_specific=1));"` if test -n "${python_path}"; then if test "${plat_python_path}" != "${python_path}"; then python_path="-I$python_path -I$plat_python_path" else python_path="-I$python_path" fi fi PYTHON_CPPFLAGS=$python_path fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5 $as_echo "$PYTHON_CPPFLAGS" >&6; } # # Check for Python library path # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5 $as_echo_n "checking for Python library path... " >&6; } if test -z "$PYTHON_LIBS"; then # (makes two attempts to ensure we've got a version number # from the interpreter) ac_python_version=`cat<>confdefs.h <<_ACEOF #define HAVE_PYTHON "$ac_python_version" _ACEOF # First, the library directory: ac_python_libdir=`cat<&5 $as_echo "$PYTHON_LIBS" >&6; } # # Check for site packages # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5 $as_echo_n "checking for Python site-packages path... " >&6; } if test -z "$PYTHON_SITE_PKG"; then PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ print (distutils.sysconfig.get_python_lib(0,0));"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5 $as_echo "$PYTHON_SITE_PKG" >&6; } # # libraries which must be linked in when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5 $as_echo_n "checking python extra libraries... " >&6; } if test -z "$PYTHON_EXTRA_LDFLAGS"; then PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5 $as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; } # # linking flags needed when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5 $as_echo_n "checking python extra linking flags... " >&6; } if test -z "$PYTHON_EXTRA_LIBS"; then PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LINKFORSHARED'))"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5 $as_echo "$PYTHON_EXTRA_LIBS" >&6; } # # final check to see if everything compiles alright # { $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5 $as_echo_n "checking consistency of all components of python development environment... " >&6; } # save current global flags ac_save_LIBS="$LIBS" ac_save_LDFLAGS="$LDFLAGS" ac_save_CPPFLAGS="$CPPFLAGS" LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS $PYTHON_EXTRA_LIBS" LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS" CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { Py_Initialize(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : pythonexists=yes else pythonexists=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # turn back to default flags CPPFLAGS="$ac_save_CPPFLAGS" LIBS="$ac_save_LIBS" LDFLAGS="$ac_save_LDFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5 $as_echo "$pythonexists" >&6; } if test ! "x$pythonexists" = "xyes"; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? " Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LIBS environment variable. Example: ./configure LIBS=\"-L/usr/non-standard-path/python/lib\" ============================================================================ ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================ See \`config.log' for more details" "$LINENO" 5; } PYTHON_VERSION="" fi # # all done! # fi if test "x$PYTHON" != "x"; then if test -n "$PYTHON"; then : ax_python_version="3.0.0" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python version" >&5 $as_echo_n "checking for python version... " >&6; } python_version=`$PYTHON -V 2>&1 | $GREP "^Python " | $SED -e 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\)/\1/'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $python_version" >&5 $as_echo "$python_version" >&6; } PYTHON_VERSION=$python_version # Used to indicate true or false condition ax_compare_version=false # Convert the two version strings to be compared into a format that # allows a simple string comparison. The end result is that a version # string of the form 1.12.5-r617 will be converted to the form # 0001001200050617. In other words, each number is zero padded to four # digits, and non digits are removed. ax_compare_version_A=`echo "$ax_python_version" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/[^0-9]//g'` ax_compare_version_B=`echo "$python_version" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/[^0-9]//g'` ax_compare_version=`echo "x$ax_compare_version_A x$ax_compare_version_B" | sed 's/^ *//' | sort | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` if test "$ax_compare_version" = "true" ; then : PYTHON_SWIG_FLAGS=-py3 else : fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find the python interpreter" >&5 $as_echo "$as_me: WARNING: could not find the python interpreter" >&2;} fi $as_echo "#define HAVE_PYTHON /**/" >>confdefs.h PYTHON_DIR=python if test "x$pythoninstalldir" = "x"; then PYTHON_INSTALL_DIR="$PYTHON_SITE_PKG" else PYTHON_INSTALL_DIR="$pythoninstalldir" fi if test "x$pythoninstalllibdir" = "x"; then PYTHON_INSTALL_LIB_DIR="$PYTHON_INSTALL_DIR" else PYTHON_INSTALL_LIB_DIR="$pythoninstalllibdir" fi if test "x$pythonusepthreads" = "x"; then cat - <<_ACEOF >conftest.py try: import threading print('yes') except: print('no') _ACEOF pythonusepthreads=`$PYTHON conftest.py` rm -f conftest.py fi echo "checking for python threads... $pythonusepthreads" if test "x$pythonusepthreads" = "xyes"; then PYTHON_HAS_POSIX_THREADS=1 PYTHON_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIpthread.la' PYTHON_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIpthread.so' else PYTHON_HAS_POSIX_THREADS=0 PYTHON_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIposix.la' PYTHON_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIposix.so' fi fi # Check for Tkinter/Tix if test "x$tkinter" = "x"; then if test "x$pythonprog" != "x"; then cat - <<_ACEOF >conftest.py try: import Tix print('yes') except: print('no') _ACEOF tkinter=`python conftest.py` rm -f conftest.py fi fi echo "checking for tkinter... $tkinter" if test "x$tkinter" = "xyes"; then PYTHON_GUI_DIR=openipmigui else PYTHON_GUI_DIR= fi # Now check for swig SWIG_DIR= SWIG= if test "x$tryswig" = "xyes"; then if test "x$swigprog" != "x"; then SWIG="$swigprog" fi # Ubuntu has swig 2.0 as /usr/bin/swig2.0 for ac_prog in swig swig2.0 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_SWIG+:} false; then : $as_echo_n "(cached) " >&6 else case $SWIG in [\\/]* | ?:[\\/]*) ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi SWIG=$ac_cv_path_SWIG if test -n "$SWIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5 $as_echo "$SWIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$SWIG" && break done if test -z "$SWIG" ; then : elif test -n "1.3.21" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5 $as_echo_n "checking SWIG version... " >&6; } swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5 $as_echo "$swig_version" >&6; } if test -n "$swig_version" ; then # Calculate the required version number components required=1.3.21 required_major=`echo $required | sed 's/[^0-9].*//'` if test -z "$required_major" ; then required_major=0 fi required=`echo $required | sed 's/[0-9]*[^0-9]//'` required_minor=`echo $required | sed 's/[^0-9].*//'` if test -z "$required_minor" ; then required_minor=0 fi required=`echo $required | sed 's/[0-9]*[^0-9]//'` required_patch=`echo $required | sed 's/[^0-9].*//'` if test -z "$required_patch" ; then required_patch=0 fi # Calculate the available version number components available=$swig_version available_major=`echo $available | sed 's/[^0-9].*//'` if test -z "$available_major" ; then available_major=0 fi available=`echo $available | sed 's/[0-9]*[^0-9]//'` available_minor=`echo $available | sed 's/[^0-9].*//'` if test -z "$available_minor" ; then available_minor=0 fi available=`echo $available | sed 's/[0-9]*[^0-9]//'` available_patch=`echo $available | sed 's/[^0-9].*//'` if test -z "$available_patch" ; then available_patch=0 fi # Convert the version tuple into a single number for easier comparison. # Using base 100 should be safe since SWIG internally uses BCD values # to encode its version number. required_swig_vernum=`expr $required_major \* 10000 \ \+ $required_minor \* 100 \+ $required_patch` available_swig_vernum=`expr $available_major \* 10000 \ \+ $available_minor \* 100 \+ $available_patch` if test $available_swig_vernum -lt $required_swig_vernum; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >= 1.3.21 is required. You have $swig_version." >&5 $as_echo "$as_me: WARNING: SWIG version >= 1.3.21 is required. You have $swig_version." >&2;} SWIG='' else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5 $as_echo_n "checking for SWIG library... " >&6; } SWIG_LIB=`$SWIG -swiglib` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5 $as_echo "$SWIG_LIB" >&6; } fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5 $as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;} SWIG='' fi fi if test "x$SWIG" != "x"; then $as_echo "#define HAVE_SWIG /**/" >>confdefs.h SWIG_DIR=swig fi fi # Handle SNMP support if test "x$tryucdsnmp" != "xno"; then HAVE_UCDSNMP=no HAVE_NETSNMP=no FOUND_SNMPINCL=no # Try net snmp first ac_fn_c_check_header_mongrel "$LINENO" "net-snmp/net-snmp-config.h" "ac_cv_header_net_snmp_net_snmp_config_h" "$ac_includes_default" if test "x$ac_cv_header_net_snmp_net_snmp_config_h" = xyes; then : FOUND_SNMPINCL=yes; HAVE_NETSNMP=yes; fi if test "x$FOUND_SNMPINCL" = "xno"; then # Try old UCD snmp ac_fn_c_check_header_mongrel "$LINENO" "snmp_api.h" "ac_cv_header_snmp_api_h" "$ac_includes_default" if test "x$ac_cv_header_snmp_api_h" = xyes; then : FOUND_SNMPINCL=yes; fi if test "x$FOUND_SNMPINCL" = "xno"; then ac_fn_c_check_header_mongrel "$LINENO" "ucd-snmp/snmp_api.h" "ac_cv_header_ucd_snmp_snmp_api_h" "$ac_includes_default" if test "x$ac_cv_header_ucd_snmp_snmp_api_h" = xyes; then : FOUND_SNMPINCL=yes; $as_echo "#define HAVE_ALT_UCDSNMP_DIR /**/" >>confdefs.h fi fi fi if test "x$FOUND_SNMPINCL" = "xyes"; then if test "x$HAVE_NETSNMP" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snmp_add in -lnetsnmp" >&5 $as_echo_n "checking for snmp_add in -lnetsnmp... " >&6; } if ${ac_cv_lib_netsnmp_snmp_add+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnetsnmp $SNMPLIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char snmp_add (); int main () { return snmp_add (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_netsnmp_snmp_add=yes else ac_cv_lib_netsnmp_snmp_add=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_netsnmp_snmp_add" >&5 $as_echo "$ac_cv_lib_netsnmp_snmp_add" >&6; } if test "x$ac_cv_lib_netsnmp_snmp_add" = xyes; then : SNMPLIBS="-lnetsnmp $SNMPLIBS" $as_echo "#define HAVE_UCDSNMP /**/" >>confdefs.h $as_echo "#define HAVE_NETSNMP /**/" >>confdefs.h HAVE_UCDSNMP=yes HAVE_NETSNMP=yes fi if test "x$HAVE_UCDSNMP" = "xno"; then # Try net snmp with crypto { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snmp_add_full in -lnetsnmp" >&5 $as_echo_n "checking for snmp_add_full in -lnetsnmp... " >&6; } if ${ac_cv_lib_netsnmp_snmp_add_full+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnetsnmp -lcrypto $SNMPLIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char snmp_add_full (); int main () { return snmp_add_full (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_netsnmp_snmp_add_full=yes else ac_cv_lib_netsnmp_snmp_add_full=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_netsnmp_snmp_add_full" >&5 $as_echo "$ac_cv_lib_netsnmp_snmp_add_full" >&6; } if test "x$ac_cv_lib_netsnmp_snmp_add_full" = xyes; then : SNMPLIBS="-lnetsnmp -lcrypto $SNMPLIBS" $as_echo "#define HAVE_UCDSNMP /**/" >>confdefs.h $as_echo "#define HAVE_NETSNMP /**/" >>confdefs.h HAVE_UCDSNMP=yes HAVE_NETSNMP=yes fi fi if test "x$HAVE_UCDSNMP" = "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Found NET SNMP include files, but could not find libraries" >&5 $as_echo "$as_me: WARNING: Found NET SNMP include files, but could not find libraries" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snmp_open_ex in -lsnmp" >&5 $as_echo_n "checking for snmp_open_ex in -lsnmp... " >&6; } if ${ac_cv_lib_snmp_snmp_open_ex+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsnmp $SNMPLIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char snmp_open_ex (); int main () { return snmp_open_ex (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_snmp_snmp_open_ex=yes else ac_cv_lib_snmp_snmp_open_ex=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_snmp_snmp_open_ex" >&5 $as_echo "$ac_cv_lib_snmp_snmp_open_ex" >&6; } if test "x$ac_cv_lib_snmp_snmp_open_ex" = xyes; then : SNMPLIBS="-lsnmp $SNMPLIBS" $as_echo "#define HAVE_UCDSNMP /**/" >>confdefs.h HAVE_UCDSNMP=yes fi if test "x$HAVE_UCDSNMP" = "xno"; then # Try with the crypto lib { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snmp_sess_perror in -lsnmp" >&5 $as_echo_n "checking for snmp_sess_perror in -lsnmp... " >&6; } if ${ac_cv_lib_snmp_snmp_sess_perror+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsnmp -lcrypto $SNMPLIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char snmp_sess_perror (); int main () { return snmp_sess_perror (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_snmp_snmp_sess_perror=yes else ac_cv_lib_snmp_snmp_sess_perror=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_snmp_snmp_sess_perror" >&5 $as_echo "$ac_cv_lib_snmp_snmp_sess_perror" >&6; } if test "x$ac_cv_lib_snmp_snmp_sess_perror" = xyes; then : SNMPLIBS="-lsnmp -lcrypto $SNMPLIBS" $as_echo "#define HAVE_UCDSNMP /**/" >>confdefs.h HAVE_UCDSNMP=yes fi fi if test "x$HAVE_UCDSNMP" = "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Found UCD SNMP include files, but could not find libraries" >&5 $as_echo "$as_me: WARNING: Found UCD SNMP include files, but could not find libraries" >&2;} fi fi fi fi # Handle SNMP support if test "x$tryopenssl" != "xno"; then HAVE_OPENSSL=no # Try net snmp first ac_fn_c_check_header_mongrel "$LINENO" "openssl/crypto.h" "ac_cv_header_openssl_crypto_h" "$ac_includes_default" if test "x$ac_cv_header_openssl_crypto_h" = xyes; then : FOUND_OPENSSL=yes; fi if test "x$FOUND_OPENSSL" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_malloc in -lcrypto" >&5 $as_echo_n "checking for CRYPTO_malloc in -lcrypto... " >&6; } if ${ac_cv_lib_crypto_CRYPTO_malloc+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $OPENSSLLIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char CRYPTO_malloc (); int main () { return CRYPTO_malloc (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_crypto_CRYPTO_malloc=yes else ac_cv_lib_crypto_CRYPTO_malloc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_CRYPTO_malloc" >&5 $as_echo "$ac_cv_lib_crypto_CRYPTO_malloc" >&6; } if test "x$ac_cv_lib_crypto_CRYPTO_malloc" = xyes; then : OPENSSLLIBS="-lcrypto $OPENSSLLIBS" $as_echo "#define HAVE_OPENSSL /**/" >>confdefs.h HAVE_OPENSSL=yes fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bind in -lsocket" >&5 $as_echo_n "checking for bind in -lsocket... " >&6; } if ${ac_cv_lib_socket_bind+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char bind (); int main () { return bind (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_bind=yes else ac_cv_lib_socket_bind=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_bind" >&5 $as_echo "$ac_cv_lib_socket_bind" >&6; } if test "x$ac_cv_lib_socket_bind" = xyes; then : SOCKETLIB=-lsocket else SOCKETLIB= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -lsocket" >&5 $as_echo_n "checking for getaddrinfo in -lsocket... " >&6; } if ${ac_cv_lib_socket_getaddrinfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getaddrinfo (); int main () { return getaddrinfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_getaddrinfo=yes else ac_cv_lib_socket_getaddrinfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_getaddrinfo" >&5 $as_echo "$ac_cv_lib_socket_getaddrinfo" >&6; } if test "x$ac_cv_lib_socket_getaddrinfo" = xyes; then : $as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h else for ac_func in getaddrinfo do : ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" if test "x$ac_cv_func_getaddrinfo" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETADDRINFO 1 _ACEOF fi done fi for ac_func in syslog do : ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog" if test "x$ac_cv_func_syslog" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYSLOG 1 _ACEOF fi done # Now check for dia and the dia version. They changed the output format # specifier without leaving backwards-compatible handling, so lots of ugly # checks here. DIA= # Extract the first word of "dia", so it can be a program name with args. set dummy dia; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_diaprog+:} false; then : $as_echo_n "(cached) " >&6 else case $diaprog in [\\/]* | ?:[\\/]*) ac_cv_path_diaprog="$diaprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_diaprog="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi diaprog=$ac_cv_path_diaprog if test -n "$diaprog"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $diaprog" >&5 $as_echo "$diaprog" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$diaprog" != "x"; then diaver=`$diaprog --version 2>&1 | grep 'Dia version' | sed 's/Dia version \([^,]*\), .*$/\1/' | sed 's/^\([0-9.]\+\)+.*$/\1/'` tmp=`echo $diaver | sed 's/^[0-9.]\+$//'` if test "x$diaver" = "x" -o "x$tmp" != 'x'; then # Couldn't get the dia version, give up. echo "Couldn't determine the dia version from '$diaver'" exit 1 else DIA="$diaprog" diaver_major=`echo $diaver | sed 's/\.[0-9.]\+$//'` diaver_minor=`echo $diaver | sed 's/^[0-9]\+\.//' | sed 's/\.[0-9.]\+$//'` echo "dia version is $diaver_major.$diaver_minor" if test $diaver_major -lt 1 -a $diaver_minor -lt 95; then # 0.94 and below use --export-to-format DIA_FILTER_NAME=--export-to-format else DIA_FILTER_NAME=--filter fi fi fi LATEX= BIBTEX= DVIPDF= # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $LATEX in [\\/]* | ?:[\\/]*) ac_cv_path_LATEX="$LATEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LATEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LATEX=$ac_cv_path_LATEX if test -n "$LATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LATEX" >&5 $as_echo "$LATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "bibtex", so it can be a program name with args. set dummy bibtex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_BIBTEX+:} false; then : $as_echo_n "(cached) " >&6 else case $BIBTEX in [\\/]* | ?:[\\/]*) ac_cv_path_BIBTEX="$BIBTEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_BIBTEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi BIBTEX=$ac_cv_path_BIBTEX if test -n "$BIBTEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BIBTEX" >&5 $as_echo "$BIBTEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "dvipdf", so it can be a program name with args. set dummy dvipdf; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DVIPDF+:} false; then : $as_echo_n "(cached) " >&6 else case $DVIPDF in [\\/]* | ?:[\\/]*) ac_cv_path_DVIPDF="$DVIPDF" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DVIPDF="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DVIPDF=$ac_cv_path_DVIPDF if test -n "$DVIPDF"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DVIPDF" >&5 $as_echo "$DVIPDF" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$DIA" = "x" -o "x$LATEX" = "x" -o "x$BIBTEX" = "x" -o "x$DVIPDF" = "x"; then echo "dia, latex, bibtex, and/or dvipdf is not present or not valid, you cannot regenerate documentation" echo "The documentation comes already generated, so this is generally not a problem" fi OPENIPMI_SWIG_LIBS="${PYTHON_POSIX_LIB} \$(top_builddir)/lib/libOpenIPMI.la \$(top_builddir)/utils/libOpenIPMIutils.la \$(top_builddir)/cmdlang/libOpenIPMIcmdlang.la ${GLIB_LIB} ${TCL_LIB}" OPENIPMI_SWIG_SO="${PYTHON_POSIX_SO}:\$(top_builddir)/lib/.libs/libOpenIPMI.so:\$(top_builddir)/utils/.libs/libOpenIPMIutils.so:\$(top_builddir)/cmdlang/.libs/libOpenIPMIcmdlang.so:${GLIB_SO}:${TCL_SO}" ax_have_epoll_cppflags="${CPPFLAGS}" ac_fn_c_check_header_mongrel "$LINENO" "linux/version.h" "ac_cv_header_linux_version_h" "$ac_includes_default" if test "x$ac_cv_header_linux_version_h" = xyes; then : CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux epoll(7) interface with signals extension" >&5 $as_echo_n "checking for Linux epoll(7) interface with signals extension... " >&6; } if ${ax_cv_have_epoll_pwait+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_LINUX_VERSION_H # include # if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) # error linux kernel version is too old to have epoll_pwait # endif #endif #include #include int main () { int fd, rc; struct epoll_event ev; fd = epoll_create(128); rc = epoll_wait(fd, &ev, 1, 0); rc = epoll_pwait(fd, &ev, 1, 0, (sigset_t const *)(0)); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_have_epoll_pwait=yes else ax_cv_have_epoll_pwait=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="${ax_have_epoll_cppflags}" if test "${ax_cv_have_epoll_pwait}" = "yes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } ax_config_feature_epoll_pwait=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ax_config_feature_epoll_pwait=no fi # Check whether --enable-epoll_pwait was given. if test "${enable_epoll_pwait+set}" = set; then : enableval=$enable_epoll_pwait; case "${enableval}" in yes) ax_config_feature_epoll_pwait="yes" ;; no) ax_config_feature_epoll_pwait="no" ;; *) as_fn_error $? "bad value ${enableval} for feature --epoll_pwait" "$LINENO" 5 ;; esac fi if test "$ax_config_feature_epoll_pwait" = yes; then : $as_echo "#define HAVE_EPOLL_PWAIT 1" >>confdefs.h if test "$ax_config_feature_verbose" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Feature epoll_pwait is enabled" >&5 $as_echo "$as_me: Feature epoll_pwait is enabled" >&6;} fi else if test "$ax_config_feature_verbose" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Feature epoll_pwait is disabled" >&5 $as_echo "$as_me: Feature epoll_pwait is disabled" >&6;} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lcurses" >&5 $as_echo_n "checking for tgetent in -lcurses... " >&6; } if ${ac_cv_lib_curses_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_curses_tgetent=yes else ac_cv_lib_curses_tgetent=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_tgetent" >&5 $as_echo "$ac_cv_lib_curses_tgetent" >&6; } if test "x$ac_cv_lib_curses_tgetent" = xyes; then : TERM_LIBS=-lcurses else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncursesw" >&5 $as_echo_n "checking for tgetent in -lncursesw... " >&6; } if ${ac_cv_lib_ncursesw_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncursesw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ncursesw_tgetent=yes else ac_cv_lib_ncursesw_tgetent=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_tgetent" >&5 $as_echo "$ac_cv_lib_ncursesw_tgetent" >&6; } if test "x$ac_cv_lib_ncursesw_tgetent" = xyes; then : TERM_LIBS=-lncursesw else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5 $as_echo_n "checking for tgetent in -lncurses... " >&6; } if ${ac_cv_lib_ncurses_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ncurses_tgetent=yes else ac_cv_lib_ncurses_tgetent=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tgetent" >&5 $as_echo "$ac_cv_lib_ncurses_tgetent" >&6; } if test "x$ac_cv_lib_ncurses_tgetent" = xyes; then : TERM_LIBS=-lncurses else as_fn_error $? "libtermcap, libcurses or libncurses are required!" "$LINENO" 5 fi fi fi for ac_func in cfmakeraw do : ac_fn_c_check_func "$LINENO" "cfmakeraw" "ac_cv_func_cfmakeraw" if test "x$ac_cv_func_cfmakeraw" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CFMAKERAW 1 _ACEOF fi done if test "${build}" != "${host}" ; then for ac_prog in ${build_alias}-gcc ${build}-gcc gcc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_BUILD_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$BUILD_CC"; then ac_cv_prog_BUILD_CC="$BUILD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_BUILD_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi BUILD_CC=$ac_cv_prog_BUILD_CC if test -n "$BUILD_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_CC" >&5 $as_echo "$BUILD_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$BUILD_CC" && break done else BUILD_CC="$CC" fi ac_config_files="$ac_config_files Makefile utils/Makefile lib/Makefile unix/Makefile glib/Makefile tcl/Makefile ui/Makefile lanserv/Makefile lanserv/OpenIPMI/Makefile lanserv/sdrcomp/Makefile lanserv/marvell-bmc/Makefile sample/Makefile doc/Makefile man/Makefile swig/Makefile swig/perl/Makefile swig/python/Makefile swig/python/openipmigui/Makefile cmdlang/Makefile include/Makefile include/OpenIPMI/Makefile include/OpenIPMI/ipmiif.h include/OpenIPMI/internal/Makefile OpenIPMI.spec OpenIPMIutils.pc OpenIPMI.pc OpenIPMIpthread.pc OpenIPMIposix.pc OpenIPMIglib.pc OpenIPMItcl.pc OpenIPMIcmdlang.pc OpenIPMIui.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_OPENIPMI_SMI_TRUE}" && test -z "${HAVE_OPENIPMI_SMI_FALSE}"; then as_fn_error $? "conditional \"HAVE_OPENIPMI_SMI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by OpenIPMI $as_me 2.0.27, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ OpenIPMI config.status 2.0.27 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "unix/Makefile") CONFIG_FILES="$CONFIG_FILES unix/Makefile" ;; "glib/Makefile") CONFIG_FILES="$CONFIG_FILES glib/Makefile" ;; "tcl/Makefile") CONFIG_FILES="$CONFIG_FILES tcl/Makefile" ;; "ui/Makefile") CONFIG_FILES="$CONFIG_FILES ui/Makefile" ;; "lanserv/Makefile") CONFIG_FILES="$CONFIG_FILES lanserv/Makefile" ;; "lanserv/OpenIPMI/Makefile") CONFIG_FILES="$CONFIG_FILES lanserv/OpenIPMI/Makefile" ;; "lanserv/sdrcomp/Makefile") CONFIG_FILES="$CONFIG_FILES lanserv/sdrcomp/Makefile" ;; "lanserv/marvell-bmc/Makefile") CONFIG_FILES="$CONFIG_FILES lanserv/marvell-bmc/Makefile" ;; "sample/Makefile") CONFIG_FILES="$CONFIG_FILES sample/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "swig/Makefile") CONFIG_FILES="$CONFIG_FILES swig/Makefile" ;; "swig/perl/Makefile") CONFIG_FILES="$CONFIG_FILES swig/perl/Makefile" ;; "swig/python/Makefile") CONFIG_FILES="$CONFIG_FILES swig/python/Makefile" ;; "swig/python/openipmigui/Makefile") CONFIG_FILES="$CONFIG_FILES swig/python/openipmigui/Makefile" ;; "cmdlang/Makefile") CONFIG_FILES="$CONFIG_FILES cmdlang/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "include/OpenIPMI/Makefile") CONFIG_FILES="$CONFIG_FILES include/OpenIPMI/Makefile" ;; "include/OpenIPMI/ipmiif.h") CONFIG_FILES="$CONFIG_FILES include/OpenIPMI/ipmiif.h" ;; "include/OpenIPMI/internal/Makefile") CONFIG_FILES="$CONFIG_FILES include/OpenIPMI/internal/Makefile" ;; "OpenIPMI.spec") CONFIG_FILES="$CONFIG_FILES OpenIPMI.spec" ;; "OpenIPMIutils.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIutils.pc" ;; "OpenIPMI.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMI.pc" ;; "OpenIPMIpthread.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIpthread.pc" ;; "OpenIPMIposix.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIposix.pc" ;; "OpenIPMIglib.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIglib.pc" ;; "OpenIPMItcl.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMItcl.pc" ;; "OpenIPMIcmdlang.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIcmdlang.pc" ;; "OpenIPMIui.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIui.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi OpenIPMI-2.0.27/README0000644000175000017500000003433213374560102010771 00000000000000 This is the OpenIPMI library, a library that makes simplifies building complex IPMI management software. What is IPMI? ============= IPMI is a specification detailing how to detect and manage sensors in a system. It also specifies some chassis-level thing like power control, reset, FRU (Field Replaceable Unit) information, and watchdogs. However, IPMI has become much more than that. Vendors have added extensions to IPMI for doing many thing, including controlling LEDs, relays, character displays, and managing hot-swapping components. In general, it has become the "standard" way to handle hardware maintenance in a system. IPMI specifies a set of interconnected intelligent Management Controllers (MCs). Each MC is a small CPU that manages a set of sensors and/or output devices. The "main" MC is called the Baseboard Management Controller (BMC); it provides the external interfaces into the system. Each MC may have a set of Sensor Data Records (SDRs). An SDR details information about a sensor. Some SDR records also have information about entities, such as their name, the FRU information, and what other entities they are contained in. Entities are the physical objects in the system (boards, CPUs, fans, power supplies, etc.) A sensor is attached to the entity it monitors; the SDR record tell what entity a sensor monitors. IPMI specifies several external interfaces to the BMC. One set is local interfaces directly to a CPU, a local CPU connections is called a system interface. The other is external interfaces through a LAN, serial port, or modem. The external interfaces allow a system to be managed even when it is turned off, since the BMC is always powered when the system is plugged in. IPMI has a strong bent toward complete "chassis" systems, basically a box with one main board with CPUs; a BMC, and perhaps a few satellite MCs in things like power supplies. It is being rapidly adopted in "shelf" systems, which has a set of slots where you can plug in complete single-board computers. In shelf systems, the BMC becomes a central shelf manager that manages all the boards in the shelf. Although IPMI was not designed for this, it does a pretty good job of extending into this architecture. What is OpenIPMI? ================= Notice that in the description above, OpenIPMI was designed to aid building "complex IPMI management software". That's a carefully chosen description. Most of the OpenIPMI library was designed for building complicated systems that continuously monitor IPMI hardware. It's not for little things that simply want to get some information, do something, and leave (unless that information is elaborate information). OpenIPMI will connect with an IPMI controller, detect any management controllers on the bus, get their SDRs, manage all the entities in the system, manage the event log, and a host of other things. As you might imagine, that is a fairly lengthy process on a complex system. OpenIPMI is also dynamic and event-driven. It will come up and start discovering things in the managed system. As it discovers things, it will report them to the software using it (assuming the software has asked for this reporting). This process of discovery is never done from OpenIPMI's point of view; things can come and go in the system and it will report these changes as it detects them. This can be a little confusing to people who want a static view of their system. OpenIPMI has no static view (though it does have a current view). When you make a connection, it will report when the connection is up; but the system will be "empty". You have to wait for OpenIPMI to report the things it finds. It is possible to use OpenIPMI's low-level connection code if you want to do a direct connection to a BMC (through the LAN or system interface). You can see the code in sample/ipmicmd.c for an example of how to do this. Most of the other pieces of OpenIPMI are not useful by themselves, though, because they are intrinsically tied together. Building and Configuring OpenIPMI ================================= OpenIPMI is built with standard autoconf/automake. You must configure OpenIPMI before you compile it. To do this, change to the main OpenIPMI directory and execute "./configure". The configure script will detect what is available in the system and configure itself accordingly. By default, the configure script will cause OpenIPMI to be installed in the "/usr/local" prefix. This means that the include files go into /usr/local/include/OpenIPMI, the libraries go into /usr/local/lib, the executables go into /usr/local/bin, etc. If you want to change the prefix, use the "--prefix=" option to configure. For instance, to install in /opt/OpenIPMI, you would do: ./configure --prefix=/opt/OpenIPMI Note that OpenIPMI will attempt to detect and use either the NET SNMP or UCD SNMP libraries. Note that if your NET SNMP or UCD SNMP library is in a non-standard location, you will need to use the '--with-ucdsnmp=' option with configure to specify the actual path to your library. You also *must* have the development system for your SNMP library installed. If you don't have the development system installed, just the runtime libraries, OpenIPMI will not detect or use the SNMP libraries. If you do not want to use the SNMP libraries even if they are installed, you can specify '--with-ucdsnmp=no' as a configure option. After you have configured OpenIPMI, type "make" to build it. To install it in the prefix you defined, do "make install". OpenIPMI requires the following packages: * popt * curses, ncurses or termcap OpenIPMI can use, but does not require, the following packages: * netsnmp or ucdsnmp - netsnmp is the preferred SNMP package, but it will use either of these. Without this, the sample programs will not be able to receive SNMP traps, but there is no functional change to the library. * openssl - This is required for IPMI 2.0 RMCP+ encryption and authentication support. See FAQ item 2.22 for details. * glib (along with pkgconfig) - glib 2.0 is preferred, but glib 1.2 will be used if 2.0 is not available. This is simply an OS handler for glib and it not used for anything else in OpenIPMI itself, but is useful for users using glib. Note that OpenIPMI will be able to use both glib 1.2 an glib 2.0 at the same time, but this is difficult and not recommended. * swig 1.3.21 or later - This is required for perl and python language support. Without it, perl, python, and the GUI will not work. * perl - Support for writing scripts in the perl language that use the OpenIPMI library. * python - Support for writing scripts in the python language that use the OpenIPMI library. * Tcl/Tk - There is no Tcl language support (someone may contribute that, though). However, A Tcl OS handler is provided so that Perl and Python may use the Tk widgets. Without this, the GUI will not work. Note that getting Tcl/Tk to work right can be difficult, see below for more details. * Tkinter/Tix - Python GUI libraries. Required for the GUI to work. * gdbm - This is used on *nix for local SDR caching. This is not required, but it *really* speeds up startup. Note you need to install the development packages (generally ending in -dev) of most of these for OpenIPMI to pick it up. You can examine the output of configure to make sure they are properly discovered. Getting Tcl/Tk to work ====================== Tcl is installed in various places, and the configure script probably won't find it. If it doesn't, you must specify the install location for Tcl by adding: --with-tclcflags=flags --with-tcllibs=lib For instance, on my Debian Linux system, I have to specify: ./configure --with-tclcflags="-I /usr/include/tcl8.4" --with-tcllibs=-ltcl8.4 to make it work right. If you don't get this right, you don't get a GUI! Using ipmish ============ ipmish is a command interpreter that lets you execute IPMI operations, get the results, etc. It gives you the full power of OpenIPMI. It can easily be driven with a TCL script or the like. See the man page for more details. The OpenIPMI GUI ================ The GUI is cleverly named openipmigui and provides a GUI interface to most of OpenIPMI. It also has the standard command language (like ipmish) available in a window, so it has all the power of ipmish. To use the GUI, you have to have the following optional packages: * swig 1.3.21 or later * python * Tcl/Tk * Tkinter/Tix The GUI is documented in the openipmigui man page. Using ipmi_ui ============= ipmi_ui is a cheesy little tool that runs on top of the OpenIPMI library. It provides a command line and text-window based view into an IPMI system. A man page is included for it, if you want to know more. Note that ipmi_ui was written primarily for testing. It does things that users generally shouldn't do. You can use it for examples, but it touches things that are considered OpenIPMI internal, so be careful what you use. ipmish and the sample code is a much better example. Perl/Python and OpenIPMI ======================== OpenIPMI has perl and python bindings using swig. The public interface of OpenIPMI is available, but the private interfaces are not (and a few other things like SNMP trap support). It is fully function. I was hoping that swig would generate documentation from the comments, but it turns out that it does not do that. You can look at swig/OpenIPMI.i for the documentation on all the interfaces, and swig/perl/sample and the gui in swig/python/openipmigui.py for a piece of sample code that uses most of the interfaces. The interface is object-oriented, so you have to know how to do OO Perl or Pythong to use this. It is like this because that is the most natural way to use SWIG (and it makes more OO languages like python easier). OpenIPMI and SNMP ================= The OpenIPMI ipmi_ui command has an optional trap handler. It will use incoming traps as an indication that something is waiting in the SEL for it to fetch and immediately start a fetch. You have to have the UCD snmp library (or something compatible) installed for this to work, and you have to start ipmi_ui with the '-snmp' option. You must do this as root, as the SNMP Trap port is 162. You may ask why the trap is not directly used, why does it just trigger an SEL fetch? Well, that's because the IPMI trap does not have enough information to determine the correct sensor (it's missing the channel and LUN) and it does not have enough information to correlate the SEL entries with the trap (It doesn't have the record ID or necessarily the proper timestamp). Also, OpenIPMI does not directly handle the traps. Instead, it has an interface to report a trap when it has been received. OpenIPMI does not want to assume the SNMP library being used; instead it lets the user pick that library. If you want an example of how to use the UCD SNMP or NET SNMP libraries and hook them into OpenIPMI, the ui/basic_ui.c file has an example of this. What Else Comes with OpenIPMI? ============================== It does include the utility "ipmicmd" which lets you do direct IPMI commands to a connection. ipmicmd can connect using the OpenIPMI driver or via IPMI LAN. OpenIPMI also includes a LAN to system interface converter, it can sit on top of an OpenIPMI driver and supply a LAN connection to the BMC. Note that to work the best, the LAN converter needs at least the v22 version of the OpenIPMI driver to support setting retries and timeouts for messages. Other sample code for using OpenIPMI is in the "samples" directory. IPMI Documentation ================== OpenIPMI includes a texinfo document in the "doc" directory. It talks a little about IPMI, must mostly about OpenIPMI. It is required reading for using OpenIPMI. Read it carefully. Unfortunately, the IPMI spec is also currently required reading for using OpenIPMI. Fortunately, you do not need to read the whole spec. If you read the OpenIPMI document first, you can probably get by with reading the following sections in the 1.5 spec: * 1.6 (overview) * 5.2 (for the error completion codes) * 33-36 (talking about sensors and entities) * 37.1 (talking about the main sensor SDR, mostly for learning about sensor capabilities). OpenIPMI should hide the rest from you. The OpenIPMI document is currently just an overview. It should point you in all the right directions, but it does not contain the actual details of most OpenIPMI functions. Those are currently documented in the include files, so you will have to look through the include files for how to use the functions. OpenIPMI Source Structure ========================= Note that parts of OpenIPMI could be used inside other systems. However, the LGPL license may be a restriction. If you are interested in re-licensing parts of OpenIPMI, contact MontaVista software. The source tree here consists of the following directories: +---cmdlang - A command-line interpreter that gives access to the | OpenIPMI library. Includes a user interface named | openipmish that demonstrates how to use it. | +--- doc - The main documentation for OpenIPMI | +---glib - A glib OS handler. | +---include | +---linux - linux-specific include files | \---OpenIPMI - User-visible include files for OpenIPMI | \---internal - Internal include files, only for plugins | +---lanserv - Code to provide a LAN interface to an IPMI device and | to provide an IPMI simulator | +---lib - The man OpenIPMI code. This is where all the logic for the | handling of IPMI messages is. | +---man - The man pages for the | +---sample - Sample code and utilities that use the OpenIPMI library. | +---swig - The main interpreter interface. swig is a program that | | takes a general description of a C/C++ interface and | | provides the equivalent interface in various interpreters. | +---perl - Perl-specific code for swig, including sample code and | | tests. | \---python - Python-specific code for swig. | \---openipmigui - A GUI for OpenIPMI, written in Python. | +---tcl - A TCL OS handler | +---ui - A depracated UI for OpenIPMI. | +---unix - A POSIX OS handler, one for threaded and one for | non-threaded applications/ | \---utils - General utility code used by both the OpenIPMI library and by the lanserv code. OpenIPMI-2.0.27/Makefile.am0000664000175000017500000000251713307527655012163 00000000000000RPM = rpmbuild RPMFLAGS = -ta SUBDIRS = include utils lib unix $(GLIB_DIR) $(TCL_DIR) cmdlang \ ui lanserv sample doc man $(SWIG_DIR) DIST_SUBDIRS = include utils lib unix glib tcl cmdlang \ ui lanserv sample doc man swig EXTRA_DIST = FAQ TODO README.Force README.MotorolaMXP OpenIPMI.spec.in \ OpenIPMI.spec ipmi.init ipmi.sysconf COPYING.BSD \ CONFIGURING_FOR_LAN PKGCONFIGS = OpenIPMIutils.pc OpenIPMI.pc OpenIPMIui.pc OpenIPMIposix.pc \ OpenIPMIpthread.pc OpenIPMIcmdlang.pc $(GLIB_PKGCONF) \ $(GLIB12_PKGCONF) $(TCL_PKGCONF) ACLOCAL_AMFLAGS = -I m4 install-data-local: $(PKGCONFIGS) $(mkinstalldirs) $(DESTDIR)$(libdir)/pkgconfig $(INSTALL_DATA) $(PKGCONFIGS) $(DESTDIR)$(libdir)/pkgconfig uninstall-local: for i in $(PKGCONFIGS); do \ rm -f $(DESTDIR)$(libdir)/pkgconfig/$$i; \ done rpm: dist $(RPM) $(RPMFLAGS) $(distdir).tar.gz < /dev/null PYPATH=$(top_builddir)/swig/python:$(top_builddir)/swig/python/.libs rungui: LD_LIBRARY_PATH=$(top_builddir)/glib/.libs LD_PRELOAD=$(OPENIPMI_SWIG_SO):$(top_builddir)/swig/python/.libs/_OpenIPMI.so PYTHONPATH=$(PYPATH) $(PYTHON) $(top_srcdir)/swig/python/openipmigui.py DISTCLEANFILES=OpenIPMI.spec OpenIPMIcmdlang.pc OpenIPMI.pc OpenIPMItcl.pc \ OpenIPMIglib12.pc OpenIPMIposix.pc OpenIPMIui.pc OpenIPMIglib.pc \ OpenIPMIpthread.pc OpenIPMIutils.pc OpenIPMI-2.0.27/OpenIPMIglib.pc.in0000644000175000017500000000037412002623311013244 00000000000000prefix=@prefix@ exec_prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ Name: OpenIPMIglib Description: GLIB threaded OS handler for OpenIPMI Version: @VERSION@ Requires: Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMIglib Cflags: -I${includedir} OpenIPMI-2.0.27/config.sub0000755000175000017500000010544513062570567012112 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-07-31' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: OpenIPMI-2.0.27/README.Force0000644000175000017500000000423512002623311012012 00000000000000 This package includes preliminary OEM support for Force Computers (TM) cards. This is still somewhat experimental. Note that you NEED the v22 version of the OpenIPMI driver to use the dual MC handling code for Force, it solves some race conditions between the separate interfaces. This driver includes OEM handling for connections to Force CPCI systems. It will automatically handle setting up the connections for you, you do not need to set up a card as the BMC any more. I have done most of my testing with the LAN server running on Force card over ethernet to my host machine, hooking to two card running the LAN server. The Force handling of BMCs is different than other systems. You can set the MC on a Force card to be a BMC at address 0x20 or a "normal" MC. The capabilities of the MC change depending on if it is a BMC or not. Only the BMC can be an event receiver or SDR repository, for instance. Any you can only have on BMC in a system at a time. OpenIPMI can automatically manage setting one of the Force cards to a BMC (OpenIPMI calls that "activating" the connection) upon connection, and when the "active" connection fails. However, this means that the addresses changes from the PICMG specified address to the BMC address (and the card that becomes inactive will be set from the BMC address back to the PICMG address, if it is still active), and the capabilities will change, so the OpenIPMI MC will be destroyed and re-created (along with all the sensors and entities) for both the old and the new active connections. If Force ever allows a non-BMC device to be an event receiver and SDR repository, I'll change it to be an active-active connection, since the current kind of connection is difficult for OpenIPMI to handle properly. I haven't thought of a nice "smooth" way to handle this type of interface. If you have a single connection to a Force system, it's not big deal, of course. Your connection will be set to the BMC and everything will be happy. This only affects dual connections. Of course, if you connect two different OpenIPMI-enabled programs to two different cards, they will get into a war about who's connection is active, so you shouldn't do this. OpenIPMI-2.0.27/ipmi.sysconf0000644000175000017500000000437012002623311012441 00000000000000## Path: Hardware/IPMI ## Description: Enable standard hardware interfaces (KCS, BT, SMIC) ## Type: yesno ## Default: "yes" ## Config: ipmi # Enable standard hardware interfaces (KCS, BT, SMIC) # You probably want this enabled. IPMI_SI=yes ## Path: Hardware/IPMI ## Description: Enable /dev/ipmi0 interface, used by ipmitool, ipmicmd, ## Type: yesno ## Default: "yes" ## Config: ipmi # Enable /dev/ipmi0 interface, used by ipmitool, ipmicmd, # and other userspace IPMI-using applications. # You probably want this enabled. DEV_IPMI=yes ## Path: Hardware/IPMI ## Description: Enable IPMI_WATCHDOG if you want the IPMI watchdog ## Type: yesno ## Default: "no" ## Config: ipmi # Enable IPMI_WATCHDOG if you want the IPMI watchdog # to reboot the system if it hangs IPMI_WATCHDOG=no ## Path: Hardware/IPMI ## Description: Watchdog options - modinfo ipmi_watchdog for details ## Type: string ## Default: "timeout=60" ## Config: ipmi # Watchdog options - modinfo ipmi_watchdog for details # watchdog timeout value in seconds # as there is no userspace ping application that runs during shutdown, # be sure to give it enough time for any device drivers to # do their cleanup (e.g. megaraid cache flushes) # without the watchdog triggering prematurely IPMI_WATCHDOG_OPTIONS="timeout=60" ## Path: Hardware/IPMI ## Description: Enable IPMI_POWEROFF if you want the IPMI poweroff module to be loaded. ## Type: yesno ## Default: "no" ## Config: ipmi # Enable IPMI_POWEROFF if you want the IPMI # poweroff module to be loaded. IPMI_POWEROFF=no ## Path: Hardware/IPMI ## Description: Enable IPMI_POWERCYCLE if you want the system to be power-cycled on reboot ## Type: yesno ## Default: "no" ## Config: ipmi # Enable IPMI_POWERCYCLE if you want the system to be power-cycled (power # down, delay briefly, power on) rather than power off, on systems # that support such. IPMI_POWEROFF=yes is also required. IPMI_POWERCYCLE=no ## Path: Hardware/IPMI ## Description: Enable "legacy" interfaces for applications ## Type: yesno ## Default: "no" ## Config: ipmi # Enable "legacy" interfaces for applications # Intel IMB driver interface IPMI_IMB=no OpenIPMI-2.0.27/ui/0000755000175000017500000000000013437611466010613 500000000000000OpenIPMI-2.0.27/ui/ui_keypad.h0000644000175000017500000000375512002623311012643 00000000000000/* * ui_keypad.h * * MontaVista IPMI code, a simple curses UI keypad handler * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef UI_KEYPAD_H #define UI_KEYPAD_H #include typedef int (*key_handler_t)(int key, void *cb_data); struct key_entry { int key; key_handler_t handler; }; #define NUM_KEY_ENTRIES 128 typedef struct { ilist_t *keys[NUM_KEY_ENTRIES]; } *keypad_t; int keypad_handle_key(keypad_t keypad, int key, void *cb_data); int keypad_bind_key(keypad_t keypad, int key, key_handler_t handler); int keypad_unbind_key(keypad_t keypad, int key); keypad_t keypad_alloc(void); void keypad_free(keypad_t keypad); #endif /* UI_KEYPAD_H */ OpenIPMI-2.0.27/ui/ui_command.h0000644000175000017500000000374312002623311013001 00000000000000/* * ui_command.h * * MontaVista IPMI code, a simple curses UI command handler * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef UI_COMMAND_H #define UI_COMMAND_H #include typedef int (*cmd_handler_t)(char *cmd, char **toks, void *cb_data); struct cmd_entry { char *name; cmd_handler_t handler; }; typedef struct { ilist_t *cmds; } *command_t; int command_handle(command_t command, char *line, void *cb_data); int command_bind(command_t command, char *name, cmd_handler_t handler); int command_unbind(command_t command, char *name); command_t command_alloc(void); void command_free(command_t command); #endif /* UI_COMMAND_H */ OpenIPMI-2.0.27/ui/ui_keypad.c0000644000175000017500000000731012002623311012625 00000000000000/* * ui_keypad.c * * MontaVista IPMI code, a simple curses UI keypad handler * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include "ui_keypad.h" #include #include static int search_key(void *item, void *cb_data) { struct key_entry *entry = item; int *val = cb_data; return (entry->key == *val); } static struct key_entry * find_key(ilist_iter_t *iter, keypad_t keypad, int key) { int hash = ((unsigned int) key) % NUM_KEY_ENTRIES; struct key_entry *entry; ilist_init_iter(iter, keypad->keys[hash]); ilist_unpositioned(iter); entry = ilist_search_iter(iter, search_key, &key); return entry; } int keypad_handle_key(keypad_t keypad, int key, void *cb_data) { ilist_iter_t iter; struct key_entry *entry; entry = find_key(&iter, keypad, key); if (!entry) return ENOENT; return entry->handler(key, cb_data); } int keypad_bind_key(keypad_t keypad, int key, key_handler_t handler) { int hash = ((unsigned int) key) % NUM_KEY_ENTRIES; ilist_iter_t iter; struct key_entry *entry; if (find_key(&iter, keypad, key)) return EEXIST; entry = ipmi_mem_alloc(sizeof(*entry)); if (!entry) return ENOMEM; entry->key = key; entry->handler = handler; if (!ilist_add_tail(keypad->keys[hash], entry, NULL)) { ipmi_mem_free(entry); return ENOMEM; } return 0; } int keypad_unbind_key(keypad_t keypad, int key) { ilist_iter_t iter; struct key_entry *entry; entry = find_key(&iter, keypad, key); if (!entry) return ENOENT; ilist_delete(&iter); ipmi_mem_free(entry); return 0; } static void del_key_entry(ilist_iter_t *iter, void *item, void *cb_data) { ilist_delete(iter); ipmi_mem_free(item); } void keypad_free(keypad_t keypad) { int i; for (i=0; ikeys[i]) { ilist_iter(keypad->keys[i], del_key_entry, NULL); free_ilist(keypad->keys[i]); } } ipmi_mem_free(keypad); } keypad_t keypad_alloc(void) { keypad_t nv = ipmi_mem_alloc(sizeof(*nv)); int i; if (nv) { memset(nv, 0, sizeof(*nv)); for (i=0; ikeys[i] = alloc_ilist(); if (!nv->keys[i]) goto out_err; } } return nv; out_err: keypad_free(nv); return NULL; } OpenIPMI-2.0.27/ui/Makefile.am0000644000175000017500000000121313136246762012563 00000000000000 LIB_VERSION = 1.0.1 LD_VERSION = 1:1:0 SNMPLIBS=@SNMPLIBS@ AM_CFLAGS = -Wall -Wsign-compare -I$(top_builddir)/include \ -I$(top_srcdir)/include -DIPMI_CHECK_LOCKS bin_PROGRAMS = ipmi_ui noinst_HEADERS = ui_keypad.h ui_command.h lib_LTLIBRARIES = libOpenIPMIui.la libOpenIPMIui_la_SOURCES = ui.c ui_os.c ui_keypad.c ui_command.c libOpenIPMIui_la_LIBADD = libOpenIPMIui_la_LDFLAGS = -version-info $(LD_VERSION) ipmi_ui_SOURCES = basic_ui.c ipmi_ui_LDADD = libOpenIPMIui.la $(top_builddir)/utils/libOpenIPMIutils.la $(top_builddir)/lib/libOpenIPMI.la $(top_builddir)/unix/libOpenIPMIposix.la $(TERM_LIBS) $(SNMPLIBS) $(OPENSSLLIBS) $(GDBM_LIB) OpenIPMI-2.0.27/ui/ui.c0000644000175000017500000054207413414041474011317 00000000000000/* * ui.c * * MontaVista IPMI code, a simple curses UI for IPMI * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003,2004 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ui_keypad.h" #include "ui_command.h" /* X/Open curses deprecates SVr4 vwprintw/vwscanw, but some still have it. */ #ifndef HAVE_VW_PRINTW #define vw_printw vwprintw #endif WINDOW *main_win; WINDOW *cmd_win; WINDOW *stat_win; WINDOW *log_pad; WINDOW *dummy_pad; WINDOW *display_pad; int log_pad_top_line; int display_pad_top_line; keypad_t keymap; command_t commands; ipmi_domain_id_t domain_id; os_handler_t *ipmi_ui_os_hnd; ipmi_pef_t *pef; ipmi_pef_config_t *pef_config; ipmi_lanparm_t *lanparm; ipmi_lan_config_t *lanparm_config; static int full_screen; struct termios old_termios; int old_flags; #define STATUS_WIN_LINES 2 #define STATUS_WIN_COLS COLS #define STATUS_WIN_TOP 0 #define STATUS_WIN_LEFT 0 #define CMD_WIN_LINES 3 #define CMD_WIN_COLS COLS #define CMD_WIN_LEFT 0 #define CMD_WIN_TOP (LINES-CMD_WIN_LINES) #define DISPLAY_WIN_LINES (LINES - STATUS_WIN_LINES - CMD_WIN_LINES - 2) #define DISPLAY_WIN_COLS (COLS/2-1) #define DISPLAY_WIN_TOP (STATUS_WIN_LINES+1) #define DISPLAY_WIN_LEFT 0 #define DISPLAY_WIN_RIGHT (COLS/2-2) #define DISPLAY_WIN_BOTTOM (CMD_WIN_TOP-2) #define NUM_DISPLAY_LINES 1024 #define LOG_WIN_LINES (LINES - STATUS_WIN_LINES - CMD_WIN_LINES - 2) #define LOG_WIN_COLS (COLS-(COLS/2)) #define LOG_WIN_LEFT (COLS/2) #define LOG_WIN_RIGHT (COLS-1) #define LOG_WIN_TOP (STATUS_WIN_LINES+1) #define LOG_WIN_BOTTOM (CMD_WIN_TOP-2) #define NUM_LOG_LINES 1024 #define TOP_LINE STATUS_WIN_LINES #define BOTTOM_LINE (LINES-CMD_WIN_LINES-1) #define MID_COL (COLS/2-1) #define MID_LINES (LINES - STATUS_WIN_LINES - CMD_WIN_LINES - 2) enum scroll_wins_e { LOG_WIN_SCROLL, DISPLAY_WIN_SCROLL }; enum scroll_wins_e curr_win = LOG_WIN_SCROLL; /* The current thing display in the display pad. */ enum { DISPLAY_NONE, DISPLAY_SENSOR, DISPLAY_SENSORS, DISPLAY_CONTROLS, DISPLAY_CONTROL, DISPLAY_ENTITIES, DISPLAY_MCS, DISPLAY_MC, DISPLAY_RSP, DISPLAY_SDRS, HELP, EVENTS, DISPLAY_ENTITY, DISPLAY_FRU } curr_display_type; ipmi_sensor_id_t curr_sensor_id; ipmi_control_id_t curr_control_id; typedef struct pos_s {int y; int x; } pos_t; typedef struct thr_pos_s { int set; pos_t value; pos_t enabled; pos_t oor; } thr_pos_t; thr_pos_t threshold_positions[6]; pos_t value_pos; pos_t enabled_pos; pos_t scanning_pos; pos_t discr_assert_enab; pos_t discr_deassert_enab; ipmi_entity_id_t curr_entity_id; static char *line_buffer = NULL; static int line_buffer_max = 0; static int line_buffer_pos = 0; os_hnd_timer_id_t *redisplay_timer; static void conv_from_spaces(char *name) { while (*name) { if (*name == ' ') *name = '~'; name++; } } static void conv_to_spaces(char *name) { while (*name) { if (*name == '~') *name = ' '; name++; } } void log_pad_refresh(int newlines) { if (full_screen) { if (log_pad_top_line < 0) log_pad_top_line = 0; if (log_pad_top_line > (NUM_LOG_LINES - LOG_WIN_LINES)) log_pad_top_line = NUM_LOG_LINES - LOG_WIN_LINES; if (log_pad_top_line != (NUM_LOG_LINES - LOG_WIN_LINES)) { /* We are not at the bottom, so hold the same position. */ log_pad_top_line -= newlines; } prefresh(log_pad, log_pad_top_line, 0, LOG_WIN_TOP, LOG_WIN_LEFT, LOG_WIN_BOTTOM, LOG_WIN_RIGHT); wrefresh(cmd_win); } } void vlog_pad_out(const char *format, va_list ap) { if (full_screen) vw_printw(log_pad, format, ap); else vprintf(format, ap); } void log_pad_out(char *format, ...) { va_list ap; va_start(ap, format); vlog_pad_out(format, ap); va_end(ap); } void display_pad_refresh(void) { if (full_screen) { if (display_pad_top_line >= NUM_DISPLAY_LINES) display_pad_top_line = NUM_DISPLAY_LINES; if (display_pad_top_line < 0) display_pad_top_line = 0; prefresh(display_pad, display_pad_top_line, 0, DISPLAY_WIN_TOP, DISPLAY_WIN_LEFT, DISPLAY_WIN_BOTTOM, DISPLAY_WIN_RIGHT); wrefresh(cmd_win); } } void display_pad_clear(void) { display_pad_top_line = 0; if (full_screen) { werase(display_pad); wmove(display_pad, 0, 0); } } void display_pad_clear_nomove(void) { if (full_screen) { werase(display_pad); wmove(display_pad, 0, 0); } } void display_pad_out(char *format, ...) { va_list ap; va_start(ap, format); if (full_screen) vw_printw(display_pad, format, ap); else vprintf(format, ap); va_end(ap); } void cmd_win_out(char *format, ...) { va_list ap; va_start(ap, format); if (full_screen) vw_printw(cmd_win, format, ap); else vprintf(format, ap); va_end(ap); } void cmd_win_refresh(void) { if (full_screen) wrefresh(cmd_win); else fflush(stdout); } static int get_uchar(char **toks, unsigned char *val, char *errstr) { char *str, *tmpstr; str = strtok_r(NULL, " \t\n", toks); if (!str) { if (errstr) cmd_win_out("No %s given\n", errstr); return EINVAL; } *val = strtoul(str, &tmpstr, 16); if (*tmpstr != '\0') { if (errstr) cmd_win_out("Invalid %s given\n", errstr); return EINVAL; } return 0; } static int get_uint(char **toks, unsigned int *val, char *errstr) { char *str, *tmpstr; str = strtok_r(NULL, " \t\n", toks); if (!str) { if (errstr) cmd_win_out("No %s given\n", errstr); return EINVAL; } *val = strtoul(str, &tmpstr, 16); if (*tmpstr != '\0') { if (errstr) cmd_win_out("Invalid %s given\n", errstr); return EINVAL; } return 0; } static int get_ip_addr(char **toks, struct in_addr *ip_addr, char *errstr) { uint32_t addr; unsigned char val; char *str, *tmpstr, *istr; char *ntok; int i; str = strtok_r(NULL, " \t\n", toks); if (!str) { if (errstr) cmd_win_out("No %s given\n", errstr); return EINVAL; } addr = 0; for (i=0; i<4; i++) { istr = strtok_r(str, ".", &ntok); str = NULL; if (!istr) { if (errstr) cmd_win_out("%s: invalid IP address\n", errstr); return EINVAL; } val = strtoul(istr, &tmpstr, 10); if (*tmpstr != '\0') { if (errstr) cmd_win_out("%s: Invalid IP address\n", errstr); return EINVAL; } addr = (addr << 8) | val; } ip_addr->s_addr = htonl(addr); return 0; } static int get_mac_addr(char **toks, unsigned char *mac_addr, char *errstr) { char *str, *tmpstr, *istr; char *ntok; int i; str = strtok_r(NULL, " \t\n", toks); if (!str) { if (errstr) cmd_win_out("No %s given\n", errstr); return EINVAL; } for (i=0; i<6; i++) { istr = strtok_r(str, ":", &ntok); str = NULL; if (!istr) { if (errstr) cmd_win_out("%s: invalid IP address\n", errstr); return EINVAL; } mac_addr[i] = strtoul(istr, &tmpstr, 16); if (*tmpstr != '\0') { if (errstr) cmd_win_out("%s: Invalid IP address\n", errstr); return EINVAL; } } return 0; } void draw_lines() { werase(main_win); wmove(main_win, TOP_LINE, 0); whline(main_win, 0, COLS); wmove(main_win, BOTTOM_LINE, 0); whline(main_win, 0, COLS); wmove(main_win, TOP_LINE, MID_COL); wvline(main_win, ACS_TTEE, 1); wmove(main_win, TOP_LINE+1, MID_COL); wvline(main_win, 0, MID_LINES); wmove(main_win, TOP_LINE+1+MID_LINES, MID_COL); wvline(main_win, ACS_BTEE, 1); wrefresh(main_win); } void ui_vlog(const char *format, enum ipmi_log_type_e log_type, va_list ap) { int do_nl = 1; struct timeval now; ipmi_ui_os_hnd->get_real_time(ipmi_ui_os_hnd, &now); if (full_screen) { int x = 0, y = 0, old_x = 0, old_y = 0; int max_x, max_y, i, j; /* Generate the output to the dummy pad to see how many lines we will use. */ getyx(dummy_pad, old_y, old_x); switch(log_type) { case IPMI_LOG_INFO: wprintw(dummy_pad, "%d.%6.6d: ", now.tv_sec, now.tv_usec); wprintw(dummy_pad, "INFO: "); break; case IPMI_LOG_WARNING: wprintw(dummy_pad, "%d.%6.6d: ", now.tv_sec, now.tv_usec); wprintw(dummy_pad, "WARN: "); break; case IPMI_LOG_SEVERE: wprintw(dummy_pad, "%d.%6.6d: ", now.tv_sec, now.tv_usec); wprintw(dummy_pad, "SEVR: "); break; case IPMI_LOG_FATAL: wprintw(dummy_pad, "%d.%6.6d: ", now.tv_sec, now.tv_usec); wprintw(dummy_pad, "FATL: "); break; case IPMI_LOG_ERR_INFO: wprintw(dummy_pad, "%d.%6.6d: ", now.tv_sec, now.tv_usec); wprintw(dummy_pad, "EINF: "); break; case IPMI_LOG_DEBUG_START: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG: wprintw(dummy_pad, "%d.%6.6d: ", now.tv_sec, now.tv_usec); wprintw(dummy_pad, "DEBG: "); break; case IPMI_LOG_DEBUG_CONT: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG_END: break; } vw_printw(dummy_pad, format, ap); if (do_nl) wprintw(dummy_pad, "\n"); getyx(dummy_pad, y, x); if (old_y == y) { for (j=old_x; jget_real_time(ipmi_ui_os_hnd, &now); va_start(ap, format); if (full_screen) { /* Generate the output to the dummy pad to see how many lines we will use. */ wprintw(dummy_pad, "%d.%6.6d: ", now.tv_sec, now.tv_usec); vw_printw(dummy_pad, format, ap); getyx(dummy_pad, y, x); wmove(dummy_pad, 0, x); va_end(ap); va_start(ap, format); } log_pad_out("%ld.%6.6ld: ", now.tv_sec, now.tv_usec); vlog_pad_out(format, ap); log_pad_refresh(y); cmd_win_refresh(); va_end(ap); } void leave(int rv, char *format, ...) { va_list ap; ipmi_shutdown(); ipmi_ui_os_hnd->stop_timer(ipmi_ui_os_hnd, redisplay_timer); ipmi_ui_os_hnd->free_timer(ipmi_ui_os_hnd, redisplay_timer); if (full_screen) { endwin(); full_screen = 0; } else { tcsetattr(0, TCSADRAIN, &old_termios); fcntl(0, F_SETFL, old_flags); tcdrain(0); } if (pef_config) { ipmi_pef_free_config(pef_config); pef_config = NULL; } if (pef) { ipmi_pef_destroy(pef, NULL, NULL); pef = NULL; } if (lanparm_config) { ipmi_lan_free_config(lanparm_config); lanparm_config = NULL; } if (lanparm) { ipmi_lanparm_destroy(lanparm, NULL, NULL); lanparm = NULL; } if (line_buffer) { ipmi_mem_free(line_buffer); } command_free(commands); keypad_free(keymap); ipmi_ui_os_hnd->free_os_handler(ipmi_ui_os_hnd); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); ipmi_debug_malloc_cleanup(); exit(rv); } void leave_err(int err, char *format, ...) { va_list ap; if (full_screen) endwin(); else { tcsetattr(0, TCSADRAIN, &old_termios); fcntl(0, F_SETFL, old_flags); tcdrain(0); } ipmi_ui_os_hnd->free_os_handler(ipmi_ui_os_hnd); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); if (IPMI_IS_OS_ERR(err)) { fprintf(stderr, ": %s\n", strerror(IPMI_GET_OS_ERR(err))); } else { fprintf(stderr, ": IPMI Error %2.2x\n", IPMI_GET_IPMI_ERR(err)); } ipmi_debug_malloc_cleanup(); exit(1); } #ifdef HAVE_WRESIZE void recalc_windows(void) { draw_lines(); mvwin(stat_win, STATUS_WIN_TOP, STATUS_WIN_LEFT); wresize(stat_win, STATUS_WIN_LINES, STATUS_WIN_COLS); wrefresh(stat_win); touchwin(stat_win); wresize(display_pad, DISPLAY_WIN_LINES, DISPLAY_WIN_COLS); mvwin(cmd_win, CMD_WIN_TOP, CMD_WIN_LEFT); wresize(cmd_win, CMD_WIN_LINES, CMD_WIN_COLS); wrefresh(cmd_win); touchwin(cmd_win); wresize(log_pad, NUM_LOG_LINES, LOG_WIN_COLS); wresize(dummy_pad, NUM_LOG_LINES, LOG_WIN_COLS); doupdate(); log_pad_refresh(0); display_pad_refresh(); } #endif static void handle_user_char(int c) { int err = keypad_handle_key(keymap, c, NULL); if (err) ui_log("Got error on char 0x%x 0%o %d\n", c, c, c); } void user_input_ready(int fd, void *data, os_hnd_fd_id_t *id) { int c; if (full_screen) { c = wgetch(cmd_win); while (c != ERR) { handle_user_char(c); c = wgetch(cmd_win); } } else { char rc; int count; count = read(0, &rc, 1); if (count > 0) handle_user_char(rc); } } static int normal_char(int key, void *cb_data) { char out[2]; if (line_buffer_pos >= line_buffer_max) { char *new_line = ipmi_mem_alloc(line_buffer_max+10+1); if (!new_line) return ENOMEM; line_buffer_max += 10; if (line_buffer) { memcpy(new_line, line_buffer, line_buffer_pos); ipmi_mem_free(line_buffer); } line_buffer = new_line; } line_buffer[line_buffer_pos] = key; line_buffer_pos++; out[0] = key; out[1] = '\0'; cmd_win_out(out); cmd_win_refresh(); return 0; } static int end_of_line(int key, void *cb_data) { int err; if (!line_buffer) return 0; line_buffer[line_buffer_pos] = '\0'; cmd_win_out("\n"); err = command_handle(commands, line_buffer, NULL); if (err) cmd_win_out("Invalid command: %s\n> ", line_buffer); else cmd_win_out("> "); line_buffer_pos = 0; cmd_win_refresh(); return 0; } static int backspace(int key, void *cb_data) { if (line_buffer_pos == 0) return 0; line_buffer_pos--; cmd_win_out("\b \b"); cmd_win_refresh(); return 0; } static int key_up(int key, void *cb_data) { return 0; } static int key_down(int key, void *cb_data) { return 0; } static int key_right(int key, void *cb_data) { return 0; } static int key_left(int key, void *cb_data) { return 0; } static int key_ppage(int key, void *cb_data) { if (curr_win == LOG_WIN_SCROLL) { log_pad_top_line -= (LOG_WIN_LINES-1); log_pad_refresh(0); } else if (curr_win == DISPLAY_WIN_SCROLL) { display_pad_top_line -= (DISPLAY_WIN_LINES-1); display_pad_refresh(); } return 0; } static int key_npage(int key, void *cb_data) { if (curr_win == LOG_WIN_SCROLL) { log_pad_top_line += (LOG_WIN_LINES-1); log_pad_refresh(0); } else if (curr_win == DISPLAY_WIN_SCROLL) { display_pad_top_line += (DISPLAY_WIN_LINES-1); display_pad_refresh(); } return 0; } static int leave_count = 0; static void final_leave(void *cb_data) { leave_count--; if (leave_count == 0) leave(0, ""); } static void leave_cmder(ipmi_domain_t *domain, void *cb_data) { int rv; rv = ipmi_domain_close(domain, final_leave, NULL); if (!rv) leave_count++; } static int key_leave(int key, void *cb_data) { ipmi_domain_iterate_domains(leave_cmder, NULL); if (leave_count == 0) leave(0, ""); return 0; } #ifdef HAVE_WRESIZE static int key_resize(int key, void *cb_data) { recalc_windows(); return 0; } #endif static int key_set_display(int key, void *cb_data) { curr_win = DISPLAY_WIN_SCROLL; return 0; } static int key_set_log(int key, void *cb_data) { curr_win = LOG_WIN_SCROLL; return 0; } /* Includes 3 3-byte fields (entity id, entity instance, and slave address) and 1 2-byte field (channel) and three periods and the nil char at the end and possible a leading "r" for device-relative. */ #define MAX_ENTITY_LOC_SIZE 16 /* Convert an entity to a locator for the entity. This is either: . for an absolute entity, or r... for a device-relative entity. */ static char * get_entity_loc(ipmi_entity_t *entity, char *str, int strlen) { ipmi_entity_id_t id; id = ipmi_entity_convert_to_id(entity); if (id.entity_instance >= 0x60) snprintf(str, strlen, "r%d.%d.%d.%d", id.channel, id.address, id.entity_id, id.entity_instance - 0x60); else snprintf(str, strlen, "%d.%d", id.entity_id, id.entity_instance); return str; } static void entities_handler(ipmi_entity_t *entity, void *cb_data) { char *present; char loc[MAX_ENTITY_LOC_SIZE]; char name[33]; enum ipmi_dlr_type_e type; static char *ent_types[] = { "unknown", "mc", "fru", "generic", "invalid" }; type = ipmi_entity_get_type(entity); if (type > IPMI_ENTITY_GENERIC) type = IPMI_ENTITY_GENERIC + 1; curr_entity_id = ipmi_entity_convert_to_id(entity); ipmi_entity_get_id(entity, name, 32); if (strlen(name) == 0) { strncpy(name, ipmi_entity_get_entity_id_string(entity), 32); name[32] = '\0'; } if (ipmi_entity_is_present(entity)) present = "present"; else present = "not present"; display_pad_out(" %s (%s) %s %s\n", get_entity_loc(entity, loc, sizeof(loc)), name, ent_types[type], present); } static void entities_cmder(ipmi_domain_t *domain, void *cb_data) { if (cb_data) display_pad_clear_nomove(); else display_pad_clear(); display_pad_out("Entities:\n"); ipmi_domain_iterate_entities(domain, entities_handler, NULL); display_pad_refresh(); } static int entities_cmd(char *cmd, char **toks, void *cb_data) { int rv; rv = ipmi_domain_pointer_cb(domain_id, entities_cmder, NULL); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } curr_display_type = DISPLAY_ENTITIES; return 0; } typedef void (*entity_handler_cb)(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data); struct ent_rec { int id, instance, found; int channel, address; entity_handler_cb handler; char **toks, **toks2; void *cb_data; }; static void entity_searcher(ipmi_entity_t *entity, void *cb_data) { struct ent_rec *info = cb_data; ipmi_entity_id_t id; id = ipmi_entity_convert_to_id(entity); if ((info->id == id.entity_id) && (info->instance == id.entity_instance) && (info->address == id.address) && (info->channel == id.channel)) { info->found = 1; info->handler(entity, info->toks, info->toks2, info->cb_data); } } static void entity_finder_d(ipmi_domain_t *domain, void *cb_data) { ipmi_domain_iterate_entities(domain, entity_searcher, cb_data); } int entity_finder(char *cmd, char **toks, entity_handler_cb handler, void *cb_data) { struct ent_rec info; char *ent_name; char *id_name, *instance_name, *toks2, *estr; ent_name = strtok_r(NULL, " \t\n", toks); if (!ent_name) { cmd_win_out("No entity given\n"); return EINVAL; } if (ent_name[0] == 'r') { /* Device-relative address. */ char *name; name = strtok_r(ent_name+1, ".", &toks2); info.channel = strtoul(name, &estr, 0); if (*estr != '\0') { cmd_win_out("Invalid entity channel given\n"); return EINVAL; } name = strtok_r(NULL, ".", &toks2); info.address = strtoul(name, &estr, 0); if (*estr != '\0') { cmd_win_out("Invalid entity address given\n"); return EINVAL; } id_name = strtok_r(NULL, ".", &toks2); } else { info.address = 0; info.channel = 0; id_name = strtok_r(ent_name, ".", &toks2); } instance_name = strtok_r(NULL, ".", &toks2); if (!instance_name) { cmd_win_out("Invalid entity given\n"); return EINVAL; } info.id = strtoul(id_name, &estr, 0); if (*estr != '\0') { cmd_win_out("Invalid entity id given\n"); return EINVAL; } info.instance = strtoul(instance_name, &estr, 0); if (*estr != '\0') { cmd_win_out("Invalid entity instance given\n"); return EINVAL; } if (ent_name[0] == 'r') info.instance += 0x60; info.found = 0; info.handler = handler; info.cb_data = cb_data; info.toks = toks; info.toks2 = &toks2; ipmi_domain_pointer_cb(domain_id, entity_finder_d, &info); if (!info.found) { if (ent_name[0] == 'r') cmd_win_out("Entity r%d.%d.%d.%d not found\n", info.channel, info.address, info.id, info.instance-0x60); else cmd_win_out("Entity %d.%d not found\n", info.id, info.instance); return EINVAL; } return 0; } static void entity_iterate_handler(ipmi_entity_t *o, ipmi_entity_t *entity, void *cb_data) { char name[33]; char loc[MAX_ENTITY_LOC_SIZE]; ipmi_entity_get_id(entity, name, 32); display_pad_out(" %s (%s)\n", get_entity_loc(entity, loc, sizeof(loc)), name); } static void entity_handler(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { char *present; char name[33]; char ename[IPMI_ENTITY_NAME_LEN]; char loc[MAX_ENTITY_LOC_SIZE]; enum ipmi_dlr_type_e type; static char *ent_types[] = { "unknown", "mc", "fru", "generic", "invalid" }; display_pad_clear(); type = ipmi_entity_get_type(entity); if (type > IPMI_ENTITY_GENERIC) type = IPMI_ENTITY_GENERIC + 1; curr_entity_id = ipmi_entity_convert_to_id(entity); ipmi_entity_get_id(entity, name, 32); if (ipmi_entity_is_present(entity)) present = "present"; else present = "not present"; display_pad_out("Entity %s (%s) %s\n", get_entity_loc(entity, loc, sizeof(loc)), name, present); ipmi_entity_get_name(entity, ename, sizeof(ename)); display_pad_out(" name = %s\n", ename); display_pad_out(" type = %s\n", ent_types[type]); display_pad_out(" entity id string = %s\n", ipmi_entity_get_entity_id_string(entity)); display_pad_out(" is%s fru\n", ipmi_entity_get_is_fru(entity) ? "" : " not"); display_pad_out(" present sensor%s always there\n", ipmi_entity_get_presence_sensor_always_there(entity) ? "" : " not"); if (ipmi_entity_get_is_child(entity)) { display_pad_out(" Parents:\n"); ipmi_entity_iterate_parents(entity, entity_iterate_handler, NULL); } if (ipmi_entity_get_is_parent(entity)) { display_pad_out(" Children:\n"); ipmi_entity_iterate_children(entity, entity_iterate_handler, NULL); } switch (type) { case IPMI_ENTITY_MC: display_pad_out(" channel = 0x%x\n", ipmi_entity_get_channel(entity)); display_pad_out(" lun = 0x%x\n", ipmi_entity_get_lun(entity)); display_pad_out(" oem = 0x%x\n", ipmi_entity_get_oem(entity)); display_pad_out(" slave_address = 0x%x\n", ipmi_entity_get_slave_address(entity)); display_pad_out(" ACPI_system_power_notify_required = 0x%x\n", ipmi_entity_get_ACPI_system_power_notify_required(entity)); display_pad_out(" ACPI_device_power_notify_required = 0x%x\n", ipmi_entity_get_ACPI_device_power_notify_required(entity)); display_pad_out(" controller_logs_init_agent_errors = 0x%x\n", ipmi_entity_get_controller_logs_init_agent_errors(entity)); display_pad_out(" log_init_agent_errors_accessing = 0x%x\n", ipmi_entity_get_log_init_agent_errors_accessing(entity)); display_pad_out(" global_init = 0x%x\n", ipmi_entity_get_global_init(entity)); display_pad_out(" chassis_device = 0x%x\n", ipmi_entity_get_chassis_device(entity)); display_pad_out(" bridge = 0x%x\n", ipmi_entity_get_bridge(entity)); display_pad_out(" IPMB_event_generator = 0x%x\n", ipmi_entity_get_IPMB_event_generator(entity)); display_pad_out(" IPMB_event_receiver = 0x%x\n", ipmi_entity_get_IPMB_event_receiver(entity)); display_pad_out(" FRU_inventory_device = 0x%x\n", ipmi_entity_get_FRU_inventory_device(entity)); display_pad_out(" SEL_device = 0x%x\n", ipmi_entity_get_SEL_device(entity)); display_pad_out(" SDR_repository_device = 0x%x\n", ipmi_entity_get_SDR_repository_device(entity)); display_pad_out(" sensor_device = 0x%x\n", ipmi_entity_get_sensor_device(entity)); break; case IPMI_ENTITY_FRU: display_pad_out(" channel = 0x%x\n", ipmi_entity_get_channel(entity)); display_pad_out(" lun = 0x%x\n", ipmi_entity_get_lun(entity)); display_pad_out(" oem = 0x%x\n", ipmi_entity_get_oem(entity)); display_pad_out(" access_address = 0x%x\n", ipmi_entity_get_access_address(entity)); display_pad_out(" private_bus_id = 0x%x\n", ipmi_entity_get_private_bus_id(entity)); display_pad_out(" device_type = 0x%x\n", ipmi_entity_get_device_type(entity)); display_pad_out(" device_modifier = 0x%x\n", ipmi_entity_get_device_modifier(entity)); display_pad_out(" is_logical_fru = 0x%x\n", ipmi_entity_get_is_logical_fru(entity)); display_pad_out(" fru_device_id = 0x%x\n", ipmi_entity_get_fru_device_id(entity)); break; case IPMI_ENTITY_GENERIC: display_pad_out(" channel = 0x%x\n", ipmi_entity_get_channel(entity)); display_pad_out(" lun = 0x%x\n", ipmi_entity_get_lun(entity)); display_pad_out(" oem = 0x%x\n", ipmi_entity_get_oem(entity)); display_pad_out(" access_address = 0x%x\n", ipmi_entity_get_access_address(entity)); display_pad_out(" private_bus_id = 0x%x\n", ipmi_entity_get_private_bus_id(entity)); display_pad_out(" device_type = 0x%x\n", ipmi_entity_get_device_type(entity)); display_pad_out(" device_modifier = 0x%x\n", ipmi_entity_get_device_modifier(entity)); display_pad_out(" slave_address = 0x%x\n", ipmi_entity_get_slave_address(entity)); display_pad_out(" address_span = 0x%x\n", ipmi_entity_get_address_span(entity)); break; default: break; } display_pad_refresh(); } int entity_cmd(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, entity_handler, NULL); curr_display_type = DISPLAY_ENTITY; return 0; } static void hs_get_act_time_cb(ipmi_entity_t *ent, int err, ipmi_timeout_t val, void *cb_data) { char loc[MAX_ENTITY_LOC_SIZE]; if (err) { ui_log("Could not get hot-swap act time: error 0x%x\n", err); return; } ui_log("Hot-swap activate time for %s is %lld\n", get_entity_loc(ent, loc, sizeof(loc)), val); } static void hs_get_act_time_handler(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { int rv; rv = ipmi_entity_get_auto_activate_time(entity, hs_get_act_time_cb, NULL); if (rv) cmd_win_out("Could not get auto-activate: error 0x%x\n", rv); } int hs_get_act_time(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, hs_get_act_time_handler, NULL); return 0; } static void hs_set_act_time_cb(ipmi_entity_t *ent, int err, void *cb_data) { if (err) ui_log("Could not get hot-swap act time: error 0x%x\n", err); else ui_log("hot-swap act time set\n"); } static void hs_set_act_time_handler(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { int rv; unsigned int timeout; if (get_uint(toks, &timeout, "Hot swap activate time")) return; rv = ipmi_entity_set_auto_activate_time(entity, timeout, hs_set_act_time_cb, NULL); if (rv) cmd_win_out("Could not set auto-activate: error 0x%x\n", rv); } int hs_set_act_time(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, hs_set_act_time_handler, NULL); return 0; } static void hs_get_deact_time_cb(ipmi_entity_t *ent, int err, ipmi_timeout_t val, void *cb_data) { char loc[MAX_ENTITY_LOC_SIZE]; if (err) { ui_log("Could not get hot-swap deact time: error 0x%x\n", err); return; } ui_log("Hot-swap deactivate time for %s is %lld\n", get_entity_loc(ent, loc, sizeof(loc)), val); } static void hs_get_deact_time_handler(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { int rv; rv = ipmi_entity_get_auto_deactivate_time(entity, hs_get_deact_time_cb, NULL); if (rv) cmd_win_out("Could not get auto-deactivate: error 0x%x\n", rv); } int hs_get_deact_time(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, hs_get_deact_time_handler, NULL); return 0; } static void hs_set_deact_time_cb(ipmi_entity_t *ent, int err, void *cb_data) { if (err) ui_log("Could not get hot-swap deact time: error 0x%x\n", err); else ui_log("hot-swap deact time set\n"); } static void hs_set_deact_time_handler(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { int rv; unsigned int timeout; if (get_uint(toks, &timeout, "Hot swap deactivate time")) return; rv = ipmi_entity_set_auto_deactivate_time(entity, timeout, hs_set_deact_time_cb, NULL); if (rv) cmd_win_out("Could not set auto-deactivate: error 0x%x\n", rv); } int hs_set_deact_time(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, hs_set_deact_time_handler, NULL); return 0; } static void hs_activation_request_cb(ipmi_entity_t *ent, int err, void *cb_data) { if (err) ui_log("Could not activate entity: error 0x%x\n", err); else ui_log("entity activated\n"); } static void hs_activation_request_handler(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { int rv; rv = ipmi_entity_set_activation_requested(entity, hs_activation_request_cb, NULL); if (rv) cmd_win_out("Could not set activation requested: error 0x%x\n", rv); } static int hs_activation_request(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, hs_activation_request_handler, NULL); return 0; } static void hs_activate_cb(ipmi_entity_t *ent, int err, void *cb_data) { if (err) ui_log("Could not activate entity: error 0x%x\n", err); else ui_log("entity activated\n"); } static void hs_activate_handler(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { int rv; rv = ipmi_entity_activate(entity, hs_activate_cb, NULL); if (rv) cmd_win_out("Could not activate entity: error 0x%x\n", rv); } int hs_activate(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, hs_activate_handler, NULL); return 0; } static void hs_deactivate_cb(ipmi_entity_t *ent, int err, void *cb_data) { if (err) ui_log("Could not deactivate entity: error 0x%x\n", err); else ui_log("entity deactivated\n"); } static void hs_deactivate_handler(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { int rv; rv = ipmi_entity_deactivate(entity, hs_deactivate_cb, NULL); if (rv) cmd_win_out("Could not deactivate entity: error 0x%x\n", rv); } int hs_deactivate(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, hs_deactivate_handler, NULL); return 0; } static void hs_state_cb(ipmi_entity_t *ent, int err, enum ipmi_hot_swap_states state, void *cb_data) { if (err) ui_log("Could not get hot-swap state: error 0x%x\n", err); else ui_log("Hot-swap state is %s\n", ipmi_hot_swap_state_name(state)); } static void hs_state_handler(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { int rv; rv = ipmi_entity_get_hot_swap_state(entity, hs_state_cb, NULL); if (rv) cmd_win_out("Could not get entity state: error 0x%x\n", rv); } int hs_state(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, hs_state_handler, NULL); return 0; } static void hs_check_ent(ipmi_entity_t *entity, void *cb_data) { ipmi_entity_check_hot_swap_state(entity); } static void hs_check_cmder(ipmi_domain_t *domain, void *cb_data) { ipmi_domain_iterate_entities(domain, hs_check_ent, NULL); } int hs_check_cmd(char *cmd, char **toks, void *cb_data) { int rv; rv = ipmi_domain_pointer_cb(domain_id, hs_check_cmder, NULL); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } return 0; } static void sensors_handler(ipmi_entity_t *entity, ipmi_sensor_t *sensor, void *cb_data) { char name[33]; char name2[33]; char loc[MAX_ENTITY_LOC_SIZE]; ipmi_sensor_get_id(sensor, name, 33); strcpy(name2, name); conv_from_spaces(name2); display_pad_out(" %s.%s - %s\n", get_entity_loc(entity, loc, sizeof(loc)), name2, name); } static void found_entity_for_sensors(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { char loc[MAX_ENTITY_LOC_SIZE]; curr_display_type = DISPLAY_SENSORS; display_pad_clear(); display_pad_out("Sensors for entity %s:\n", get_entity_loc(entity, loc, sizeof(loc))); ipmi_entity_iterate_sensors(entity, sensors_handler, NULL); display_pad_refresh(); } int sensors_cmd(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, found_entity_for_sensors, NULL); return 0; } struct sensor_info { int found; char *name; }; /* Has this sensor been displayed yet? */ int sensor_displayed; /* Decrement whenever the sensor is not displayed and data is recevied, when this hits zero it's time to display. */ int sensor_ops_to_read_count; /* Return value from ipmi_states_get or ipmi_reading_get. */ int sensor_read_err; /* Values from ipmi_reading_get. */ enum ipmi_value_present_e sensor_value_present; unsigned int sensor_raw_val; double sensor_val; /* Values from ipmi_states_get and ipmi_reading_get. */ ipmi_states_t *sensor_states; /* Values from ipmi_sensor_event_enables_get. */ int sensor_event_states_err; ipmi_event_state_t *sensor_event_states; /* Values from ipmi_thresholds_get */ int sensor_read_thresh_err; ipmi_thresholds_t *sensor_thresholds; static void display_sensor(ipmi_entity_t *entity, ipmi_sensor_t *sensor) { char loc[MAX_ENTITY_LOC_SIZE]; char name[33]; char sname[IPMI_SENSOR_NAME_LEN]; int rv; if (sensor_displayed) return; sensor_ops_to_read_count--; if (sensor_ops_to_read_count > 0) return; sensor_displayed = 1; ipmi_sensor_get_name(sensor, sname, sizeof(sname)); ipmi_sensor_get_id(sensor, name, 33); display_pad_clear(); conv_from_spaces(name); display_pad_out("Sensor %s.%s:\n", get_entity_loc(entity, loc, sizeof(loc)), name); if (ipmi_sensor_get_ignore_if_no_entity(sensor)) display_pad_out(" ignore if entity not present\n"); else display_pad_out(" still there if entity not present\n"); display_pad_out(" name = %s\n", sname); display_pad_out(" value = "); getyx(display_pad, value_pos.y, value_pos.x); if (!ipmi_entity_is_present(entity) && ipmi_sensor_get_ignore_if_no_entity(sensor)) { display_pad_out("not present"); } else { if (sensor_read_err) { display_pad_out("unreadable"); } else if (ipmi_sensor_get_event_reading_type(sensor) == IPMI_EVENT_READING_TYPE_THRESHOLD) { if (sensor_value_present == IPMI_BOTH_VALUES_PRESENT) display_pad_out("%f (%2.2x)", sensor_val, sensor_raw_val); else if (sensor_value_present == IPMI_RAW_VALUE_PRESENT) display_pad_out("0x%x (RAW)", sensor_raw_val); else display_pad_out("unreadable"); } else { int i; for (i=0; i<15; i++) { int val; val = ipmi_is_state_set(sensor_states, i); display_pad_out("%d", val != 0); } } } display_pad_out("\n Events = "); getyx(display_pad, enabled_pos.y, enabled_pos.x); if (sensor_event_states_err) display_pad_out("? "); else { int global_enable; global_enable = ipmi_event_state_get_events_enabled (sensor_event_states); if (global_enable) display_pad_out("enabled"); else display_pad_out("disabled"); } display_pad_out("\n Scanning = "); getyx(display_pad, scanning_pos.y, scanning_pos.x); if (sensor_event_states_err) display_pad_out("? "); else { int scanning_enable; scanning_enable = ipmi_event_state_get_scanning_enabled (sensor_event_states); if (scanning_enable) display_pad_out("enabled"); else display_pad_out("disabled"); } display_pad_out("\n Hysteresis = "); switch (ipmi_sensor_get_hysteresis_support(sensor)) { case IPMI_HYSTERESIS_SUPPORT_NONE: display_pad_out("none"); break; case IPMI_HYSTERESIS_SUPPORT_READABLE: display_pad_out("readable"); break; case IPMI_HYSTERESIS_SUPPORT_SETTABLE: display_pad_out("settable"); break; case IPMI_HYSTERESIS_SUPPORT_FIXED: display_pad_out("fixed"); break; default: display_pad_out("invalid"); break; } display_pad_out("\n"); display_pad_out(" sensor type = %s (0x%2.2x)\n", ipmi_sensor_get_sensor_type_string(sensor), ipmi_sensor_get_sensor_type(sensor)); display_pad_out(" event/reading type = %s (0x%2.2x)\n", ipmi_sensor_get_event_reading_type_string(sensor), ipmi_sensor_get_event_reading_type(sensor)); if (ipmi_sensor_get_event_reading_type(sensor) == IPMI_EVENT_READING_TYPE_THRESHOLD) { enum ipmi_thresh_e t; double val; display_pad_out(" units = %s%s", ipmi_sensor_get_base_unit_string(sensor), ipmi_sensor_get_rate_unit_string(sensor)); switch(ipmi_sensor_get_modifier_unit_use(sensor)) { case IPMI_MODIFIER_UNIT_BASE_DIV_MOD: display_pad_out("/%s", ipmi_sensor_get_modifier_unit_string(sensor)); break; case IPMI_MODIFIER_UNIT_BASE_MULT_MOD: display_pad_out("*%s", ipmi_sensor_get_modifier_unit_string(sensor)); break; case IPMI_MODIFIER_UNIT_NONE: break; } display_pad_out("\n"); rv = ipmi_sensor_get_nominal_reading(sensor, &val); if (!rv) display_pad_out(" nominal = %f\n", val); rv = ipmi_sensor_get_normal_min(sensor, &val); if (!rv) display_pad_out(" normal_min = %f\n", val); rv = ipmi_sensor_get_normal_max(sensor, &val); if (!rv) display_pad_out(" normal_max = %f\n", val); rv = ipmi_sensor_get_sensor_min(sensor, &val); if (!rv) display_pad_out(" sensor_min = %f\n", val); rv = ipmi_sensor_get_sensor_max(sensor, &val); if (!rv) display_pad_out(" sensor_max = %f\n", val); display_pad_out("Thresholds:\n"); for (t=IPMI_LOWER_NON_CRITICAL; t<=IPMI_UPPER_NON_RECOVERABLE; t++){ int settable, readable; int i; int assert_sup[2], deassert_sup[2]; int anything_set = 0; ipmi_sensor_threshold_settable(sensor, t, &settable); anything_set |= settable; ipmi_sensor_threshold_readable(sensor, t, &readable); anything_set |= readable; for (i=0; i<=1; i++) { ipmi_sensor_threshold_event_supported( sensor, t, i, IPMI_ASSERTION, &(assert_sup[i])); anything_set |= assert_sup[i]; ipmi_sensor_threshold_event_supported( sensor, t, i, IPMI_DEASSERTION, &(deassert_sup[i])); anything_set |= deassert_sup[i]; } if (anything_set) { display_pad_out(" %s:", ipmi_get_threshold_string(t)); threshold_positions[t].set = 1; display_pad_out("\n available: "); if (readable) display_pad_out("R"); else display_pad_out(" "); if (settable) display_pad_out("W"); else display_pad_out(" "); if (assert_sup[0]) display_pad_out("L^"); else display_pad_out(" "); if (deassert_sup[0]) display_pad_out("Lv"); else display_pad_out(" "); if (assert_sup[1]) display_pad_out("H^"); else display_pad_out(" "); if (deassert_sup[1]) display_pad_out("Hv"); else display_pad_out(" "); display_pad_out("\n enabled: "); getyx(display_pad, threshold_positions[t].enabled.y, threshold_positions[t].enabled.x); if (sensor_event_states_err) display_pad_out("? "); else { if (ipmi_is_threshold_event_set(sensor_event_states, t, IPMI_GOING_LOW, IPMI_ASSERTION)) display_pad_out("L^"); else display_pad_out(" "); if (ipmi_is_threshold_event_set(sensor_event_states, t, IPMI_GOING_LOW, IPMI_DEASSERTION)) display_pad_out("Lv"); else display_pad_out(" "); if (ipmi_is_threshold_event_set(sensor_event_states, t, IPMI_GOING_HIGH, IPMI_ASSERTION)) display_pad_out("H^"); else display_pad_out(" "); if (ipmi_is_threshold_event_set(sensor_event_states, t, IPMI_GOING_HIGH, IPMI_DEASSERTION)) display_pad_out("HV"); else display_pad_out(" "); } display_pad_out("\n value: "); getyx(display_pad, threshold_positions[t].value.y, threshold_positions[t].value.x); if (sensor_read_thresh_err) display_pad_out("?"); else { double val; rv = ipmi_threshold_get(sensor_thresholds, t, &val); if (rv) display_pad_out("?", val); else display_pad_out("%f", val); } display_pad_out("\n out of range: "); getyx(display_pad, threshold_positions[t].oor.y, threshold_positions[t].oor.x); if (!sensor_read_err) { if (ipmi_is_threshold_out_of_range(sensor_states, t)) display_pad_out("true "); else display_pad_out("false"); } display_pad_out("\n"); } else { threshold_positions[t].set = 0; } } } else { int val; int i; /* A discrete sensor. */ display_pad_out("\n Assertion: "); display_pad_out("\n available: "); for (i=0; i<15; i++) { ipmi_sensor_discrete_event_supported(sensor, i, IPMI_ASSERTION, &val); display_pad_out("%d", val != 0); } display_pad_out("\n enabled: "); getyx(display_pad, discr_assert_enab.y, discr_assert_enab.x); if (sensor_event_states_err) display_pad_out("?"); else { for (i=0; i<15; i++) { val = ipmi_is_discrete_event_set(sensor_event_states, i, IPMI_ASSERTION); display_pad_out("%d", val != 0); } } display_pad_out("\n Deasertion: "); display_pad_out("\n available: "); for (i=0; i<15; i++) { ipmi_sensor_discrete_event_supported(sensor, i, IPMI_DEASSERTION, &val); display_pad_out("%d", val != 0); } display_pad_out("\n enabled: "); getyx(display_pad, discr_deassert_enab.y, discr_deassert_enab.x); if (sensor_event_states_err) display_pad_out("?"); else { for (i=0; i<15; i++) { val = ipmi_is_discrete_event_set(sensor_event_states, i, IPMI_DEASSERTION); display_pad_out("%d", val != 0); } } display_pad_out("\n"); } display_pad_refresh(); } static void read_sensor(ipmi_sensor_t *sensor, int err, enum ipmi_value_present_e value_present, unsigned int raw_val, double val, ipmi_states_t *states, void *cb_data) { ipmi_sensor_id_t sensor_id; enum ipmi_thresh_e t; if (err) { if (sensor_displayed) { wmove(display_pad, value_pos.y, value_pos.x); display_pad_out("unreadable: %x", err); display_pad_refresh(); } else { curr_display_type = DISPLAY_NONE; } return; } sensor_id = ipmi_sensor_convert_to_id(sensor); if (!((curr_display_type == DISPLAY_SENSOR) && (ipmi_cmp_sensor_id(sensor_id, curr_sensor_id) == 0))) return; if (sensor_displayed) { wmove(display_pad, value_pos.y, value_pos.x); if (value_present == IPMI_BOTH_VALUES_PRESENT) display_pad_out("%f (%2.2x)", val, raw_val); else if (value_present == IPMI_RAW_VALUE_PRESENT) display_pad_out("0x%x (RAW)", raw_val); else display_pad_out("unreadable"); for (t=IPMI_LOWER_NON_CRITICAL; t<=IPMI_UPPER_NON_RECOVERABLE; t++) { if (threshold_positions[t].set) { wmove(display_pad, threshold_positions[t].oor.y, threshold_positions[t].oor.x); if (ipmi_is_threshold_out_of_range(states, t)) display_pad_out("true "); else display_pad_out("false"); } } display_pad_refresh(); } else { sensor_read_err = err; sensor_value_present = value_present; sensor_raw_val = raw_val; sensor_val = val; if (states) ipmi_copy_states(sensor_states, states); display_sensor(ipmi_sensor_get_entity(sensor), sensor); } } static void read_thresholds(ipmi_sensor_t *sensor, int err, ipmi_thresholds_t *th, void *cb_data) { ipmi_sensor_id_t sensor_id; enum ipmi_thresh_e t; double val; int rv; sensor_id = ipmi_sensor_convert_to_id(sensor); if (!((curr_display_type == DISPLAY_SENSOR) && (ipmi_cmp_sensor_id(sensor_id, curr_sensor_id) == 0))) return; if (sensor_displayed) { if (err) { for (t=IPMI_LOWER_NON_CRITICAL; t<=IPMI_UPPER_NON_RECOVERABLE; t++) { if (threshold_positions[t].set) { wmove(display_pad, threshold_positions[t].value.y, threshold_positions[t].value.x); display_pad_out("?"); } } } else { for (t=IPMI_LOWER_NON_CRITICAL; t<=IPMI_UPPER_NON_RECOVERABLE; t++) { if (threshold_positions[t].set) { rv = ipmi_threshold_get(th, t, &val); wmove(display_pad, threshold_positions[t].value.y, threshold_positions[t].value.x); if (rv) display_pad_out("?", val); else display_pad_out("%f", val); } } } display_pad_refresh(); } else { sensor_read_thresh_err = err; if (th) ipmi_copy_thresholds(sensor_thresholds, th); display_sensor(ipmi_sensor_get_entity(sensor), sensor); } } static void read_thresh_event_enables(ipmi_sensor_t *sensor, int err, ipmi_event_state_t *states, void *cb_data) { ipmi_sensor_id_t sensor_id; enum ipmi_thresh_e t; int global_enable; int scanning_enable; sensor_id = ipmi_sensor_convert_to_id(sensor); if (!((curr_display_type == DISPLAY_SENSOR) && (ipmi_cmp_sensor_id(sensor_id, curr_sensor_id) == 0))) return; if (sensor_displayed) { if (err) return; global_enable = ipmi_event_state_get_events_enabled(states); scanning_enable = ipmi_event_state_get_scanning_enabled(states); wmove(display_pad, enabled_pos.y, enabled_pos.x); if (err) display_pad_out("? "); else if (global_enable) display_pad_out("enabled"); else display_pad_out("disabled"); wmove(display_pad, scanning_pos.y, scanning_pos.x); if (err) display_pad_out("? "); else if (scanning_enable) display_pad_out("enabled"); else display_pad_out("disabled"); if (ipmi_sensor_get_event_support(sensor) != IPMI_EVENT_SUPPORT_PER_STATE) goto out; for (t=IPMI_LOWER_NON_CRITICAL; t<=IPMI_UPPER_NON_RECOVERABLE; t++) { if (threshold_positions[t].set) { wmove(display_pad, threshold_positions[t].enabled.y, threshold_positions[t].enabled.x); if (err) { display_pad_out("? "); continue; } display_pad_out(" "); if (ipmi_is_threshold_event_set(states, t, IPMI_GOING_LOW, IPMI_ASSERTION)) display_pad_out("L^"); else display_pad_out(" "); if (ipmi_is_threshold_event_set(states, t, IPMI_GOING_LOW, IPMI_DEASSERTION)) display_pad_out("Lv"); else display_pad_out(" "); if (ipmi_is_threshold_event_set(states, t, IPMI_GOING_HIGH, IPMI_ASSERTION)) display_pad_out("H^"); else display_pad_out(" "); if (ipmi_is_threshold_event_set(states, t, IPMI_GOING_HIGH, IPMI_DEASSERTION)) display_pad_out("HV"); else display_pad_out(" "); } } out: display_pad_refresh(); } else { sensor_event_states_err = err; if (states) ipmi_copy_event_state(sensor_event_states, states); display_sensor(ipmi_sensor_get_entity(sensor), sensor); } } static void read_discrete_event_enables(ipmi_sensor_t *sensor, int err, ipmi_event_state_t *states, void *cb_data) { ipmi_sensor_id_t sensor_id; int i; int val; int global_enable; int scanning_enable; sensor_id = ipmi_sensor_convert_to_id(sensor); if (!((curr_display_type == DISPLAY_SENSOR) && (ipmi_cmp_sensor_id(sensor_id, curr_sensor_id) == 0))) return; if (sensor_displayed) { global_enable = ipmi_event_state_get_events_enabled(states); scanning_enable = ipmi_event_state_get_scanning_enabled(states); wmove(display_pad, enabled_pos.y, enabled_pos.x); if (err) display_pad_out("? "); else if (global_enable) display_pad_out("enabled"); else display_pad_out("disabled"); wmove(display_pad, scanning_pos.y, scanning_pos.x); if (err) display_pad_out("? "); else if (scanning_enable) display_pad_out("enabled"); else display_pad_out("disabled"); if (ipmi_sensor_get_event_support(sensor) != IPMI_EVENT_SUPPORT_PER_STATE) goto out; if (err) { wmove(display_pad, discr_assert_enab.y, discr_assert_enab.x); display_pad_out("?"); wmove(display_pad, discr_deassert_enab.y, discr_deassert_enab.x); display_pad_out("?"); } else { wmove(display_pad, discr_assert_enab.y, discr_assert_enab.x); for (i=0; i<15; i++) { val = ipmi_is_discrete_event_set(states, i, IPMI_ASSERTION); display_pad_out("%d", val != 0); } wmove(display_pad, discr_deassert_enab.y, discr_deassert_enab.x); for (i=0; i<15; i++) { val = ipmi_is_discrete_event_set(states, i, IPMI_DEASSERTION); display_pad_out("%d", val != 0); } } out: display_pad_refresh(); } else { sensor_event_states_err = err; if (states) ipmi_copy_event_state(sensor_event_states, states); display_sensor(ipmi_sensor_get_entity(sensor), sensor); } } static void read_states(ipmi_sensor_t *sensor, int err, ipmi_states_t *states, void *cb_data) { ipmi_sensor_id_t sensor_id; int i; int val; sensor_id = ipmi_sensor_convert_to_id(sensor); if (!((curr_display_type == DISPLAY_SENSOR) && (ipmi_cmp_sensor_id(sensor_id, curr_sensor_id) == 0))) return; if (sensor_displayed) { wmove(display_pad, value_pos.y, value_pos.x); if (err) { display_pad_out("?"); } else { for (i=0; i<15; i++) { val = ipmi_is_state_set(states, i); display_pad_out("%d", val != 0); } } display_pad_refresh(); } else { sensor_read_err = err; if (states) ipmi_copy_states(sensor_states, states); display_sensor(ipmi_sensor_get_entity(sensor), sensor); } } static void redisplay_sensor(ipmi_sensor_t *sensor, void *cb_data) { int rv; ipmi_entity_t *entity; entity = ipmi_sensor_get_entity(sensor); if (!entity) return; if (!ipmi_entity_is_present(entity) && ipmi_sensor_get_ignore_if_no_entity(sensor)) { wmove(display_pad, value_pos.y, value_pos.x); display_pad_out("not present"); return; } if (ipmi_sensor_get_event_reading_type(sensor) == IPMI_EVENT_READING_TYPE_THRESHOLD) { rv = ipmi_sensor_get_reading(sensor, read_sensor, NULL); if (rv) ui_log("redisplay_sensor: Unable to get sensor reading: 0x%x\n", rv); switch (ipmi_sensor_get_threshold_access(sensor)) { case IPMI_THRESHOLD_ACCESS_SUPPORT_READABLE: case IPMI_THRESHOLD_ACCESS_SUPPORT_SETTABLE: rv = ipmi_sensor_get_thresholds(sensor, read_thresholds, NULL); if (rv) ui_log("Unable to get threshold values: 0x%x\n", rv); break; default: break; } switch (ipmi_sensor_get_event_support(sensor)) { case IPMI_EVENT_SUPPORT_PER_STATE: case IPMI_EVENT_SUPPORT_ENTIRE_SENSOR: rv = ipmi_sensor_get_event_enables(sensor, read_thresh_event_enables, NULL); if (rv) ui_log("Unable to get event values: 0x%x\n", rv); break; default: break; } } else { rv = ipmi_sensor_get_states(sensor, read_states, NULL); if (rv) ui_log("Unable to get sensor reading: 0x%x\n", rv); switch (ipmi_sensor_get_event_support(sensor)) { case IPMI_EVENT_SUPPORT_PER_STATE: case IPMI_EVENT_SUPPORT_ENTIRE_SENSOR: rv = ipmi_sensor_get_event_enables(sensor, read_discrete_event_enables, NULL); if (rv) ui_log("Unable to get event values: 0x%x\n", rv); break; default: break; } } } static void sensor_handler(ipmi_entity_t *entity, ipmi_sensor_t *sensor, void *cb_data) { char name[33]; struct sensor_info *sinfo = cb_data; int rv; int present = 1; ipmi_sensor_get_id(sensor, name, 33); if (strcmp(name, sinfo->name) == 0) { sinfo->found = 1; curr_display_type = DISPLAY_SENSOR; curr_sensor_id = ipmi_sensor_convert_to_id(sensor); sensor_displayed = 0; sensor_ops_to_read_count = 1; if (! ipmi_entity_is_present(entity) && ipmi_sensor_get_ignore_if_no_entity(sensor)) { present = 0; } if (ipmi_sensor_get_event_reading_type(sensor) == IPMI_EVENT_READING_TYPE_THRESHOLD) { if (present) { sensor_ops_to_read_count++; rv = ipmi_sensor_get_reading(sensor, read_sensor, NULL); if (rv) ui_log("Unable to get sensor reading: 0x%x\n", rv); switch (ipmi_sensor_get_threshold_access(sensor)) { case IPMI_THRESHOLD_ACCESS_SUPPORT_READABLE: case IPMI_THRESHOLD_ACCESS_SUPPORT_SETTABLE: sensor_ops_to_read_count++; rv = ipmi_sensor_get_thresholds(sensor, read_thresholds, NULL); if (rv) ui_log("Unable to get threshold values: 0x%x\n", rv); break; default: break; } switch (ipmi_sensor_get_event_support(sensor)) { case IPMI_EVENT_SUPPORT_PER_STATE: case IPMI_EVENT_SUPPORT_ENTIRE_SENSOR: sensor_ops_to_read_count++; rv = ipmi_sensor_get_event_enables (sensor, read_thresh_event_enables, NULL); if (rv) ui_log("Unable to get event values: 0x%x\n", rv); break; default: break; } } } else { if (present) { sensor_ops_to_read_count++; rv = ipmi_sensor_get_states(sensor, read_states, NULL); if (rv) ui_log("Unable to get sensor reading: 0x%x\n", rv); switch (ipmi_sensor_get_event_support(sensor)) { case IPMI_EVENT_SUPPORT_PER_STATE: case IPMI_EVENT_SUPPORT_ENTIRE_SENSOR: sensor_ops_to_read_count++; rv = ipmi_sensor_get_event_enables (sensor, read_discrete_event_enables, NULL); if (rv) ui_log("Unable to get event values: 0x%x\n", rv); break; default: break; } } } display_sensor(entity, sensor); display_pad_refresh(); } } static void found_entity_for_sensor(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { struct sensor_info sinfo; sinfo.name = strtok_r(NULL, "", toks2); if (!sinfo.name) { cmd_win_out("Invalid sensor given\n"); return; } conv_to_spaces(sinfo.name); sinfo.found = 0; ipmi_entity_iterate_sensors(entity, sensor_handler, &sinfo); if (!sinfo.found) { char loc[MAX_ENTITY_LOC_SIZE]; conv_from_spaces(sinfo.name); cmd_win_out("Sensor %s.%s not found\n", get_entity_loc(entity, loc, sizeof(loc)), sinfo.name); return; } } int sensor_cmd(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, found_entity_for_sensor, NULL); return 0; } typedef struct events_enable_info_s { ipmi_event_state_t *states; } events_enable_info_t; void events_enable_done(ipmi_sensor_t *sensor, int err, void *cb_data) { if (err) ui_log("Error setting events enable: 0x%x", err); } static void events_enable(ipmi_sensor_t *sensor, void *cb_data) { events_enable_info_t *info = cb_data; int rv; rv = ipmi_sensor_set_event_enables(sensor, info->states, events_enable_done, NULL); if (rv) ui_log("Error sending events enable: 0x%x", rv); ipmi_mem_free(info); } static int events_enable_cmd(char *cmd, char **toks, void *cb_data) { events_enable_info_t *info; unsigned char enable; int i; char *enptr; int rv; info = ipmi_mem_alloc(sizeof(*info)); if (!info) { cmd_win_out("Out of memory\n"); return 0; } info->states = ipmi_mem_alloc(ipmi_event_state_size()); if (!info->states) { ipmi_mem_free(info); cmd_win_out("Out of memory\n"); return 0; } ipmi_event_state_init(info->states); if (get_uchar(toks, &enable, "events")) return 0; ipmi_event_state_set_events_enabled(info->states, enable); if (get_uchar(toks, &enable, "scanning")) return 0; ipmi_event_state_set_scanning_enabled(info->states, enable); enptr = strtok_r(NULL, " \t\n", toks); if (!enptr) { cmd_win_out("No assertion mask given\n"); return 0; } for (i=0; enptr[i]!='\0'; i++) { if (enptr[i] == '1') ipmi_discrete_event_set(info->states, i, IPMI_ASSERTION); else if (enptr[i] == '0') ipmi_discrete_event_clear(info->states, i, IPMI_ASSERTION); else { cmd_win_out("Invalid assertion value\n"); return 0; } } enptr = strtok_r(NULL, " \t\n", toks); if (!enptr) { cmd_win_out("No deassertion mask given\n"); return 0; } for (i=0; enptr[i]!='\0'; i++) { if (enptr[i] == '1') ipmi_discrete_event_set(info->states, i, IPMI_DEASSERTION); else if (enptr[i] == '0') ipmi_discrete_event_clear(info->states, i, IPMI_DEASSERTION); else { cmd_win_out("Invalid deassertion value\n"); return 0; } } rv = ipmi_sensor_pointer_cb(curr_sensor_id, events_enable, info); if (rv) { cmd_win_out("Unable to get sensor pointer: 0x%x\n", rv); ipmi_mem_free(info); } return 0; } static void controls_handler(ipmi_entity_t *entity, ipmi_control_t *control, void *cb_data) { char loc[MAX_ENTITY_LOC_SIZE]; char name[33]; char name2[33]; ipmi_control_get_id(control, name, 33); strcpy(name2, name); conv_from_spaces(name2); display_pad_out(" %s.%s - %s\n", get_entity_loc(entity, loc, sizeof(loc)), name2, name); } static void found_entity_for_controls(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { char loc[MAX_ENTITY_LOC_SIZE]; curr_display_type = DISPLAY_CONTROLS; display_pad_clear(); display_pad_out("Controls for entity %s:\n", get_entity_loc(entity, loc, sizeof(loc))); ipmi_entity_iterate_controls(entity, controls_handler, NULL); display_pad_refresh(); } static int controls_cmd(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, found_entity_for_controls, NULL); return 0; } int control_displayed; int control_ops_to_read_count; int control_read_err; int *normal_control_vals; ipmi_light_setting_t *light_control_val; int id_control_length; unsigned char *id_control_vals; static void display_control(ipmi_entity_t *entity, ipmi_control_t *control) { char loc[MAX_ENTITY_LOC_SIZE]; int control_type; char name[33]; char cname[IPMI_CONTROL_NAME_LEN]; int i; int num_vals; if (control_displayed) return; control_ops_to_read_count--; if (control_ops_to_read_count > 0) return; control_displayed = 1; ipmi_control_get_id(control, name, 33); curr_control_id = ipmi_control_convert_to_id(control); display_pad_clear(); conv_from_spaces(name); display_pad_out("Control %s.%s:\n", get_entity_loc(entity, loc, sizeof(loc)), name); if (ipmi_control_get_ignore_if_no_entity(control)) display_pad_out(" ignore if entity not present\n"); else display_pad_out(" still there if entity not present\n"); ipmi_control_get_name(control, cname, sizeof(cname)); display_pad_out(" name = %s\n", cname); control_type = ipmi_control_get_type(control); display_pad_out(" type = %s (%d)\n", ipmi_control_get_type_string(control), control_type); num_vals = ipmi_control_get_num_vals(control); switch (control_type) { case IPMI_CONTROL_LIGHT: case IPMI_CONTROL_RELAY: case IPMI_CONTROL_ALARM: case IPMI_CONTROL_RESET: case IPMI_CONTROL_ONE_SHOT_RESET: case IPMI_CONTROL_POWER: case IPMI_CONTROL_FAN_SPEED: case IPMI_CONTROL_OUTPUT: case IPMI_CONTROL_ONE_SHOT_OUTPUT: display_pad_out(" num entities = %d\n", num_vals); break; case IPMI_CONTROL_DISPLAY: case IPMI_CONTROL_IDENTIFIER: break; } display_pad_out(" value = "); getyx(display_pad, value_pos.y, value_pos.x); if (! ipmi_control_is_readable(control)) { display_pad_out("not readable"); } else if (control_read_err) { /* Nothing to do. */ } else { switch (control_type) { case IPMI_CONTROL_LIGHT: if (ipmi_control_light_set_with_setting(control)) { if (light_control_val) { ipmi_light_setting_t *setting = light_control_val; for (i=0; iname) == 0) { iinfo->found = 1; curr_display_type = DISPLAY_CONTROL; curr_control_id = ipmi_control_convert_to_id(control); control_ops_to_read_count = 1; control_displayed = 0; if (! ipmi_control_is_readable(control)) { /* If the control can't be read, then just display it now. */ display_control(entity, control); return; } control_type = ipmi_control_get_type(control); switch (control_type) { case IPMI_CONTROL_LIGHT: if (ipmi_control_light_set_with_setting(control)) { control_ops_to_read_count++; rv = ipmi_control_get_light(control, light_control_val_read, NULL); if (rv) { ui_log("Unable to read light control val: 0x%x\n", rv); } break; } /* FALLTHRU */ case IPMI_CONTROL_RELAY: case IPMI_CONTROL_ALARM: case IPMI_CONTROL_RESET: case IPMI_CONTROL_ONE_SHOT_RESET: case IPMI_CONTROL_POWER: case IPMI_CONTROL_FAN_SPEED: case IPMI_CONTROL_OUTPUT: case IPMI_CONTROL_ONE_SHOT_OUTPUT: control_ops_to_read_count++; rv = ipmi_control_get_val(control, normal_control_val_read, NULL); if (rv) { ui_log("Unable to read control val: 0x%x\n", rv); } break; case IPMI_CONTROL_DISPLAY: break; case IPMI_CONTROL_IDENTIFIER: control_ops_to_read_count++; rv = ipmi_control_identifier_get_val(control, identifier_control_val_read, NULL); if (rv) { ui_log("Unable to read control val: 0x%x\n", rv); } break; } display_control(entity, control); } } static void found_entity_for_control(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { struct control_info iinfo; iinfo.name = strtok_r(NULL, "", toks2); if (!iinfo.name) { cmd_win_out("Invalid control given\n"); return; } conv_to_spaces(iinfo.name); iinfo.found = 0; ipmi_entity_iterate_controls(entity, control_handler, &iinfo); if (!iinfo.found) { char loc[MAX_ENTITY_LOC_SIZE]; conv_from_spaces(iinfo.name); cmd_win_out("Control %s.%s not found\n", get_entity_loc(entity, loc, sizeof(loc)), iinfo.name); return; } } int control_cmd(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, found_entity_for_control, NULL); return 0; } typedef struct rearm_info_s { int global; ipmi_event_state_t *states; } rearm_info_t; void rearm_done(ipmi_sensor_t *sensor, int err, void *cb_data) { if (err) ui_log("Error rearming sensor: 0x%x", err); } static void rearm(ipmi_sensor_t *sensor, void *cb_data) { rearm_info_t *info = cb_data; int rv; rv = ipmi_sensor_rearm(sensor, info->global, info->states, rearm_done, NULL); if (rv) ui_log("Error sending rearm: 0x%x", rv); if (info->states) ipmi_mem_free(info->states); ipmi_mem_free(info); } static int rearm_cmd(char *cmd, char **toks, void *cb_data) { rearm_info_t *info; unsigned char global; int i; char *enptr; int rv; info = ipmi_mem_alloc(sizeof(*info)); if (!info) { cmd_win_out("Out of memory\n"); return 0; } info->states = NULL; if (get_uchar(toks, &global, "global rearm")) goto out_err; info->global = global; if (!global) { info->states = ipmi_mem_alloc(ipmi_event_state_size()); if (!info->states) { ipmi_mem_free(info); cmd_win_out("Out of memory\n"); goto out_err; } ipmi_event_state_init(info->states); enptr = strtok_r(NULL, " \t\n", toks); if (!enptr) { cmd_win_out("No assertion mask given\n"); goto out_err; } for (i=0; enptr[i]!='\0'; i++) { if (enptr[i] == '1') ipmi_discrete_event_set(info->states, i, IPMI_ASSERTION); else if (enptr[i] == '0') ipmi_discrete_event_clear(info->states, i, IPMI_ASSERTION); else { cmd_win_out("Invalid assertion value\n"); goto out_err; } } enptr = strtok_r(NULL, " \t\n", toks); if (!enptr) { cmd_win_out("No deassertion mask given\n"); return 0; } for (i=0; enptr[i]!='\0'; i++) { if (enptr[i] == '1') ipmi_discrete_event_set(info->states, i, IPMI_DEASSERTION); else if (enptr[i] == '0') ipmi_discrete_event_clear(info->states, i, IPMI_DEASSERTION); else { cmd_win_out("Invalid deassertion value\n"); goto out_err; } } } rv = ipmi_sensor_pointer_cb(curr_sensor_id, rearm, info); if (rv) { cmd_win_out("Unable to get sensor pointer: 0x%x\n", rv); goto out_err; } return 0; out_err: if (info) { if (info->states) ipmi_mem_free(info->states); ipmi_mem_free(info); } return 0; } void set_hysteresis_done(ipmi_sensor_t *sensor, int err, void *cb_data) { if (err) ui_log("Error setting hysteresis: 0x%x", err); else ui_log("Hysteresis set"); } static int set_hysteresis_cmd(char *cmd, char **toks, void *cb_data) { unsigned char physt, nhyst; int rv; if (get_uchar(toks, &physt, "positive hysteresis value")) goto out_err; if (get_uchar(toks, &nhyst, "negative hysteresis value")) goto out_err; rv = ipmi_sensor_id_set_hysteresis(curr_sensor_id, physt, nhyst, set_hysteresis_done, NULL); if (rv) { cmd_win_out("Unable to set hysteresis: 0x%x\n", rv); goto out_err; } out_err: return 0; } void get_hysteresis_done(ipmi_sensor_t *sensor, int err, unsigned int positive_hysteresis, unsigned int negative_hysteresis, void *cb_data) { if (err) ui_log("Error setting hysteresis: 0x%x", err); else ui_log("Hysteresis values: positive = 0x%x, negative = 0x%x", positive_hysteresis, negative_hysteresis); } static int get_hysteresis_cmd(char *cmd, char **toks, void *cb_data) { int rv; rv = ipmi_sensor_id_get_hysteresis(curr_sensor_id, get_hysteresis_done, NULL); if (rv) { cmd_win_out("Unable to get hysteresis: 0x%x\n", rv); goto out_err; } out_err: return 0; } static int dump_fru_str(ipmi_fru_t *fru, char *str, int (*glen)(ipmi_fru_t *fru, unsigned int *length), int (*gtype)(ipmi_fru_t *fru, enum ipmi_str_type_e *type), int (*gstr)(ipmi_fru_t *fru, char *str, unsigned int *strlen)) { enum ipmi_str_type_e type; int rv; char buf[128]; unsigned int len; rv = gtype(fru, &type); if (rv) { if (rv != ENOSYS) display_pad_out(" Error fetching type for %s: %x\n", str, rv); return rv; } if (type == IPMI_BINARY_STR) { display_pad_out(" %s is in binary\n", str); return 0; } else if (type == IPMI_UNICODE_STR) { display_pad_out(" %s is in unicode\n", str); return 0; } else if (type != IPMI_ASCII_STR) { display_pad_out(" %s is in unknown format\n", str); return 0; } len = sizeof(buf); rv = gstr(fru, buf, &len); if (rv) { display_pad_out(" Error fetching string for %s: %x\n", str, rv); return rv; } display_pad_out(" %s: %s\n", str, buf); return 0; } static int dump_fru_custom_str(ipmi_fru_t *fru, char *str, int num, int (*glen)(ipmi_fru_t *fru, unsigned int num, unsigned int *length), int (*gtype)(ipmi_fru_t *fru, unsigned int num, enum ipmi_str_type_e *type), int (*gstr)(ipmi_fru_t *fru, unsigned int num, char *str, unsigned int *strlen)) { enum ipmi_str_type_e type; int rv; char buf[128]; unsigned int len; rv = gtype(fru, num, &type); if (rv) return rv; if (type == IPMI_BINARY_STR) { display_pad_out(" %s custom %d is in binary\n", str, num); return 0; } else if (type == IPMI_UNICODE_STR) { display_pad_out(" %s custom %d is in unicode\n", str, num); return 0; } else if (type != IPMI_ASCII_STR) { display_pad_out(" %s custom %d is in unknown format\n", str, num); return 0; } len = sizeof(buf); rv = gstr(fru, num, buf, &len); if (rv) { display_pad_out(" Error fetching string for %s custom %d: %x\n", str, num, rv); return rv; } display_pad_out(" %s custom %d: %s\n", str, num, buf); return 0; } #define DUMP_FRU_STR(name, str) \ dump_fru_str(fru, str, ipmi_fru_get_ ## name ## _len, \ ipmi_fru_get_ ## name ## _type, \ ipmi_fru_get_ ## name) #define DUMP_FRU_CUSTOM_STR(name, str) \ do { \ int i, _rv; \ for (i=0; ; i++) { \ _rv = dump_fru_custom_str(fru, str, i, \ ipmi_fru_get_ ## name ## _custom_len, \ ipmi_fru_get_ ## name ## _custom_type, \ ipmi_fru_get_ ## name ## _custom); \ if (_rv) \ break; \ } \ } while (0) static int traverse_fru_multi_record_tree(ipmi_fru_node_t *node, int indent) { const char *name; unsigned int i, k; enum ipmi_fru_data_type_e dtype; int intval, rv; double floatval; time_t time; char *data; unsigned int data_len; ipmi_fru_node_t *sub_node; for (i=0; ; i++) { rv = ipmi_fru_node_get_field(node, i, &name, &dtype, &intval, &time, &floatval, &data, &data_len, &sub_node); if ((rv == EINVAL) || (rv == ENOSYS)) break; else if (rv) continue; if (name) display_pad_out("%*sName: %s \n", indent, "", name); else /* An array index. */ display_pad_out("%*%d: \n", indent, "", i); switch (dtype) { case IPMI_FRU_DATA_INT: display_pad_out("%*sType: integer\n", indent, ""); display_pad_out("%*sData: %d\n", indent, "", intval); break; case IPMI_FRU_DATA_TIME: display_pad_out("%*sType: time\n", indent, ""); display_pad_out("%*sData: %ld\n", indent, "", (long)time); break; case IPMI_FRU_DATA_BOOLEAN: display_pad_out("%*sType: boolean\n", indent, ""); display_pad_out("%*sData: %ls\n", indent, "", intval ? "true" : "false"); break; case IPMI_FRU_DATA_FLOAT: display_pad_out("%*sType: float\n", indent, ""); display_pad_out("%*sData: %lf\n", indent, "", floatval); break; case IPMI_FRU_DATA_BINARY: display_pad_out("%*sType: binary\n", indent, ""); display_pad_out("%*sData:", indent, ""); for(k=0; k 0) && ((j % 16) == 0)) display_pad_out("\n "); display_pad_out(" %2.2x", data[j]); } display_pad_out("\n"); rv = ipmi_fru_multi_record_get_root_node(fru, i, &name, &node); if ( !rv ) { display_pad_out("Multi-record decode: %s", name); traverse_fru_multi_record_tree(node, 2); } else if ((rv != ENOSYS) && (rv != EINVAL)) { display_pad_out(" multi-record %d, error get root obj: %x\n ", i, rv); } } ipmi_mem_free(data); } } static void found_entity_for_fru(ipmi_entity_t *entity, char **toks, char **toks2, void *cb_data) { char loc[MAX_ENTITY_LOC_SIZE]; ipmi_fru_t *fru = ipmi_entity_get_fru(entity); display_pad_clear(); if (!fru) { cmd_win_out("No FRU for entity %s\n", get_entity_loc(entity, loc, sizeof(loc))); return; } display_pad_out("FRU for entity %s\n", get_entity_loc(entity, loc, sizeof(loc))); dump_fru_info(fru); display_pad_refresh(); } static int fru_cmd(char *cmd, char **toks, void *cb_data) { entity_finder(cmd, toks, found_entity_for_fru, NULL); curr_display_type = DISPLAY_ENTITY; return 0; } static void fru_fetched(ipmi_fru_t *fru, int err, void *cb_data) { display_pad_clear(); if (err) display_pad_out("Error fetching fru: %x\n", err); else dump_fru_info(fru); display_pad_refresh(); if (err != ECANCELED) ipmi_fru_destroy(fru, NULL, NULL); } typedef struct fru_rec_s { unsigned char is_logical; unsigned char device_address; unsigned char device_id; unsigned char lun; unsigned char private_bus; unsigned char channel; } fru_rec_t; static void dump_fru_cmder(ipmi_domain_t *domain, void *cb_data) { fru_rec_t *info = cb_data; int rv; rv = ipmi_fru_alloc(domain, info->is_logical, info->device_address, info->device_id, info->lun, info->private_bus, info->channel, fru_fetched, NULL, NULL); if (rv) cmd_win_out("Unable to allocate fru: %x\n", rv); } static int dump_fru_cmd(char *cmd, char **toks, void *cb_data) { int rv; fru_rec_t info; if (get_uchar(toks, &info.is_logical, "is_logical")) return 0; if (get_uchar(toks, &info.device_address, "device_address")) return 0; if (get_uchar(toks, &info.device_id, "device_id")) return 0; if (get_uchar(toks, &info.lun, "lun")) return 0; if (get_uchar(toks, &info.private_bus, "private_bus")) return 0; if (get_uchar(toks, &info.channel, "channel")) return 0; rv = ipmi_domain_pointer_cb(domain_id, dump_fru_cmder, &info); if (rv) cmd_win_out("Unable to convert domain id to a pointer\n"); else curr_display_type = DISPLAY_ENTITY; return 0; } static char y_or_n(int val) { if (val) return 'y'; else return 'n'; } #define MCCMD_DATA_SIZE 30 typedef struct mccmd_info_s { ipmi_mcid_t mc_id; unsigned char lun; ipmi_msg_t msg; int found; unsigned char val; } mccmd_info_t; void mc_handler(ipmi_mc_t *mc, void *cb_data) { unsigned char vals[4]; mccmd_info_t *info = cb_data; curr_display_type = DISPLAY_MC; info->found = 1; display_pad_clear(); display_pad_out("MC (%x %x) - %s\n", ipmi_mc_get_channel(mc), ipmi_mc_get_address(mc), ipmi_mc_is_active(mc) ? "active" : "inactive"); display_pad_out(" provides_device_sdrs: %c\n", y_or_n(ipmi_mc_provides_device_sdrs(mc))); display_pad_out(" device_available: %c\n", y_or_n(ipmi_mc_device_available(mc))); display_pad_out(" chassis_support: %c\n", y_or_n(ipmi_mc_chassis_support(mc))); display_pad_out(" bridge_support: %c\n", y_or_n(ipmi_mc_bridge_support(mc))); display_pad_out(" ipmb_event_generator: %c\n", y_or_n(ipmi_mc_ipmb_event_generator_support(mc))); display_pad_out(" ipmb_event_receiver: %c\n", y_or_n(ipmi_mc_ipmb_event_receiver_support(mc))); display_pad_out(" fru_inventory_support: %c\n", y_or_n(ipmi_mc_fru_inventory_support(mc))); display_pad_out(" sel_device_support: %c\n", y_or_n(ipmi_mc_sel_device_support(mc))); display_pad_out(" sdr_repository_support: %c\n", y_or_n(ipmi_mc_sdr_repository_support(mc))); display_pad_out(" sensor_device_support: %c\n", y_or_n(ipmi_mc_sensor_device_support(mc))); display_pad_out(" device_id: %2.2x\n", ipmi_mc_device_id(mc)); display_pad_out(" device_revision: %1.1x\n", ipmi_mc_device_revision(mc)); display_pad_out(" fw_revision: %d.%d%d\n", ipmi_mc_major_fw_revision(mc), ipmi_mc_minor_fw_revision(mc)>>4, ipmi_mc_minor_fw_revision(mc)&0xf); display_pad_out(" version: %d.%d\n", ipmi_mc_major_version(mc), ipmi_mc_minor_version(mc)); display_pad_out(" manufacturer_id: %6.6x\n", ipmi_mc_manufacturer_id(mc)); display_pad_out(" product_id: %4.4x\n", ipmi_mc_product_id(mc)); ipmi_mc_aux_fw_revision(mc, vals); display_pad_out(" aux_fw_revision: %2.2x %2.2x %2.2x %2.2x\n", vals[0], vals[1], vals[2], vals[3]); display_pad_out(" SEL count: %d entries, %d slots used\n", ipmi_mc_sel_count(mc), ipmi_mc_sel_entries_used(mc)); } int get_mc_id(char **toks, ipmi_mcid_t *mc_id) { unsigned char val; if (get_uchar(toks, &val, "mc channel")) return 1; mc_id->channel = val; if (get_uchar(toks, &val, "MC num")) return 1; mc_id->mc_num = val; mc_id->domain_id = domain_id; return 0; } int mc_cmd(char *cmd, char **toks, void *cb_data) { mccmd_info_t info; int rv; if (get_mc_id(toks, &info.mc_id)) return 0; info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, mc_handler, &info); if (rv) { cmd_win_out("Unable to find MC\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); return 0; } void mcs_handler(ipmi_domain_t *domain, ipmi_mc_t *mc, void *cb_data) { int addr; int channel; addr = ipmi_mc_get_address(mc); channel = ipmi_mc_get_channel(mc); display_pad_out(" (%x %x) - %s\n", channel, addr, ipmi_mc_is_active(mc) ? "active" : "inactive"); } static void mcs_cmder(ipmi_domain_t *domain, void *cb_data) { ipmi_domain_iterate_mcs(domain, mcs_handler, NULL); } int mcs_cmd(char *cmd, char **toks, void *cb_data) { int rv; display_pad_clear(); curr_display_type = DISPLAY_MCS; display_pad_out("MCs:\n"); rv = ipmi_domain_pointer_cb(domain_id, mcs_cmder, NULL); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } display_pad_refresh(); return 0; } static void mccmd_rsp_handler(ipmi_mc_t *src, ipmi_msg_t *msg, void *rsp_data) { unsigned int i; unsigned char *data; display_pad_clear(); curr_display_type = DISPLAY_RSP; display_pad_out("Response:\n"); display_pad_out(" NetFN = 0x%2.2x\n", msg->netfn); display_pad_out(" Command = 0x%2.2x\n", msg->cmd); display_pad_out(" Completion code = 0x%2.2x\n", msg->data[0]); display_pad_out(" data ="); data = msg->data + 1; for (i=0; i+1data_len; i++) { if ((i != 0) && ((i % 8) == 0)) display_pad_out("\n "); display_pad_out(" %2.2x", data[i]); } display_pad_out("\n"); display_pad_refresh(); } void mccmd_handler(ipmi_mc_t *mc, void *cb_data) { mccmd_info_t *info = cb_data; int rv; info->found = 1; rv = ipmi_mc_send_command(mc, info->lun, &(info->msg), mccmd_rsp_handler, NULL); if (rv) cmd_win_out("Send command failure: %x\n", rv); } int mccmd_cmd(char *cmd, char **toks, void *cb_data) { mccmd_info_t info; unsigned char data[MCCMD_DATA_SIZE]; unsigned int data_len; int rv; if (get_mc_id(toks, &info.mc_id)) return 0; if (get_uchar(toks, &info.lun, "LUN")) return 0; if (get_uchar(toks, &info.msg.netfn, "NetFN")) return 0; if (get_uchar(toks, &info.msg.cmd, "command")) return 0; for (data_len=0; ; data_len++) { if (get_uchar(toks, data+data_len, NULL)) break; } info.msg.data_len = data_len; info.msg.data = data; info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, mccmd_handler, &info); if (rv) { cmd_win_out("Unable to convert MC id to a pointer\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); return 0; } void mc_events_enable_cb(ipmi_mc_t *mc, int err, void *cb_data) { if (err) ui_log("Error setting events enable: 0x%x\n", err); else ui_log("Events enable set\n"); } void mc_events_enable_handler(ipmi_mc_t *mc, void *cb_data) { mccmd_info_t *info = cb_data; int rv; info->found = 1; rv = ipmi_mc_set_events_enable(mc, info->val, mc_events_enable_cb, NULL); if (rv) cmd_win_out("Set events enable failure: %x\n", rv); } int mc_events_enable_cmd(char *cmd, char **toks, void *cb_data) { mccmd_info_t info; int rv; if (get_mc_id(toks, &info.mc_id)) return 0; if (get_uchar(toks, &info.val, "enabled")) return 0; info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, mc_events_enable_handler, &info); if (rv) { cmd_win_out("Unable to convert MC id to a pointer\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); return 0; } void mc_events_enabled_handler(ipmi_mc_t *mc, void *cb_data) { mccmd_info_t *info = cb_data; info->found = 1; if (ipmi_mc_get_events_enable(mc)) cmd_win_out("Events enabled\n"); else cmd_win_out("Events not enabled\n"); } int mc_events_enabled_cmd(char *cmd, char **toks, void *cb_data) { mccmd_info_t info; int rv; if (get_mc_id(toks, &info.mc_id)) return 0; info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, mc_events_enabled_handler, &info); if (rv) { cmd_win_out("Unable to convert MC id to a pointer\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); return 0; } void display_pef(void) { if (!pef) { display_pad_out("No PEF read, use readpef to fetch one\n"); return; } display_pad_out("PEF\n"); display_pad_out(" Version: %d.%d", ipmi_pef_major_version(pef), ipmi_pef_minor_version(pef)); display_pad_out(" Supports:"); if (ipmi_pef_supports_diagnostic_interrupt(pef)) display_pad_out(" diagnostic_interrupt"); if (ipmi_pef_supports_oem_action(pef)) display_pad_out(" oem_action"); if (ipmi_pef_supports_power_cycle(pef)) display_pad_out(" power_cycle"); if (ipmi_pef_supports_reset(pef)) display_pad_out(" reset"); if (ipmi_pef_supports_power_down(pef)) display_pad_out(" power_down"); if (ipmi_pef_supports_alert(pef)) display_pad_out(" alert"); display_pad_out("\n"); display_pad_out(" Num event filter table entries: %d\n", num_event_filter_table_entries(pef)); } typedef struct pef_table_s { char *name; int (*get)(ipmi_pef_config_t *pefc, unsigned int sel, unsigned int *val); char *fmt; } pef_table_t; #define X(n, f) { #n, ipmi_pefconfig_get_##n, f } static pef_table_t eft_table[] = { X(enable_filter, "%d"), X(filter_type, "%d"), X(diagnostic_interrupt, "%d"), X(oem_action, "%d"), X(power_cycle, "%d"), X(reset, "%d"), X(power_down, "%d"), X(alert, "%d"), X(alert_policy_number, "%d"), X(event_severity, "0x%x"), X(generator_id_addr, "0x%x"), X(generator_id_channel_lun, "0x%x"), X(sensor_type, "0x%x"), X(sensor_number, "0x%x"), X(event_trigger, "%d"), X(data1_offset_mask, "0x%x"), X(data1_mask, "%d"), X(data1_compare1, "%d"), X(data1_compare2, "%d"), X(data2_mask, "%d"), X(data2_compare1, "%d"), X(data2_compare2, "%d"), X(data3_mask, "%d"), X(data3_compare1, "%d"), X(data3_compare2, "%d"), { NULL } }; static pef_table_t apt_table[] = { X(policy_num, "%d"), X(enabled, "%d"), X(policy, "%d"), X(channel, "0x%x"), X(destination_selector, "%d"), X(alert_string_event_specific, "%d"), X(alert_string_selector, "%d"), { NULL } }; static pef_table_t ask_table[] = { X(event_filter, "%d"), X(alert_string_set, "%d"), { NULL } }; void display_pef_config(void) { unsigned int i, j; unsigned int val; unsigned int len; unsigned char data[128]; int rv; unsigned int count; if (!pef_config) { display_pad_out("No PEF config read, use readpef to fetch one\n"); return; } display_pad_out(" alert_startup_delay_enabled: %d\n", ipmi_pefconfig_get_alert_startup_delay_enabled(pef_config)); display_pad_out(" startup_delay_enabled: %d\n", ipmi_pefconfig_get_startup_delay_enabled(pef_config)); display_pad_out(" event_messages_enabled: %d\n", ipmi_pefconfig_get_event_messages_enabled(pef_config)); display_pad_out(" pef_enabled: %d\n", ipmi_pefconfig_get_pef_enabled(pef_config)); display_pad_out(" diagnostic_interrupt_enabled: %d\n", ipmi_pefconfig_get_diagnostic_interrupt_enabled(pef_config)); display_pad_out(" oem_action_enabled: %d\n", ipmi_pefconfig_get_oem_action_enabled(pef_config)); display_pad_out(" power_cycle_enabled: %d\n", ipmi_pefconfig_get_power_cycle_enabled(pef_config)); display_pad_out(" reset_enabled: %d\n", ipmi_pefconfig_get_reset_enabled(pef_config)); display_pad_out(" power_down_enabled: %d\n", ipmi_pefconfig_get_power_down_enabled(pef_config)); display_pad_out(" alert_enabled: %d\n", ipmi_pefconfig_get_alert_enabled(pef_config)); if (ipmi_pefconfig_get_startup_delay(pef_config, &val) == 0) display_pad_out(" startup_delay: %d\n", val); if (ipmi_pefconfig_get_alert_startup_delay(pef_config, &val) == 0) display_pad_out(" alert_startup_delay: %d\n", val); len = sizeof(data); rv = ipmi_pefconfig_get_guid(pef_config, &val, data, &len); if (!rv) { display_pad_out(" guid_enabled: %d\n", val); display_pad_out(" guid:", val); for (i=0; ifound = 1; if (pef) { ipmi_pef_destroy(pef, NULL, NULL); pef = NULL; } if (pef_config) { ipmi_pef_free_config(pef_config); pef_config = NULL; } rv = ipmi_pef_alloc(mc, readpef_alloc_handler, NULL, NULL); if (rv) cmd_win_out("Error allocating PEF"); } int readpef_cmd(char *cmd, char **toks, void *cb_data) { mccmd_info_t info; int rv; if (get_mc_id(toks, &info.mc_id)) return 0; info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, readpef_mc_handler, &info); if (rv) { cmd_win_out("Unable to find MC\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); return 0; } int viewpef_cmd(char *cmd, char **toks, void *cb_data) { display_pad_clear(); display_pef(); display_pef_config(); display_pad_refresh(); return 0; } void writepef_done(ipmi_pef_t *pef, int err, void *cb_data) { if (err) ui_log("Error writing PEF: %x\n", err); else ui_log("PEF written\n"); } int writepef_cmd(char *cmd, char **toks, void *cb_data) { int rv; if (!pef) { cmd_win_out("No PEF to write\n"); return 0; } if (!pef_config) { cmd_win_out("No PEF config to write\n"); return 0; } rv = ipmi_pef_set_config(pef, pef_config, writepef_done, NULL); if (rv) { cmd_win_out("Error writing pef parms: %x\n", rv); } return 0; } void clearpeflock_done(ipmi_pef_t *pef, int err, void *cb_data) { if (err) ui_log("Error clearing PEF lock: %x\n", err); else ui_log("PEF lock cleared\n"); } static void clearpeflock_rsp_handler(ipmi_mc_t *src, ipmi_msg_t *msg, void *rsp_data) { if (msg->data[0]) ui_log("Error clearing PEF lock: %x\n", IPMI_IPMI_ERR_VAL(msg->data[0])); else ui_log("PEF lock cleared\n"); } void clearpeflock_mc_handler(ipmi_mc_t *mc, void *cb_data) { mccmd_info_t *info = cb_data; unsigned char data[2]; ipmi_msg_t msg; int rv; info->found = 1; data[0] = 0; data[1] = 0; msg.netfn = IPMI_SENSOR_EVENT_NETFN; msg.cmd = IPMI_SET_PEF_CONFIG_PARMS_CMD; msg.data = data; msg.data_len = 2; rv = ipmi_mc_send_command(mc, 0, &msg, clearpeflock_rsp_handler, NULL); if (rv) cmd_win_out("Send PEF clear lock failure: %x\n", rv); } int clearpeflock_cmd(char *cmd, char **toks, void *cb_data) { mccmd_info_t info; int rv; char *mc_toks; char buf[100]; char *ntoks; mc_toks = strtok_r(NULL, "", toks); if (mc_toks) { strncpy(buf+2, mc_toks, sizeof(buf)-2); buf[0] = 'a'; buf[1] = ' '; strtok_r(buf, " ", &ntoks); if (get_mc_id(&ntoks, &info.mc_id)) return 0; info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, clearpeflock_mc_handler, &info); if (rv) { cmd_win_out("Unable to find MC\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); } else { if (!pef) { ui_log("No PEF to write\n"); return 0; } ipmi_pef_clear_lock(pef, pef_config, clearpeflock_done, NULL); } return 0; } typedef struct setpef_parm_s { char *name; int (*set_val)(ipmi_pef_config_t *, unsigned int); int (*set_data)(ipmi_pef_config_t *, unsigned char *, unsigned int); int (*set_val_sel)(ipmi_pef_config_t *, unsigned int, unsigned int); int (*set_data_sel)(ipmi_pef_config_t *, unsigned int, unsigned char *, unsigned int); } setpef_parm_t; #define N NULL #define D(x) #x #define C(x) D(x) #define H(x) ipmi_pefconfig_set_ ## x #define G(x) H(x) static setpef_parm_t pef_conf[] = { #undef V #define V startup_delay_enabled { C(V), G(V), N, N, N }, #undef V #define V alert_startup_delay_enabled { C(V), G(V), N, N, N }, #undef V #define V event_messages_enabled { C(V), G(V), N, N, N }, #undef V #define V pef_enabled { C(V), G(V), N, N, N }, #undef V #define V diagnostic_interrupt_enabled { C(V), G(V), N, N, N }, #undef V #define V oem_action_enabled { C(V), G(V), N, N, N }, #undef V #define V power_cycle_enabled { C(V), G(V), N, N, N }, #undef V #define V reset_enabled { C(V), G(V), N, N, N }, #undef V #define V power_down_enabled { C(V), G(V), N, N, N }, #undef V #define V alert_enabled { C(V), G(V), N, N, N }, #undef V #define V startup_delay { C(V), G(V), N, N, N }, #undef V #define V alert_startup_delay { C(V), G(V), N, N, N }, #undef V #define V enable_filter { C(V), N, N, G(V), N }, #undef V #define V filter_type { C(V), N, N, G(V), N }, #undef V #define V diagnostic_interrupt { C(V), N, N, G(V), N }, #undef V #define V oem_action { C(V), N, N, G(V), N }, #undef V #define V power_cycle { C(V), N, N, G(V), N }, #undef V #define V reset { C(V), N, N, G(V), N }, #undef V #define V power_down { C(V), N, N, G(V), N }, #undef V #define V alert { C(V), N, N, G(V), N }, #undef V #define V alert_policy_number { C(V), N, N, G(V), N }, #undef V #define V event_severity { C(V), N, N, G(V), N }, #undef V #define V generator_id_addr { C(V), N, N, G(V), N }, #undef V #define V generator_id_channel_lun { C(V), N, N, G(V), N }, #undef V #define V sensor_type { C(V), N, N, G(V), N }, #undef V #define V sensor_number { C(V), N, N, G(V), N }, #undef V #define V event_trigger { C(V), N, N, G(V), N }, #undef V #define V data1_offset_mask { C(V), N, N, G(V), N }, #undef V #define V data1_mask { C(V), N, N, G(V), N }, #undef V #define V data1_compare1 { C(V), N, N, G(V), N }, #undef V #define V data1_compare2 { C(V), N, N, G(V), N }, #undef V #define V data2_mask { C(V), N, N, G(V), N }, #undef V #define V data2_compare1 { C(V), N, N, G(V), N }, #undef V #define V data2_compare2 { C(V), N, N, G(V), N }, #undef V #define V data3_mask { C(V), N, N, G(V), N }, #undef V #define V data3_compare1 { C(V), N, N, G(V), N }, #undef V #define V data3_compare2 { C(V), N, N, G(V), N }, #undef V #define V policy_num { C(V), N, N, G(V), N }, #undef V #define V enabled { C(V), N, N, G(V), N }, #undef V #define V channel { C(V), N, N, G(V), N }, #undef V #define V destination_selector { C(V), N, N, G(V), N }, #undef V #define V alert_string_event_specific { C(V), N, N, G(V), N }, #undef V #define V alert_string_selector { C(V), N, N, G(V), N }, #undef V #define V event_filter { C(V), N, N, G(V), N }, #undef V #define V alert_string_set { C(V), N, N, G(V), N }, { NULL } }; static int setpef_cmd(char *cmd, char **toks, void *cb_data) { unsigned int sel; unsigned int val; unsigned char data[30]; char *name; char *str; unsigned int i; int rv = 0; if (!pef_config) { cmd_win_out("No PEF config read, use readpef to fetch one\n"); return 0; } name = strtok_r(NULL, " \t\n", toks); if (!name) { cmd_win_out("No PEF config name given\n"); return 0; } for (i=0; pef_conf[i].name != NULL; i++) { if (strcmp(pef_conf[i].name, name) == 0) break; } if (pef_conf[i].name == NULL) { if (strcmp(name, "guid") == 0) { for (i=0; ifound = 1; if (lanparm) { ipmi_lanparm_destroy(lanparm, NULL, NULL); lanparm = NULL; } if (lanparm_config) { ipmi_lan_free_config(lanparm_config); lanparm_config = NULL; } rv = ipmi_lanparm_alloc(mc, info->channel, &lanparm); if (rv) { cmd_win_out("failed lanparm allocation: %x\n", rv); return; } rv = ipmi_lan_get_config(lanparm, readlanparm_getconf_handler, NULL); } int readlanparm_cmd(char *cmd, char **toks, void *cb_data) { lanparm_info_t info; int rv; unsigned char val; if (get_mc_id(toks, &info.mc_id)) return 0; if (get_uchar(toks, &val, "lanparm channel")) return 0; info.channel = val; info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, readlanparm_mc_handler, &info); if (rv) { cmd_win_out("Unable to find MC\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); return 0; } int viewlanparm_cmd(char *cmd, char **toks, void *cb_data) { display_pad_clear(); display_lanparm_config(); display_pad_refresh(); return 0; } void writelanparm_done(ipmi_lanparm_t *lanparm, int err, void *cb_data) { if (err) ui_log("Error writing LANPARM: %x\n", err); else ui_log("LANPARM written\n"); } int writelanparm_cmd(char *cmd, char **toks, void *cb_data) { int rv; if (!lanparm) { cmd_win_out("No LANPARM to write\n"); return 0; } if (!lanparm_config) { cmd_win_out("No LANPARM config to write\n"); return 0; } rv = ipmi_lan_set_config(lanparm, lanparm_config, writelanparm_done, NULL); if (rv) { cmd_win_out("Error writing lan parms: %x\n", rv); } return 0; } void clearlanparmlock_done(ipmi_lanparm_t *lanparm, int err, void *cb_data) { if (err) ui_log("Error clearing LANPARM lock: %x\n", err); else ui_log("LANPARM lock cleared\n"); } static void clearlanparmlock_rsp_handler(ipmi_mc_t *src, ipmi_msg_t *msg, void *rsp_data) { if (msg->data[0]) ui_log("Error clearing LANPARM lock: %x\n", IPMI_IPMI_ERR_VAL(msg->data[0])); else ui_log("LANPARM lock cleared\n"); } void clearlanparmlock_mc_handler(ipmi_mc_t *mc, void *cb_data) { lanparm_info_t *info = cb_data; unsigned char data[3]; ipmi_msg_t msg; int rv; info->found = 1; data[0] = info->channel; data[1] = 0; data[2] = 0; msg.netfn = IPMI_TRANSPORT_NETFN; msg.cmd = IPMI_SET_LAN_CONFIG_PARMS_CMD; msg.data = data; msg.data_len = 3; rv = ipmi_mc_send_command(mc, 0, &msg, clearlanparmlock_rsp_handler, NULL); if (rv) cmd_win_out("Send LANPARM clear lock failure: %x\n", rv); } int clearlanparmlock_cmd(char *cmd, char **toks, void *cb_data) { lanparm_info_t info; int rv; char *mc_toks; char buf[100]; char *ntoks; unsigned char val; mc_toks = strtok_r(NULL, "", toks); if (mc_toks) { strncpy(buf+2, mc_toks, sizeof(buf)-2); buf[0] = 'a'; buf[1] = ' '; strtok_r(buf, " ", &ntoks); if (get_mc_id(&ntoks, &info.mc_id)) return 0; if (get_uchar(&ntoks, &val, "lanparm channel")) return 0; info.channel = val; info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, clearlanparmlock_mc_handler, &info); if (rv) { cmd_win_out("Unable to find MC\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); } else { if (!lanparm) { ui_log("No LANPARM to write\n"); return 0; } ipmi_lan_clear_lock(lanparm, lanparm_config, clearlanparmlock_done, NULL); } return 0; } typedef struct setlan_parm_s { char *name; int (*set_val)(ipmi_lan_config_t *, unsigned int); int (*set_data)(ipmi_lan_config_t *, unsigned char *, unsigned int); int (*set_val_sel)(ipmi_lan_config_t *, unsigned int, unsigned int); int (*set_data_sel)(ipmi_lan_config_t *, unsigned int, unsigned char *, unsigned int); } setlan_parm_t; #undef N #define N NULL #undef D #define D(x) #x #undef C #define C(x) D(x) #undef H #define H(x) ipmi_lanconfig_set_ ## x #undef G #define G(x) H(x) static setlan_parm_t lan_conf[] = { #undef V #define V ip_addr_source { C(V), G(V), N, N, N }, #undef V #define V ipv4_ttl { C(V), G(V), N, N, N }, #undef V #define V ipv4_flags { C(V), G(V), N, N, N }, #undef V #define V ipv4_precedence { C(V), G(V), N, N, N }, #undef V #define V ipv4_tos { C(V), G(V), N, N, N }, #undef V #define V enable_auth_oem { C(V), N, N, G(V), N }, #undef V #define V enable_auth_straight { C(V), N, N, G(V), N }, #undef V #define V enable_auth_md5 { C(V), N, N, G(V), N }, #undef V #define V enable_auth_md2 { C(V), N, N, G(V), N }, #undef V #define V enable_auth_none { C(V), N, N, G(V), N }, #undef V #define V ip_addr { C(V), N, G(V), N, N }, #undef V #define V mac_addr { C(V), N, G(V), N, N }, #undef V #define V subnet_mask { C(V), N, G(V), N, N }, #undef V #define V primary_rmcp_port { C(V), N, G(V), N, N }, #undef V #define V secondary_rmcp_port { C(V), N, G(V), N, N }, #undef V #define V bmc_generated_arps { C(V), G(V), N, N, N }, #undef V #define V bmc_generated_garps { C(V), G(V), N, N, N }, #undef V #define V garp_interval { C(V), G(V), N, N, N }, #undef V #define V default_gateway_ip_addr { C(V), N, G(V), N, N }, #undef V #define V default_gateway_mac_addr { C(V), N, G(V), N, N }, #undef V #define V backup_gateway_ip_addr { C(V), N, G(V), N, N }, #undef V #define V backup_gateway_mac_addr { C(V), N, G(V), N, N }, #undef V #define V alert_ack { C(V), N, N, G(V), N }, #undef V #define V dest_type { C(V), N, N, G(V), N }, #undef V #define V alert_retry_interval { C(V), N, N, G(V), N }, #undef V #define V max_alert_retries { C(V), N, N, G(V), N }, #undef V #define V dest_format { C(V), N, N, G(V), N }, #undef V #define V gw_to_use { C(V), N, N, G(V), N }, #undef V #define V dest_ip_addr { C(V), N, N, N, G(V) }, #undef V #define V dest_mac_addr { C(V), N, N, N, G(V) }, }; static int setlanparm_cmd(char *cmd, char **toks, void *cb_data) { unsigned int sel; unsigned int val; unsigned char data[30]; char *name; char *str; unsigned int i, j; int rv = 0; if (!lanparm_config) { cmd_win_out("No LAN config read, use readlan to fetch one\n"); return 0; } name = strtok_r(NULL, " \t\n", toks); if (!name) { cmd_win_out("No LAN config name given\n"); return 0; } for (i=0; lan_conf[i].name != NULL; i++) { if (strcmp(lan_conf[i].name, name) == 0) break; } if (lan_conf[i].name == NULL) { if (strcmp(name, "community_string") == 0) { if (get_uint(toks, &sel, "selector")) return 0; str = strtok_r(NULL, "", toks); rv = ipmi_lanconfig_set_community_string(lanparm_config, (unsigned char *) str, strlen(str)); } else { cmd_win_out("Invalid LAN config name: '%s'\n", name); return 0; } } else if (lan_conf[i].set_val) { if (get_uint(toks, &val, "value")) return 0; rv = lan_conf[i].set_val(lanparm_config, val); } else if (lan_conf[i].set_data) { for (j=0; jconnection, info->channel, info->ip_addr, info->mac_addr, info->eft_sel, info->policy_num, info->apt_sel, info->lan_dest_sel, pet_done, NULL, &pet); if (rv) cmd_win_out("Error creating PET: %x\n", rv); } static int pet_cmd(char *cmd, char **toks, void *cb_data) { pet_info_t info; int rv; if (pet) { ipmi_pet_destroy(pet, NULL, NULL); pet = NULL; } if (get_uint(toks, &info.connection, "connection")) return 0; if (get_uint(toks, &info.channel, "channel")) return 0; if (get_ip_addr(toks, &info.ip_addr, "IP address")) return 0; if (get_mac_addr(toks, info.mac_addr, "MAC address")) return 0; if (get_uint(toks, &info.eft_sel, "eft selector")) return 0; if (get_uint(toks, &info.policy_num, "policy_num")) return 0; if (get_uint(toks, &info.apt_sel, "apt selector")) return 0; if (get_uint(toks, &info.lan_dest_sel, "LAN dest selector")) return 0; rv = ipmi_domain_pointer_cb(domain_id, pet_domain_cb, &info); if (rv) cmd_win_out("Error converting domain"); return 0; } typedef struct msg_cmd_data_s { unsigned char data[MCCMD_DATA_SIZE]; unsigned int data_len; ipmi_ipmb_addr_t addr; ipmi_msg_t msg; } msg_cmd_data_t; static int mccmd_addr_rsp_handler(ipmi_domain_t *domain, ipmi_msgi_t *rspi) { ipmi_msg_t *msg = &rspi->msg; unsigned int i; unsigned char *data; display_pad_clear(); curr_display_type = DISPLAY_RSP; display_pad_out("Response:\n"); display_pad_out(" NetFN = 0x%2.2x\n", msg->netfn); display_pad_out(" Command = 0x%2.2x\n", msg->cmd); display_pad_out(" Completion code = 0x%2.2x\n", msg->data[0]); display_pad_out(" data ="); data = msg->data + 1; for (i=0; i+1data_len; i++) { if ((i != 0) && ((i % 8) == 0)) display_pad_out("\n "); display_pad_out(" %2.2x", data[i]); } display_pad_out("\n"); display_pad_refresh(); return IPMI_MSG_ITEM_NOT_USED; } static void msg_cmder(ipmi_domain_t *domain, void *cb_data) { msg_cmd_data_t *info = cb_data; int rv; rv = ipmi_send_command_addr(domain, (ipmi_addr_t *) &(info->addr), sizeof(info->addr), &info->msg, mccmd_addr_rsp_handler, NULL, NULL); if (rv) cmd_win_out("Send command failure: %x\n", rv); } static int msg_cmd(char *cmd, char **toks, void *cb_data) { msg_cmd_data_t info; unsigned int channel; int rv; info.addr.addr_type = IPMI_IPMB_ADDR_TYPE; if (get_uint(toks, &channel, "channel")) return 0; info.addr.channel = channel; if (get_uchar(toks, &info.addr.slave_addr, "slave address")) return 0; if (info.addr.slave_addr == 0) { info.addr.addr_type = IPMI_IPMB_BROADCAST_ADDR_TYPE; if (get_uchar(toks, &info.addr.slave_addr, "slave address")) return 0; } if (get_uchar(toks, &info.addr.lun, "LUN")) return 0; if (get_uchar(toks, &info.msg.netfn, "NetFN")) return 0; if (get_uchar(toks, &info.msg.cmd, "command")) return 0; for (info.data_len=0; ; info.data_len++) { if (get_uchar(toks, info.data+info.data_len, NULL)) break; } info.msg.data_len = info.data_len; info.msg.data = info.data; rv = ipmi_domain_pointer_cb(domain_id, msg_cmder, &info); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } display_pad_refresh(); return 0; } static void set_control(ipmi_control_t *control, void *cb_data) { char **toks = cb_data; int num_vals; int i; int *vals = NULL; unsigned char *cvals = NULL; char *tok; char *estr; int rv; int control_type; control_type = ipmi_control_get_type(control); switch (control_type) { case IPMI_CONTROL_LIGHT: if (ipmi_control_light_set_with_setting(control)) { ipmi_light_setting_t *setting; num_vals = ipmi_control_get_num_vals(control); setting = ipmi_alloc_light_settings(num_vals); if (!setting) { cmd_win_out("set_control: out of memory\n"); goto out; } for (i=0; imc_id.domain_id = domain_id; event = ipmi_domain_first_event(domain); while (event) { if ((ipmi_cmp_mc_id_noseq(ipmi_event_get_mcid(event),info->mc_id) == 0) && (ipmi_event_get_record_id(event) == info->record_id)) { rv = ipmi_domain_del_event(domain, event, delevent_cb, NULL); if (rv) cmd_win_out("error deleting log: %x\n", rv); ipmi_event_free(event); found = 1; break; } else { n = ipmi_domain_next_event(domain, event); ipmi_event_free(event); event = n; } } if (!found) cmd_win_out("log not found\n"); } static int delevent_cmd(char *cmd, char **toks, void *cb_data) { delevent_info_t info; int rv; if (get_mc_id(toks, &info.mc_id)) return 0; if (get_uint(toks, &info.record_id, "record id")) return 0; rv = ipmi_domain_pointer_cb(domain_id, delevent_cmder, &info); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } return 0; } static void addevent_cb(ipmi_mc_t *mc, unsigned int record_id, int err, void *cb_data) { if (err) ui_log("Error adding event: %x\n", err); else ui_log("event 0x%4.4x added\n", record_id); } typedef struct addevent_info_s { ipmi_mcid_t mc_id; unsigned int record_id; unsigned int type; ipmi_time_t timestamp; unsigned char data[13]; } addevent_info_t; static void addevent_cmder(ipmi_mc_t *mc, void *cb_data) { int rv; addevent_info_t *info = cb_data; ipmi_event_t *event; event = ipmi_event_alloc(ipmi_mc_convert_to_id(mc), info->record_id, info->type, info->timestamp, info->data, 13); if (!event) { cmd_win_out("Could not allocate event\n"); return; } rv = ipmi_mc_add_event_to_sel(mc, event, addevent_cb, NULL); if (rv) cmd_win_out("Unable to send add event: %x\n", rv); ipmi_event_free(event); } static int addevent_cmd(char *cmd, char **toks, void *cb_data) { addevent_info_t info; int rv; int i; struct timeval time; if (get_mc_id(toks, &info.mc_id)) return 0; if (get_uint(toks, &info.record_id, "record id")) return 0; if (get_uint(toks, &info.type, "record type")) return 0; for (i=0; i<13; i++) { if (get_uchar(toks, &info.data[i], "data")) return 0; } ipmi_ui_os_hnd->get_monotonic_time(ipmi_ui_os_hnd, &time); info.timestamp = time.tv_sec * 1000000000; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, addevent_cmder, &info); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } return 0; } static int debug_cmd(char *cmd, char **toks, void *cb_data) { char *type; char *on_off; int val; type = strtok_r(NULL, " \t\n", toks); if (!type) { cmd_win_out("No debug type specified\n"); goto out; } on_off = strtok_r(NULL, " \t\n", toks); if (!on_off) { cmd_win_out("on or off not specified\n"); goto out; } else if (strcmp(on_off, "on") == 0) { val = 1; } else if (strcmp(on_off, "off") == 0) { val = 0; } else { cmd_win_out("on or off not specified, got '%s'\n", on_off); goto out; } if (strcmp(type, "msg") == 0) { if (val) DEBUG_MSG_ENABLE(); else DEBUG_MSG_DISABLE(); } else if (strcmp(type, "rawmsg") == 0) { if (val) DEBUG_RAWMSG_ENABLE(); else DEBUG_RAWMSG_DISABLE(); } else if (strcmp(type, "locks") == 0) { if (val) DEBUG_LOCKS_ENABLE(); else DEBUG_LOCKS_DISABLE(); } else if (strcmp(type, "events") == 0) { if (val) DEBUG_EVENTS_ENABLE(); else DEBUG_EVENTS_DISABLE(); } else if (strcmp(type, "con0") == 0) { if (val) DEBUG_CON_FAIL_ENABLE(0); else DEBUG_CON_FAIL_DISABLE(0); } else if (strcmp(type, "con1") == 0) { if (val) DEBUG_CON_FAIL_ENABLE(1); else DEBUG_CON_FAIL_DISABLE(1); } else if (strcmp(type, "con2") == 0) { if (val) DEBUG_CON_FAIL_ENABLE(2); else DEBUG_CON_FAIL_DISABLE(2); } else if (strcmp(type, "con3") == 0) { if (val) DEBUG_CON_FAIL_ENABLE(3); else DEBUG_CON_FAIL_DISABLE(3); } else { cmd_win_out("Invalid debug type specified: '%s'\n", type); goto out; } out: return 0; } static void clear_sel_cmder(ipmi_domain_t *domain, void *cb_data) { ipmi_event_t *event, *event2; event = ipmi_domain_first_event(domain); while (event) { event2 = event; event = ipmi_domain_next_event(domain, event2); ipmi_domain_del_event(domain, event2, NULL, NULL); ipmi_event_free(event2); } } static int clear_sel_cmd(char *cmd, char **toks, void *cb_data) { int rv; rv = ipmi_domain_pointer_cb(domain_id, clear_sel_cmder, NULL); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } return 0; } static void list_sel_cmder(ipmi_domain_t *domain, void *cb_data) { int rv; ipmi_event_t *event, *event2; unsigned int count1, count2; curr_display_type = EVENTS; display_pad_clear(); rv = ipmi_domain_sel_count(domain, &count1); if (rv) count1 = -1; rv = ipmi_domain_sel_entries_used(domain, &count2); if (rv) count2 = -1; display_pad_out("Event counts: %d entries, %d slots used\n", count1, count2); display_pad_out("Events:\n"); event = ipmi_domain_first_event(domain); while (event) { ipmi_mcid_t mcid = ipmi_event_get_mcid(event); unsigned int record_id = ipmi_event_get_record_id(event); unsigned int type = ipmi_event_get_type(event); ipmi_time_t timestamp = ipmi_event_get_timestamp(event); unsigned int data_len = ipmi_event_get_data_len(event); const unsigned char *data = ipmi_event_get_data_ptr(event); unsigned int i; display_pad_out(" (%x %x) %4.4x:%2.2x %lld:", mcid.channel, mcid.mc_num, record_id, type, timestamp); for (i=0; ifound = 1; rv = ipmi_mc_get_current_sel_time(mc, sel_time_fetched, NULL); if (rv) cmd_win_out("Error sending SEL time fetch: %x\n", rv); } int get_sel_time_cmd(char *cmd, char **toks, void *cb_data) { mccmd_info_t info; int rv; if (get_mc_id(toks, &info.mc_id)) return 0; info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, get_sel_time_handler, &info); if (rv) { cmd_win_out("Unable to find MC\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); return 0; } static void mc_reset_done(ipmi_mc_t *mc, int err, void *cb_data) { if (err) ui_log("Error resetting mc: %x", err); else ui_log("MC reset"); } static void mc_reset_handler(ipmi_mc_t *mc, void *cb_data) { mccmd_info_t *info = cb_data; int rv; info->found = 1; rv = ipmi_mc_reset(mc, info->msg.cmd, mc_reset_done, NULL); if (rv) cmd_win_out("Error sending MC reset: %x\n", rv); } static int mc_reset_cmd(char *cmd, char **toks, void *cb_data) { mccmd_info_t info; int rv; char *type; if (get_mc_id(toks, &info.mc_id)) return 0; type = strtok_r(NULL, " \n\t", toks); if (!type) { cmd_win_out("No reset type given, must be 'cold' or 'warm'\n"); return 0; } if (strcmp(type, "warm") == 0) { info.msg.cmd = IPMI_MC_RESET_WARM; } else if (strcmp(type, "cold") == 0) { info.msg.cmd = IPMI_MC_RESET_COLD; } else { cmd_win_out("Invalid reset type given, must be 'cold' or 'warm'\n"); return 0; } info.found = 0; rv = ipmi_mc_pointer_noseq_cb(info.mc_id, mc_reset_handler, &info); if (rv) { cmd_win_out("Unable to find MC\n"); return 0; } if (!info.found) { cmd_win_out("Unable to find MC (%d %x)\n", info.mc_id.channel, info.mc_id.mc_num); } display_pad_refresh(); return 0; } typedef struct sdrs_info_s { int found; ipmi_mcid_t mc_id; unsigned char do_sensors; } sdrs_info_t; void sdrs_fetched(ipmi_sdr_info_t *sdrs, int err, int changed, unsigned int count, void *cb_data) { sdrs_info_t *info = cb_data; unsigned int i; int rv; int total_size = 0; if (err) { ui_log("Error fetching sdrs: %x\n", err); goto out; } if (!sdrs) { ui_log("sdrs went away during fetch\n"); goto out; } display_pad_clear(); curr_display_type = DISPLAY_SDRS; display_pad_out("%s SDRs for MC (%x %x)\n", info->do_sensors ? "device" : "main", info->mc_id.channel, info->mc_id.mc_num); for (i=0; ido_sensors, &sdrs); if (rv) { cmd_win_out("Unable to alloc sdr info: %x\n", rv); ipmi_mem_free(info); return; } rv = ipmi_sdr_fetch(sdrs, sdrs_fetched, info); if (rv) { cmd_win_out("Unable to start SDR fetch: %x\n", rv); ipmi_sdr_info_destroy(sdrs, NULL, NULL); ipmi_mem_free(info); return; } } void sdrs_mcs_handler(ipmi_mc_t *mc, void *cb_data) { sdrs_info_t *info = cb_data; info->found = 1; start_sdr_dump(mc, info); } static int sdrs_cmd(char *cmd, char **toks, void *cb_data) { int rv; sdrs_info_t *info; info = ipmi_mem_alloc(sizeof(*info)); if (!info) { ui_log("Could not allocate memory for SDR fetch\n"); return 0; } if (get_mc_id(toks, &info->mc_id)) { ipmi_mem_free(info); return 0; } if (get_uchar(toks, &info->do_sensors, "do_sensors")) { ipmi_mem_free(info); return 0; } info->found = 0; rv = ipmi_mc_pointer_noseq_cb(info->mc_id, sdrs_mcs_handler, info); if (rv) { cmd_win_out("Unable to find MC\n"); ipmi_mem_free(info); } else { if (!info->found) { cmd_win_out("Unable to find that mc\n"); ipmi_mem_free(info); } } return 0; } typedef struct scan_cmd_info_s { unsigned char addr; unsigned char channel; } scan_cmd_info_t; void scan_done(ipmi_domain_t *domain, int err, void *cb_data) { log_pad_out("Bus scan done\n"); } static void scan_cmder(ipmi_domain_t *domain, void *cb_data) { scan_cmd_info_t *info = cb_data; ipmi_start_ipmb_mc_scan(domain, info->channel, info->addr, info->addr, scan_done, NULL); } static int scan_cmd(char *cmd, char **toks, void *cb_data) { int rv; scan_cmd_info_t info; if (get_uchar(toks, &info.channel, "channel")) return 0; if (get_uchar(toks, &info.addr, "IPMB address")) return 0; rv = ipmi_domain_pointer_cb(domain_id, scan_cmder, &info); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); } return 0; } static void presence_cmder(ipmi_domain_t *domain, void *cb_data) { int rv; rv = ipmi_detect_domain_presence_changes(domain, 1); if (rv) cmd_win_out("domain presence detect error: %x\n", rv); } int presence_cmd(char *cmd, char **toks, void *cb_data) { int rv; rv = ipmi_domain_pointer_cb(domain_id, presence_cmder, NULL); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } return 0; } static void is_con_active_cmder(ipmi_domain_t *domain, void *cb_data) { int rv; unsigned int *connection = cb_data; unsigned int val; rv = ipmi_domain_is_connection_active(domain, *connection, &val); if (rv) cmd_win_out("Invalid connection number %d: %x\n", *connection, rv); else cmd_win_out("Connection %d is%s active\n", *connection, val ? "" : " not"); } static int is_con_active_cmd(char *cmd, char **toks, void *cb_data) { int rv; unsigned int connection; if (get_uint(toks, &connection, "connection")) return 0; rv = ipmi_domain_pointer_cb(domain_id, is_con_active_cmder, &connection); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } return 0; } static void activate_con_cmder(ipmi_domain_t *domain, void *cb_data) { int rv; unsigned int *connection = cb_data; rv = ipmi_domain_activate_connection(domain, *connection); if (rv) cmd_win_out("Invalid connection number %d: %x\n", *connection, rv); } static int activate_con_cmd(char *cmd, char **toks, void *cb_data) { int rv; unsigned int connection; if (get_uint(toks, &connection, "connection")) return 0; rv = ipmi_domain_pointer_cb(domain_id, activate_con_cmder, &connection); if (rv) { cmd_win_out("Unable to convert domain id to a pointer\n"); return 0; } return 0; } static int quit_cmd(char *cmd, char **toks, void *cb_data) { int rv; rv = ipmi_domain_pointer_cb(domain_id, leave_cmder, NULL); if (rv) { leave(0, ""); } return 0; } static int display_win_cmd(char *cmd, char **toks, void *cb_data) { curr_win = DISPLAY_WIN_SCROLL; return 0; } static int log_win_cmd(char *cmd, char **toks, void *cb_data) { curr_win = LOG_WIN_SCROLL; return 0; } static int new_domain_cmd(char *cmd, char **toks, void *cb_data) { char *parms[30]; int num_parms; int curr_parm; ipmi_args_t *con_parms[2]; int set = 0; int i; ipmi_con_t *con[2]; int rv; for (num_parms=0; num_parms<30; num_parms++) { parms[num_parms] = strtok_r(NULL, " \t\n", toks); if (!parms[num_parms]) break; /* Remove surrounding quotes, if any. */ if (parms[num_parms][0] == '"') { (parms[num_parms])++; if (parms[num_parms][0]) parms[num_parms][strlen(parms[num_parms])-1] = '\0'; } } if (num_parms < 2) { cmd_win_out("Not enough parms given\n"); return 0; } curr_parm = 1; rv = ipmi_parse_args(&curr_parm, num_parms, parms, &con_parms[set]); if (rv) { cmd_win_out("First connection parms are invalid\n"); return 0; } set++; if (curr_parm > num_parms) { rv = ipmi_parse_args(&curr_parm, num_parms, parms, &con_parms[set]); if (rv) { ipmi_free_args(con_parms[0]); cmd_win_out("Second connection parms are invalid\n"); goto out; } set++; } for (i=0; iclose_connection(con[i]); goto out; } cmd_win_out("Domain started\n"); out: for (i=0; iname) == 0) { /* Found it. */ info->err = ipmi_domain_close(domain, final_close, NULL); if (info->err) cmd_win_out("Could not close connection\n"); } } static int close_domain_cmd(char *cmd, char **toks, void *cb_data) { domain_scan_t info; info.err = ENODEV; info.name = strtok_r(NULL, " \t\n", toks); if (!info.name) { cmd_win_out("No domain given\n"); return 0; } ipmi_domain_iterate_domains(close_domain_handler, &info); return 0; } static void set_domain_handler(ipmi_domain_t *domain, void *cb_data) { domain_scan_t *info = cb_data; char name[IPMI_DOMAIN_NAME_LEN]; ipmi_domain_get_name(domain, name, sizeof(name)); if (strcmp(name, info->name) == 0) { /* Found it. */ info->err = 0; domain_id = ipmi_domain_convert_to_id(domain); } } static int set_domain_cmd(char *cmd, char **toks, void *cb_data) { domain_scan_t info; info.err = ENODEV; info.name = strtok_r(NULL, " \t\n", toks); if (!info.name) { cmd_win_out("No domain given\n"); return 0; } ipmi_domain_iterate_domains(set_domain_handler, &info); if (info.err) cmd_win_out("Error setting domain: 0x%x\n", info.err); return 0; } static void domains_handler(ipmi_domain_t *domain, void *cb_data) { char name[IPMI_DOMAIN_NAME_LEN]; ipmi_domain_get_name(domain, name, sizeof(name)); display_pad_out(" %s\n", name); } static int domains_cmd(char *cmd, char **toks, void *cb_data) { display_pad_clear(); display_pad_out("Domains:\n"); ipmi_domain_iterate_domains(domains_handler, NULL); display_pad_refresh(); return 0; } static int help_cmd(char *cmd, char **toks, void *cb_data); static struct { char *name; cmd_handler_t handler; char *help; } cmd_list[] = { { "display_win", display_win_cmd, " - Sets the display window (left window) for scrolling" }, { "log_win", log_win_cmd, " - Sets the log window (right window) for scrolling" }, { "entities", entities_cmd, " - list all the entities the UI knows about" }, { "entity", entity_cmd, " - list all the info about an entity" }, { "hs_get_act_time", hs_get_act_time, " " " - Get the host-swap auto-activate time" }, { "hs_set_act_time", hs_set_act_time, "