Hi,
I have mentioning one chunk of code in which I m getting crash dump
(Segmentation fault).
That is code of TCP send data protocol.
could you give me a pointer the cause of crash after looking part odf code.
and if i will put sanity check then this would not effect.
Here we go for chunk of code (Bold part is that where crash comes)
######################################
tcp_output_segment(VTASK* vtask,struct tcp_seg *seg, struct tcp_pcb *pcb)
{
u16_t len;
struct netif *netif;
/*The TCP header has already been constructed, but the ackno and
wnd fields remain.
*/
seg->tcphdr->ackno = htonl(pcb->rcv_nxt);
/* silly window avoidance */
if (pcb->rcv_wnd < pcb->mss)
{
seg->tcphdr->wnd = 0;
} else
{
/* advertise our receive window size in this TCP segment */
seg->tcphdr->wnd = htons(TCP_WND);
}
/* If we don't have a local IP address, we get one by
calling ip_route().
*/
if (ip_addr_isany(&(pcb->local_ip)))
{
netif = ip_route(&(pcb->remote_ip));
if (netif == NULL)
{
return;
}
ip_addr_set(&(pcb->local_ip), &(netif->ip_addr));
}
pcb->rtime = 0;
*len = (u16_t)((u8_t *)seg->tcphdr - (u8_t *)seg->p->payload); //Here
crash is comming .*
*
*
*The reason for that in debugger .its dumping due to seg->p->payload where p
is 0*0.*
*###########################*
*
*
*Could you suggest me cause of this and if i will think error check. then I
can check by in that manner.*
*if (seg->p == Null) (*
*return;*
*}*
*
*
*
*
*TIA*
*
*
*-Ravi*
*
*
*
*
*
*
*
*
*
*
[Non-text portions of this message have been removed]