lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Program hangs in ip_frag()


From: pekez
Subject: Re: [lwip-users] Program hangs in ip_frag()
Date: Fri, 3 Mar 2017 13:32:21 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1

After further examination, I noticed that ip_frag() works fine when variable left is set to 1480 initially. However, when it's bigger than that value, it get stuck in while (left_to_copy) loop.

When left is initially 1480:
1st iteration through while(left_to_copy): left_to_copy is 1464, p->len is 1480, newpbuflen is 1464
2nd iteration: left_to_copy is 16, p->len is 16, newpbuflen is 16

And it gets out of ip_frag function. It works as expected.

When left initially is > 1480 (for example 2964):
1st iteration: left_to_copy is 1464, p->len is 1480, newpbuflen is 1464
2nd iteration: left_to_copy is 1464, p->len is 16, newpbuflen is 16
3rd iteration: left_to_copy is 1448, p->len is 0, newpbuflen is 0
and every next iteration looks as the 3rd one... every next p->len is 0, so newpbuf is 0, left_to_copy never gets decremented and it hangs in infinite loop :(

Since left is set to p->tot_len - IP_HLEN at the beginning of the ip_frag() function, it seems to me as though p->tot_len doesn't correspond to the real total len of p??? Is that possible? Can I somehow recalculate p->tot_len inside of ip_frag()? Any suggestion on how I could handle this condition?

On 3.3.2017 11:45, pekez wrote:
I am not able to step through files that are part of BSP. Not much help of a debugger. I am using Xilinx SDK. So far I have been printing, and I found out that program get stuck inside of while (left_to_copy) loop in ip_frag(). left_to_copy is 1448 all the time... p->len is 0.

I am confused why ip_frag is called only sometimes. It is called from here:

if (netif->mtu && (p->tot_len > netif->mtu)) {
    return ip_frag(p, netif, dest);
  }

netif->mtu is always > 0, so that means the other argument is true as well. I don't get why p->tot_len is sometimes bigger than netif->mtu, since I am always doing the same thing from application. Can you explain this? I have little knowledge on how TCP works under the hood.

When program works fine, it never gets into ip_frag, so that means it get stuck only when this function is called.

On 2.3.2017 19:48, address@hidden wrote:
pekez wrote:
I have not real clue what is going on.

Me neither.

You seem to have a debugger, why don't you try to find out? ;-)
(I.e. see where/why it hangs to try to give us more information or even be able to fix it yourself)

Cheers,
Simon

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]