P1sec / pysctp

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

Source address and add new address #41

Open KatanaBit opened 2 years ago

KatanaBit commented 2 years ago

Hello, who can tell me how to set a new source address, and how to add new addresses to the created association so that they can be seen by the remote party? Thank you in advance

p1-bmu commented 2 years ago

It's probably bindx() that you are looking for:

In [9]: from sctp import *                                                                                                                                

In [10]: sctpsocket.bindx?                                                                                                                                
Signature: sctpsocket.bindx(self, sockaddrs, action=1)
Docstring:
Binds to a list of addresses. This method() allows to bind to any subset 
of available interfaces, while standard bind() allows only one specific
interface, or all of them using the INADDR_ANY pseudo-address. Also, it
allows to *remove* the binding from one or more addresses.

If you don't need the extended functionality of bindx(), standard bind()
can be used and works as expected for SCTP.

Parameters:

sockaddr: List of (address, port) tuples.
action: BINDX_ADD or BINDX_REMOVE. Default is BINDX_ADD.

bindx() raises an exception if bindx() is not successful.
File:      /usr/local/lib/python3.8/dist-packages/pysctp-0.7.1-py3.8-linux-x86_64.egg/sctp.py
Type:      function
KatanaBit commented 2 years ago

Can I trigger sending an event directly? Let's say after creating an association at one point in time I decided to add new addresses using the method bindx() (notifications about adding addresses are not automatically sent), how do I notify the remote party in this situation that I have added a new address?

p1-bmu commented 2 years ago

There are many configuration possible regarding events and notification in the SCTP kernel API, which are wrapped by pysctp. Unfortunately I don't know how do solve your issue. In case you find a way to trigger such notifications to the remote peer, please keep us updated. I guess you have to dig in the SCTP kernel API, and then in the docstrings provided in pysctp to see how to call it.

KatanaBit commented 2 years ago

Then I will look, thanks for the help