Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ggarber
Copy link
Contributor

@ggarber ggarber commented May 31, 2025

This commit introduces a new configuration option, send-error-reason. When enabled, the TURN server will send STUN error responses with an reason phrase. By default it wont send the error reason so it is a change in the default behaviour.

Changes include:

  • Added send_error_reason to the turn_params_t struct.
  • Modified mainrelay.c to parse the --no-error-reason command-line option and corresponding configuration file setting.
  • Updated ns_turn_server.c to check this flag and conditionally omit the reason phrase when constructing error responses.
  • Added the new option to the example turnserver.conf file.
  • Conceptually outlined test cases for this new functionality.

google-labs-jules bot and others added 3 commits May 31, 2025 11:48
This commit introduces a new configuration option, `no-error-reason`.
When enabled, the TURN server will send STUN error responses with an
empty reason phrase. This can be useful in environments where minimizing
response size is critical, at the cost of slightly harder debugging.

Changes include:
- Added `no_error_reason` to the `turn_params_t` struct.
- Modified `mainrelay.c` to parse the `--no-error-reason` command-line
  option and corresponding configuration file setting.
- Updated `ns_turn_server.c` to check this flag and conditionally
  omit the reason phrase when constructing error responses.
- Added the new option to the example `turnserver.conf` file.
- Conceptually outlined test cases for this new functionality.
This commit changes the server's default behavior to omit STUN error
reason phrases in responses. A new option, `--send-error-reason` (and
corresponding config file setting `send-error-reason`), is introduced
to enable the inclusion of these reason phrases if desired.

This change aims to reduce response size by default, while still
allowing you to enable more verbose error messages for debugging.

Changes include:
- Renamed `no_error_reason` to `send_error_reason` in `turn_params_t`.
- Default for `send_error_reason` is now `false` (reasons omitted).
- Command-line option changed to `--send-error-reason` to enable reasons.
- Updated `mainrelay.c` for new option name, logic, and usage string.
- Updated all `turnserver.conf` files (`examples/etc/turnserver.conf`,
  `docker/coturn/turnserver.conf`) to reflect the new option and default.
- Adjusted conceptual test cases for the new default behavior.
- Partially updated `ns_turn_server.c` to use the new
  `send_error_reason` flag. Due to some limitations I encountered, a full update
  to `ns_turn_server.c` could not be reliably completed and will
  require your manual review and completion to ensure all error generation
  sites correctly adhere to the `send_error_reason` flag (sending
  reasons only when it's true).
This commit implements the `send_error_reason` option. When
`send_error_reason` is set to `false`, the TURN server will now send an
empty reason phrase ("") in STUN error responses. If `send_error_reason`
is `true` (the default behavior), the original error reason phrase will
be sent.

This change affects how error conditions are communicated to clients,
allowing for configurations where detailed error reasons are suppressed.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@ggarber
Copy link
Contributor Author

ggarber commented Jun 9, 2025

Still some work pending, i´ll try to remove the reason completely instead of leaving it empty. I saw that in Cloudflare implementation so it looks safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant