Main Page | Class List | Directories | File List | Class Members | File Members

ipmi_lan.h File Reference

#include <OpenIPMI/ipmiif.h>
#include <OpenIPMI/ipmi_addr.h>
#include <OpenIPMI/ipmi_conn.h>
#include <netinet/in.h>

Go to the source code of this file.

Classes

struct  ipmi_lanp_parm_s
struct  ipmi_payload_s
struct  ipmi_rmcpp_authentication_s
struct  ipmi_rmcpp_confidentiality_s
struct  ipmi_rmcpp_integrity_s

Defines

#define IPMI_LAN_STD_PORT   623
#define IPMI_LAN_STD_PORT_STR   "623"
#define IPMI_LANP_PARMID_AUTHTYPE   1
#define IPMI_LANP_PARMID_PRIVILEGE   2
#define IPMI_LANP_PARMID_PASSWORD   3
#define IPMI_LANP_PARMID_USERNAME   4
#define IPMI_LANP_PARMID_ADDRS   5
#define IPMI_LANP_PARMID_PORTS   6
#define IPMI_LANP_AUTHENTICATION_ALGORITHM   7
#define IPMI_LANP_AUTHENTICATION_ALGORITHM_BMCPICK   (~0)
#define IPMI_LANP_AUTHENTICATION_ALGORITHM_RAKP_NONE   0
#define IPMI_LANP_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1   1
#define IPMI_LANP_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5   2
#define IPMI_LANP_INTEGRITY_ALGORITHM   8
#define IPMI_LANP_INTEGRITY_ALGORITHM_BMCPICK   (~0)
#define IPMI_LANP_INTEGRITY_ALGORITHM_NONE   0
#define IPMI_LANP_INTEGRITY_ALGORITHM_HMAC_SHA1_96   1
#define IPMI_LANP_INTEGRITY_ALGORITHM_HMAC_MD5_128   2
#define IPMI_LANP_INTEGRITY_ALGORITHM_MD5_128   3
#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM   9
#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_BMCPICK   (~0)
#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_NONE   0
#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_AES_CBC_128   1
#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_xRC4_128   2
#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_xRC4_40   3
#define IPMI_LANP_NAME_LOOKUP_ONLY   10
#define IPMI_LANP_BMC_KEY   11
#define IPMI_RMCPP_PAYLOAD_TYPE_IPMI   0
#define IPMI_RMCPP_PAYLOAD_TYPE_SOL   1
#define IPMI_RMCPP_PAYLOAD_TYPE_OEM_EXPLICIT   2
#define IPMI_RMCPP_PAYLOAD_TYPE_OPEN_SESSION_REQUEST   0x10
#define IPMI_RMCPP_PAYLOAD_TYPE_OPEN_SESSION_RESPONSE   0x11
#define IPMI_RMCPP_PAYLOAD_TYPE_RAKP_1   0x12
#define IPMI_RMCPP_PAYLOAD_TYPE_RAKP_2   0x13
#define IPMI_RMCPP_PAYLOAD_TYPE_RAKP_3   0x14
#define IPMI_RMCPP_PAYLOAD_TYPE_RAKP_4   0x15
#define IPMI_RMCPP_ADDR_SOL   (IPMI_RMCPP_ADDR_START + IPMI_RMCPP_PAYLOAD_TYPE_SOL)

Typedefs

typedef ipmi_lanp_parm_s ipmi_lanp_parm_t
typedef ipmi_payload_s ipmi_payload_t
typedef ipmi_rmcpp_auth_s ipmi_rmcpp_auth_t
typedef void(* ipmi_rmcpp_finish_auth_cb )(ipmi_con_t *ipmi, int err, int addr_num, void *cb_data)
typedef int(* ipmi_rmcpp_set_info_cb )(ipmi_con_t *ipmi, int addr_num, ipmi_rmcpp_auth_t *ainfo, void *cb_data)
typedef ipmi_rmcpp_authentication_s ipmi_rmcpp_authentication_t
typedef ipmi_rmcpp_confidentiality_s ipmi_rmcpp_confidentiality_t
typedef ipmi_rmcpp_integrity_s ipmi_rmcpp_integrity_t

Functions

