fix(): Исправлено копирование данных UDP без подсчета контрольной суммы

This commit is contained in:
algin 2023-12-08 14:41:58 +03:00
parent 2f8e2e726f
commit 546220b3b1
2 changed files with 9 additions and 3 deletions

View File

@ -14,7 +14,7 @@
namespace free_rtos {
static constexpr uint32_t LINK_TASK_PRIORITY = tskIDLE_PRIORITY + 2;
static constexpr uint32_t LINK_TASK_STACK_SIZE = 0x2000 / sizeof(StackType_t);
static constexpr uint32_t LINK_TASK_STACK_SIZE = 0x1800 / sizeof(StackType_t);
}
#endif /* FREE_RTOS_ETHERNET_ETH_TASK_SETTINGS_HPP_ */

View File

@ -189,14 +189,20 @@ uint16_t free_rtos::EthUpdClient::fill_udp_header(UDPHandlerArgs& udpHandlerArgs
chk_sum32 += IP_PROT_UDP + udp_len;
//uint16_t chk_sum16 = eth_calcChksum2(chk_sum32, (uint8_t *)&udpHandlerArgs.udp_header, sizeof(TUdpHeader), (uint8_t *)udpHandlerArgs.p_data, udpHandlerArgs.ip_data_len);
//Ðàñ÷åò êîíòðîëüíîé ñóììû ñîâìåùåí ñ êîïèðîâàíèåì äàííûõ !
uint16_t chk_sum16 = eth_calcChksum3(udp_hdr, chk_sum32,
&udp_header, sizeof(TUdpHeader),
udpHandlerArgs.p_data, udpHandlerArgs.ip_data_len);
udp_hdr->Chk_sum = BASE_SWAP16(chk_sum16);
} else {
uint8_t* udp_data = udpHandlerArgs.buffer + sizeof(TEthFrameHeader) + sizeof(TIpHeader) + sizeof(TUdpHeader);
*udp_hdr = udp_header;
memcpy(udp_data, udpHandlerArgs.p_data, udpHandlerArgs.ip_data_len);
}
return sizeof(TUdpHeader);
return sizeof(TUdpHeader) + udpHandlerArgs.ip_data_len;
}
uint16_t free_rtos::EthUpdClient::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
@ -205,7 +211,7 @@ uint16_t free_rtos::EthUpdClient::Sender(HandlerArgs& handlerArgs, size_t scatte
fill_udp_header(udpHandlerArgs);
return udpHandlerArgs.ip_header_len + udpHandlerArgs.ip_data_len;
return sizeof(TUdpHeader) + udpHandlerArgs.ip_data_len;
}
int32_t free_rtos::EthUpdClient::Process(uint8_t * p_data, uint32_t len)