dummy: Add default dummy socket

fake-ipmistack uses a default socket at /tmp/.ipmi_dummy.
Use it when IPMI_DUMMY_SOCK environment variable is not set.
This commit is contained in:
Alexander Amelkin 2018-07-27 16:34:08 +03:00
parent 329ebdff84
commit 3aade24297
No known key found for this signature in database
GPG Key ID: E893587B5B74178D
2 changed files with 5 additions and 9 deletions

View File

@ -180,9 +180,8 @@ ipmi_dummyipmi_open(struct ipmi_intf *intf)
dummy_sock_path = getenv("IPMI_DUMMY_SOCK"); dummy_sock_path = getenv("IPMI_DUMMY_SOCK");
if (dummy_sock_path == NULL) { if (dummy_sock_path == NULL) {
lprintf(LOG_DEBUG, "No IPMI_DUMMY_SOCK set. Dummy mode ON."); lprintf(LOG_DEBUG, "No IPMI_DUMMY_SOCK set. Using " IPMI_DUMMY_DEFAULTSOCK);
intf->opened = 1; dummy_sock_path = IPMI_DUMMY_DEFAULTSOCK;
return intf->fd;
} }
if (intf->opened == 1) { if (intf->opened == 1) {
@ -218,12 +217,7 @@ ipmi_dummyipmi_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req)
static struct ipmi_rs rsp; static struct ipmi_rs rsp;
struct dummy_rq req_dummy; struct dummy_rq req_dummy;
struct dummy_rs rsp_dummy; struct dummy_rs rsp_dummy;
char *dummy_sock_path;
dummy_sock_path = getenv("IPMI_DUMMY_SOCK");
if (dummy_sock_path == NULL) {
lprintf(LOG_DEBUG, "No IPMI_DUMMY_SOCK set. Dummy mode ON.");
return NULL;
}
if (intf == NULL || intf->fd < 0 || intf->opened != 1) { if (intf == NULL || intf->fd < 0 || intf->opened != 1) {
lprintf(LOG_ERR, "dummy failed on intf check."); lprintf(LOG_ERR, "dummy failed on intf check.");
return NULL; return NULL;

View File

@ -1,6 +1,8 @@
#ifndef IPMI_DUMMYIPMI_H #ifndef IPMI_DUMMYIPMI_H
# define IPMI_DUMMYIPMI_H # define IPMI_DUMMYIPMI_H
#define IPMI_DUMMY_DEFAULTSOCK "/tmp/.ipmi_dummy"
struct dummy_rq { struct dummy_rq {
struct { struct {
uint8_t netfn; uint8_t netfn;