int ipmi_lanp_setup_con (ipmi_lanp_parm_t *parms, unsigned int num_parms, os_handler_t *handlers, void *user_data, ipmi_con_t **new_con)
int ipmi_ip_setup_con (char *const ip_addrs[], char *const ports[], unsigned int num_ip_addrs, unsigned int authtype, unsigned int privilege, void *username, unsigned int username_len, void *password, unsigned int password_len, os_handler_t *handlers, void *user_data, ipmi_con_t **new_con)
int ipmi_lan_setup_con (struct in_addr *ip_addrs, int *ports, unsigned int num_ip_addrs, unsigned int authtype, unsigned int privilege, void *username, unsigned int username_len, void *password, unsigned int password_len, os_handler_t *handlers, void *user_data, ipmi_con_t **new_con)
int ipmi_lan_handle_external_event (const struct sockaddr *src_addr, const ipmi_msg_t *msg, const unsigned char *pet_ack)
int ipmi_rmcpp_register_payload (unsigned int payload_type, ipmi_payload_t *payload)
int ipmi_rmcpp_register_oem_payload (unsigned int payload_type, unsigned char iana[3], unsigned int payload_id, ipmi_payload_t *payload)
uint32_t ipmi_rmcpp_auth_get_my_session_id (ipmi_rmcpp_auth_t *ainfo)
uint32_t ipmi_rmcpp_auth_get_mgsys_session_id (ipmi_rmcpp_auth_t *ainfo)
uint8_t ipmi_rmcpp_auth_get_role (ipmi_rmcpp_auth_t *ainfo)
const unsigned char * ipmi_rmcpp_auth_get_username (ipmi_rmcpp_auth_t *ainfo, unsigned int *max_len)
unsigned int ipmi_rmcpp_auth_get_username_len (ipmi_rmcpp_auth_t *ainfo)
const unsigned char * ipmi_rmcpp_auth_get_password (ipmi_rmcpp_auth_t *ainfo, unsigned int *max_len)
unsigned int ipmi_rmcpp_auth_get_password_len (ipmi_rmcpp_auth_t *ainfo)
int ipmi_rmcpp_auth_get_use_two_keys (ipmi_rmcpp_auth_t *ainfo)
const unsigned char * ipmi_rmcpp_auth_get_bmc_key (ipmi_rmcpp_auth_t *ainfo, unsigned int *max_len)
unsigned int ipmi_rmcpp_auth_get_bmc_key_len (ipmi_rmcpp_auth_t *ainfo)
const unsigned char * ipmi_rmcpp_auth_get_oem_iana (ipmi_rmcpp_auth_t *ainfo, unsigned int *len)
unsigned char ipmi_rmcpp_auth_get_oem_aux (ipmi_rmcpp_auth_t *ainfo)
unsigned char * ipmi_rmcpp_auth_get_my_rand (ipmi_rmcpp_auth_t *ainfo, unsigned int *max_len)
unsigned int ipmi_rmcpp_auth_get_my_rand_len (ipmi_rmcpp_auth_t *ainfo)
void ipmi_rmcpp_auth_set_my_rand_len (ipmi_rmcpp_auth_t *ainfo, unsigned int length)
unsigned char * ipmi_rmcpp_auth_get_mgsys_rand (ipmi_rmcpp_auth_t *ainfo, unsigned int *max_len)
unsigned int ipmi_rmcpp_auth_get_mgsys_rand_len (ipmi_rmcpp_auth_t *ainfo)
void ipmi_rmcpp_auth_set_mgsys_rand_len (ipmi_rmcpp_auth_t *ainfo, unsigned int length)
unsigned char * ipmi_rmcpp_auth_get_mgsys_guid (ipmi_rmcpp_auth_t *ainfo, unsigned int *max_len)
unsigned int ipmi_rmcpp_auth_get_mgsys_guid_len (ipmi_rmcpp_auth_t *ainfo)
void ipmi_rmcpp_auth_set_mgsys_guid_len (ipmi_rmcpp_auth_t *ainfo, unsigned int length)
unsigned char * ipmi_rmcpp_auth_get_sik (ipmi_rmcpp_auth_t *ainfo, unsigned int *max_len)
unsigned int ipmi_rmcpp_auth_get_sik_len (ipmi_rmcpp_auth_t *ainfo)
void ipmi_rmcpp_auth_set_sik_len (ipmi_rmcpp_auth_t *ainfo, unsigned int length)
unsigned char * ipmi_rmcpp_auth_get_k1 (ipmi_rmcpp_auth_t *ainfo, unsigned int *max_len)
unsigned int ipmi_rmcpp_auth_get_k1_len (ipmi_rmcpp_auth_t *ainfo)
void ipmi_rmcpp_auth_set_k1_len (ipmi_rmcpp_auth_t *ainfo, unsigned int length)
unsigned char * ipmi_rmcpp_auth_get_k2 (ipmi_rmcpp_auth_t *ainfo, unsigned int *max_len)
unsigned int ipmi_rmcpp_auth_get_k2_len (ipmi_rmcpp_auth_t *ainfo)
void ipmi_rmcpp_auth_set_k2_len (ipmi_rmcpp_auth_t *ainfo, unsigned int length)
int ipmi_rmcpp_register_authentication (unsigned int auth_num, ipmi_rmcpp_authentication_t *auth)
int ipmi_rmcpp_register_oem_authentication (unsigned int auth_num, unsigned char iana[3], ipmi_rmcpp_authentication_t *auth)
int ipmi_rmcpp_register_confidentiality (unsigned int conf_num, ipmi_rmcpp_confidentiality_t *conf)
int ipmi_rmcpp_register_oem_confidentiality (unsigned int conf_num, unsigned char iana[3], ipmi_rmcpp_confidentiality_t *conf)
int ipmi_rmcpp_register_integrity (unsigned int integ_num, ipmi_rmcpp_integrity_t *integ)
int ipmi_rmcpp_register_oem_integrity (unsigned int integ_num, unsigned char iana[3], ipmi_rmcpp_integrity_t *integ)
int ipmi_lan_send_command_forceip (ipmi_con_t *ipmi, int addr_num, ipmi_addr_t *addr, unsigned int addr_len, ipmi_msg_t *msg, ipmi_ll_rsp_handler_t rsp_handler, ipmi_msgi_t *rspi)


