diff --git a/VERSION b/VERSION index 138cdb95..8d242dc5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-187-gcfd8126e5d+1 \ No newline at end of file +B1-188-gdcce288a98+1 \ No newline at end of file diff --git a/c-host/src/app.c b/c-host/src/app.c index 1860d4ba..6ca67085 100644 --- a/c-host/src/app.c +++ b/c-host/src/app.c @@ -413,8 +413,14 @@ int app_main(int argc, char * argv[]) DEBUG_INFO("IVSHMEM Address : 0x%" PRIXPTR, (uintptr_t)shmDev.mem); DEBUG_INFO("Max Pointer Size : %u KiB", (unsigned int)MAX_POINTER_SIZE / 1024); + KVMFR udata = { + .magic = KVMFR_MAGIC, + .version = KVMFR_VERSION + }; + 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)); goto fail; diff --git a/client/src/main.c b/client/src/main.c index 478aa22b..c1ae6e9f 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1446,7 +1446,11 @@ static int lg_run() LGMP_STATUS status; 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; if (status == LGMP_ERR_INVALID_SESSION || status == LGMP_ERR_INVALID_MAGIC) @@ -1455,6 +1459,16 @@ static int lg_run() 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)); return -1; } diff --git a/common/include/common/KVMFR.h b/common/include/common/KVMFR.h index ab9a24a7..701ccd36 100644 --- a/common/include/common/KVMFR.h +++ b/common/include/common/KVMFR.h @@ -50,6 +50,16 @@ typedef enum CursorType } CursorType; +#define KVMFR_MAGIC "KVMFR---" +#define KVMFR_VERSION 1 + +typedef struct KVMFR +{ + char magic[8]; + uint32_t version; +} +KVMFR; + typedef struct KVMFRCursor { int16_t x, y; // cursor x & y position diff --git a/repos/LGMP b/repos/LGMP index 1d412a1c..61c9178c 160000 --- a/repos/LGMP +++ b/repos/LGMP @@ -1 +1 @@ -Subproject commit 1d412a1cf572a341d0d0c9c2714f1107d5376647 +Subproject commit 61c9178c87df46f39a817e63eb85afe2a131e51d