From e1fa8d8f6a3c7c9e82e8a603377dc35cb7bc93e4 Mon Sep 17 00:00:00 2001 From: Rudy Hardeman Date: Fri, 6 Jan 2017 17:06:23 +0100 Subject: [PATCH] Updates to Tellus --- TellusAgent.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/TellusAgent.c b/TellusAgent.c index fcd7449..5665b0e 100644 --- a/TellusAgent.c +++ b/TellusAgent.c @@ -388,7 +388,7 @@ int main(int argc, const char* argv[]) memset(outgoingBuffer, 0, sizeof(struct RewindData)); memcpy(outgoingBuffer, REWIND_PROTOCOL_SIGN, REWIND_SIGN_LENGTH); - struct sockaddr_in repeaterSocketAddresses[3]; + struct sockaddr_in repeaterSocketAddresses[2 * PROXY_PORT_COUNT]; memset(repeaterSocketAddresses, 0, sizeof(repeaterSocketAddresses)); // Main loop @@ -511,9 +511,14 @@ int main(int argc, const char* argv[]) int handle = proxyHandles[selection]; if (CHECK(event, handle)) { + struct sockaddr_in dummyAddress; socklen_t size = sizeof(struct sockaddr_in); uint8_t* buffer = (uint8_t*)outgoingBuffer->data; struct sockaddr_in* address = repeaterSocketAddresses + selection; + + // Move to additional buffer to keep initial value + address += PROXY_PORT_COUNT * (address->si_family != AF_UNSPEC); + size_t length = recvfrom(handle, buffer, BUFFER_SIZE, 0, (struct sockaddr*)address, &size); outgoingBuffer->type = htole16(REWIND_CLASS_HYTERA_DATA + selection);