mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 06:47:19 +00:00
[client/host] added enforcement of KVMFR versioning
This commit is contained in:
parent
dcce288a98
commit
c4bf992c0c
@ -413,8 +413,14 @@ int app_main(int argc, char * argv[])
|
|||||||
DEBUG_INFO("IVSHMEM Address : 0x%" PRIXPTR, (uintptr_t)shmDev.mem);
|
DEBUG_INFO("IVSHMEM Address : 0x%" PRIXPTR, (uintptr_t)shmDev.mem);
|
||||||
DEBUG_INFO("Max Pointer Size : %u KiB", (unsigned int)MAX_POINTER_SIZE / 1024);
|
DEBUG_INFO("Max Pointer Size : %u KiB", (unsigned int)MAX_POINTER_SIZE / 1024);
|
||||||
|
|
||||||
|
KVMFR udata = {
|
||||||
|
.magic = KVMFR_MAGIC,
|
||||||
|
.version = KVMFR_VERSION
|
||||||
|
};
|
||||||
|
|
||||||
LGMP_STATUS status;
|
LGMP_STATUS status;
|
||||||
if ((status = lgmpHostInit(shmDev.mem, shmDev.size, &app.lgmp)) != LGMP_OK)
|
if ((status = lgmpHostInit(shmDev.mem, shmDev.size, &app.lgmp,
|
||||||
|
sizeof(udata), (uint8_t *)&udata)) != LGMP_OK)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("lgmpHostInit Failed: %s", lgmpStatusString(status));
|
DEBUG_ERROR("lgmpHostInit Failed: %s", lgmpStatusString(status));
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -1446,7 +1446,11 @@ static int lg_run()
|
|||||||
LGMP_STATUS status;
|
LGMP_STATUS status;
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp)) == LGMP_OK)
|
uint32_t udataSize;
|
||||||
|
KVMFR *udata;
|
||||||
|
|
||||||
|
if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp,
|
||||||
|
&udataSize, (uint8_t **)&udata)) == LGMP_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (status == LGMP_ERR_INVALID_SESSION || status == LGMP_ERR_INVALID_MAGIC)
|
if (status == LGMP_ERR_INVALID_SESSION || status == LGMP_ERR_INVALID_MAGIC)
|
||||||
@ -1455,6 +1459,16 @@ static int lg_run()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (udataSize != sizeof(KVMFR) ||
|
||||||
|
memcmp(udata->magic, KVMFR_MAGIC, sizeof(udata->magic)) != 0 ||
|
||||||
|
udata->version != KVMFR_VERSION)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("The host application is not compatible with this client");
|
||||||
|
DEBUG_ERROR("Expected KVMFR version %d\n", KVMFR_VERSION);
|
||||||
|
DEBUG_ERROR("This is not a Looking Glass error, do not report this");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_ERROR("lgmpClientInit Failed: %s", lgmpStatusString(status));
|
DEBUG_ERROR("lgmpClientInit Failed: %s", lgmpStatusString(status));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,16 @@ typedef enum CursorType
|
|||||||
}
|
}
|
||||||
CursorType;
|
CursorType;
|
||||||
|
|
||||||
|
#define KVMFR_MAGIC "KVMFR---"
|
||||||
|
#define KVMFR_VERSION 1
|
||||||
|
|
||||||
|
typedef struct KVMFR
|
||||||
|
{
|
||||||
|
char magic[8];
|
||||||
|
uint32_t version;
|
||||||
|
}
|
||||||
|
KVMFR;
|
||||||
|
|
||||||
typedef struct KVMFRCursor
|
typedef struct KVMFRCursor
|
||||||
{
|
{
|
||||||
int16_t x, y; // cursor x & y position
|
int16_t x, y; // cursor x & y position
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 1d412a1cf572a341d0d0c9c2714f1107d5376647
|
Subproject commit 61c9178c87df46f39a817e63eb85afe2a131e51d
|
Loading…
Reference in New Issue
Block a user