From: John Wolfe Date: Tue, 4 May 2021 02:39:41 +0000 (-0700) Subject: VGAuth: Use GUESTRPCPKT_FIELD_FAST_CLOSE flag for log messages. X-Git-Tag: stable-11.3.0~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16e2be2e2c67d49ed01032348368157ad9867920;p=thirdparty%2Fopen-vm-tools.git VGAuth: Use GUESTRPCPKT_FIELD_FAST_CLOSE flag for log messages. VGauth is a single action service. With the GUESTRPCPKT_FIELD_FAST_CLOSE flag added, VMX closes the vsocket as soon as the RPC response is sent. This cleans up the vsocket connections faster and minimizes the number of connect() failures in the guest. --- diff --git a/open-vm-tools/vgauth/common/vmxlog.c b/open-vm-tools/vgauth/common/vmxlog.c index fd0f495ef..411fec873 100644 --- a/open-vm-tools/vgauth/common/vmxlog.c +++ b/open-vm-tools/vgauth/common/vmxlog.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2018-2019 VMware, Inc. All rights reserved. + * Copyright (C) 2018-2021 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -242,6 +242,11 @@ MakePacket(const char *cmd, uint32 fieldId; uint64 value; } hdr; + struct { + uint32 type; + uint32 fieldId; + uint64 value; + } flags; struct { uint32 type; uint32 fieldId; @@ -260,6 +265,14 @@ MakePacket(const char *cmd, hdr.fieldId = htonl(1); // GUESTRPCPKT_FIELD_TYPE hdr.value = _vmxlog_htonll(1); // GUESTRPCPKT_TYPE_DATA + /* + * Adding the fast_close flag GUESTRPCPKT_FIELD_FAST_CLOSE in the packet + * to indicate vmx to close the channel as soon as the response is sent. + */ + flags.type = htonl(1); // DMFIELDTYPE_INT64 + flags.fieldId = htonl(3); // GUESTRPCPKT_FIELD_FAST_CLOSE + flags.value = _vmxlog_htonll(1); // GUESTRPCPKT_TYPE_DATA + /* * this part of the data doesn't seem to care about network byte * order, but do it anyways. @@ -268,7 +281,7 @@ MakePacket(const char *cmd, payload.fieldId = htonl(2); // GUESTRPCPKT_FIELD_PAYLOAD payload.len = htonl(len); // length of 'cmd' - plen = sizeof(hdr) + sizeof(payload) + len; + plen = sizeof(hdr) + sizeof(flags) + sizeof(payload) + len; tlen = plen + sizeof(int); packet = (char *) g_malloc(tlen); @@ -281,6 +294,8 @@ MakePacket(const char *cmd, memcpy(p, &hdr, sizeof hdr); p += sizeof hdr; + memcpy(p, &flags, sizeof flags); + p += sizeof flags; memcpy(p, &payload, sizeof payload); p += sizeof payload; memcpy(p, cmd, len);