test
This commit is contained in:
@ -104,12 +104,38 @@ void networkSntpEngine(void *handle) {
|
|||||||
coloredMsg(LOG_BLUE, "nes, nothing received yet, try again");
|
coloredMsg(LOG_BLUE, "nes, nothing received yet, try again");
|
||||||
schAdd(networkSntpEngine, (void*) localHandle, 100, 0);
|
schAdd(networkSntpEngine, (void*) localHandle, 100, 0);
|
||||||
}
|
}
|
||||||
} else if (recvLen == sizeof(localHandle->ntpMsg)) {
|
} else if (recvLen >= sizeof(localHandle->ntpMsg)) {
|
||||||
memset(&(localHandle->ntpMsg), 0, sizeof(localHandle->ntpMsg));
|
memset(&(localHandle->ntpMsg), 0, sizeof(localHandle->ntpMsg));
|
||||||
uint8_t srcAddr[4];
|
uint8_t srcAddr[4];
|
||||||
uint16_t srcPort;
|
uint16_t srcPort;
|
||||||
|
/*
|
||||||
recvfrom(SNTP_SOCK, (uint8_t*)(&(localHandle->ntpMsg)),
|
recvfrom(SNTP_SOCK, (uint8_t*)(&(localHandle->ntpMsg)),
|
||||||
sizeof(localHandle->ntpMsg), srcAddr, &srcPort);
|
sizeof(localHandle->ntpMsg), srcAddr, &srcPort);
|
||||||
|
*/
|
||||||
|
uint8_t buf[90];
|
||||||
|
recvfrom(SNTP_SOCK, buf, sizeof(buf), srcAddr, &srcPort);
|
||||||
|
uint8_t x = 0;
|
||||||
|
coloredMsg(LOG_BLUE, "%02x %02x %02x %02x %02x %02x %02x %02x",
|
||||||
|
buf[x+0], buf[x+1], buf[x+2], buf[x+3], buf[x+4], buf[x+5], buf[x+6], buf[x+7]);
|
||||||
|
x += 8;
|
||||||
|
coloredMsg(LOG_BLUE, "%02x %02x %02x %02x %02x %02x %02x %02x",
|
||||||
|
buf[x+0], buf[x+1], buf[x+2], buf[x+3], buf[x+4], buf[x+5], buf[x+6], buf[x+7]);
|
||||||
|
x += 8;
|
||||||
|
coloredMsg(LOG_BLUE, "%02x %02x %02x %02x %02x %02x %02x %02x",
|
||||||
|
buf[x+0], buf[x+1], buf[x+2], buf[x+3], buf[x+4], buf[x+5], buf[x+6], buf[x+7]);
|
||||||
|
x += 8;
|
||||||
|
coloredMsg(LOG_BLUE, "%02x %02x %02x %02x %02x %02x %02x %02x",
|
||||||
|
buf[x+0], buf[x+1], buf[x+2], buf[x+3], buf[x+4], buf[x+5], buf[x+6], buf[x+7]);
|
||||||
|
x += 8;
|
||||||
|
coloredMsg(LOG_BLUE, "%02x %02x %02x %02x %02x %02x %02x %02x",
|
||||||
|
buf[x+0], buf[x+1], buf[x+2], buf[x+3], buf[x+4], buf[x+5], buf[x+6], buf[x+7]);
|
||||||
|
x += 8;
|
||||||
|
coloredMsg(LOG_BLUE, "%02x %02x %02x %02x %02x %02x %02x %02x",
|
||||||
|
buf[x+0], buf[x+1], buf[x+2], buf[x+3], buf[x+4], buf[x+5], buf[x+6], buf[x+7]);
|
||||||
|
x += 8;
|
||||||
|
coloredMsg(LOG_BLUE, "%02x %02x %02x %02x %02x %02x %02x %02x",
|
||||||
|
buf[x+0], buf[x+1], buf[x+2], buf[x+3], buf[x+4], buf[x+5], buf[x+6], buf[x+7]);
|
||||||
|
|
||||||
close(SNTP_SOCK);
|
close(SNTP_SOCK);
|
||||||
coloredMsg(LOG_BLUE, "nes, msg received from %d.%d.%d.%d:%d",
|
coloredMsg(LOG_BLUE, "nes, msg received from %d.%d.%d.%d:%d",
|
||||||
srcAddr[0], srcAddr[1], srcAddr[2], srcAddr[3],
|
srcAddr[0], srcAddr[1], srcAddr[2], srcAddr[3],
|
||||||
|
BIN
docs/ntp.pcap
Normal file
BIN
docs/ntp.pcap
Normal file
Binary file not shown.
Reference in New Issue
Block a user