From: Katy Feng Date: Thu, 5 Oct 2023 17:35:27 +0000 (-0700) Subject: Changes to common source files not applicable to open-vm-tools. X-Git-Tag: stable-12.4.0~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e43c69c0ab3e84a6d63d39d9fb832fc02d6076c;p=thirdparty%2Fopen-vm-tools.git Changes to common source files not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/asyncsocket/asyncSocketInterface.c b/open-vm-tools/lib/asyncsocket/asyncSocketInterface.c index fe5b2c91c..b00ac212c 100644 --- a/open-vm-tools/lib/asyncsocket/asyncSocketInterface.c +++ b/open-vm-tools/lib/asyncsocket/asyncSocketInterface.c @@ -1222,6 +1222,38 @@ AsyncSocket_GetNetworkStats(AsyncSocket *asock, // IN } +/* + *---------------------------------------------------------------------------- + * + * AsyncSocket_GetSNIHostname -- + * + * Get SNI hostname from the active socket. + * + * Results: + * ASOCKERR_* + * + * Side effects: + * None. + * + *---------------------------------------------------------------------------- + */ + +int +AsyncSocket_GetSNIHostname(AsyncSocket *asock, // IN + const char **sniHostname) // OUT +{ + int ret; + if (VALID(asock, getSNIHostname)) { + AsyncSocketLock(asock); + ret = VT(asock)->getSNIHostname(asock, sniHostname); + AsyncSocketUnlock(asock); + } else { + ret = ASOCKERR_INVAL; + } + return ret; +} + + /* *---------------------------------------------------------------------------- * diff --git a/open-vm-tools/lib/asyncsocket/asyncSocketVTable.h b/open-vm-tools/lib/asyncsocket/asyncSocketVTable.h index 4c2e4fa6d..04d161a62 100644 --- a/open-vm-tools/lib/asyncsocket/asyncSocketVTable.h +++ b/open-vm-tools/lib/asyncsocket/asyncSocketVTable.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (c) 2011,2014-2017,2019-2022 VMware, Inc. All rights reserved. + * Copyright (c) 2011,2014-2017,2019-2023 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 @@ -41,6 +41,8 @@ /* * If we change the AsyncSocketVTable, we also need to change the follow files: + * apps/asyncSocketProxy/asyncVvcSocket.c + * lib/blastSockets/asyncBweSocket.c * lib/blastSockets/asyncProxySocket.c * lib/asyncsocket/asyncsocket.c * lib/asyncsocket/asyncWebSocket.c @@ -108,6 +110,8 @@ typedef struct AsyncSocketVTable { int (*isSendBufferFull)(AsyncSocket *asock); int (*getNetworkStats)(AsyncSocket *asock, AsyncSocketNetworkStats *stats); + int (*getSNIHostname)(AsyncSocket *asock, + const char **sniHostname); int (*close)(AsyncSocket *asock); int (*closeWrite)(AsyncSocket *asock); int (*cancelRecv)(AsyncSocket *asock, int *partialRecvd, void **recvBuf, diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c b/open-vm-tools/lib/asyncsocket/asyncsocket.c index 26aee553a..4f7b1843a 100644 --- a/open-vm-tools/lib/asyncsocket/asyncsocket.c +++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c @@ -413,6 +413,7 @@ static const AsyncSocketVTable asyncTCPSocketVTable = { AsyncTCPSocketSend, AsyncTCPSocketIsSendBufferFull, NULL, /* getNetworkStats */ + NULL, /* getSNIHostname */ AsyncTCPSocketClose, AsyncTCPSocketCloseWrite, AsyncTCPSocketCancelRecv, diff --git a/open-vm-tools/lib/include/asyncsocket.h b/open-vm-tools/lib/include/asyncsocket.h index 21c2d27a4..57d491570 100644 --- a/open-vm-tools/lib/include/asyncsocket.h +++ b/open-vm-tools/lib/include/asyncsocket.h @@ -729,6 +729,8 @@ int AsyncSocket_SendWithFd(AsyncSocket *asock, void *buf, int len, int passFd, int AsyncSocket_IsSendBufferFull(AsyncSocket *asock); int AsyncSocket_GetNetworkStats(AsyncSocket *asock, AsyncSocketNetworkStats *stats); +int AsyncSocket_GetSNIHostname(AsyncSocket *asock, + const char **sniHostname); int AsyncSocket_CancelRecv(AsyncSocket *asock, int *partialRecvd, void **recvBuf, void **recvFn); int AsyncSocket_CancelRecvEx(AsyncSocket *asock, int *partialRecvd, void **recvBuf,