OPNsense Forum

English Forums => 24.1 Production Series => Topic started by: JetSerge on February 09, 2024, 10:14:14 pm

Title: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: JetSerge on February 09, 2024, 10:14:14 pm
miniupnpd is working fine, but I noticed the increasing number of duplicate entries in the status (Services: Universal Plug and Play: Status).

Example:

Code: [Select]
Port Protocol Internal IP Int. Port Description
62852 tcp 10.0.0.87 6690 upnpclient:6690
62852 tcp 10.0.0.87 6690 upnpclient:6690
62852 tcp 10.0.0.87 6690 upnpclient:6690
62852 tcp 10.0.0.87 6690 upnpclient:6690
62852 tcp 10.0.0.87 6690 upnpclient:6690
62852 tcp 10.0.0.87 6690 upnpclient:6690
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)
9308 udp 10.0.0.149 9308 10.0.0.149:9308 to 9308 (UDP)

They stick there forever, never expire, and the list grows over time.

For example, 10.0.0.149 is my PS5. 10.0.0.87 is Synology NAS, and there is already a port forward rule for 6690 (Cloud Station).

Is it expected? If not, why it happens and should I do something about it? I know that explicit port forwards are recommended, but in case I want to keep using miniupnpd, should I be worried about these duplicates and possible resource leaks, or maybe it's just a visual representation bug?

EDIT:

I found some more details which may explain why it happens.
Using command line miniupnpc 2.2.6 and other upnp clients (like https://github.com/kaklakariada/portmapper), listing the existing mappings shows corrupted results:

Code: [Select]
i protocol exPort->inAddr:inPort description remoteHost leaseTime
 0 UDP     0->10.0.0.87:0     '' '34.26.0.0' 0
 1 UDP     0->10.0.0.87:0     '' '34.26.0.0' 0
 2 UDP     0->10.0.0.87:0     '' '34.26.0.0' 0

(https://i.imgur.com/yfbV80J.png)

Instead of these:

Code: [Select]
62852 tcp 10.0.0.87 6690 upnpclient:6690
62852 tcp 10.0.0.87 6690 upnpclient:6690
62852 tcp 10.0.0.87 6690 upnpclient:6690

It could be that PS5 and other clients get the same corrupted results, don't see the mapping they already created and try to add a new one which produces duplicates (and probably also cannot delete a mapping).

The question is why miniupnpd 2.3.3_2,1 server on opnsense returns these corrupted mappings.
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: slackadelic on February 16, 2024, 07:53:45 am
After reading this I check and I'm seeing the same growing list happening.  Not sure it's causing any issues, but it's concerning for sure.
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: AhnHEL on February 19, 2024, 05:32:02 am
I'm seeing this too.  Do you happen to have NAT-PMP checked as well in your UPnP settings?
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: slackadelic on February 19, 2024, 05:42:02 am
I'm seeing this too.  Do you happen to have NAT-PMP checked as well in your UPnP settings?

I did have that turned on.   I've disabled it for now, not sure it would matter, but here's hoping!
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: JetSerge on February 21, 2024, 05:34:44 pm
Disabling Allow PCP/NAT-PMP Port Mapping setting doesn't help. I can still see duplicate entries and the client reads them incorrectly.
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: slackadelic on February 21, 2024, 08:43:27 pm
Disabling Allow PCP/NAT-PMP Port Mapping setting doesn't help. I can still see duplicate entries and the client reads them incorrectly.

Confirmed.  I thought at first it was working, but nah, back to a bunch of duplicate entries.
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: JetSerge on February 22, 2024, 08:24:13 pm
Found a related bug report: https://github.com/opnsense/plugins/issues/3831.
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: franco on February 23, 2024, 09:35:09 am
I nudged the upstream bug report but to be frank a lot of the pfSense/libpfctl work has been a train wreck hit and run on both the src and ports infrastructure of FreeBSD.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277226

Since the author ignores reports that originate from OPNsense just because he can don't expect this to be fixed any time soon. I've talked through all the FreeBSD ranks and nobody can/wants to do anything about it.


Cheers,
Franco
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: JetSerge on February 23, 2024, 09:48:14 am
Since the author ignores reports that originate from OPNsense just because he can don't expect this to be fixed any time soon. I've talked through all the FreeBSD ranks and nobody can/wants to do anything about it.

Thanks!

Maybe it's possible to use miniupnpd 2.3.3_1 instead of 2.3.3_2 somehow?

The pkg you suggested on GitHub from 23.7 version didn't work due to openssl dependency change.
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: Seimus on February 23, 2024, 09:49:59 am
I nudged the upstream bug report but to be frank a lot of the pfSense/libpfctl work has been a train wreck hit and run on both the src and ports infrastructure of FreeBSD.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277226

Since the author ignores reports that originate from OPNsense just because he can don't expect this to be fixed any time soon. I've talked through all the FreeBSD ranks and nobody can/wants to do anything about it.


Cheers,
Franco

This is just sad.... Still holding a grudge because somebody took his milkyway in kindergarden.

Regards,
S.
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: Patrick M. Hausen on February 23, 2024, 09:58:28 am
Doesn't look like grudge to me but more like maintainer has gone missing, disinterested, whatever ...

If you look at the patch that introduced the bug, that one was created by Kristof Provost and not my the miniupnpd maintainer. And this patch already was "approved" by maintainer timeout.

So more an orphaned port than anything else. Possibly best to nudge Kristof about it - if he can find the time.

Kind regards
Patrick
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: franco on February 23, 2024, 10:01:57 am
> Maybe it's possible to use miniupnpd 2.3.3_1 instead of 2.3.3_2 somehow?

Yes, but after a very nasty bug I had to fix myself on stable/13 after him saying "we should fix our own stuff" I'm pretty confident he should fix his stuff, too.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273207#c18

> Supporting opnsense is your job, not mine. You don’t get to just throw bugs over the wall without doing any actual testing on freebsd.

And this to a bug he himself added... And then we had this which went into production causing quite a stir and a whole night overtime for me working it out...

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275006

I'm done enabling others to continue do sub-par work while complaining about others.  :)


Cheers,
Franco
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: Patrick M. Hausen on February 23, 2024, 10:14:43 am
I see your point  :)
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: franco on February 23, 2024, 10:17:47 am
Actually I mentioned this elsewhere and asked why we can't have an option like LIBPFCTL which can be on by default but easily disabled to unbreak stuff it that happens. Because this also happened on pftop if anyone remembers.


Cheers,
Franco
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: xpendable on April 11, 2024, 09:12:08 pm
This issue appears to have been resolved upstream by the miniupnp devs with version 2.3.5
https://github.com/miniupnp/miniupnp/issues/719

I'm not familiar with how freebsd ports work... how do you get the maintainer of the freebsd port to update from source?
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: franco on April 15, 2024, 01:21:57 pm
I tried to update to 2.3.6 but of course the custom patching in FreeBSD ports for pf breaks the build of the new version. I guess this is as good as it gets. ;)