Define Documentation

#define IPMI_LAN_STD_PORT   623
 

Definition at line 46 of file ipmi_lan.h.

Referenced by handle_activate_payload_response().

#define IPMI_LAN_STD_PORT_STR   "623"
 

Definition at line 47 of file ipmi_lan.h.

Referenced by get_sock_addr(), and ipmi_lanp_setup_con().

#define IPMI_LANP_AUTHENTICATION_ALGORITHM   7
 

Definition at line 141 of file ipmi_lan.h.

Referenced by ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_AUTHENTICATION_ALGORITHM_BMCPICK   (~0)
 

Definition at line 142 of file ipmi_lan.h.

Referenced by ipmi_lanp_setup_con(), lan_parse_args(), and send_rmcpp_open_session().

#define IPMI_LANP_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5   2
 

Definition at line 145 of file ipmi_lan.h.

Referenced by _ipmi_rakp_init().

#define IPMI_LANP_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1   1
 

Definition at line 144 of file ipmi_lan.h.

Referenced by _ipmi_rakp_init(), ipmi_lanp_setup_con(), lan_con_alloc_args(), and lan_parse_args().

#define IPMI_LANP_AUTHENTICATION_ALGORITHM_RAKP_NONE   0
 

Definition at line 143 of file ipmi_lan.h.

Referenced by _ipmi_rakp_init(), and lan_parse_args().

#define IPMI_LANP_BMC_KEY   11
 

Definition at line 170 of file ipmi_lan.h.

Referenced by ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM   9
 

Definition at line 152 of file ipmi_lan.h.

Referenced by ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_AES_CBC_128   1
 

Definition at line 155 of file ipmi_lan.h.

Referenced by _ipmi_aes_cbc_init(), ipmi_lanp_setup_con(), lan_con_alloc_args(), and lan_parse_args().

#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_BMCPICK   (~0)
 

Definition at line 153 of file ipmi_lan.h.

Referenced by ipmi_lanp_setup_con(), lan_parse_args(), and send_rmcpp_open_session().

#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_NONE   0
 

Definition at line 154 of file ipmi_lan.h.

Referenced by handle_rmcpp_recv(), lan_parse_args(), reset_session_data(), rmcpp_format_msg(), and start_rmcpp().

#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_xRC4_128   2
 

Definition at line 156 of file ipmi_lan.h.

Referenced by lan_parse_args().

#define IPMI_LANP_CONFIDENTIALITY_ALGORITHM_xRC4_40   3
 

Definition at line 157 of file ipmi_lan.h.

#define IPMI_LANP_INTEGRITY_ALGORITHM   8
 

Definition at line 146 of file ipmi_lan.h.

Referenced by ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_INTEGRITY_ALGORITHM_BMCPICK   (~0)
 

Definition at line 147 of file ipmi_lan.h.

Referenced by ipmi_lanp_setup_con(), lan_parse_args(), and send_rmcpp_open_session().

#define IPMI_LANP_INTEGRITY_ALGORITHM_HMAC_MD5_128   2
 

Definition at line 150 of file ipmi_lan.h.

Referenced by _ipmi_hmac_init(), and lan_parse_args().

#define IPMI_LANP_INTEGRITY_ALGORITHM_HMAC_SHA1_96   1
 

Definition at line 149 of file ipmi_lan.h.

Referenced by _ipmi_hmac_init(), ipmi_lanp_setup_con(), lan_con_alloc_args(), and lan_parse_args().

#define IPMI_LANP_INTEGRITY_ALGORITHM_MD5_128   3
 

Definition at line 151 of file ipmi_lan.h.

Referenced by _ipmi_md5_init().

#define IPMI_LANP_INTEGRITY_ALGORITHM_NONE   0
 

Definition at line 148 of file ipmi_lan.h.

