eiger, jungfrau, ctb, moench, gotthard virtual servers checked

This commit is contained in:
2020-03-30 18:24:42 +02:00
parent 719157f5c3
commit 3ba9e5ec22
11 changed files with 448 additions and 273 deletions

View File

@ -616,7 +616,12 @@ void getMacAddressinString(char* cmac, int size, uint64_t mac) {
void getIpAddressinString(char* cip, uint32_t ip) {
memset(cip, 0, INET_ADDRSTRLEN);
#if defined(EIGERD) && !defined(VIRTUAL)
inet_ntop(AF_INET, &ip, cip, INET_ADDRSTRLEN);
#else
sprintf(cip, "%d.%d.%d.%d",
(ip>>24)&0xff,(ip>>16)&0xff,(ip>>8)&0xff,(ip)&0xff);
#endif
}

View File

@ -16,7 +16,7 @@
int udpSockfd[2] = {-1, -1};
struct addrinfo* udpServerAddrInfo[2] = {0, 0};
unsigned short int udpDestinationPort[2] = {0, 0};
char udpDestinationIp[2][MAX_STR_LENGTH] = {"", ""};
char udpDestinationIp[2][INET_ADDRSTRLEN] = {"", ""};
//DEFAULT_TX_UDP_PORT;// src port
int getUdPSocketDescriptor(int index) {
@ -26,8 +26,8 @@ int getUdPSocketDescriptor(int index) {
int setUDPDestinationDetails(int index, const char* ip, unsigned short int port) {
udpDestinationPort[index] = port;
size_t len = strlen(ip);
memset(udpDestinationIp[index], 0, MAX_STR_LENGTH);
strncpy(udpDestinationIp[index], ip, len > MAX_STR_LENGTH ? MAX_STR_LENGTH : len );
memset(udpDestinationIp[index], 0, INET_ADDRSTRLEN);
strncpy(udpDestinationIp[index], ip, len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len );
if (udpServerAddrInfo[index]) {
freeaddrinfo(udpServerAddrInfo[index]);