Re: [lwip-users] upgrade from 1.4.1 to 2.0.3

2018-03-08 Thread Mattia Settin
Hi
Thanks
Buh how is possible that: with an operative system sys_timeouts_mbox_fetch call
sys_check_timeouts() which is the handle timeouts for NO_SYS==1.
Is the comment of sys_check_timeouts()  wrong ?



On Thu, Mar 8, 2018 at 4:24 PM, Sylvain Rochet <grada...@gradator.net>
wrote:

> Hi Mattia,
>
> On Thu, Mar 08, 2018 at 09:14:33AM +0100, Mattia Settin wrote:
> > Yes, but sys_now is required even for timeouts for NO_SYS==0
> (LWIP_TIMERS =
> > 1). It this correct ?
>
> This is correct, sys_now() is now necessary for all systems, furthermore
> it should be bound, at best, to a monotonic clock source.
>
> Sylvain
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>



-- 
Mattia Settin
Software and System Engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] upgrade from 1.4.1 to 2.0.3

2018-03-08 Thread Mattia Settin
In addition I don't really get why
with NO_SYS = 0 (with FreeRTOS) sys_timeouts_mbox_fetch call
sys_check_timeouts() which is the handle timeouts for NO_SYS==1 (without OS)
Probably I have an too old port file for FreeRTOS.
Regards
m

On Thu, Mar 8, 2018 at 9:14 AM, Mattia Settin <mattia.set...@gmail.com>
wrote:

> Yes, but sys_now is required even for timeouts for NO_SYS==0 (LWIP_TIMERS
> = 1). It this correct ?
>
> On Wed, Mar 7, 2018 at 8:02 PM, goldsi...@gmx.de <goldsi...@gmx.de> wrote:
>
>> On 07.03.2018 17:40, Mattia Settin wrote:
>>
>>> [..]
>>> The question is:
>>> It is now mandatory define/use sys_now() ?
>>>
>>
>> You can do without, but a number of features new to 2.0.x (or improved
>> there) require it. Right now, the list is:
>> - timeouts for NO_SYS==1
>> - LWIP_SO_SNDTIMEO
>> - LWIP_SO_LINGER
>> - lwiperf app
>> - LWIP_TCP_TIMESTAMPS
>> - PPPoS
>>
>> This list can grow longer in the future. As such, we can't ifdef out the
>> prototype for these configs and it's always there. You can try without and
>> you'll get a linker error once you enable code which actually uses it.
>>
>> Simon
>>
>> _______
>> lwip-users mailing list
>> lwip-users@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/lwip-users
>>
>
>
>
> --
> Mattia Settin
> Software and System Engineer
>
>
>


-- 
Mattia Settin
Software and System Engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] upgrade from 1.4.1 to 2.0.3

2018-03-08 Thread Mattia Settin
Yes, but sys_now is required even for timeouts for NO_SYS==0 (LWIP_TIMERS =
1). It this correct ?

On Wed, Mar 7, 2018 at 8:02 PM, goldsi...@gmx.de <goldsi...@gmx.de> wrote:

> On 07.03.2018 17:40, Mattia Settin wrote:
>
>> [..]
>> The question is:
>> It is now mandatory define/use sys_now() ?
>>
>
> You can do without, but a number of features new to 2.0.x (or improved
> there) require it. Right now, the list is:
> - timeouts for NO_SYS==1
> - LWIP_SO_SNDTIMEO
> - LWIP_SO_LINGER
> - lwiperf app
> - LWIP_TCP_TIMESTAMPS
> - PPPoS
>
> This list can grow longer in the future. As such, we can't ifdef out the
> prototype for these configs and it's always there. You can try without and
> you'll get a linker error once you enable code which actually uses it.
>
> Simon
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>



-- 
Mattia Settin
Software and System Engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] upgrade from 1.4.1 to 2.0.3

2018-03-07 Thread Mattia Settin
Dear
I'm upgrading my application from from lwip 1.4.1 to 2.0.3 version.
My current configuration is
#define LWIP_TIMERS 1
#define LWIP_TIMERS_CUSTOM   0
#define NO_SYS  0
I note that
v. 2.0.3: timeouts_last_time is always define
v 1.4.1, timeouts_last_time no define (with NO_SYS = 0)
similar for sys_now().

The question is:
It is now mandatory define/use sys_now() ?
Regards
m
-- 
Mattia Settin
Software and System Engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] access to tcp_pcb data from socket+

2018-03-07 Thread Mattia Settin
Hi
For example I need to check the send buffer size (e.i. SO_SNDBUF) which is
not implemented options.
Regards