Referenced by handle_rmcpp_recv(), lan_parse_args(), reset_session_data(), rmcpp_format_msg(), and start_rmcpp().

#define IPMI_LANP_NAME_LOOKUP_ONLY   10
 

Definition at line 165 of file ipmi_lan.h.

Referenced by ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_PARMID_ADDRS   5
 

Definition at line 120 of file ipmi_lan.h.

Referenced by ipmi_ip_setup_con(), ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_PARMID_AUTHTYPE   1
 

Definition at line 91 of file ipmi_lan.h.

Referenced by ipmi_ip_setup_con(), ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_PARMID_PASSWORD   3
 

Definition at line 101 of file ipmi_lan.h.

Referenced by ipmi_ip_setup_con(), ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_PARMID_PORTS   6
 

Definition at line 135 of file ipmi_lan.h.

Referenced by ipmi_ip_setup_con(), ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_PARMID_PRIVILEGE   2
 

Definition at line 96 of file ipmi_lan.h.

Referenced by ipmi_ip_setup_con(), ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_LANP_PARMID_USERNAME   4
 

Definition at line 106 of file ipmi_lan.h.

Referenced by ipmi_ip_setup_con(), ipmi_lanp_setup_con(), and lan_connect_args().

#define IPMI_RMCPP_ADDR_SOL   (IPMI_RMCPP_ADDR_START + IPMI_RMCPP_PAYLOAD_TYPE_SOL)
 

Definition at line 251 of file ipmi_lan.h.

Referenced by ipmi_sol_open(), and lan_send_addr().

#define IPMI_RMCPP_PAYLOAD_TYPE_IPMI   0
 

Definition at line 240 of file ipmi_lan.h.

Referenced by handle_lan15_recv(), ipmi_rmcpp_register_payload(), and lan_send_addr().

#define IPMI_RMCPP_PAYLOAD_TYPE_OEM_EXPLICIT   2
 

Definition at line 242 of file ipmi_lan.h.

Referenced by handle_payload(), handle_rmcpp_recv(), ipmi_rmcpp_register_oem_payload(), ipmi_rmcpp_register_payload(), lan_send_addr(), rmcpp_find_ipmi(), and rmcpp_format_msg().

#define IPMI_RMCPP_PAYLOAD_TYPE_OPEN_SESSION_REQUEST   0x10
 

Definition at line 244 of file ipmi_lan.h.

Referenced by ipmi_rmcpp_register_payload(), and send_rmcpp_open_session().

#define IPMI_RMCPP_PAYLOAD_TYPE_OPEN_SESSION_RESPONSE   0x11
 

Definition at line 245 of file ipmi_lan.h.

Referenced by handle_payload(), and ipmi_rmcpp_register_payload().

#define IPMI_RMCPP_PAYLOAD_TYPE_RAKP_1   0x12
 

Definition at line 246 of file ipmi_lan.h.

Referenced by _ipmi_rakp_init(), and send_rakp1().

#define IPMI_RMCPP_PAYLOAD_TYPE_RAKP_2   0x13
 

Definition at line 247 of file ipmi_lan.h.

Referenced by _ipmi_rakp_init().

#define IPMI_RMCPP_PAYLOAD_TYPE_RAKP_3   0x14
 

Definition at line 248 of file ipmi_lan.h.

Referenced by _ipmi_rakp_init(), and send_rakp3().

#define IPMI_RMCPP_PAYLOAD_TYPE_RAKP_4   0x15
 

Definition at line 249 of file ipmi_lan.h.

Referenced by _ipmi_rakp_init().

#define IPMI_RMCPP_PAYLOAD_TYPE_SOL   1
 

Definition at line 241 of file ipmi_lan.h.

Referenced by _ipmi_sol_init(), _ipmi_sol_shutdown(), handle_get_channel_payload_support_response(), handle_lan15_recv(), send_activate_payload(), send_close(), and send_get_payload_activation_status_command().


Typedef Documentation

typedef struct ipmi_lanp_parm_s ipmi_lanp_parm_t
 

typedef struct ipmi_payload_s ipmi_payload_t
 

typedef struct ipmi_rmcpp_auth_s ipmi_rmcpp_auth_t
 

Definition at line 344 of file ipmi_lan.h.

typedef struct ipmi_rmcpp_authentication_s ipmi_rmcpp_authentication_t
 

typedef struct ipmi_rmcpp_confidentiality_s ipmi_rmcpp_confidentiality_t
 

typedef void(* ipmi_rmcpp_finish_auth_cb)(ipmi_con_t *ipmi, int err, int addr_num, void *cb_data)
 

Definition at line 398 of file ipmi_lan.h.

typedef struct ipmi_rmcpp_integrity_s ipmi_rmcpp_integrity_t
 

