UDP buf address calculation error
Brought to you by:
adamdunkels,
harbaum
I changed in line 1159:
------------------------------------------------------------
uip_appdata = &uip_buf [UIP_LLH_LEN + UIP_IPTCPH_LEN] ;
------------------------------------------------------------
to
------------------------------------------------------------
uip_appdata = &uip_buf [UIP_LLH_LEN + UIP_IPUDPH_LEN] ;
------------------------------------------------------------
(because of e-Mail in uip-users mailing list of Jack Elston, 16 Aug 2006 and Adam Dunkels on 26. Nov 2006).
Logged In: YES
user_id=1922332
Originator: NO
I think this one is not an error. In fact on my port it breaks UDP
transmissions.
The reason is that the low level transmission routines I use are similar
to the ones suggested in the documentation:
void
devicedriver_send(void)
{
hwsend(&uip_buf[0], UIP_LLH_LEN);
if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) {
hwsend(&uip_buf[UIP_LLH_LEN], uip_len - UIP_LLH_LEN);
} else {
hwsend(&uip_buf[UIP_LLH_LEN], UIP_TCPIP_HLEN);
hwsend(uip_appdata, uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN);
}
}
So if a UDP packet is transmitted, that is greater than UIP_LLH_LEN +
UIP_TCPIP_HLEN bytes long, then uip_appdata must point to &uip_buf
[UIP_LLH_LEN + UIP_IPTCPH_LEN], otherwise the incorrect data is
transmitted.