Bug 1562341 Comment 28 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Oh! I have it working in my server with this change!

```diff
 			// Set SCTP_ENABLE_STREAM_RESET.
 			struct sctp_assoc_value av;

-			av.assoc_value = SCTP_ENABLE_RESET_STREAM_REQ;
+			av.assoc_value = SCTP_ENABLE_RESET_STREAM_REQ | SCTP_ENABLE_RESET_ASSOC_REQ | SCTP_ENABLE_CHANGE_ASSOC_REQ;
 
 			ret = usrsctp_setsockopt(this->socket, IPPROTO_SCTP, SCTP_ENABLE_STREAM_RESET, &av, sizeof(av));

```

In fact I see this in the logs:

```
mediasoup:worker RTC::SctpAssociation::OnUsrSctpReceiveSctpNotification() | SCTP association connected, streams [in:16, out:2048]
mediasoup:worker RTC::SctpAssociation::OnUsrSctpReceiveSctpNotification() | SCTP stream changed, streams [in:32, out:2048, flags:0]
```

Now I see that `datachannel.readyState` becomes "open" :)

So basically `SCTP_ENABLE_CHANGE_ASSOC_REQ` is required as per https://tools.ietf.org/html/rfc6525#section-6.3:

> SCTP_ENABLE_CHANGE_ASSOC_REQ:  Process received Add Outgoing
>         Streams Requests if this flag is set; deny them if not.
Oh! I have it working in my server with this change!

```diff
  // Set SCTP_ENABLE_STREAM_RESET.
  struct sctp_assoc_value av;

-  av.assoc_value = SCTP_ENABLE_RESET_STREAM_REQ;
+  av.assoc_value = SCTP_ENABLE_RESET_STREAM_REQ | SCTP_ENABLE_RESET_ASSOC_REQ | SCTP_ENABLE_CHANGE_ASSOC_REQ;
 
  ret = usrsctp_setsockopt(this->socket, IPPROTO_SCTP, SCTP_ENABLE_STREAM_RESET, &av, sizeof(av));
```

In fact I see this in the logs:

```
mediasoup:worker RTC::SctpAssociation::OnUsrSctpReceiveSctpNotification() | SCTP association connected, streams [in:16, out:2048]
mediasoup:worker RTC::SctpAssociation::OnUsrSctpReceiveSctpNotification() | SCTP stream changed, streams [in:32, out:2048, flags:0]
```

Now I see that `datachannel.readyState` becomes "open" :)

So basically `SCTP_ENABLE_CHANGE_ASSOC_REQ` is required as per https://tools.ietf.org/html/rfc6525#section-6.3:

> SCTP_ENABLE_CHANGE_ASSOC_REQ:  Process received Add Outgoing
>         Streams Requests if this flag is set; deny them if not.
Oh! I have it working in my server with this change!

```diff
  // Set SCTP_ENABLE_STREAM_RESET.
  struct sctp_assoc_value av;

-  av.assoc_value = SCTP_ENABLE_RESET_STREAM_REQ;
+  av.assoc_value = SCTP_ENABLE_RESET_STREAM_REQ | SCTP_ENABLE_RESET_ASSOC_REQ | SCTP_ENABLE_CHANGE_ASSOC_REQ;
 
  ret = usrsctp_setsockopt(this->socket, IPPROTO_SCTP, SCTP_ENABLE_STREAM_RESET, &av, sizeof(av));
```

In fact I see this in the logs:

```
mediasoup:worker RTC::SctpAssociation::OnUsrSctpReceiveSctpNotification() | SCTP association connected, streams [in:16, out:2048]
mediasoup:worker RTC::SctpAssociation::OnUsrSctpReceiveSctpNotification() | SCTP stream changed, streams [in:32, out:2048, flags:0]
```

Now I see that `datachannel.readyState` becomes "open" :)

So basically `SCTP_ENABLE_CHANGE_ASSOC_REQ` is required as per https://tools.ietf.org/html/rfc6525#section-6.3:

> SCTP_ENABLE_CHANGE_ASSOC_REQ:  Process received Add Outgoing
>         Streams Requests if this flag is set; deny them if not.

Since this issue was originally reported for Janus, the problem is that Janus does [this](https://github.com/meetecho/janus-gateway/blob/master/sctp.c#L203):

```c
av.assoc_value = 1;
```

so it's just enabling `SCTP_ENABLE_RESET_STREAM_REQ` but it's not enabling `SCTP_ENABLE_CHANGE_ASSOC_REQ`.

Back to Bug 1562341 Comment 28