svn commit: r361360 - head/sys/dev/hyperv/hvsock
Wei Hu
whu at FreeBSD.org
Fri May 22 09:17:07 UTC 2020
Author: whu
Date: Fri May 22 09:17:07 2020
New Revision: 361360
URL: https://svnweb.freebsd.org/changeset/base/361360
Log:
Socket AF_HYPERV should return failure when it is not running on HyperV
Reported by: pho
Sponsored by: Microsoft
Modified:
head/sys/dev/hyperv/hvsock/hv_sock.c
Modified: head/sys/dev/hyperv/hvsock/hv_sock.c
==============================================================================
--- head/sys/dev/hyperv/hvsock/hv_sock.c Fri May 22 09:02:40 2020 (r361359)
+++ head/sys/dev/hyperv/hvsock/hv_sock.c Fri May 22 09:17:07 2020 (r361360)
@@ -354,6 +354,9 @@ hvs_trans_attach(struct socket *so, int proto, struct
{
struct hvs_pcb *pcb = so2hvspcb(so);
+ if (vm_guest != VM_GUEST_HV)
+ return (ESOCKTNOSUPPORT);
+
HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
"%s: HyperV Socket hvs_trans_attach called\n", __func__);
@@ -380,6 +383,9 @@ hvs_trans_detach(struct socket *so)
{
struct hvs_pcb *pcb;
+ if (vm_guest != VM_GUEST_HV)
+ return;
+
HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
"%s: HyperV Socket hvs_trans_detach called\n", __func__);
@@ -589,6 +595,9 @@ hvs_trans_disconnect(struct socket *so)
{
struct hvs_pcb *pcb;
+ if (vm_guest != VM_GUEST_HV)
+ return (ESOCKTNOSUPPORT);
+
HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
"%s: HyperV Socket hvs_trans_disconnect called\n", __func__);
@@ -916,6 +925,9 @@ hvs_trans_close(struct socket *so)
{
struct hvs_pcb *pcb;
+ if (vm_guest != VM_GUEST_HV)
+ return;
+
HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
"%s: HyperV Socket hvs_trans_close called\n", __func__);
@@ -956,6 +968,9 @@ void
hvs_trans_abort(struct socket *so)
{
struct hvs_pcb *pcb = so2hvspcb(so);
+
+ if (vm_guest != VM_GUEST_HV)
+ return;
HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
"%s: HyperV Socket hvs_trans_abort called\n", __func__);
More information about the svn-src-head
mailing list