Cheers,
Franco
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: xpendable on April 15, 2024, 05:20:25 pm
Well I created a freebsd bugzilla account and commented on bug 277226. Not sure if it will make a difference, but I figure the more noise that is made... the more likely it will be fixed :)
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: franco on April 15, 2024, 05:41:58 pm
Appreciate your help!
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: AlpAne on April 17, 2024, 03:21:58 pm
Hey guys,

I'm quite new to OPNsense and my setup with three PC:s and two Xbox consoles depends on UPNP to work, especially Call of Duty: Warzone.

Why can't the new version 2.3.6 that resolves the problem introduced with OPNsense 24.1 be included in easily so we can update the plugin and get a working UPNP-function again? I believe I don't understand the dependencies between FreeBSD versions, miniupnd versions and how they are implemented within OPNsense?

Please try to oversee my lack of knowledge on the internals and try to give a easy to understand explanation.
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: franco on April 18, 2024, 03:21:17 pm
FreeBSD introduced custom code patches into their port that now requires rewriting.


Cheers,
Franco
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: AlpAne on April 25, 2024, 10:14:49 am
Is it in OPNsense or miniupnp the rewriting needs to be done? Is there any preliminary time plan when this can be implemented?
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: xpendable on April 25, 2024, 03:28:58 pm
OPNsense uses the FreeBSD port of miniupnpd, it is the FreeBSD port maintainers that need to update the package.

Link to the FreeBSD port of miniupnpd:
https://www.freshports.org/net/miniupnpd/

Link to the FreeBSD bugzilla for this issue:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277226
Title: Re: Duplicate and growing number of entries in Universal Plug and Play: Status
Post by: AlpAne on May 06, 2024, 10:18:33 am
I have also bumped this issue at the FreeBSD bugzilla. Is there anything else we can do to push to get this issue resolved as soon as possible?