Skip to content

[BREAKING] Reverse SOFTWARE_ATTRIBUTE_OPT to avoid inverse logic - #1598

Merged
eakraly merged 3 commits into
coturn:masterfrom
eakraly:software_attr_default_off
Dec 13, 2024
Merged

eakraly merged 3 commits into
coturn:masterfrom
eakraly:software_attr_default_off

Conversation

@eakraly

@eakraly eakraly commented Nov 18, 2024 •

Copy link
Copy Markdown
Collaborator

As part of looking at #1588 , I figured that sending SOFTWARE attribute is also part of a problem as it increases messages sent out by coturn and thus increasing amplification factor. For 4.6.2, the additional size is 24 bytes (4 bytes attribute header, and 20 bytes for "Coturn-4.6.2 'Gorst'")

If we are to use an example from #1588, "A 62 byte request will be met with Coturn’s 401 Unauthorized response which is 150 bytes, a factor of ~2.42." - without SOFTWARE the response will be 126 bytes which reduces amplification factor to ~2.

As I observed with multiple providers using coturn - some of the are sending it. Meaning, they do not set --no-software-attribute - most probably due to lack of clarity about this setting.

I believe sending SOFTWARE_ATTRIBUTE should be off by default which is hinted in the RFC (https://datatracker.ietf.org/doc/html/rfc8489#section-16.1.2)

Detailed changes:

  • Extract setting the attribute into a function to avoid code duplication
  • This option is now not reloadable
  • The option is now called software_attribute because inverse logic creates multiple double-not in the code which makes it harder to read.
  • no-software_attribute is still functional but marked as deprecated in documentation

Test Plan:

  • Run local tests with different cli arguments (new and deprecated) and confirm SOFTWARE attribute is off by default, and added when arguments say so

Extract adding the attribute into a function to avoid code duplication
This option is now not reloadable
@eakraly

eakraly commented Nov 21, 2024

Copy link
Copy Markdown
Collaborator Author

This is a breaking change so delaying merging for a little

@eakraly
eakraly marked this pull request as ready for review December 13, 2024 05:33
@eakraly eakraly changed the title Reverse SOFTWARE_ATTRIBUTE_OPT to avoid inverse logic [BREAKING] Reverse SOFTWARE_ATTRIBUTE_OPT to avoid inverse logic Dec 13, 2024

const char *get_version(turn_turnserver *server) {
if (server && !*server->no_software_attribute) {
if (server && server->software_attribute) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're dropping a dereference on this line.

Was the dereference a bug?

@eakraly
eakraly merged commit 94fcfad into coturn:master Dec 13, 2024
@eakraly
eakraly deleted the software_attr_default_off branch December 13, 2024 17:28
chengpeng-wang pushed a commit to chengpeng-wang/coturn that referenced this pull request Mar 24, 2026
…urn#1598)

As part of looking at coturn#1588 , I figured that sending `SOFTWARE`
attribute is also part of a problem as it increases messages sent out by
coturn and thus increasing amplification factor. For 4.6.2, the
additional size is 24 bytes (4 bytes attribute header, and 20 bytes for
"Coturn-4.6.2 'Gorst'")

If we are to use an example from coturn#1588, "A 62 byte request will be met
with Coturn’s 401 Unauthorized response which is 150 bytes, a factor of
~2.42." - without SOFTWARE the response will be 126 bytes which reduces
amplification factor to ~2.

As I observed with multiple providers using coturn - some of the are
sending it. Meaning, they do not set `--no-software-attribute` - most
probably due to lack of clarity about this setting.

I believe sending SOFTWARE_ATTRIBUTE should be off by default which is
hinted in the RFC
(https://datatracker.ietf.org/doc/html/rfc8489#section-16.1.2)

Detailed changes:
- Extract setting the attribute into a function to avoid code
duplication
- This option is now not reloadable
- The option is now called `software_attribute` because inverse logic
creates multiple double-not in the code which makes it harder to read.
- `no-software_attribute` is still functional but marked as deprecated
in documentation

Test Plan:
- Run local tests with different cli arguments (new and deprecated) and
confirm SOFTWARE attribute is off by default, and added when arguments
say so
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.

2 participants