Socket AF_HYPERV should return failure when it is not running on HyperV

Reported by:	pho
Sponsored by:	Microsoft
This commit is contained in:
Wei Hu 2020-05-22 09:17:07 +00:00
parent 242349823c
commit c97c20ace7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=361360

View File

@ -354,6 +354,9 @@ hvs_trans_attach(struct socket *so, int proto, struct thread *td)
{
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__);
@ -957,6 +969,9 @@ 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__);