fix(): Исправлено копирование данных UDP без подсчета контрольной суммы
This commit is contained in:
parent
2f8e2e726f
commit
546220b3b1
@ -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_ */
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user