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

[enh] UPNP: various fixes and improvements #2055

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

[enh] UPNP: various fixes and improvements #2055

wants to merge 5 commits into from

Conversation

kay0u
Copy link
Member

@kay0u kay0u commented Mar 3, 2025

The problem

  • typo upnpc -> self.upnpc
  • sudo yunohost firewall upnp --debug was crashing with:
26   DEBUG   acquiring lock...
32   DEBUG   lock has been acquired
52   DEBUG   loading python module yunohost.firewall took 0.020s
52   DEBUG   processing action 'yunohost.firewall.upnp'
59   DEBUG   discovering UPnP devices...
3063 DEBUG   found 1 UPnP device(s)
3069 DEBUG   unable to add port 22 using UPnP
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/yunohost/firewall.py", line 245, in open_port
    self.upnpc.addportmapping(
Exception: UnknownError
3146 DEBUG   action executed in 3.094s
3146 DEBUG   lock has been released
3146 ERROR   Could not open port via UPnP
  • Ports remained open when upnp was disabled

Solution

  • fix typo
  • The UnknownError exception occurs when the protocol is not recognized. Use "TCP" instead of "tcp" (same for "UDP") fix the problem.
  • Close all ports if they have been opened by us

PR Status

Tested on my server

How to test

...

Copy link
Member

@alexAubin alexAubin left a comment

Choose a reason for hiding this comment

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

LGTM

Any opinion on this @Salamandar

@kay0u
Copy link
Member Author

kay0u commented Mar 6, 2025

PR #2063 on this branch before merging

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