On Wed, Mar 7, 2018 at 10:55 AM, Mattia Settin <mattia.set...@gmail.com>
wrote:

> Hi
> Yes you are right but I don't need to touch the pcb, just some check on
> the pcb.
> getpeername  stores the address of the peer that is connected socket (it
> dosen't return the pcb structure).
> Which is the api for retrive the connection tcp data for a certain socket ?
> Thanks
> reagards
> m
>
>
> On Wed, Mar 7, 2018 at 10:26 AM, Jens Nielsen <d...@telia.com> wrote:
>
>> Hi
>>
>> The short answer is: don't. If you're using the socket api you're not
>> touching the pcb.
>>
>> What do you really want to do?  There are basically two options here
>>
>> a) Just like your question about getpeername, there's an api for that.
>> Google is your friend.
>> or
>> b) Since the beginning of time people have managed without it, in which
>> case you're probably doing something weird and you're probably on your own
>>
>> BR /Jens
>>
>>
>> On 2018-03-07 10:07, Mattia Settin wrote:
>>
>> Dear all
>> I developing an application wih lwip 2.0.3 using socket bsd.
>> The tcp server performs the following operation:
>> s = socket()
>> bind
>> accept //wait a new connection
>> read  //packet received
>>
>> I need to perform some check on the pcb data of my socket.
>> I note the get_socket is defined as static and the get_sockopt do not
>> return all data I need.
>> I solve adding following function in socket.c:
>> struct tcp_pcb * lwip_getsockpcb(int s)
>> {
>>   struct lwip_sock *sock = get_socket(s);
>>   if (!sock) {
>> return NULL;
>>   }
>>   return sock->conn->pcb.tcp;
>> }
>>
>> My question is:
>> how can acces to the tcp_pcb of my socket with out modify the library ?
>> Which is the smart way ?
>> Thank all
>> regard
>>
>>
>> --
>> Mattia Settin
>> Software and System Engineer
>>
>>
>>
>>
>> _______
>> lwip-users mailing 
>> listlwip-users@nongnu.orghttps://lists.nongnu.org/mailman/listinfo/lwip-users
>>
>>
>>
>> ___
>> lwip-users mailing list
>> lwip-users@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/lwip-users
>>
>
>
>
> --
> Mattia Settin
> Software and System Engineer
>
>
>


-- 
Mattia Settin
Software and System Engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] access to tcp_pcb data from socket+

2018-03-07 Thread Mattia Settin
Hi
Yes you are right but I don't need to touch the pcb, just some check on the
pcb.
getpeername  stores the address of the peer that is connected socket (it
dosen't return the pcb structure).
Which is the api for retrive the connection tcp data for a certain socket ?
Thanks
reagards
m


On Wed, Mar 7, 2018 at 10:26 AM, Jens Nielsen <d...@telia.com> wrote:

> Hi
>
> The short answer is: don't. If you're using the socket api you're not
> touching the pcb.
>
> What do you really want to do?  There are basically two options here
>
> a) Just like your question about getpeername, there's an api for that.
> Google is your friend.
> or
> b) Since the beginning of time people have managed without it, in which
> case you're probably doing something weird and you're probably on your own
>
> BR /Jens
>
>
> On 2018-03-07 10:07, Mattia Settin wrote:
>
> Dear all
> I developing an application wih lwip 2.0.3 using socket bsd.
> The tcp server performs the following operation:
> s = socket()
> bind
> accept //wait a new connection
> read  //packet received
>
> I need to perform some check on the pcb data of my socket.
> I note the get_socket is defined as static and the get_sockopt do not
> return all data I need.
> I solve adding following function in socket.c:
> struct tcp_pcb * lwip_getsockpcb(int s)
> {
>   struct lwip_sock *sock = get_socket(s);
>   if (!sock) {
> return NULL;
>   }
>   return sock->conn->pcb.tcp;
> }
>
> My question is:
> how can acces to the tcp_pcb of my socket with out modify the library ?
> Which is the smart way ?
> Thank all
> regard
>
>
> --
> Mattia Settin
> Software and System Engineer
>
>
>
>
> ___
> lwip-users mailing 
> listlwip-users@nongnu.orghttps://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>



-- 
Mattia Settin
Software and System Engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] access to tcp_pcb data from socket+

2018-03-07 Thread Mattia Settin
Dear all
I developing an application wih lwip 2.0.3 using socket bsd.
The tcp server performs the following operation:
s = socket()
bind
accept //wait a new connection
read  //packet received