typedef int(* ipmi_rmcpp_set_info_cb)(ipmi_con_t *ipmi, int addr_num, ipmi_rmcpp_auth_t *ainfo, void *cb_data)
 

Definition at line 402 of file ipmi_lan.h.


Function Documentation

int ipmi_ip_setup_con char *const   ip_addrs[],
char *const   ports[],
unsigned int  num_ip_addrs,
unsigned int  authtype,
unsigned int  privilege,
void *  username,
unsigned int  username_len,
void *  password,
unsigned int  password_len,
os_handler_t handlers,
void *  user_data,
ipmi_con_t **  new_con
 

Definition at line 5195 of file ipmi_lan.c.

References IPMI_LANP_PARMID_ADDRS, IPMI_LANP_PARMID_AUTHTYPE, IPMI_LANP_PARMID_PASSWORD, IPMI_LANP_PARMID_PORTS, IPMI_LANP_PARMID_PRIVILEGE, IPMI_LANP_PARMID_USERNAME, ipmi_lanp_setup_con(), ipmi_lanp_parm_s::parm_data, ipmi_lanp_parm_s::parm_data_len, ipmi_lanp_parm_s::parm_id, and ipmi_lanp_parm_s::parm_val.

Referenced by ipmi_lan_setup_con().

05207 {
05208     ipmi_lanp_parm_t parms[6];
05209 
05210     parms[0].parm_id = IPMI_LANP_PARMID_ADDRS;
05211     parms[0].parm_data = (void *) ip_addrs;
05212     parms[0].parm_data_len = num_ip_addrs;
05213     parms[1].parm_id = IPMI_LANP_PARMID_PORTS;
05214     parms[1].parm_data = (void *) ports;
05215     parms[1].parm_data_len = num_ip_addrs;
05216     parms[2].parm_id = IPMI_LANP_PARMID_AUTHTYPE;
05217     parms[2].parm_val = authtype;
05218     parms[3].parm_id = IPMI_LANP_PARMID_PRIVILEGE;
05219     parms[3].parm_val = privilege;
05220     parms[4].parm_id = IPMI_LANP_PARMID_USERNAME;
05221     parms[4].parm_data = username;
05222     parms[4].parm_data_len = username_len;
05223     parms[5].parm_id = IPMI_LANP_PARMID_PASSWORD;
05224     parms[5].parm_data = password;
05225     parms[5].parm_data_len = password_len;
05226     return ipmi_lanp_setup_con(parms, 6, handlers, user_data, new_con);
05227 }

int ipmi_lan_handle_external_event const struct sockaddr *  src_addr,
const ipmi_msg_t msg,
const unsigned char *  pet_ack
 

Definition at line 5620 of file ipmi_lan.c.

References lan_data_s::cparm, hash_lan_addr(), lan_conn_parms_s::ip_addr, lan_data_s::ipmi, ipmi_lock(), ipmi_mem_alloc(), ipmi_mem_free(), ipmi_unlock(), lan_do_evt_s::lan, lan_link_s::lan, lan_put(), lan_do_evt_s::next, lan_link_s::next, lan_conn_parms_s::num_ip_addr, lan_data_s::refcount, sockaddr_ip_s::s_ipsock, and snmp_got_match().

Referenced by ipmi_handle_snmp_trap_data().

05623 {
05624     lan_link_t   *l;
05625     lan_data_t   *lan;
05626     int          i;
05627     int          idx;
05628     lan_do_evt_t *found = NULL;
05629     lan_do_evt_t *next = NULL;
05630 
05631     idx = hash_lan_addr(src_addr);
05632     ipmi_lock(lan_list_lock);
05633     l = lan_ip_list[idx].next;
05634     /* Note that we call all the connections with the given IP
05635        address, not just the first one we find.  There may be more
05636        than one. */
05637     while (l->lan) {
05638         lan = NULL;
05639         for (i=0; i<l->lan->cparm.num_ip_addr; i++) {
05640             if (l->lan->cparm.ip_addr[i].s_ipsock.s_addr.sa_family
05641                 != src_addr->sa_family)
05642             {
05643                 continue;
05644             }
05645             switch (src_addr->sa_family)
05646             {
05647             case PF_INET:
05648             {
05649                 struct sockaddr_in *src, *dst;
05650                 src = (struct sockaddr_in *) src_addr;
05651                 dst = &(l->lan->cparm.ip_addr[i].s_ipsock.s_addr4);
05652                 if (dst->sin_addr.s_addr == src->sin_addr.s_addr) {
05653                     /* We have a match, handle it */
05654                     lan = l->lan;
05655                     lan->refcount++;
05656                 }
05657             }
05658             break;
05659 #ifdef PF_INET6
05660             case PF_INET6:
05661             {
05662                 struct sockaddr_in6 *src, *dst;
05663                 src = (struct sockaddr_in6 *) src_addr;
05664                 dst = &(l->lan->cparm.ip_addr[i].s_ipsock.s_addr6);
05665                 if (memcmp(dst->sin6_addr.s6_addr,
05666                            src->sin6_addr.s6_addr,
05667                            sizeof(struct in6_addr))
05668                     == 0)
05669                 {
05670                     /* We have a match, handle it */
05671                     lan = l->lan;
05672                     lan->refcount++;
05673                 }
05674             }
05675             break;
05676 #endif
05677             }
05678 
05679             if (lan) {
05680                 next = ipmi_mem_alloc(sizeof(*next));
05681                 if (!next)
05682                     /* Can't do anything, just go on.  It's not
05683                        fatal, it just delays things. */
05684                     continue;
05685                 next->lan = lan;
05686                 next->next = found;
05687                 found = next;
05688             }
05689         }
05690         l = l->next;
05691     }
05692     ipmi_unlock(lan_list_lock);
05693 
05694     while (found) {
05695         next = found;
05696         found = found->next;
05697         snmp_got_match(next->lan, msg, pet_ack);
05698         lan_put(next->lan->ipmi);
05699         ipmi_mem_free(next);
05700     }
05701 
05702     /* Next will be left non-NULL if something was delivered, it will
05703        be NULL if nothing was delivered. */
05704     return next != NULL;
05705 }

