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

2018-03-07 Thread goldsi...@gmx.de

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


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

2018-03-07 Thread Joel Cunningham



On 03/07/2018 04:05 AM, Mattia Settin wrote:

Hi
For example I need to check the send buffer size (e.i. SO_SNDBUF) 
which is not implemented options.

Regards

Setting the send buffer size at run-time is not supported. We have a 
compile time setting TCP_SND_BUF for that.  Are you wanting to only get 
the current send buffer size?  I'm curious what the use case is.  You 
can easily use non-blocking sockets and an application specific write 
buffer. TCP will then copy as much as it can to fill the send buffer and 
return a partial write.
On Wed, Mar 7, 2018 at 10:55 AM, Mattia Settin 
> 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 > 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 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





-- 
Mattia Settin

Software and System Engineer





--
Mattia Settin
Software and System Engineer


Joel


___
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] tcp communication problem with server and client on different subnets

2018-03-07 Thread Sergio R. Caprile
Besides the advice given by Simon, have you even tried the obvious and 
basics of networking ?
The way you phrase makes me think you are not comfortable with the 
secret arts of networking, so...


If your devices are on different subnets, they are in different 
networks. Subnet or no subnet, when you apply your mask to your IP and 
to the other end IP and the results are not the same, you need someone 
else to deliver the message. Yes, a router.
Perhaps you forgot you need a router or forgot to properly set the 
gateway address or the mask, or both. Since you didn't post your setup, 
I'm guessing
A "communication problem with X and Y on different subnets" is a routing 
problem. Yes, there can be a firewall, not quite common on inside 
networks, but you must know your company/lab/whatever network if you 
plan to do tests in there.

Have you even tried to ping ?

First of all, as Simon said, you need to see what your device gets and 
sends in the wire. I guess you did that at the other end. In the good 
old days we used to use hubs. A hub connects all ports together, so you 
are able to see other people's traffic, and that includes a notebook 
sniffing your lwIP box. If you are fortunate enough, perhaps you can get 
one. I saved a couple for these tasks. They are 10baseT, so perhaps some 
hardware won't like them, but working in 10Mbps is great for finding 
driver errors on the tx side.
Today we use switches. Some people invest some extra bucks on a switch 
with monitor capability: you connect your PC to the monitor port and 
then you monitor the lwIP device port, in order to sniff its traffic.
Other thing you can do is run your stuff on a PC, with a tap interface, 
that is, your lwIP stack and application run as a process on your 
computer and you see it as an extra interface. I use the Unix example 
app that is in the contrib tree. This way I can easily sniff on that 
TUN/TAP interface.
Other tool you might have available is the router itself. Some of them 
have a sort of tcpdump capability.
And finally, I'm running out of ideas today, you can put a breakpoint 
somewhere in the interface code and check if the stack is getting the 
SYN or trying to send the ACK to whereverland.


___
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 
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  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  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

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

2018-03-07 Thread Jens Nielsen

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 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] 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