I need to perform some check on the pcb data of my socket.
I note the get_socket is defined as static and the get_sockopt do not
return all data I need.
I solve adding following function in socket.c:
struct tcp_pcb * lwip_getsockpcb(int s)
{
  struct lwip_sock *sock = get_socket(s);
  if (!sock) {
return NULL;
  }
  return sock->conn->pcb.tcp;
}

My question is:
how can acces to the tcp_pcb of my socket with out modify the library ?
Which is the smart way ?
Thank all
regard


-- 
Mattia Settin
Software and System Engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] static get_socket

2018-03-06 Thread Mattia Settin
Dear
Yes, you are rigth, it was not a lwip question.
Sorry for that
Thank for your replay.
Regards
m

On Mon, Mar 5, 2018 at 7:52 PM, goldsi...@gmx.de <goldsi...@gmx.de> wrote:

> On 05.03.2018 14:41, Mattia Settin wrote:
>
>>
>> Dear All,
>> I need to know the remote ip (remote_ip) of a speficif socket.
>> Now i call the get_socket (removing the static attribute) and then point
>> to the remote_ip:
>> psock = get_socket(index);
>> psock->conn->pcb.tcp->remote_ip.addr;
>> The bad thing is that I need to modify the lwip library.
>> anyone knows how to get the remote_ip give the socket or index ?
>>
>
> This is not an lwIP specific question. It's a socket API question. And the
> answer 'getpeername' is valid for (nearly?) all implementations of the
> socket API.
>
> Simon
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>



-- 
Mattia Settin
Software and System Engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] static get_socket

2018-03-05 Thread Mattia Settin
Dear All,
I need to know the remote ip (remote_ip) of a speficif socket.
Now i call the get_socket (removing the static attribute) and then point to
the remote_ip:
psock = get_socket(index);
psock->conn->pcb.tcp->remote_ip.addr;
The bad thing is that I need to modify the lwip library.
anyone knows how to get the remote_ip give the socket or index ?
thank all
regards



-- 
Mattia Settin
Software and System Engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] NETIF_FLAG_DHCP flag removed

2018-02-12 Thread Mattia Settin
Dear all
I upgrading my system from lwip 1.4.1 to 2.0.3.
I note that the NETIF_FLAG_DHCP flag was removed.
Unfortunately I can find any note in the change log.
Do you have idea how maintain the flags (i.e. previus compatibily) ?
Thank you
regards
m


Mattia Settin
Inviato da iPhone

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] lwip 2.0.0 ping issue via IPv6 on stm32

2017-11-17 Thread Mattia Settin
Hi,
Set static ip configuration and then check the subnet mask.
m


On Fri, Nov 17, 2017 at 7:33 AM, meera <mee...@glidemtech.com> wrote:

> Hello team,
>
> I want to ping my stm32 via ipv6. for that i have
> tried dhcp and static ip assign tasks, but ipv6 not working on stm32.
> Please help me as soon as possible. Please desibe with lwipopt.h and lwip.c
> for ipv6 configuratins.
>
>  Thanks in advance.
>
> --
> Meera Shah Embedded software developer Glide Technology Pvt. Ltd.
> www.glidemtech.com cid:image001.png@01D2BAAB.64870570
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users




-- 
Mattia Settin
System engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] lwip 1.4.1 send a sporadic RST ACK

2017-10-24 Thread Mattia Settin
Yes
The main problem was related that the tcp_kill_prio() kills the active pcb
with a priority equals to the pcb passaed in input.
For my specific web server application, this lead to send a (sporadic) RST
ACK to the client, when the tcp_alloc fails to allocate new connection.
br


On Tue, Oct 24, 2017 at 4:34 PM, Axel Lin <axel@ingics.com> wrote:

