-
-
Notifications
You must be signed in to change notification settings - Fork 422
Description
I noticed that after negotiating sctp ports different from 5000 (to get nicer filtering in wireshark) this library stopped opening datachannels. This is caused by this function:
pub(crate) fn send_init(&mut self) -> Result<()> {
if let Some(stored_init) = self.stored_init.clone() {
log::debug!("[{}] sending INIT", self.name);
self.source_port = 5000; // Spec??
self.destination_port = 5000; // Spec??
let outbound = Packet {
source_port: self.source_port,
destination_port: self.destination_port,
verification_tag: 0,
chunks: vec![Box::new(stored_init)],
};
self.control_queue.push_back(outbound);
self.awake_write_loop();
Ok(())
} else {
Err(Error::ErrInitNotStoredToSend)
}
}
Which causes an init on the wrong ports, which results in an abort later on.
I think this can be fixed rather easily by passing the negotiated ports to this function. This is (outside of tests) only called from start_sctp
which in turn is only called here:
if let Some(parsed) = &remote_desc.parsed {
if have_application_media_section(parsed) {
self.start_sctp().await;
}
}
Instead of just checking if there is an application section in the remote description this could look at both the remote and local description to get the correct sctp ports and pass them to this function down to the sctp transport via two new fields in the sctp::association::Config
struct.
I'd be willing to make a PR, just wanted to get your opinions first.