[lwip-users] Is tcp_err()-callback optional?
Hi, indepenedent from the fact if it makes sense or if it is bad program style: is it mandatory to announce a error-callback via tcp_err() or will the whole thing also work smoothly when there is no error-callback function available? Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Is tcp_err()-callback optional?
OK, thanks! 2015-10-12 13:17 GMT+02:00 Simon Goldschmidt <goldsi...@gmx.de>: > Karl Karpfen wrote: > >indepenedent from the fact if it makes sense or if it is bad program > style: > > is it mandatory to announce a error-callback via tcp_err() or will the > whole > > thing also work smoothly when there is no error-callback function > available? > > It is kind ofmandatory: without an 'err' callback, your application would > never know if the pcb got deallocated (and possibly reused) due to a RST > received or due to local pcb shortage. > > > Simon > > ___ > lwip-users mailing list > lwip-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/lwip-users > ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Call tcp_close() out of tcp_recv()-context?
2015-09-07 14:17 GMT+02:00 Sergio R. Caprile: > It depends on what you mean by "context". > > The structure is as follows (all non-OS and with RAW API): With tcp_recv() I set up a receive-callback function my_recv(). my_recv() is triggered by lwIP whenever some data are received. Some of these data may contain an information "connection will be closed by host". My question: can I do a tcp_close() from within my_recv() which is called in lwIP's receive-context (which possibly may be a receive-IRQ)? Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
[lwip-users] Call tcp_close() out of tcp_recv()-context?
Hi, I'm using raw-API within my application and have defined a receive-callback by using tcp_recv(). Now it may happen a close-command (from my own protocol running on top of TCP/IP) is received within this receive-callback. My question: is it allowed to call tcp_close() out of the context of this receive-function? Thanks! Karl ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Patch to update from 1.4.0 to 1.4.x?
OK, I checked some of the differences between TI's lwIP 1.4.0 and the original version. I don't really understand what's going on: - in err.c the error ERR_WOULDBLOCK does not exit - in ipv4/ip.c there is a statement in ip_input() which seems to cause opposite behaviour: if (check_ip_src current_iphdr_src.addr == IPADDR_ANY) vs. if (check_ip_src !ip_addr_isany(current_iphdr_src)) - in core/mem.c the static sys_mutex_t mem_mutex; is encapsulated by an #if !NO_SYS/#endif which does not exist in original version Is it possible TI's lwIP bases on some release candidate or BETA-version? Thanks! 2015-03-18 12:58 GMT+01:00 Robert Deschambault robert.deschamba...@gmail.com: Given the number of fixes and improvements I would recommend going through the pain and try to keep any custom code out of the stock sources. I moved our v1.3.2 code to the latest from the main branch in git. On Mar 18, 2015 3:57 AM, Simon Goldschmidt goldsi...@gmx.de wrote: Karl Karpfen wrote: So my question: is there a patch available somewhere that can be applied to an existing 1.4.0 which adds all changes and - probably - shows me some conflicts at these positions where my lwIP variant was changed comparing to 1.4.0? http://download.savannah.gnu.org/releases/lwip/ does not contain something like that... Comparing and merging manually seems to be impossible, nearly all files are changed, so this would be a long time task. No, there is no patch. You could either create the patch on your own by diffing the two versions, or you could compare your vendors version an the original to see if they have changed something. Simon ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
[lwip-users] Patch to update from 1.4.0 to 1.4.x?
Hi, I'm running my controller with lwIP 1.4.0 and tried recently to update it to 1.4.1 but with no success. Simply copying the 1.4.1 sources lead to a non-working network stack. So I have to assume the vendor of the board support package has changed some important things directly within lwIP. So my question: is there a patch available somewhere that can be applied to an existing 1.4.0 which adds all changes and - probably - shows me some conflicts at these positions where my lwIP variant was changed comparing to 1.4.0? http://download.savannah.gnu.org/releases/lwip/ does not contain something like that... Comparing and merging manually seems to be impossible, nearly all files are changed, so this would be a long time task. Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] SNTP client does not work
Hi Sylvain, now that it is working it is not really a problem for me. But that's what I have seen: in lwiplib.c / lwIPInit() there is a statement if(lwipIf-ipMode == IPADDR_USE_STATIC) { ip_addr.addr = htonl(lwipIf-ipAddr); net_mask.addr = htonl(lwipIf-netMask); gw_addr.addr = htonl(lwipIf-gwAddr); } which seems to be responsible for exchanging the byteorder. udp_sendto() of the SNTP-code does not seem to do something similar. So that could explain why both behave that different. Karl 2015-02-06 15:08 GMT+01:00 Sylvain Rochet grada...@gradator.net: Hello Karl, On Fri, Feb 06, 2015 at 08:57:06AM +0100, Karl Karpfen wrote: 2015-02-03 15:24 GMT+01:00 Simon Goldschmidt goldsi...@gmx.de: Karl Karpfen wrote: There's nothing strange here: the contents of ip_addr_t needs to be in network byte order and the sntp client calls a function that returns the correct byte order. OK, to clarify that: to get the ip_addr_t that is used to configure my network interface I have to do the following for IP, gateway and netmask: ipaddr_aton(c, globalConfig.ip); globalConfig.ip.addr=htonl(globalConfig.ip.addr); Something is wrong in your setup/port/whatever, what I have is: ipaddr_aton((char*)linebuf, config.ethernet.address4); ipaddr_aton((char*)linebuf, config.ethernet.netmask4); ipaddr_aton((char*)linebuf, config.ethernet.gateway4); netif_add(MACB_if, config.ethernet.address4, config.ethernet.netmask4, config.ethernet.gateway4, NULL, ethernetif_init, tcpip_input); Could you dig deeper into your issue finding the root cause of the problem ? Sylvain ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] SNTP client does not work
2015-02-03 15:24 GMT+01:00 Simon Goldschmidt goldsi...@gmx.de: Karl Karpfen wrote: There's nothing strange here: the contents of ip_addr_t needs to be in network byte order and the sntp client calls a function that returns the correct byte order. OK, to clarify that: to get the ip_addr_t that is used to configure my network interface I have to do the following for IP, gateway and netmask: ipaddr_aton(c, globalConfig.ip); globalConfig.ip.addr=htonl(globalConfig.ip.addr); For getting the ip_addr_t for the SNTP-server this is not neccesary, there a plain ipaddr_aton(c, globalConfig.sntp_ip); works (without the need to do a htonl() on the addr member). So this is different depending on the usage of the IP - for what reason ever. ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] SNTP client does not work
Hi Sylvain, that is not a solution since I have to parse a string containing the IP. Meanwhile it is working. The trick: I have to do a htonl/s() for all addresses that are used to configure the network interface (IP, netmask, gateway) but not for the IP and port number of the SNTP server to be contacted. Somewhat strange but works this way. Karl 2015-01-29 18:04 GMT+01:00 Sylvain Rochet grada...@gradator.net: Hi Karl, On Thu, Jan 29, 2015 at 05:57:50PM +0100, Karl Karpfen wrote: 2015-01-29 15:56 GMT+01:00 Simon Goldschmidt goldsi...@gmx.de: Karl Karpfen wrote: No but there I have to specify the IP of the NTP-server to communcate with My assumption: when I have to ntohl() the netif-IP, I have to do that for the NTP-IP and the port-number too. Is this wrong? Yes. Do you have evidence that there is an endianness problem here? Have you checked with wireshark what gets sent? BTW: ipaddr_aton already returns network byte order and udp_sendto() takes a host byte order port. Please first check your code before assuming bugs in other people's code ;-) Sorry but I did nowhere and never blamed somebody for bugs, I just asked a question regarding USAGE of lwIP - or isn't this allowed here in this maling list? I didn't read thoroughly, what about IP4_ADDR(*, a, b, c, d) ? Sylvain ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] SNTP client does not work
2015-01-29 15:56 GMT+01:00 Simon Goldschmidt goldsi...@gmx.de: Karl Karpfen wrote: No but there I have to specify the IP of the NTP-server to communcate with My assumption: when I have to ntohl() the netif-IP, I have to do that for the NTP-IP and the port-number too. Is this wrong? Yes. Do you have evidence that there is an endianness problem here? Have you checked with wireshark what gets sent? BTW: ipaddr_aton already returns network byte order and udp_sendto() takes a host byte order port. Please first check your code before assuming bugs in other people's code ;-) Sorry but I did nowhere and never blamed somebody for bugs, I just asked a question regarding USAGE of lwIP - or isn't this allowed here in this maling list? ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] SNTP client does not work
2015-01-29 7:46 GMT+01:00 Simon Goldschmidt goldsi...@gmx.de: Karl Karpfen wrote: - I have rewritten the example a bit to get rid of the sys_xxx() functions which are not available for me I'm not sure I understand. You don't have sys_timeout/sys_untimeout? That's correct, LWIP_TIMERS is not configured in my system because NO_SYS is 1 and NO_SYS_NO_TIMERS is 1 too. But this is not a problems since I can handle this out of my application. - I do a ntohl() on all IP's that are retruned by ipaddr_aton(), this seems to be necessary on my platform (at least for configuring the IP of my Ethernet interface it has to be done to apply the correct address for it, so I assume this is necessary for all IPs) - based on this I do a ntohs() for the SNTP-port too Both shouldn't be necessary. At least for the IP it definitely is necessary. When I hand over a non-ntohl()'ed IP-address to LWIP_IF.ipAddr (used with lwIPInit()), my network interface comes up with wrong IP. ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] SNTP client does not work
2015-01-29 14:35 GMT+01:00 Simon Goldschmidt goldsi...@gmx.de: Karl Karpfen wrote: At least for the IP it definitely is necessary. When I hand over a non-ntohl()'ed IP-address to LWIP_IF.ipAddr (used with lwIPInit()), my network interface comes up with wrong IP. Of course it's necessary for ip addresses to be in network byte order. However, you were talking about sntp.c. There's no netif setup in there. No but there I have to specify the IP of the NTP-server to communcate with. My assumption: when I have to ntohl() the netif-IP, I have to do that for the NTP-IP and the port-number too. Is this wrong? ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Handling in case of disabled Nagle
2014-12-08 19:47 GMT+01:00 goldsi...@gmx.de goldsi...@gmx.de: As it's always better to know than to guess, why don't you check wih wireshark? Simply because Wireshark does not work - it crashes on capturing. This is for sure a Windows-problem but it keeps me away from analysing this. But connection problems I described does not seem to have the same reason like this crash, I could do a (very quick) test on a different Windows PC, there I could observe the same. ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
[lwip-users] Handling in case of disabled Nagle
Hi, I found a strange problem related to Nagle-algorithm but possibly caused by host operating system. My application is as follows: - host sends payload data to my lwIP-driven device in packets of 1460 bytes - host sends state-requests to this device in packets of 3 bytes - device sends state-response in packets of 40 bytes to host (which is waiting for them asynchronously, means receiving is done in an own thread) Since all these packets have to be handled as fast as possible, I disabled Nagle on both ends (TCP_NODELAY on host side and tcp_nagle_disable() on device side). Now there is a situation where host sends state-requests (3 bytes) to device quite fast. Under Linux host is able to receive the related state-response (40 bytes) wihtout problems, unter Windows at some point no more data are received, it seems disabled Nagle-algorithm seems to stall the receiving-side when many packets are sent. From device-side it seems it is not possible to send these data (means even to queue them). Since it works smoothly with Linux I think that happens because Windows no longer accepts any packets so that the lwIP-internal buffer becomes full at some point. My current - really ugly - solution is to have a delay of at least 10 msec after submission of every send-request. This lets Windows receive the response without problems. My question: did anybody notice such a behaviour? Is there anything I can do to avoid this and to enforce lwIP to send the response also when there are many packages received? Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] poll-function not called
Just to complete this discussion: TI's support for their products is really very, very poor. There is simply no answer to my question why they have disabled it although the poll-callbacks are still there (not the first time that there is no response to users requests also in case of definitive bugs). So I'll try to do some hacks for my own according to your hints. ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] poll-function not called
OK, thanks, this leaded me into the correct direction: Texas Instrumetns has implemented full poll-functionality but they have set both NO_SYS and NO_SYS_NO_TIMERS to 1 which disables the timers completely. One of both seems to be wrong/superfluid for me... 2014-09-22 9:31 GMT+02:00 mobin.seven mobin.se...@live.com: Hi lad tcp_tmr() must be called every TCP_TMR_INTERVAL milliseconds.this is necessary for poll callback. -- View this message in context: http://lwip.100.n7.nabble.com/poll-function-not-called-tp23324p23326.html Sent from the lwip-users mailing list archive at Nabble.com. ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Context of poll and recv?
Sergio, reception is not the problem but transmission. Here I learned I can't enqueue data fgrom main loop directly. Meanwhile I'm setting a similar flag and collect all my data from within transmission IRQ context - which works fine. Karl 2014-09-17 15:03 GMT+02:00 Sergio R. Caprile scapr...@gmail.com: Hi Karl, I'm not trying to teach you how to do things, but I need to ask you if there is any reason why you can't rise a flag in your eth rx interrupt and run all lwIP code from the main loop ? (zero latency ?) Mine (sort of): void eth_input(ifc) { do { if(!flag) break; p = pbuf_alloc(); get frame; netif-input(p, ifc); } while(more frames); } main() { while(1){ eth_input(myeth); } } void rxint() { ack; set flag; } ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
[lwip-users] poll-function not called
Hi, I'm using lwIP 1.4.0 implementation that comes with Starterware for AM3358 from Texas Instruments. Thus I do not know that much about its exact implementation for used hardware. Now I found the poll-function is never called in TI's implementation. To track down the problem: where in lwIP is this this part implemented? Any hints/suggestion hwere to look at are welcome! Kind regards Karl ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] How to check send state?
2014-09-17 9:08 GMT+02:00 Simon Goldschmidt goldsi...@gmx.de: Currently I'm doing it as described at http://lwip.wikia.com/wiki/Raw/TCPin section Sending TCP data which seems to be wrong for my case... I only get an empty page with this link: This page needs content. You can help by adding a sentence or a photo. Sorry, it is http://lwip.wikia.com/wiki/Raw/TCP http://lwip.wikia.com/wiki/Raw/TCPin , I forgot the space between the link and the following word in. ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
[lwip-users] Context of poll and recv?
Hi, this is a follow-up to How to check send state? but I start a new discussion since it is a new question: I'm trying to enqueue some data into lwIP's send queue that are generated from within my applications main-loop (which is not allowed). Now my solution is to just set a flag and then fetch and enqueue the data out of lwIPs thread context. This is done once periodically within my poll-function (specified by tcp_poll()) and once immediately from within my recv-function (specified with tcp_recv()). My question: are both running in same IRQ-context or are they triggered by different ones so that filling the send buffer this way would lead to troubles too? A check if previously enqueued data are fully send of course is implemented. Thanks for all your kind help :-) ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] How to check send state?
OK, got it - thanks :-) 2014-09-17 11:10 GMT+02:00 Simon Goldschmidt goldsi...@gmx.de: Karl Karpfen wrote: Currently I'm doing it as described at http://lwip.wikia.com/wiki/Raw/TCPin section Sending TCP data which seems to be wrong for my case... There's nothing wrong with what's described at http://lwip.wikia.com/wiki/Raw/TCP. What's wrong is that your lwIP calls into lwIP from interrupt context and you call it from your main loop. This is not allowed, that's all. Simon ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Context of poll and recv?
Great, thanks! :-) :-) :-) 2014-09-17 12:16 GMT+02:00 Simon Goldschmidt goldsi...@gmx.de: Karl Karpfen wrote: [..] My question: are both running in same IRQ-context or are they triggered by different ones so that filling the send buffer this way would lead to troubles too? A check if previously enqueued data are fully send of course is implemented. That *totally* depends on your lwIP port. However, that port has to ensure lwIP code is not executed in parallel, so you should be safe (unless your port does not follow this rule). Simon ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] How to check send state?
I don't use any threads but plain, bare-metal programming. Here lwIP is running in context of the Ethernet-PHY-interrupt(s) while some data are pushed to lwIP from the main-loop. 2014-09-16 9:04 GMT+02:00 Simon Goldschmidt goldsi...@gmx.de: Karl Karpfen wrote: [..] My problem here: sentLength is manipulated out of interrupt context while checking it for completion is done out of main loop. That's a problem indeed. Seems like you are violating lwIP's threading requirements (search the list or the wiki, there are numerous post about it). Simon ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] How to check send state?
OK, so let me ask this in an different way: Currently I do have data to be sent available in main loop only. How can I enqueue these data into the lwIP-ISR-context correctly so that it can be transmitted without problems? Currently I'm doing it as described at http://lwip.wikia.com/wiki/Raw/TCPin section Sending TCP data which seems to be wrong for my case... 2014-09-16 17:20 GMT+02:00 Bill Auerbach bauerb...@arrayonline.com: Yeah, I should have kept reading. Sorry *From:* lwip-users-bounces+bauerbach=arrayonline@nongnu.org [mailto: lwip-users-bounces+bauerbach=arrayonline@nongnu.org] *On Behalf Of *Simon Goldschmidt *Sent:* Tuesday, September 16, 2014 9:51 AM *To:* Mailing list for lwIP users *Subject:* Re: [lwip-users] How to check send state? Bill, I appreciate you trying to teach programming basics, but I think this won't get Karl Karpfen further: sending from main-loop and receiving in interrupt just won't work with lwIP. Simon *Gesendet:* Dienstag, 16. September 2014 um 15:43 Uhr *Von:* Bill Auerbach bauerb...@arrayonline.com *An:* 'Mailing list for lwIP users' lwip-users@nongnu.org *Betreff:* Re: [lwip-users] How to check send state? Hi, Did you declare sentLength as volatile? You might also need to protect it if it’s not loaded/stored in a single processor instruction (not likely to be the case with a 32-bit architecture). Bill *From:* lwip-users-bounces+bauerbach=arrayonline@nongnu.org [ mailto:lwip-users-bounces+bauerbach=arrayonline@nongnu.org lwip-users-bounces+bauerbach=arrayonline@nongnu.org] *On Behalf Of *Karl Karpfen *Sent:* Monday, September 15, 2014 3:00 PM *To:* lwip-users@nongnu.org *Subject:* [lwip-users] How to check send state? Hi, within my lwIP application (TCP with permanent connection) I'm sending some data out of main-loop (no interrupt context) and start submission by calling tcp_output(currentPcb); Sending of data is done via tcp_write(). Within the send function itself amount of data already sent is stored in a variable sentLength. Now to find out if it is possible to send next bunch of data I check this variable. When its size is equal to the length of the previous data buffer, sending was completed and I start submission of next buffer. My problem here: sentLength is manipulated out of interrupt context while checking it for completion is done out of main loop. It seems this sometimes causes troubles, at receiver side I can see incomplete frames. So my question: what is the correct way to find out if currentPcb has finished sending (or better has pushed all data to tcp_write()) and is ready to accept next bunch of data? Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
[lwip-users] How to check send state?
Hi, within my lwIP application (TCP with permanent connection) I'm sending some data out of main-loop (no interrupt context) and start submission by calling tcp_output(currentPcb); Sending of data is done via tcp_write(). Within the send function itself amount of data already sent is stored in a variable sentLength. Now to find out if it is possible to send next bunch of data I check this variable. When its size is equal to the length of the previous data buffer, sending was completed and I start submission of next buffer. My problem here: sentLength is manipulated out of interrupt context while checking it for completion is done out of main loop. It seems this sometimes causes troubles, at receiver side I can see incomplete frames. So my question: what is the correct way to find out if currentPcb has finished sending (or better has pushed all data to tcp_write()) and is ready to accept next bunch of data? Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users