-/* $OpenBSD: vmt.c,v 1.22 2014/12/18 19:18:22 reyk Exp $ */
+/* $OpenBSD: vmt.c,v 1.23 2014/12/18 19:22:21 deraadt Exp $ */
/*
* Copyright (c) 2007 David Crawshaw <david@zentus.com>
suspend_randomness();
- log(LOG_KERN | LOG_NOTICE, "Shutting down in response to request from VMware host\n");
+ log(LOG_KERN | LOG_NOTICE,
+ "Shutting down in response to request from VMware host\n");
prsignal(initprocess, SIGUSR2);
}
suspend_randomness();
- log(LOG_KERN | LOG_NOTICE, "Rebooting in response to request from VMware host\n");
+ log(LOG_KERN | LOG_NOTICE,
+ "Rebooting in response to request from VMware host\n");
prsignal(initprocess, SIGINT);
}
struct vmt_softc *sc = arg;
if (vm_rpc_send_rpci_tx(sc, "tools.capability.hgfs_server toolbox 0") != 0) {
- printf("%s: failed to disable hgfs server capability\n", DEVNAME(sc));
+ printf("%s: failed to disable hgfs server capability\n",
+ DEVNAME(sc));
}
if (vm_rpc_send(&sc->sc_tclo_rpc, NULL, 0) != 0) {
if (sc->sc_tclo_ping) {
if (vm_rpc_send(&sc->sc_tclo_rpc, NULL, 0) != 0) {
- printf("%s: failed to send TCLO outgoing ping\n", DEVNAME(sc));
+ printf("%s: failed to send TCLO outgoing ping\n",
+ DEVNAME(sc));
sc->sc_rpc_error = 1;
goto out;
}
}
if (vm_rpc_get_length(&sc->sc_tclo_rpc, &rlen, &ack) != 0) {
- printf("%s: failed to get length of incoming TCLO data\n", DEVNAME(sc));
+ printf("%s: failed to get length of incoming TCLO data\n",
+ DEVNAME(sc));
sc->sc_rpc_error = 1;
goto out;
}
sc->sc_rpc_error = 1;
}
} else if (strcmp(sc->sc_rpc_buf, "OS_Suspend") == 0) {
- log(LOG_KERN | LOG_NOTICE, "VMware guest entering suspended state\n");
+ log(LOG_KERN | LOG_NOTICE,
+ "VMware guest entering suspended state\n");
suspend_randomness();
sc->sc_rpc_error = 1;
}
} else if (strcmp(sc->sc_rpc_buf, "OS_Resume") == 0) {
- log(LOG_KERN | LOG_NOTICE, "VMware guest resuming from suspended state\n");
+ log(LOG_KERN | LOG_NOTICE,
+ "VMware guest resuming from suspended state\n");
/* force guest info update */
sc->sc_hostname[0] = '\0';
vmt_tclo_state_change_success(sc, 1, VM_STATE_CHANGE_RESUME);
if (vm_rpc_send_str(&sc->sc_tclo_rpc, VM_RPC_REPLY_OK) != 0) {
- printf("%s: error sending resume response\n", DEVNAME(sc));
+ printf("%s: error sending resume response\n",
+ DEVNAME(sc));
sc->sc_rpc_error = 1;
}
} else if (strcmp(sc->sc_rpc_buf, "Capabilities_Register") == 0) {
/* don't know if this is important at all */
- if (vm_rpc_send_rpci_tx(sc, "vmx.capability.unified_loop toolbox") != 0) {
+ if (vm_rpc_send_rpci_tx(sc,
+ "vmx.capability.unified_loop toolbox") != 0) {
printf("%s: unable to set unified loop\n", DEVNAME(sc));
sc->sc_rpc_error = 1;
}
if (vm_rpci_response_successful(sc) == 0) {
- printf("%s: host rejected unified loop setting\n", DEVNAME(sc));
+ printf("%s: host rejected unified loop setting\n",
+ DEVNAME(sc));
}
/* the trailing space is apparently important here */
if (vm_rpc_send_rpci_tx(sc, "tools.capability.statechange ") != 0) {
- printf("%s: unable to send statechange capability\n", DEVNAME(sc));
+ printf("%s: unable to send statechange capability\n",
+ DEVNAME(sc));
sc->sc_rpc_error = 1;
}
if (vm_rpci_response_successful(sc) == 0) {
- printf("%s: host rejected statechange capability\n", DEVNAME(sc));
+ printf("%s: host rejected statechange capability\n",
+ DEVNAME(sc));
}
- if (vm_rpc_send_rpci_tx(sc, "tools.set.version %u", VM_VERSION_UNMANAGED) != 0) {
+ if (vm_rpc_send_rpci_tx(sc, "tools.set.version %u",
+ VM_VERSION_UNMANAGED) != 0) {
printf("%s: unable to set tools version\n", DEVNAME(sc));
sc->sc_rpc_error = 1;
}
vmt_update_guest_uptime(sc);
if (vm_rpc_send_str(&sc->sc_tclo_rpc, VM_RPC_REPLY_OK) != 0) {
- printf("%s: error sending capabilities_register response\n", DEVNAME(sc));
+ printf("%s: error sending capabilities_register response\n",
+ DEVNAME(sc));
sc->sc_rpc_error = 1;
}
} else if (strcmp(sc->sc_rpc_buf, "Set_Option broadcastIP 1") == 0) {
inet_ntop(AF_INET, &guest_ip->sin_addr, ip, sizeof(ip));
if (vm_rpc_send_rpci_tx(sc, "info-set guestinfo.ip %s",
ip) != 0) {
- printf("%s: unable to send guest IP address\n", DEVNAME(sc));
+ printf("%s: unable to send guest IP address\n",
+ DEVNAME(sc));
sc->sc_rpc_error = 1;
}
if (vm_rpc_send_str(&sc->sc_tclo_rpc, VM_RPC_REPLY_OK) != 0) {
- printf("%s: error sending broadcastIP response\n", DEVNAME(sc));
+ printf("%s: error sending broadcastIP response\n",
+ DEVNAME(sc));
sc->sc_rpc_error = 1;
}
} else {
- if (vm_rpc_send_str(&sc->sc_tclo_rpc, VM_RPC_REPLY_ERROR_IP_ADDR) != 0) {
+ if (vm_rpc_send_str(&sc->sc_tclo_rpc,
+ VM_RPC_REPLY_ERROR_IP_ADDR) != 0) {
printf("%s: error sending broadcastIP error response\n",
DEVNAME(sc));
sc->sc_rpc_error = 1;
}
} else {
if (vm_rpc_send_str(&sc->sc_tclo_rpc, VM_RPC_REPLY_ERROR) != 0) {
- printf("%s: error sending unknown command reply\n", DEVNAME(sc));
+ printf("%s: error sending unknown command reply\n",
+ DEVNAME(sc));
sc->sc_rpc_error = 1;
}
}
if (frame.ecx.part.high != 1 || frame.edx.part.low != 0) {
/* open-vm-tools retries without VM_RPC_FLAG_COOKIE here.. */
printf("vmware: open failed, eax=%08x, ecx=%08x, edx=%08x\n",
- frame.eax.word, frame.ecx.word, frame.edx.word);
+ frame.eax.word, frame.ecx.word, frame.edx.word);
return EIO;
}
if (frame.ecx.part.high == 0 || frame.ecx.part.low != 0) {
printf("vmware: close failed, eax=%08x, ecx=%08x\n",
- frame.eax.word, frame.ecx.word);
+ frame.eax.word, frame.ecx.word);
return EIO;
}
if ((frame.ecx.part.high & VM_RPC_REPLY_SUCCESS) == 0) {
printf("vmware: sending length failed, eax=%08x, ecx=%08x\n",
- frame.eax.word, frame.ecx.word);
+ frame.eax.word, frame.ecx.word);
return EIO;
}
if (frame.ebx.word != VM_RPC_ENH_DATA) {
printf("vmware: get data failed, ebx=%08x\n",
- frame.ebx.word);
+ frame.ebx.word);
return EIO;
}
if (frame.ecx.part.high == 0) {
printf("vmware: ack data failed, eax=%08x, ecx=%08x\n",
- frame.eax.word, frame.ecx.word);
+ frame.eax.word, frame.ecx.word);
return EIO;
}
if ((frame.ecx.part.high & VM_RPC_REPLY_SUCCESS) == 0) {
printf("vmware: get length failed, eax=%08x, ecx=%08x\n",
- frame.eax.word, frame.ecx.word);
+ frame.eax.word, frame.ecx.word);
return EIO;
}
if ((frame.ecx.part.high & VM_RPC_REPLY_DORECV) == 0) {
}
if (vm_rpc_get_length(&rpci, &rlen, &ack) != 0) {
- printf("%s: failed to get length of rpci response data\n", DEVNAME(sc));
+ printf("%s: failed to get length of rpci response data\n",
+ DEVNAME(sc));
result = EIO;
goto out;
}
}
if (vm_rpc_get_data(&rpci, sc->sc_rpc_buf, rlen, ack) != 0) {
- printf("%s: failed to get rpci response data\n", DEVNAME(sc));
+ printf("%s: failed to get rpci response data\n",
+ DEVNAME(sc));
result = EIO;
goto out;
}