tass-belgium / picotcp

PicoTCP is a free TCP/IP stack implementation
Other
1.18k stars 219 forks source link

Usage of two sockets with same port on two interfaces #398

Open fjullien opened 8 years ago

fjullien commented 8 years ago

I may have miss something but it looks like picoTCP can't handle two sockets on two different physical interfaces using the same port.

Seems like we should have TCP and UDP tables per interfaces (https://github.com/tass-belgium/picotcp/blob/master/stack/pico_socket.c#L391).

matthiasvp commented 8 years ago

Hi @fjullien, picoTCP can handle multiple sockets on different interfaces with the same port. In the TCP and UDP tables struct pico_sockport entries are stored. Each struct pico_sockport contains a protocol, port number and a tree with sockets matching these.(see here) When a new socket is added with the same port number and protocol of an already existing socket it will be added to the same struct pico_sockport entry in the TCP or UDP table.(see here)

fjullien commented 8 years ago

Ok, it was a wild guess since I was using this configuration and it was a complete mess. Then I change one of the two ports and everything worked much better. I did not try to find what the problem was.