Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S2S DNS discovery fix #4278

Merged
merged 4 commits into from
May 22, 2024
Merged

S2S DNS discovery fix #4278

merged 4 commits into from
May 22, 2024

Conversation

jacekwegr
Copy link
Contributor

@jacekwegr jacekwegr commented May 15, 2024

This PR fixes an issue with S2S connections using DNS discovery where connecting to another server would fail. The root cause was that inet_res:getbyname/3 returns a DNS type instead of the expected inet type needed for establishing connection. The updated logic now includes a proper lookup for the correct inet type to ensure successful connections.

Previously, the Erlang documentation did not clearly specify this behavior, which could be misleading. More details can be found here: erlang/otp#5803.

Testing was performed by mocking the appropriate inet functions. An alternative solution could involve setting up a local DNS server or using external tools like dnsmasq to set up a lightweight DNS resolver. However, this would require installing additional dependencies in the CI environment, so mocking was chosen as a simpler solution.

@mongoose-im

This comment was marked as outdated.

Copy link

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 84.46%. Comparing base (e0b6504) to head (edf9530).
Report is 25 commits behind head on master.

Files Patch % Lines
src/ejabberd_s2s_out.erl 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4278      +/-   ##
==========================================
+ Coverage   84.42%   84.46%   +0.04%     
==========================================
  Files         553      553              
  Lines       33582    33591       +9     
==========================================
+ Hits        28352    28374      +22     
+ Misses       5230     5217      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mongoose-im

This comment was marked as outdated.

@jacekwegr jacekwegr marked this pull request as ready for review May 15, 2024 12:11
@jacekwegr jacekwegr changed the title DNS discovery fix S2S DNS discovery fix May 15, 2024
src/ejabberd_s2s_out.erl Outdated Show resolved Hide resolved
big_tests/tests/s2s_SUITE.erl Outdated Show resolved Hide resolved
@mongoose-im
Copy link
Collaborator

mongoose-im commented May 22, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / edf9530
Reports root/ big
OK: 437 / Failed: 0 / User-skipped: 43 / Auto-skipped: 0


small_tests_25 / small_tests / edf9530
Reports root / small


small_tests_26 / small_tests / edf9530
Reports root / small


small_tests_26_arm64 / small_tests / edf9530
Reports root / small


ldap_mnesia_25 / ldap_mnesia / edf9530
Reports root/ big
OK: 2288 / Failed: 0 / User-skipped: 897 / Auto-skipped: 0


dynamic_domains_mysql_redis_26 / mysql_redis / edf9530
Reports root/ big
OK: 4510 / Failed: 0 / User-skipped: 144 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / edf9530
Reports root/ big
OK: 4543 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / edf9530
Reports root/ big
OK: 2288 / Failed: 0 / User-skipped: 897 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / edf9530
Reports root/ big
OK: 4540 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / edf9530
Reports root/ big
OK: 4543 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / edf9530
Reports root/ big
OK: 2428 / Failed: 0 / User-skipped: 757 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / edf9530
Reports root/ big
OK: 4460 / Failed: 0 / User-skipped: 178 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / edf9530
Reports root/ big
OK: 4934 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / edf9530
Reports root/ big
OK: 4913 / Failed: 0 / User-skipped: 139 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / edf9530
Reports root/ big
OK: 4931 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / edf9530
Reports root/ big
OK: 4934 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0

Copy link
Collaborator

@NelsonVides NelsonVides left a comment

Choose a reason for hiding this comment

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

Excellent, thank you so much for fixing this!

@NelsonVides NelsonVides merged commit e5daeaf into master May 22, 2024
4 checks passed
@NelsonVides NelsonVides deleted the dns-discovery-fix branch May 22, 2024 10:21
@jacekwegr jacekwegr added this to the 6.3.0 milestone Oct 3, 2024
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.

3 participants