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

Forwarding random port with upnpc #700 #810

Conversation

apoorv-2204
Copy link
Contributor

Description

We chose a random port , from a list of unassigned ports as per IANA.

Fixes

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Manual
image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@apoorv-2204 apoorv-2204 added the networking Involve networking label Jan 5, 2023
@apoorv-2204 apoorv-2204 self-assigned this Jan 5, 2023
@apoorv-2204 apoorv-2204 marked this pull request as ready for review January 5, 2023 15:33
lib/archethic/networking/port_forwarding.ex Outdated Show resolved Hide resolved
lib/archethic/networking/port_forwarding.ex Outdated Show resolved Hide resolved
Copy link
Member

@samuelmanzanera samuelmanzanera left a comment

Choose a reason for hiding this comment

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

Code seems ok for me

@bchamagne
Copy link
Member

bchamagne commented Jan 6, 2023

I see some functions that use this code are completely ignoring the random port:
ex: Archethic.Networking.Scheduler.open_ports

Not an issue, I didn't notice the force = false flag.

@bchamagne
Copy link
Member

bchamagne commented Jan 6, 2023

what about HTTP(S) port, you don't want to open random port for them (ex: ArchethicWeb.Supervisor.init)

Not an issue, I didn't notice the force = false flag.

@samuelmanzanera
Copy link
Member

@apoorv-2204 Could you check why the CI is not passing ?

@apoorv-2204
Copy link
Contributor Author

@apoorv-2204 Could you check why the CI is not passing ?

Thanks for pointing it out

Copy link
Member

@Neylix Neylix left a comment

Choose a reason for hiding this comment

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

On line 21 of PortForwarding module, if the function do_try_open_port return an error, the fallback is never called so the random port is never published

@apoorv-2204
Copy link
Contributor Author

apoorv-2204 commented Jan 11, 2023

On line 21 of PortForwarding module, if the function do_try_open_port return an error, the fallback is never called so the random port is never published

{:ok, port} <- do_try_open_port(port) do
      {:ok, port}

@Neylix Neylix merged commit e103d9a into archethic-foundation:develop Jan 12, 2023
@apoorv-2204 apoorv-2204 deleted the forwarding_random_port_with_upnpc_#700 branch January 13, 2023 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
networking Involve networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants