ipmi_dcmi.c (ce861658c058c60209c23137ccfb8dc407abe811) ipmi_dcmi.c (eb54136775f63a6a159f3c55ee4772d7aa363cc4)
1/*
2 * Copyright (C) 2008 Intel Corporation.
3 * All rights reserved
4 *
5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
6 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
7 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR

--- 736 unchanged lines hidden (view full) ---

745static int
746ipmi_dcmi_prnt_oobDiscover(struct ipmi_intf * intf)
747{
748# ifndef IPMI_INTF_LANPLUS
749 lprintf(LOG_ERR,
750 "DCMI Discovery is available only when LANplus(IPMI v2.0) is enabled.");
751 return (-1);
752# else
1/*
2 * Copyright (C) 2008 Intel Corporation.
3 * All rights reserved
4 *
5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
6 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
7 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR

--- 736 unchanged lines hidden (view full) ---

745static int
746ipmi_dcmi_prnt_oobDiscover(struct ipmi_intf * intf)
747{
748# ifndef IPMI_INTF_LANPLUS
749 lprintf(LOG_ERR,
750 "DCMI Discovery is available only when LANplus(IPMI v2.0) is enabled.");
751 return (-1);
752# else
753 struct ipmi_session *s;
753 struct ipmi_session_params *p;
754
755 if (intf->opened == 0 && intf->open != NULL) {
756 if (intf->open(intf) < 0)
757 return (-1);
758 }
759 if (intf == NULL || intf->session == NULL)
760 return -1;
761
754
755 if (intf->opened == 0 && intf->open != NULL) {
756 if (intf->open(intf) < 0)
757 return (-1);
758 }
759 if (intf == NULL || intf->session == NULL)
760 return -1;
761
762 s = intf->session;
762 p = &intf->ssn_params;
763
763
764 if (s->port == 0)
765 s->port = IPMI_LAN_PORT;
766 if (s->privlvl == 0)
767 s->privlvl = IPMI_SESSION_PRIV_ADMIN;
768 if (s->timeout == 0)
769 s->timeout = IPMI_LAN_TIMEOUT;
770 if (s->retry == 0)
771 s->retry = IPMI_LAN_RETRY;
764 if (p->port == 0)
765 p->port = IPMI_LAN_PORT;
766 if (p->privlvl == 0)
767 p->privlvl = IPMI_SESSION_PRIV_ADMIN;
768 if (p->timeout == 0)
769 p->timeout = IPMI_LAN_TIMEOUT;
770 if (p->retry == 0)
771 p->retry = IPMI_LAN_RETRY;
772
772
773 if (s->hostname == NULL || strlen((const char *)s->hostname) == 0) {
773 if (p->hostname == NULL || strlen((const char *)p->hostname) == 0) {
774 lprintf(LOG_ERR, "No hostname specified!");
775 return -1;
776 }
777
778 intf->abort = 1;
779 intf->session->sol_data.sequence_number = 1;
780
781 if (ipmi_intf_socket_connect (intf) == -1) {
782 lprintf(LOG_ERR, "Could not open socket!");
783 return -1;
784 }
785
786 if (intf->fd < 0) {
787 lperror(LOG_ERR, "Connect to %s failed",
774 lprintf(LOG_ERR, "No hostname specified!");
775 return -1;
776 }
777
778 intf->abort = 1;
779 intf->session->sol_data.sequence_number = 1;
780
781 if (ipmi_intf_socket_connect (intf) == -1) {
782 lprintf(LOG_ERR, "Could not open socket!");
783 return -1;
784 }
785
786 if (intf->fd < 0) {
787 lperror(LOG_ERR, "Connect to %s failed",
788 s->hostname);
788 p->hostname);
789 intf->close(intf);
790 return -1;
791 }
792
793 intf->opened = 1;
794
795 /* Lets ping/pong */
796 return ipmiv2_lan_ping(intf);

--- 3095 unchanged lines hidden ---
789 intf->close(intf);
790 return -1;
791 }
792
793 intf->opened = 1;
794
795 /* Lets ping/pong */
796 return ipmiv2_lan_ping(intf);

--- 3095 unchanged lines hidden ---