int ipmi_lan_send_command_forceip ipmi_con_t ipmi,
int  addr_num,
ipmi_addr_t addr,
unsigned int  addr_len,
ipmi_msg_t msg,
ipmi_ll_rsp_handler_t  rsp_handler,
ipmi_msgi_t rspi
 

Definition at line 3458 of file ipmi_lan.c.

References os_handler_s::alloc_timer, ipmi_con_s::con_data, ipmi_msg_item_s::data4, ipmi_msg::data_len, os_handler_s::free_timer, handle_msg_send(), lan_data_s::in_cleanup, ipmi_lock(), IPMI_MAX_MSG_LENGTH, ipmi_mem_alloc(), ipmi_mem_free(), ipmi_unlock(), lan_send_addr(), MAX_IP_ADDR, ipmi_msg::netfn, ipmi_con_s::os_hnd, lan_data_s::outstanding_msg_count, and lan_data_s::seq_num_lock.

Referenced by send_activate_session(), send_auth_cap(), send_challenge(), send_get_dev_id(), send_rakp1(), send_rakp3(), send_rmcpp_open_session(), and send_set_session_privilege().

03465 {
03466     lan_timer_info_t *info;
03467     lan_data_t       *lan;
03468     int              rv;
03469     /* We store the address number in data4. */
03470 
03471     if (addr_num >= MAX_IP_ADDR)
03472         return EINVAL;
03473 
03474     if (addr_len > sizeof(ipmi_addr_t))
03475         return EINVAL;
03476 
03477     if (msg->data_len > IPMI_MAX_MSG_LENGTH)
03478         return EINVAL;
03479 
03480     lan = (lan_data_t *) ipmi->con_data;
03481 
03482     if (lan->in_cleanup)
03483         return ECANCELED;
03484 
03485     /* Odd netfns are responses or unacknowledged data.  Just send
03486        them. */
03487     if (msg->netfn & 1)
03488         return lan_send_addr(lan, addr, addr_len, msg, 0, addr_num, NULL);
03489 
03490     info = ipmi_mem_alloc(sizeof(*info));
03491     if (!info)
03492         return ENOMEM;
03493     memset(info, 0, sizeof(*info));
03494 
03495     /* Put it in the list first. */
03496     info->ipmi = ipmi;
03497     info->cancelled = 0;
03498 
03499     rv = ipmi->os_hnd->alloc_timer(ipmi->os_hnd, &(info->timer));
03500     if (rv) {
03501         ipmi_mem_free(info);
03502         return rv;
03503     }
03504 
03505     ipmi_lock(lan->seq_num_lock);
03506 
03507     if (lan->outstanding_msg_count >= 60) {
03508         rv = EAGAIN;
03509         goto out_unlock;
03510     }
03511 
03512     rspi->data4 = (void *) (long) addr_num;
03513     rv = handle_msg_send(info, addr_num, addr, addr_len, msg,
03514                          rsp_handler, rspi);
03515     /* handle_msg_send handles freeing the timer and info on an error */
03516     info = NULL;
03517     if (! rv)
03518         lan->outstanding_msg_count++;
03519     ipmi_unlock(lan->seq_num_lock);
03520     return rv;
03521 
03522  out_unlock:
03523     ipmi_unlock(lan->seq_num_lock);
03524     if (rv) {
03525         if (info) {
03526             if (info->timer)
03527                 ipmi->os_hnd->free_timer(ipmi->os_hnd, info->timer);
03528             ipmi_mem_free(info);
03529         }
03530     }
03531     return rv;
03532 }