> 2017-10-24 16:37 GMT+08:00 Axel Lin <axel@ingics.com>:
> > 2017-10-24 1:13 GMT+08:00 Mattia Settin <mattia.set...@gmail.com>:
> >> Dear all
> >> After a week of debugging I finally find the issue. The problem is
> related to priority in pcb.
> >> Taking a deep look I saw that the priority in the stack 1.4.1 is
> change, in particular:
> >> Tcp_alloc return e pcb with a prior equal to the prior passed in input.
> >> Tcp_listen_with_backlog return e pcb with a prior equal to the
> pcb.prior passed in input.
> >> This two changes lead to a sporadic RST ACK call from the kill_prio
> routine.
> >> Finally I fix this issue removing the equal condition in the kill_prio
> function.
> >
> > The comment on the code seems confusion for "the same priority case":
> > (I check the latest git tree)
> >
> > Th comment on the caller:
> >   /* Try killing active connections with lower priority than
> > the new one. */
> >   LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing connection with
> > prio lower than %d\n", prio));
> >   tcp_kill_prio(prio);
> >
> > But the comment on tcp_kill_prio() function:
> > /**
> >  * Kills the oldest active connection that has the same or lower
> priority than
> >  * 'prio'.
>
> The comment for tcp_kill_prio() is updated by:
> commit 6a4c30fe5d65 fixed bug #31723 (tcp_kill_prio() kills pcbs with
> the same prio) by updating its documentation only
>
> And take a look at bug #31723: tcp_kill_prio() kills pcbs with the same
> prio
>
> According to its documentation, tcp_kill_prio() kills "the oldest
> active connection that has lower priority than prio". However, the
> current code also kills connections with a priority equal to 'prio'.
> We should either change the documentation or the implementation.
> The downside of the current implementation is that every call to
> tcp_new() can lead to aborting an old (active) connection.
> This has been in there since revision 1.1 of tcp.c, so changing it
> might involve changing applications relying on this (like I have one
> :).
>
> I'm wondering if it should change the implementation rather than the
> documentation.
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>



-- 
Mattia Settin
System engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] lwip 1.4.1 send a sporadic RST ACK

2017-10-24 Thread Mattia Settin
Perfectly agree :)

On Tue, Oct 24, 2017 at 10:37 AM, Axel Lin <axel@ingics.com> wrote:

> 2017-10-24 1:13 GMT+08:00 Mattia Settin <mattia.set...@gmail.com>:
> > Dear all
> > After a week of debugging I finally find the issue. The problem is
> related to priority in pcb.
> > Taking a deep look I saw that the priority in the stack 1.4.1 is change,
> in particular:
> > Tcp_alloc return e pcb with a prior equal to the prior passed in input.
> > Tcp_listen_with_backlog return e pcb with a prior equal to the pcb.prior
> passed in input.
> > This two changes lead to a sporadic RST ACK call from the kill_prio
> routine.
> > Finally I fix this issue removing the equal condition in the kill_prio
> function.
>
> The comment on the code seems confusion for "the same priority case":
> (I check the latest git tree)
>
> Th comment on the caller:
>   /* Try killing active connections with lower priority than
> the new one. */
>   LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing connection with
> prio lower than %d\n", prio));
>   tcp_kill_prio(prio);
>
> But the comment on tcp_kill_prio() function:
> /**
>  * Kills the oldest active connection that has the same or lower priority
> than
>  * 'prio'.
>
> _______
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>



-- 
Mattia Settin
System engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] lwip 1.4.1 send a sporadic RST ACK

2017-10-23 Thread Mattia Settin
Dear all
After a week of debugging I finally find the issue. The problem is related to 
priority in pcb.
Taking a deep look I saw that the priority in the stack 1.4.1 is change, in 
particular:
Tcp_alloc return e pcb with a prior equal to the prior passed in input.
Tcp_listen_with_backlog return e pcb with a prior equal to the pcb.prior passed 
in input.
This two changes lead to a sporadic RST ACK call from the kill_prio routine.
Finally I fix this issue removing the equal condition in the kill_prio function.
Best regards 


Mattia Settin
Inviato da iPhone


> Il giorno 20 ott 2017, alle ore 14:41, Sergio R. Caprile <scapr...@gmail.com> 
> ha scritto:
> 
> Sorry, I don't follow.
> Can you please post a traffic capture and your detailed usage ?
> API = ?
> httpd = ? contrib ? RAW or netconn ? did you modify ?
> port = STM32; your own or buggy cube ?
> NO_SYS = ?
> 
> 
> ___
> 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] lwip 1.4.1 send a sporadic RST ACK

2017-10-20 Thread Mattia Settin
Dear
The system is compose by:
1. Web server running on STM32 microncontroller with httpd server and lwip
1.4.1.
2. Web client Chrome.
I note with the lwip 1.4.1 stack the tcp_alloc call the tcp_kill_prio and
there is a active pcb to be killed.
This lead to call the abort/abandon routine and so send a RST ACK to the
client (because the pcb appear to be in established state).
Stange think: with the stack 1.3.2 this never appear (e.g. the
tcp_kill_prio function never kill the oldest active connection that has
lower priority than prio).
>From 1.3.2 to 1.4.1 I have port (as it) the lwipopts.h config file.
did anyone have the same problem?
Any idea or solution?
regards.

-- 
Mattia Settin
System engineer
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users