P1sec / pysctp

SCTP stack for Python
http://www.p1sec.com
161 stars 67 forks source link

SCTP keeps trying to socket-connect with a dummy IP for hours before it times out. #31

Closed veyselserifoglu closed 4 years ago

veyselserifoglu commented 4 years ago

I am trying to use SCTP to transfer data between two parties, however, whenever my IPs are incorrect, it stuck. So I don't know if the protocol keeps listening till it finds the IP on the network and it will never time out.

OR when it gets stuck, that means there is a problem with the socket implementation approach or the protocol itself.

Looking forward to hearing your insights.

RubenKelevra commented 4 years ago

Do you try to connect via routers or is this a switched network?

veyselserifoglu commented 4 years ago

Actually my local is hosting both the client-side and server-side. Whenever I insert a dummy IP, it keeps-alive for a long time. And I couldn't find any relevant files where I can change the needed parameters.

RubenKelevra commented 4 years ago

So you're running this connection attempt towards an IP which is within a your local IP range?

The host should try to find the IP via NDP (or ARP in case of use legacy IP). The default timeout for connection attempts and the default timeout in between is usually set by the OS. If the OS has completed to retry and wait it will notify the stack above.

I'm not that familiar with these options, you may want to read the docs yourself.

veyselserifoglu commented 4 years ago

When I insert any IP within my local IP range, it works fine. However, whenever I insert any IP that is out of my local IP range, it gets stuck.

I might have solved this issue actually. Almost all SCTP parameters' files are located within the following path; /proc/sys/net/sctp where I found this file "max_init_retransmits" that contains the parameter responsible for this keep-attempting to connect with unreachable IPs. For further info, you may wanna read this file I followed; https://linux.die.net/man/7/sctp

RubenKelevra commented 4 years ago

Yeah I've read that file before I answered, but wasn't sure which value would work for your scenario. :)