int ipmi_lan_setup_con struct in_addr *  ip_addrs,
int *  ports,
unsigned int  num_ip_addrs,
unsigned int  authtype,
unsigned int  privilege,
void *  username,
unsigned int  username_len,
void *  password,
unsigned int  password_len,
os_handler_t handlers,
void *  user_data,
ipmi_con_t **  new_con
 

Definition at line 5151 of file ipmi_lan.c.

References ipmi_ip_setup_con(), MAX_IP_ADDR, and p.

05163 {
05164     char s_ip_addrs[MAX_IP_ADDR][20];
05165     char s_ports[MAX_IP_ADDR][10];
05166     char *paddrs[MAX_IP_ADDR], *pports[MAX_IP_ADDR];
05167     unsigned char *p;
05168     int i,rv;
05169 
05170     if ((num_ip_addrs < 1) || (num_ip_addrs > MAX_IP_ADDR))
05171         return EINVAL;
05172     for (i=0; i<num_ip_addrs; i++) {
05173         p = (unsigned char *)&(ip_addrs[i]);
05174         sprintf(s_ip_addrs[i], "%u.%u.%u.%u", *p, *(p+1), *(p+2), *(p+3));
05175         sprintf(s_ports[i], "%u", ports[i]);
05176         paddrs[i] = s_ip_addrs[i];
05177         pports[i]= s_ports[i];
05178     }
05179     rv = ipmi_ip_setup_con(paddrs, 
05180                            pports, 
05181                            num_ip_addrs,
05182                            authtype,
05183                            privilege,
05184                            username,
05185                            username_len,
05186                            password,
05187                            password_len,
05188                            handlers,
05189                            user_data,
05190                            new_con);
05191     return rv;
05192 }

int ipmi_lanp_setup_con ipmi_lanp_parm_t parms,
unsigned int  num_parms,
os_handler_t handlers,
void *  user_data,
ipmi_con_t **  new_con
 

Definition at line 5267 of file ipmi_lan.c.

References ipmi_auth_s::authcode_init, cleanup_con(), DEFAULT_MAX_OUTSTANDING_MSG_COUNT, find_free_lan_fd(), find_matching_lan(), get_startup_args(), handle_async_event(), lan_data_s::ipmi, ipmi_auths, IPMI_AUTHTYPE_DEFAULT, IPMI_AUTHTYPE_RMCP_PLUS, ipmi_con_attr_init(), ipmi_create_lock_os_hnd(), IPMI_LAN_STD_PORT_STR, IPMI_LANP_AUTHENTICATION_ALGORITHM, IPMI_LANP_AUTHENTICATION_ALGORITHM_BMCPICK, IPMI_LANP_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1, IPMI_LANP_BMC_KEY, IPMI_LANP_CONFIDENTIALITY_ALGORITHM, IPMI_LANP_CONFIDENTIALITY_ALGORITHM_AES_CBC_128, IPMI_LANP_CONFIDENTIALITY_ALGORITHM_BMCPICK, IPMI_LANP_INTEGRITY_ALGORITHM, IPMI_LANP_INTEGRITY_ALGORITHM_BMCPICK, IPMI_LANP_INTEGRITY_ALGORITHM_HMAC_SHA1_96, IPMI_LANP_NAME_LOOKUP_ONLY, IPMI_LANP_PARMID_ADDRS, IPMI_LANP_PARMID_AUTHTYPE, IPMI_LANP_PARMID_PASSWORD, IPMI_LANP_PARMID_PORTS, IPMI_LANP_PARMID_PRIVILEGE, IPMI_LANP_PARMID_USERNAME, ipmi_mem_alloc(), IPMI_PRIVILEGE_ADMIN, ipmi_strdup(), lan_add_con(), lan_add_con_change_handler(), lan_add_event_handler(), lan_add_ipmb_addr_handler(), lan_close_connection(), lan_close_connection_done(), lan_deregister_for_command(), lan_get_num_ports(), lan_register_for_command(), lan_remove_con_change_handler(), lan_remove_event_handler(), lan_remove_ipmb_addr_handler(), lan_send_command(), lan_send_command_option(), lan_send_response(), lan_set_ipmb_addr(), lan_start_con(), lan_use_connection(), locked_list_alloc(), MAX_IP_ADDR, MAX_IPMI_AUTHS, MAX_IPMI_USED_CHANNELS, ipmi_lanp_parm_s::parm_data, ipmi_lanp_parm_s::parm_data_len, and ipmi_lanp_parm_s::parm_val.

Referenced by ipmi_ip_setup_con(), and lan_connect_args().

