multipass icon indicating copy to clipboard operation
multipass copied to clipboard

[network] Bridges with long names use hash suffix

Open levkropp opened this issue 3 months ago • 1 comments

This pull request introduces a new strategy for generating bridge names in the Linux backend to ensure uniqueness when interface names are long by truncating long interface names and appending a short hash. This ensures that bridge names are both readable and unique.

  • Updated the bridge creation logic in create_bridge_with to use the new generate_bridge_name function, replacing the previous simple truncation method.
  • Added QCryptographicHash includes to both backend_utils.cpp and test_backend_utils.cpp to support the new hashing logic for bridge name generation.

Originally:

  • eth123456789abcbr-eth123456789 (truncated to 15 chars)
  • eth123456789xyzbr-eth123456789 (same name - collision)

With the fix:

  • eth123456789abcbr-eth12345-8f9 (unique hash suffix)
  • eth123456789xyzbr-eth12345-a2c (different hash - no collision)

Short names (unchanged, fully readable):

  • eth0br-eth0
  • wlan0br-wlan0
  • enp0s3br-enp0s3

resolves #2158

levkropp avatar Oct 09 '25 16:10 levkropp

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 89.39%. Comparing base (96a02d6) to head (4a070df). :warning: Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4422   +/-   ##
=======================================
  Coverage   89.39%   89.39%           
=======================================
  Files         253      253           
  Lines       16457    16468   +11     
=======================================
+ Hits        14711    14722   +11     
  Misses       1746     1746           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Oct 09 '25 17:10 codecov[bot]