05272 {
05273     ipmi_con_t         *ipmi = NULL;
05274     lan_data_t         *lan = NULL;
05275     int                rv;
05276     int                i;
05277     int                count;
05278     struct sockaddr_in *pa;
05279     char               **ip_addrs = NULL;
05280     char               *tports[MAX_IP_ADDR];
05281     char               **ports = NULL;
05282     lan_conn_parms_t   cparm;
05283 
05284     memset(&cparm, 0, sizeof(cparm));
05285 
05286     /* Pick some secure defaults. */
05287     cparm.authtype = IPMI_AUTHTYPE_DEFAULT;
05288     cparm.privilege = IPMI_PRIVILEGE_ADMIN;
05289     cparm.conf = IPMI_LANP_CONFIDENTIALITY_ALGORITHM_AES_CBC_128;
05290     cparm.integ = IPMI_LANP_INTEGRITY_ALGORITHM_HMAC_SHA1_96;
05291     cparm.auth = IPMI_LANP_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1;
05292     cparm.name_lookup_only = 1;
05293 
05294     for (i=0; i<num_parms; i++) {
05295         switch (parms[i].parm_id) {
05296         case IPMI_LANP_PARMID_AUTHTYPE:
05297             cparm.authtype = parms[i].parm_val;
05298             break;
05299 
05300         case IPMI_LANP_PARMID_PRIVILEGE:
05301             cparm.privilege = parms[i].parm_val;
05302             break;
05303 
05304         case IPMI_LANP_PARMID_PASSWORD:
05305             if (parms[i].parm_data_len > sizeof(cparm.password))
05306                 return EINVAL;
05307             memcpy(cparm.password, parms[i].parm_data, parms[i].parm_data_len);
05308             cparm.password_len = parms[i].parm_data_len;
05309             break;
05310 
05311         case IPMI_LANP_PARMID_USERNAME:
05312             if (parms[i].parm_data_len > sizeof(cparm.username))
05313                 return EINVAL;
05314             memcpy(cparm.username, parms[i].parm_data, parms[i].parm_data_len);
05315             cparm.username_len = parms[i].parm_data_len;
05316             break;
05317 
05318         case IPMI_LANP_PARMID_ADDRS:
05319             if (cparm.num_ip_addr
05320                 && (cparm.num_ip_addr != parms[i].parm_data_len))
05321                 return EINVAL;
05322             if (parms[i].parm_data_len > MAX_IP_ADDR)
05323                 return EINVAL;
05324             ip_addrs = parms[i].parm_data;
05325             cparm.num_ip_addr = parms[i].parm_data_len;
05326             break;
05327 
05328         case IPMI_LANP_PARMID_PORTS:
05329             if (cparm.num_ip_addr
05330                 && (cparm.num_ip_addr != parms[i].parm_data_len))
05331                 return EINVAL;
05332             if (parms[i].parm_data_len > MAX_IP_ADDR)
05333                 return EINVAL;
05334             ports = parms[i].parm_data;
05335             cparm.num_ip_addr = parms[i].parm_data_len;
05336             break;
05337 
05338         case IPMI_LANP_AUTHENTICATION_ALGORITHM:
05339             cparm.auth = parms[i].parm_val;
05340             if (cparm.auth != IPMI_LANP_AUTHENTICATION_ALGORITHM_BMCPICK)
05341             {
05342                 if (cparm.auth >= 64)
05343                     return EINVAL;
05344                 if ((cparm.auth < 0x30) && (!auths[cparm.auth]))
05345                     return ENOSYS;
05346             }
05347             break;
05348 
05349         case IPMI_LANP_INTEGRITY_ALGORITHM:
05350             cparm.integ = parms[i].parm_val;
05351             if (cparm.integ != IPMI_LANP_INTEGRITY_ALGORITHM_BMCPICK)
05352             {
05353                 if (cparm.integ >= 64)
05354                     return EINVAL;
05355                 if (cparm.integ
05356                     && ((cparm.integ < 0x30) && (!integs[cparm.integ])))
05357                     return ENOSYS;
05358             }
05359             break;
05360 
05361         case IPMI_LANP_CONFIDENTIALITY_ALGORITHM:
05362             cparm.conf = parms[i].parm_val;
05363             if (cparm.conf != IPMI_LANP_CONFIDENTIALITY_ALGORITHM_BMCPICK)
05364             {
05365                 if (cparm.conf >= 64)
05366                     return EINVAL;
05367                 if (cparm.conf
05368                     && ((cparm.conf < 0x30) && (!confs[cparm.conf])))
05369                     return ENOSYS;
05370             }
05371             break;
05372 
05373         case IPMI_LANP_NAME_LOOKUP_ONLY:
05374             cparm.name_lookup_only = parms[i].